sdroege/gstreamer-rs

There are many useful examples but they are undiscoverable

Farmadupe opened this issue · 1 comments

There is a rich set of examples in this repository, but it is very difficult to discover them because:

  • It is not possible to access a description of any example without opening its source code
  • Some examples are for users who are already familiar with the API (e.g "custom_meta.rs") and some are for those who are not ("video_converter.rs", "thumbnail.rs"). The mixing of "very detailed" examples with general-purpose examples makes the general purpose examples harder to find.
  • The directory hierarchy is a little 'odd' because it's uncommon to see a crate with ~30 different binary targets. Until I opened Cargo.toml I assumed there was a single binary but I couldn't find main.rs
  • I think there may be some common usecases where it is hard to work out what is the best example just by reading filenames in examples/src/bin. My particular usecase (which I think is probably fairly common) is "get every frame in a video for further processing (with minimum adequate error handling ie. stopping on any error)", but I think the best example is called "thumbnail.rs"

P.S. is there any chance such code has already been written, e.g.

struct VideoFrameIterator { .. }
impl VideoFrameIterator {fn next() -> Option<Result<ImageBuffer, ErrorType>> { .. }}

///Iterate over all frames in a video until the first error
fn thing_that_farmadupe_wants(uri : OsStr) -> VideoFrameIterator { .. }

The closest example to that is the thumbnail examples, yes.

For the other issues, please report this at https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/ . This repository here is only a mirror :)