Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port all GStreamer tutorials #32

Closed
sdroege opened this issue Sep 8, 2017 · 21 comments
Closed

Port all GStreamer tutorials #32

sdroege opened this issue Sep 8, 2017 · 21 comments

Comments

@sdroege
Copy link
Owner

sdroege commented Sep 8, 2017

Code can be found here: https://cgit.freedesktop.org/gstreamer/gst-docs/tree/examples/tutorials
Text with explanations here: https://gstreamer.freedesktop.org/documentation/tutorials/index.html

Would be nice to port these to Rust

@sdroege
Copy link
Owner Author

sdroege commented Sep 8, 2017

Start of this can be found here: https://github.com/sdroege/gstreamer-rs/tree/master/tutorials

Write here if someone wants to work on porting a specific tutorial

@Jouan
Copy link
Contributor

Jouan commented Sep 8, 2017

I can try porting basic-tutorial-2.

@sdroege
Copy link
Owner Author

sdroege commented Sep 8, 2017

I can try porting basic-tutorial-2.

That would be great, thanks! Let me know if you have questions

@sdroege
Copy link
Owner Author

sdroege commented Sep 14, 2017

basic-tutorial-2 is also done. Someone wants to do basic-tutorial-3? There's code in the examples that is almost like this already (decodebin.rs)

@sireliah
Copy link

Hey, I can try to write the third one. I'll use previous examples as a base.

@sdroege
Copy link
Owner Author

sdroege commented Sep 24, 2017

Thanks, that would be great :)

@sdroege
Copy link
Owner Author

sdroege commented Oct 8, 2017

Tutorial 3 is available here now: #38

@lovebug356
Copy link
Contributor

I also tried basic-tutorial-4. The query part works, but it is not clear how to write GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT in rust?

lovebug356@0c9d36d

@sdroege
Copy link
Owner Author

sdroege commented Oct 9, 2017

@lovebug356 This should work gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT (if you use master, which uses bitflags 1.0. With 0.9 it was gst::SEEK_FLAG_FLUSH IIRC).

@lovebug356
Copy link
Contributor

Fyi, I'm working on tutorial-6, but I'm struggling a bit with adding bindings for StaticPadTemplate (gir does not build on my system due to a problem with git2-rs).

@raytiley
Copy link
Contributor

Figured I would comment on this issue rather than open a new one. Just looking into gstreamer, and have been wanting to a reason to learn a bit more about rust, so I figured I would check this project out.

I cloned the repo and ran cargo build inside the tutorials directory and received errors:

error: associated constants are experimental (see issue #29646)
   --> /Users/raytiley/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.0.0/src/lib.rs:441:17
    |
441 |                 pub const $Flag: $BitFlags = $BitFlags { bits: $value };
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: /Users/raytiley/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.0.0/src/example_generated.rs
    |
4   | bitflags! {
    | - in this macro invocation

Can anyone point me in the right direction? Is there a "Getting Started" for these tutorials somewhere?

Thanks for any guidance.

@raytiley
Copy link
Contributor

Ok.. so did some googling and figured out I had an outdated version of rust. Got everything to build but running tutorial-1 panics.

🍻 RUST_BACKTRACE=1 ./basic-tutorial-1                                                                              master 08c30a0
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Boxed { inner: ForeignOwned(0x7ffba4d146a0) })', src/libcore/result.rs:906:4
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::unwrap
  10: basic_tutorial_1::main
  11: __rust_maybe_catch_panic
  12: std::rt::lang_start
  13: main

@sdroege
Copy link
Owner Author

sdroege commented Oct 14, 2017

Fyi, I'm working on tutorial-6, but I'm struggling a bit with adding bindings for StaticPadTemplate (gir does not build on my system due to a problem with git2-rs).

I can add it tomorrow if that helps, should be a matter of 5 minutes and boring :) You probably don't want to fight with libgit2 just for that :)

@sdroege
Copy link
Owner Author

sdroege commented Oct 14, 2017

@raytiley A backtrace with line numbers would be useful (and for the other thing, you need Rust 1.20 at least because of latest bitflags). My guess is that you're missing a GStreamer plugin or your GStreamer installation is otherwise incomplete/broken (the tutorial has no error handling at all to first focus on the actual GStreamer bits).

@raytiley
Copy link
Contributor

A backtrace with line numbers would be useful (and for the other thing, you need Rust 1.20 at least because of latest bitflags). My guess is that you're missing a GStreamer plugin or your GStreamer installation is otherwise incomplete/broken (the tutorial has no error handling at all to first focus on the actual GStreamer bits).

@sdroege I'll look into how to generate a more useful backtrace and confirm my gstreamer install. I'm on a mac and just used brew install gstreamer. Not sure how to verify it installed properly but I'll poke around.

@sdroege
Copy link
Owner Author

sdroege commented Oct 14, 2017

@raytiley You also need at least gst-plugins-base and gst-plugins-good installed. I don't know if homebrew is splitting those up into separate plugins or have them as single packages with all the plugins.

@raytiley
Copy link
Contributor

You also need at least gst-plugins-base and gst-plugins-good installed. I don't know if homebrew is splitting those up into separate plugins or have them as single packages with all the plugins.

@sdroege Awesome! Thanks for helping out. I found the the other homebrew formulas.. (Also needed gst-libav for the codecs).

@sdroege
Copy link
Owner Author

sdroege commented Oct 15, 2017

@lovebug356 The bindings are there now, hopefully all that is needed 9206ddb . Had to be written manually unfortunately due to those types being a bit special (no constructor, no copy/ref/free/unref, etc).

@sireliah
Copy link

I wrote wrote some code before sireliah@344f4ef but I didn't have much time to finish it. Then I found you already have tutorial-3 ready here: https://github.com/sdroege/gstreamer-rs/blob/master/tutorials/src/bin/basic-tutorial-3.rs. Well, I guess that there is nothing more to do with third one?

@sdroege
Copy link
Owner Author

sdroege commented Oct 25, 2017

@sireliah If you have any suggestions for improving the existing tutorial, please submit a PR. I'm sure there are ways for making it nicer still :) Thanks for your effort in any case

Also it would be good if anybody working on another tutorial would write a short comment here so that people don't work on the same tutorial and duplicate work.

@sdroege
Copy link
Owner Author

sdroege commented Nov 3, 2018

@sdroege sdroege closed this as completed Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants