gstreamer-pbutils-0.22.0/.cargo_vcs_info.json0000644000000001570000000000100145710ustar { "git": { "sha1": "bc3bdebf96b8cc8ebaf5dc705471d46cce997943" }, "path_in_vcs": "gstreamer-pbutils" }gstreamer-pbutils-0.22.0/CHANGELOG.md000064400000000000000000002337011046102023000151750ustar 00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html), specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field). ## [0.22.0] - 2024-02-08 ### Changed - Compatible with gtk-rs-core 0.19 / gtk4-rs 0.8. - Update GStreamer gir files to latest (upcoming) 1.24 APIs. - Various standalone functions were moved to separate modules or methods. - `gst::Rank` is not implemented as an enum but as a struct with associated constants now. - Optimized `gst::Buffer::from_slice()` and `Memory::from_slice()` implementations that have one heap allocation fewer. - Various `gst::Buffer` and `gst::Memory` functions take ranges now instead of offset/size parameters. ### Added - Bindings for `gst_gl::GLContext::thread_add()`, `GLFrameBuffer::draw_to_texture()`. - New `gst_gl::GLVideoFrame` type that replaces `gst_video::VideoFrame` for GL-specific API, and comes with mostly the same interface. - Basic gstreamer-tag bindings. - `gst::Buffer:dump()` and `dump_range()` together with the same API on `gst::Memory` for hex-dumping the whole buffer/memory content. - Implement `Clone` on `gst::MetaRef`. - Bindings for `gst::Buffer::map_range_readable()` and its writable variant. - Array-based accessor for `gst_video::VideoFrame` and `gst_audio::AudioBuffer` plane data. - Support for handling custom authentication in `gstreamer-rtsp-server`. - Accessors for various base class struct fields. - Owned buffer getter for `AudioBuffer` / `VideoFrame`. - `gst_rtp::RTPSourceMeta` bindings. - `gst::macos_main()` bindings. - gstreamer-analytics bindings. ### Fixed - API typo in owned `gst::ReferenceTimestampMeta` reference getter. - Allow variable expansion in `gst::loggable_error!` macro. - `gstreamer-gl-*` crates can build docs again on stable. ### Removed - `gst::Pad::caps()` property getter. Use `current_caps()` instead which does the same thing. - Various deprecated APIs that were deprecated in previous releases. - Getter for a mutable buffer reference from `AudioBuffer` / `VideoFrame` as that allowed invalidating the buffer map. ### Fixed ## [0.21.3] - 2023-12-18 ### Added - Update GStreamer gir files to latest (upcoming) 1.24 APIs. - Add an example for writing subclasses with virtual methods. - Add `gst::ClockTime::absdiff()` and same for similar types. ### Fixed - In `Play` example, set bus to flushing before dropping `Play` instance. - Add missing `docsrs` configuration for correct documentation generation. - Make `gst_pbutils::element_properties` module public. - Add missing `gst_audio::AudioFilterImpl::parent_allowed_caps()`. - Fix assertions in `gst::Memory` copy/share/resize functions. ### Changed - Update to itertool 0.12, pretty-hex 0.4. ## [0.21.2] - 2023-11-11 ### Changed - Update GStreamer gir files to latest (upcoming) 1.24 APIs. - Update to latest gir code generator from the gtk-rs 0.18 branch. ### Fixed - Big endian video format order is correct again. - `gst::MetaRef::has_tags()` and `tags()` API actually works and works based on the tags of the concrete meta instance. - `gst::MetaRef::tags()` returns strings with arbitrary lifetimes now because they're statically stored anyway. - Fix another potential deadlock in `gst_utils::StreamProducer` when sending force-keyunit events. ### Added - Bindings for `gst_video::VBIEncoder` and `VBIParser`. - Accessors for the different `gst::PadProbeData` types on `PadProbeInfo`. - `Default` impl for `gst::AllocationParams`. - `From` / `TryFrom` implementations between formatted types (e.g. `gst::Bytes`) and `usize`. - `gst::MetaRef::copy()` to copy metas from one buffer to another. - `gst::ElementImpl::catch_panic_future()` to wrap a `Future` in such a way that panics are converted to GStreamer error messages and the element is marked as unusable. - `gst_gl::GLDisplay::handle()` to get a raw display handle. ## [0.21.1] - 2023-10-04 ### Changed - Update GStreamer gir files to latest (upcoming) 1.24 APIs. ### Fixed - Use correct media links in the tutorials code. - Fix a couple of new 1.72/1.73 clippy warnings. - Fix description of gstreamer-validate crate. - Copyright/license files for the gstreamer-gl were added. - Ordering of raw video formats follows the rules of latest libgstvideo now. - Fix potential deadlock in `gst_utils::StreamProducer` when sending force-keyunit events. ### Added - `max-time` / `max-bytes` setters to `gst_app::AppSink` builder. - `gst::CustomMeta::register_simple()`. ## [0.21.0] - 2023-08-08 ### Changed - Minimum supported Rust version is updated to 1.70.0. - Compatible with gtk-rs-core 0.18. - `gst::Bin::add_many()`, `remove_many()` and `gst::Element::link_many()`, `unlink_many()` are more generic now. - `gst_base::Aggregator::src_pad()` returns an `AggregatorPad`. - `gst::Bus::add_watch()` now returns a guard value that automatically removes the watch when it goes out of scope. - `gst::Bin`, `Pipeline` and `Pad` constructors don't take the optional name parameter anymore but it can instead be provided via the builder API. - `gst::Pad` and `GhostPad` builders inherit name from the pad template (or target) if possible and no other name is provided explicitly. - The preroll samples and selected sticky events are forwarded to `StreamProducer` consumers. ### Added - Support for the upcoming GStreamer 1.24 APIs. - Support for inline variable names in format strings for error/warning/info messages. - Methods for converting between floating point seconds and `gst::ClockTime`. - Various additions to the gst-validate bindings. - `Display` implementations for error/warning/info messages. - More useful `Debug` implementations for messages, events and queries and `gst_pbutils::DiscovererInfo` related structs. - API for listing/checking `gst::Meta` tags. ## [0.20.7] - 2023-07-05 ### Fixed - Fix `wait-for-eos` property name string in `appsink`. - Fix various memory leaks in `BaseTransform` subclassing bindings. - Mark some GES APIs as `Send+Sync`. ### Added - Implement `DiscovererInfo::debug()` and on related structs. + Add subclassing bindings for `GESFormatter`. ## [0.20.6] - 2023-06-06 ### Added - Getter for the `gst_rtsp_server::RTSPContext` URI field. ### Fixed - `gst_pbutils::DiscovererStreamInfo::stream_id()` can return `NULL`. This is mapped to the empty string for this release to keep backwards compatibility. - `gst_pbutils::DiscovererStreamInfo` iterator methods can be called on any subclass directly now without casting. - Debug logs use the actual function name against instead of the name of a closure generated by the log macros. ### Changed - Minor performance improvements to debug logging. ## [0.20.5] - 2023-04-22 ### Added - `glib::HasParamSpec` impl for miniobjects to allow using them with the properties derive macro. - `Default` impl for `gst_player::Player`. ## [0.20.4] - 2023-04-07 ### Fixed - Work around `gst_webrtc::WebRTCICE::add_candidate()` API breakage in 1.24. ### Changed - Reduce size of `gst_audio::AudioBuffer` and `gst_video::VideoFrame` by a factor of two by not storing an unnecessary copy of the audio/video info. ## [0.20.3] - 2023-03-14 ### Fixed - `gst::ParamSpecArray` uses the correct `glib::Type` now. - Work around accidental ABI breakage in 1.18 gst-rtsp-server `GstRTSPClient`. ### Added - Document `gst_utils::StreamProducer::forward_eos()` default value. ## [0.20.2] - 2023-02-21 ### Added - `glib::HasParamSpec` impl for `gst::ClockTime` - `Default` impl for `gst_play::Play` - Constructors for non-raw `gst_audio::AudioCapsBuilder` / `gst_video::VideoCapsBuilder` ## [0.20.1] - 2023-02-13 ### Fixed - Fix memory leaks when converting a `gst_audio::AudioBuffer` or `gst_video::VideoFrame` to a `gst::Buffer` or FFI type. ## [0.20.0] - 2023-02-10 ### Fixed - Make `gst_gL::GLDisplay::create_context()` `other_context` parameter optional. - Make allocation query caps optional. ### Added - Conversions between `gst::Signed` and `T` and signed integer types. - Bindings for the object lock via `gst::Object::lock()`. - Various `FromIterator`, `Extend` and `From` impls for creating `Caps`, `Structure`, `Buffer`, `BufferList`, `CapsFeatures` and other types. - `PartialEq` impls between owned/borrowed miniobjects/structures. - API for appending items to `gst::Array` and `gst::List`. ### Changed - Compatible with the 0.17 gtk-rs release. - Updated minimum supported Rust version to 1.64. - Require GStreamer 1.22.0 or newer when enabling the `v1_22` feature. - Require the object lock to be taken for various `gst_gl::GLDisplay` methods. - Renamed `gst::TagSetter::add()` to `add_tags()` to avoid name conflict with `Bin::add()`. - Mark various un-extendable enums as exhaustive. - Make use of `glib::GStr` and related API in caps, structure, tags and logging API to reduce temporary string allocations. - Various code optimizations to reduce generated code size and allow more optimal code to be generated. - Reduce size of various types, including reduction of `gst_audio::AudioInfo` from 832 to 320 bytes. - Use actual function name instead of module name in log output. - Change `gst_utils::StreamProducer` API to forward buffers by default and allow temporarily discarding via new `set_discard()` function. ## [0.19.8] - 2023-02-09 ### Changed - Update GStreamer .gir files to 1.22.0 release. ### Fixed - Marked `gst::MessageType` as non-exhaustive. ### Added - Added bindings for `gst::Message::structure_mut()`. - Added subclassing support for `gst_allocators::FdAllocator` and `DmabufAllocator`. ## [0.19.7] - 2023-01-19 ### Fixed - Work around the possibility that the caps in the allocation query can be `NULL` by returning any caps for now. This will be handled properly with a minimal API change in the 0.20 release. ## [0.19.6] - 2023-01-18 ### Fixed - The `AppSrc` and `AppSink` builders now assert that GStreamer is initialized before creating an instance. ## [0.19.5] - 2022-12-27 ### Fixed - Clear video frame values when mapping as GL texture to avoid out of bounds reads when trying to access the GL texture as raw video frame. - Allow returning `Handled` from `BufferList` pad probes. ### Changed - Update GStreamer .gir files to latest 1.21 git. ## [0.19.4] - 2022-12-16 ### Added - Subclassing bindings for `gst_audio::AudioFilter`. ### Fixed - Various new clippy warnings. ### Changed - Update GStreamer .gir files to 1.21.3 release. ## [0.19.3] - 2022-11-28 ### Added - `FromIterator` and `Extend` for `Caps`. - `PartialEq` impls between owned/borrowed miniobjects/structures. ### Fixed - Sticky event ordering for instant-rate-change. ### Changed - Updated GStreamer .gir files to post 1.22.2 release. ## [0.19.2] - 2022-11-13 ### Added - Subclassing support for `gst::Allocator`. - `gst_gl::GLBaseMemory::context()` to retrieve the GL context used by the memory. ### Changed - Updated GStreamer .gir files to 1.22.2 release. ### Fixed - `gst::Allocator::register()` does not cause use-after free with GStreamer < 1.20.5 anymore. - Don't generate version constants in `gstreamer-editing-services-sys` as they are useless and change with every update. ### Changed - Fixed various new clippy warnings. ## [0.19.1] - 2022-10-24 ### Changed - Make it possible to use objects not just as reference in the logging macros. ## [0.19.0] - 2022-10-22 ### Added - Builders for element construction. `gst::ElementFactory::make()` returns a builder now that allows to easily set the name or any other property at construction time. The old API is available as `make_with_name()`. - Builders for `Bin` and `Pipeline` as well as a `Default` trait implementation to simplify object construction. - Builders for `appsrc` and `appsink`, which allow type-safe construction of both elements while also allowing to easily set all their properties at construction time. - Builders for the GStreamer-specific fraction/array param/property specs. - Infrastructure for casting between `gst::Memory` subtypes/supertypes, and make use of it for GL memory. - Bindings for the `gstreamer-allocator` library with support for file descriptor-based and DMABUF memory. - Complete bindings for `gst_video` `Navigation` events. - Constructors for error/warning/info messages with a pre-built `glib::Error`. This also leads to some minor simplification of the existing API. - Accessors for static pads of various base classes for making accessing them cheaper and less error-prone than getting them by name. - Builder for pad templates. - Static PTP clock API for statistics, initialization and deinitialization. - New `gstreamer-utils` crate that currently contains only a `StreamProducer` API. This allows building 1:N bridges between live pipelines via `appsink` / `appsrc` elements. - Bindings for the new `gstreamer-play` library that was added in 1.20. - `gst::Caps::new_empty_simple()` to create caps without fields and just a name. - `gst_audio::AudioCapsBuilder` and `gst_video::VideoCapsBuilder` for building (possibly) unfixed raw audio/videos caps with typed setters for the various fields. This makes it impossible to mix up types and e.g. use an `u32` instead of an `i32` for the width of video caps. - `gst::Buffer::ptr_eq()` to compare buffers by pointer instead of doing a deep comparison, and also `ptr_eq()` on all other miniobject types. - Accessors for `gst_webrtc::WebRTCICECandidateStats` fields. - Bindings for the `gstreamer-validate` API. - Subclassing bindings for `gst_audio::AudioVisualizer` base class for easily writing audio visualization elements. - `gst_pbutils::EncodingProfile` API for element properties. - Support for returning buffer lists from `BaseSrc` / `PushSrc` subclasses. - Support for implementing `gst::Bin::do_latency()`. - Minimal bindings for the `gstreamer-mpegts` library. ### Fixed - Signature for `gst_base::Aggregator::connect_samples_selected()` to remove unnecessary generic parameter and make it straightforward to use. - Various APIs had optional parameters/return types corrected to match the C API more closely. - Logging does not evaluate its arguments anymore if the debug category is not enabled or below the current threshold. - Registering custom metas is now possible without transform function. - `gst::subclass::ElementImpl::request_new_pad()` signature uses a `&str` instead of an owned `String` now. ### Removed - `fragile` dependency and instead use the same functionality from `glib`. - `gst_audio::AudioAggregator` `ignore_inactive_pads` property, which was duplicated from the `Aggregator` base class. ### Changed - Compatible with the 0.16 gtk-rs release. - Updated minimum supported GStreamer version from 1.8 to 1.14. - Updated to the latest GStreamer 1.22 APIs while still supporting up to GStreamer 1.14. Any new 1.22 APIs might still change until the stable 1.22 release. - Updated minimum supported Rust version to 1.63. - In `EventView` / `QueryView`, getters that return references now return references that can outlive the view and are only bound by the lifetime of the corresponding event/query. - In addition `Query`, `Event` and `Message` views are implemented more consistently now, which makes them easier to use and as a side effect allows to pass e.g. more strongly typed queries to functions that only accept a single query type. - Various improvements to `gst::ClockTime`, `gst::format::Bytes`, `gst::format::Signed` and related types and their usage in the API, which should make its use from applications easier and less error-prone. Check the `gst::format` module-level documentation for details. - `gst::StreamsSelected` event builder takes the selected streams as iterator instead of slice. - For consistency with other macros the `gst` prefix of the logging macros was also removed. - Various iterator implementations were added and the existing ones were optimized by implementing more specialized traits and custom implementations for a couple of iterator functions. - GStreamer initialization safety checks were optimized. - `gst::Bus::post()` takes ownership of the passed messages like the C API. - Better and easier to read `Debug` impls for `Caps`, `TagList`, `Structure` and `Promise`. - `ser_de` feature was renamed to `serde`. - `gst::Tracer` implementations get result enums passed as `Result`s now instead of single enums. - `gst::Pad`, `ProxyPad`, `GhostPad` default functions are all associated functions instead of methods now to avoid conflicts between multiple types with the same method. - `Pad` tasks are catching panics from the task function and if the parent of the pad is an element then the panic is converted into an error message and the task is simply stopped. Otherwise the panic is rethrown. ## [0.18.8] - 2022-04-26 ### Added - Bindings for `RTPBasePayload` and `RTPBaseDepayload`. - Accessors for `RTPBuffer` buffer. - Bindings for `RTPBuffer` length calculation API. - More complete `gst::Task` bindings. ### Fixed - Export `gst::subclass::TaskPoolFunction`. ## [0.18.7] - 2022-04-04 ### Added - Bindings for `VideoAggregator` and the `VideoAggregatorPad`s. - Bindings for `AudioAggregator` and the `AudioAggregatorPad`s. - Bindings for `TaskPool`. - Various helper functions for `VideoFormatInfo`, `VideoInfo` and `VideoFrame`. ## [0.18.6] - 2022-03-08 ### Fixed - Require `Send` and not `Sync` for the values of an `gst::Array` / `gst::List`. ### Changed - Simplify and speed up log message string construction ## [0.18.5] - 2022-02-20 ### Changed - Require GStreamer 1.20.0 at least when building with `v1_20`. Earlier versions were already going to fail due to API mismatches before. ### Added - `gst::BufferPool` subclassing support. - `Debug` impl for `gst::MiniObject`. - `gst_rtsp_server::RTSPOnvifServer` and related API, including subclassing support. ### Fixed - Handle empty slices correctly at the FFI layer. - `MiniObjectRef::downcast_ref()` and similar functions return the correct type now. While this is an API change, the previous API would've never worked. ## [0.18.4] - 2022-02-04 ### Changed - Update gir files to GStreamer 1.20.0 release. ### Added - `gst_video::VideoCodecFrame::input_buffer_owned()` for getting an owned reference. ### Fixed - All documentation links in the `README.md`s are correct again. ## [0.18.3] - 2022-01-31 ### Added - `Default` implementation for `gst_video::VideoOverlayComposition` when targeting GStreamer 1.20. - `gst_video::VideoOverlayComposition::add_rectangle()` in addition to the addition of all rectangles via an iterator during construction. - Subclassing support for `gst_rtp::RTPHeaderExtension`. - `gst_webrtc::WebRTCError` for programmatically handling WebRTC errors. ### Fixed - `gst_rtp::RTPHeaderExtension` has `gst::Element` set as parent class now. - Global functions are re-exported from the `gst_rtp` crate root. ### Changed - GIO-style async operations in GES no longer need `Send`-able closures. ### Removed - `fragile` is no longer a dependency and instead the corresponding GLib API is used. ## [0.18.2] - 2022-01-24 ### Added - `glib::FromValue` for mini object references. - Bindings for `gst::DebugCategory::get_line()`. ## [0.18.1] - 2022-01-18 ### Fixed - `Message::view()` also handles the redirect message now. - `Message` and `Query` view variants that return references now borrow again from the underlying query and not the view enum, allowing to use them in a wider scope. ### Changed - All miniobjects, `VideoTimeCode`, `Structure` and `CapsFeatures` are marked as `#[repr(transparent)]` now to ensure that their memory representation is exactly the underlying raw pointer. ## [0.18.0] - 2022-01-16 ### Added - `gst_rtp::RtpHeaderExtension::read()` and `write()`. - `gst::ElementMetadata` has a `const` constructor now. - `gst_rtp::RtpBuffer` API works on buffer references instead of plain buffers for statically enforcing writability and usage in more places. - `gst_video::VideoCodecAlphaMeta` and `gst::CustomMeta`. - `gst::MiniObject` for generically passing around mini objects instead of their concrete types. - `gst_app::AppSink` `new-event` callback and `pull_object()` function. - `gst_pbutils::PbUtilsCapsDescriptionFlags` and `pb_utils_get_caps_description_flags()`. - `gst_rtp::RtpBuffer::remove_extension_data()`. - `gst_video::VideoDecoder` subframe API. - `gst_webrtc::WebRTCSCTPTransport`. - `gst::ElementFactory` `create_with_properties()` / `make_with_properties()`. - `gst_video::VideoContentLightLevel` and `VideoMasteringDisplayInfo` for HDR signalling. - Lots of missing `GES` API. - `gst::AllocationParams` and support in the allocation query. - `propose_allocation()` and `decide_allocation()` support in the various base classes. - `Iterator` implementation for `gst_video::VideoOverlayComposition`. - `Extend`, `IntoIterator` and `FromIterator` implementations for `Buffer`, `Caps`, `BufferList`, `CapsFeatures`, `StreamCollection` and `Structure` for more natural Rust APIs. - `instant-rate-change` events/messages bindings. - Support for arithmetic operations on `Option` and related types. - `gst_video::ColorBalance`. - `gst::MetaFlags`. - `gst_base::Aggregator::set_position()`. - Convenience getters for `gst::ElementFactory` and `gst::DeviceProviderFactory` metadata. - `gst_rtp::RtpBuffer::set_padding()`, `get_padding()` and `payload_mut()`. - `#[must_use]` to many types and functions. - `gst::Event`, `gst::Message` and `gst::Structure` `has_name()`. - `gst_video::Navigation` subclassing support and API improvements. - `gst::Structure` and `gst::Caps` `foreach()`, `map_in_place()` and `filter_map_in_place()`. - `gst_gl::GLBufferPool` and various GL constants and functions. - `gst_pbutils` codec utils APIs. ### Fixed - `gst_base::BaseTransform::prepare_output_buffer()` correctly reflects buffer writability. ### Changed - Compatible with the 0.15 gtk-rs release. - Updated to the latest GStreamer 1.20 APIs while still supporting up to GStreamer 1.8. Any new 1.20 APIs might still change until the stable 1.20 release. - Update all code to the Rust 2021 edition. This causes no user-facing changes. - `gst::Sample::segment()` returns a reference instead of a copy of the segment. - `gst::Object::set_property_from_str()` returns a `Result` now instead of silently failing like the C version. - Allow handling passed in buffers in `gst_base::PushSrc::create`. - Allow passing in `None` in `gst_player::Player::set_uri()`. - Use `[[f32; 4]; 4]` instead of `[f32; 16]` for affine transformation matrix. - `gst::Pad::sticky_event()` statically gets the event of the requested type instead of requiring to match on it afterwards. - Clean up `gst_pbutils` `EncodingProfile` API to be harder to misuse and less confusing. - Various `gst::Array`, `gst::List`, `gst::IntRange` and `gst::Fraction` API improvements that should reduce some friction. - Directly generate `NUL`-terminated C strings in debug log API instead of having multiple allocations per message. - Various functions return `glib::SList` and `glib::List` now to avoid copying into a `Vec` if only iteration is needed. - `gst::ChildProxy` API is more consistent with object property API. - Improved `gst::Buffer::foreach()`, `gst::Pad::sticky_events_foreach()` and `gst::BufferList::foreach()` APIs. - Don't post error messages from `propose_allocation()` and `decide_allocation()`. ## [0.17.4] - 2021-09-13 ### Added - Add constructor for device provider metadata. ## [0.17.3] - 2021-08-23 ### Fixed - `gst::Value::deserialize()` takes the target type as parameter now. This is technically an API change but the function would've never worked previously. ### Added - The release date-time parameter to `gst::plugin_define!` is optional now like in the C version of the macro. - Bindings to `gst::Tracer` and `gst::TracerFactory` for allowing to implement custom tracers in Rust. - Bindings for the new `gst::Value::deserialize_with_psec()` function from GStreamer 1.20. - serde `Serialize`/`Deserialize` impls for `gst::PadDirection`, `gst::PadPresence`, `gst::URIType` and `gst::Rank`. ## [0.17.2] - 2021-08-05 ### Fixed - Various new clippy warnings. - Compilation of `gstreamer-audio` on big-endian platforms. ### Added - Support for 1.20 `Gap` event `GapFlags`. - Support for 1.20 `Structure::serialize()` / `Caps::serialize()`. ## [0.17.1] - 2021-07-13 ### Fixed - Store 1.19 as plugin version when building plugins with `v1_20`. Otherwise plugins fail to load with GStreamer versions below 1.20.0. - Fix documentation for `gst::Element::request_pad_simple()` to actually show up. ## [0.17.0] - 2021-06-28 ### Fixed - Use `#[repr(transparent)]` where it is more correct and remove unneeded `#[repr(C)]` annotations. - Don't provide direct access to the logged object in logging functions as the object might currently be finalized and might be unsafe to access. - Moved X11/EGL/Wayland-specific GL APIs into their own crates instead of having them inside gstreamer-gl and behind feature flags. This simplifies conditional usage of them in applications. - Various nullability issues: parameters and return values that should've been or shouldn't have been nullable were fixed. - Print source object correctly in `gst::Message` `Debug` impl. - `gst_rtsp_server::RTSPServer::attach()` is fallible. - `gst::ElementFactoryListType` is a proper bitflags type now instead of generic `u64`. - `gst::PluginFeature::load()` returns the same type as the one passed in. - Value returned by `gst::PromiseFuture` can no longer be freed while still in scope. - Only assign to `GError**`s in subclassing code if they're not `NULL`. ### Added - Bindings for the GStreamer Controller library and the corresponding core API. - Subclassing support for `gst_player::PlayerVideoRenderer`. - `gst::PARAM_FLAG_CONTROLLABLE` and related bindings. - `gst_video::VideoOrientation` and `VideoOrientationMethod` bindings. - Support for removing pad probes from inside the pad probe callback. - `gst_check::Harness::pull_until_eos()` bindings. - `ges::TransitionClip` and `OperationClip`. - Bindings for `gst_gl::GLMemory` and related APIs. - Subclassing support for `gst_gl::GLFilter` and `gst_gl::BaseSrc`. - `gst::TagList::remove()`. - `gst::CapsFeatures` and `gst::Structure` API based on `glib::Quark`s instead of strings. - Subclassing support for `gst_video::VideoFilter`. - Bindings for various new 1.20 APIs: `gst_app::LeakyType`, `gst_video::VideoDecoderRequestSyncPointFlags`, `gst_rtp::RTPHeaderExtension`, `gst_audio::AudioLevelMeta`, `gst_webrtc::WebRTCKind` and various other new flags/enum types. - Subclassing support for `gst_rtsp_server::RTSPMountPoints`. ### Removed - Deprecated APIs in 0.16. - Don't declare that `gst_app::AppSink` and `AppSrc` inherit from `gst_base::BaseSink` and `BaseSrc` to avoid exposing API that is meant for subclasses to applications. - `gst_app::AppSrc` and `AppSink` signals that are also covered by the callbacks. The callbacks are more flexible and have lower overhead. - Duplicated getters/setters for `gst_base::BaseSink` and `BaseTransform` properties. ### Changed - Compatible with the 0.14 gtk-rs release. - Updated to the new GStreamer 1.20 APIs while still supporting up to GStreamer 1.8. Any new 1.20 APIs might still change until the stable 1.20 release. - FFI and safe high-level bindings are in the same repository now and use the same version numbers. - The .gir files are shared with gtk-rs and the GStreamer-specific ones are in a separate git submodule. - Update all code to the Rust 2018 edition. As part of this, most macros lost their `gst_` prefix. - Re-export dependency crates from the different preludes. - Getter functions don't have a `get_` prefix anymore and GObject property accessors don't include the `_property_` part in the middle of their function names anymore. Applications developers should use [`fix-getters-calls`](https://crates.io/crates/fix-getters-calls) to ease migration of their applications. Use [`fix-getters-def`](https://crates.io/crates/fix-getters-def) if you also want your `get` functions definition to comply with the API standards applied in this release. - Lots of changes to the subclassing API. Check the various elements in [gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs) for examples. - Major improvements to the documentation infrastructure and generated documentation. - `gst::ClockID` bindings are refactored to use different types for single-shot and periodic clock ids, which makes misuse harder. - `gst::ProxyPad` extension trait uses trait functions instead of associated functions now for usability reasons. - Use `Result` for overriding flow returns from pad probes. - `gst_video::VideoInfo::align()` returns a `Result` instead of a `bool`. - Use actual error types instead of `()` in `gst_sdp` APIs. - `Display` impl for `gst::ClockTime` provides better human-readable strings. - `gst::Element::link_filtered()` and `link_pads_filtered()` takes a non-optional caps now. That's easier to use and for not providing caps the non-filtered variants of the functions exist. - Replace various manual bindings with auto-generated ones. - `gst::Element::get_request_pad()` is replaced by `request_pad_simple()` as a simpler version of `request_pad()` and in accordance with the deprecation in GStreamer 1.20. - `gst::ClockTime` and APIs working on it were changed to make possibility of using `GST_CLOCK_TIME_NONE` expressed in the type system. `Option` can be `None` while `gst::ClockTime` is always a valid time. ## [0.16.7] - 2021-02-13 ### Fixed - Usage of the logging system with a GStreamer library with the logging system compiled out does not crash any longer. - Double-free in `gst_video::VideoTimeCode` API when converting between validated and unvalidated timecodes. ### Added - `gst::Element::get_current_state()` and `get_pending_state()` convenience APIs. - `gst_audio::AudioConverterConfig` for setting the configuration on e.g. the `audiomixer` element. The low-level `AudioConverter` API is still not included in the bindings. ## [0.16.6] - 2020-12-20 ### Fixed - `VideoTimeCodeInterval`'s `Ord` and `PartialEq` implementations compare against the correct fields now. - `SDPMessage::medias_mut()` iterator does not crash any longer. ### Added - `PartialEq` and `Eq` implementations on `VideoAlignment`. - Alignment API for `VideoMeta` and `get_plane_height()` / `get_plane_size()`. - `VideoInfo::align_full()`. ## [0.16.5] - 2020-11-23 ### Fixed - Make sure to use `$crate` in more macros to allow them to work without anything special in scope already. - Update documentation location. - Don't panic if C code stores invalid seqnums in events and the seqnum is used directly or via the `Display` impl. - Fix docs build for some crates on docs.rs. - Fix `Debug` impl for `gst_video::VideoTimeCode` to print the correct type name. - Fix plugin version to be 1.18 instead of 1.17 when compiling a plugin with `v1_18`. ### Added - Event handling support in pad probes, that is returning `PadProbeReturn::Handled` for events. - `EventRef::get_structure_mut()` getter that allows changing the events' structures. ### Changed - Remove unnecessary `PhantomData` markers and use `repr(transparent)` instead of `repr(C)` where it is more correct. ## [0.16.4] - 2020-10-09 ### Fixed - Correctly implement `ExactSizeIterator` on the `AudioFormat` and `VideoFormat` iterators. Previously they returned the overall size instead of the remaining size, and they didn't implement `Iterator::size_hint()`. - Don't implement `ExactSizeIterator` on the buffer `gst::Meta` iterator. The overall length is not known easily and the implementation would've simply panicked in the past. ### Added - `gst::ClockID::wait_async_stream()` for async integration for clock waiting. - `From` / `TryFrom` impls for converting between `gst::ClockTime` and `std::time::Duration`. ## [0.16.3] - 2020-09-08 ### Fixed - Reset vfuncs if calling `BaseTransformClass::configure()` multiple times. - Fix `gst::debug_remove_default_log_function()` to actually remove the default log function. ### Added - Some more new APIs added in 1.18. - API for getting an owned buffer from a readable `gst_video::VideoFrame` / `VideoFrameRef`. ### Changed - Updated bindings to 1.18.0. This stabilized GStreamer 1.18 support and any API behind the "v1_18" feature is considered stable now. - Factor out some common code from `gst::Pad::ProbeInfo` code. This reduces the code generated for each pad probe considerably. - Update paste dependency to 1.0 and pretty-hex to 0.2. ## [0.16.2] - 2020-07-27 ### Fixed - Use correct pointer for the plane data in `gst_audio::AudioBuffer`. ### Added - Add `gst::GhostPad` convenience constructors that take a target pad, similar to the ones that existed in 0.15 and before. - Add `gst::parse_bin_from_description_with_name` that allows setting a name for the created bin without having to use unsafe code in application code. ## [0.16.1] - 2020-07-10 ### Fixed - Allow calling `gst::DebugCategory::new()` before `gst::init()` again. ## [0.16.0] - 2020-07-06 ### Added - Updated bindings to 1.17.2, adding experimental 1.18 support. This can be opted-in via the "v1_18" feature flag but there might still be API changes in the newly added API. - `gst::MemoryRef::dump()` for dumping contents of a memory. - `gst::Bus::stream()` instead of a custom constructor on the `BusStream`. - Use more accurate types for `Seqnum`, `GroupId` and `MetaSeqnum`. These are now proper wrapper types instead of plain integers, which makes misuse harder. - Provide `TryFrom` impls for conversion between `glib::DateTime` and `gst::DateTime`. - Add `get_allocator()` functions to `gst_base::{Aggregator, BaseTransform, BaseSrc}`, and allow overriding `BaseSrc::alloc()`. - Add subclassing bindings for `gst_base::PushSrc`. - Add new `gst::BufferCursor` API that allows to handle a buffer as `Read`, `Write` and `Seek` and accesses the underlying memories of the buffer individually without mapping them all together. - Add `gst::Plugin::get_plugin_name()`. - Support for `gst_video::VideoAFDMeta` and `VideoBarMeta`. - API for getting all / iterating over all `gst_audio::AudioFormat` and `gst_video::VideoFormat`. - Bindings and subclassing bindings for `gst_video::VideoSink`. - `gst::Pad` can be constructed via the builder pattern and `gst::PadBuilder` now, which allows to safely set the pad functions and various other fields during construction. The `PadBuilder` works on any `gst::Pad` subclass and also has special support for `GhostPad`s by allowing to set pad functions of the proxy pad. - `gst::Message`, `gst::Event` and `gst::Query` type constructors are now on the specific target type instead of various `new_XXX()` functions on the basic type. E.g. `gst::message::Eos::new()`. - Support for overriding `gst_audio::AudioSrc/Sink::reset()`. - Support for overriding `gst_base::BaseParse::stop()`. - Support for overriding `gst::Element::post_message()`. - Added bindings for `gst::BufferList::foreach()` and `foreach_mut()`. - Added bindings for `gst::Buffer::foreach_meta()` and `foreach_meta_mut()`. ### Fixed - Allow using any `glib::Object` as target object for logging instead of just `gst::Object`. - Remove restriction API from `gst_pbutils::EncodingContainerProfile`. They are supposed to be used only with the other encoding profiles. - Return `&'static str` for various `gst::StructureRef` functions where the string is backed by a `glib::Quark`. - Fix various `gst::DateTime` functions to actually return `Option`s. - Add support for filling in a buffer passed to the `gst::Pad` getrange function, allow passing one in into `get_range()` and `pull_range()` and provide the corresponding API on `gst_base::BaseSrc` too. - Allocator in audio/video `Decoder` base classes is optional and can return `None`. - `gst_video::ValidVideoTimeCode::add_interval()` always returns a valid timecode again. - Allow resolving a `gst::Promise` with `None` and also handle that correctly in the callback. This is allowed by the API. - Allow calling various debugging related functions before `gst::init()`. - Various enum/function versions were fixed to only show up if the corresponding version feature is enabled. - `gst::Pad` function setters are marked unsafe now as changing the functions is not thread-safe. - Remove `gst::Object::set_name()` as changing the name after construction generally causes problems and is potentially unsafe. - Remove `gst::Pad::set_pad_template()` as changing the pad template after construction is generally unsafe. - `gst::Pad::stream_lock()` borrows the pad now instead of taking a new reference. - Unimplemented `Jitter` and `Buffer` queries were removed from the bindings. These are not implemented in C and only have a type registered. - Various `LAST`, `NONE` variants of enums and flags were removed as these only make sense in C. - Call the parent impl of various vfuncs that were omitted before to not require further subclasses of them to implement them but automatically call the parent ones. ### Changed - Use `NonZeroU64/U32` for various ID types to allow further optimizations. - Use `thiserror` crate for deriving error types. - Switch from `lazy_static` to `once_cell`. - Change various miniobject functions like `gst::Caps::append()` from taking the object by value to modifying it internally. This makes them easier to use and only applies to functions that are defined on the non-reference type and take ownership of the values passed in. - Use `mem::ManuallyDrop` instead of `mem::forget()` everywhere. - Replace most `mem::transmute()` calls with safer alternatives. - `gst:StreamCollection` API was changed to the builder pattern for construction as the collection must not be changed after construction. - `gst::ProxyPad` default functions are plain functions on `ProxyPad` now instead of trait functions to allow easier usage of them. - Use proper error types in various `TryFrom` impls. - `gst_video::VideoMeta::add()` returns a `Result` now instead of panicking. - Various constructors were renamed from `new_with_XXX()` and `new_from_XXX()` to the more idiomatic `with_XXX()` and `from_XXX()`. - Miniobject bindings are simplified now and there is no `gst::GstRc` type anymore, instead everything is directly implemented on the concrete types. As part of this the `gst::MiniObject` trait was also removed as it was unneeded now. ## [0.15.7] - 2020-06-08 ### Fixed - Allow multiple filter types per process with `gst::Iterator::filter()`. - Check that `VideoInfo` is valid when creating a `VideoFrame`. - Don't potentially dereference a `NULL` pointer when getting the format from an invalid `VideoInfo` or `AudioInfo`. - Don't unmap borrowed `VideoFrameRef`s. ### Added - `gst::ProtectionMeta`, `gst_video::VideoAffineTransformationMeta`, `VideoCropMeta` and `VideoRegionOfInterestMeta` bindings. - Various new `gst_rtp::RTPBuffer` methods. - `gst_audio::audio_buffer_truncate()`, `AudioMeta` and `AudioBuffer` bindings. ## [0.15.6] - 2020-05-28 ### Fixed - Assert that the data passed to `VideoCaptionMeta::add()` is not empty. - Don't store strong references to the object in the bus, appsink and appsrc futures `Stream` / `Sink` adapters. This would keep them alive unnecessarily and would prevent the `Stream` / `Sink` to ever "finish" on its own. - Handle receiving a `None` reply in the change function of `gst::Promise`. This is apparently valid. For backwards compatibility reasons this is currently replaced with an empty structure but in 0.16 the API will explicitly handle `None`. ### Added - `gst::Stream::debug()` and `gst::StreamCollection::debug()` for converting into a structured string with the actual contents of each. - `gst::Structure::from_iter()` and `gst::Caps::from_iter()` to create structures/caps from iterators. - `gst::Event` support for getting/setting the `gst::Stream` in the `StreamStart` event. - `gst_video::calculate_display_ratio()` and `::guess_framerate()`. - Various video related `gst::CapsFeatures` in `gst_video`. - `TryFrom`/`From` impls for converting between `gst::Structure` and `gst_video::VideoConverterConfig`. - Various `glib::Value` trait impls for `SDPMessage`, `StructureRef`, `CapsFeatureRef` and all borrowed variants of miniobjects to be able to work with the borrowed, non-owned variants when handling `glib::Value`s. ## [0.15.5] - 2020-05-03 ### Fixed - Revert: Allow logging any `glib::Object` and not just `gst::Object`. This broke API in subtle ways and needs to wait until 0.16 - Replace `%` in log output with `%%` to prevent accidental C formatting - Add missing manual traits to the documentation ### Added - `BufferRef::peek_memory_mut()` to give a mutable reference to a given memory - Different iterators for iterating over the memories of a buffer - Support for `gst_audio::AudioClippingMeta` - `gst::Plugin::get_plugin_name()` was added - `gst::Element::get_current_clock_time()` and `gst::Element::get_current_running_time() helper functions - `gst::State` and `StateChange` API for calculating next/previous state and convert from/to the components of a state change ### Changed - Use `mem::ManuallyDrop` instead of `mem::forget` everywhere ## [0.15.4] - 2020-03-09 ### Fixed - Allow logging any `glib::Object` and not just `gst::Object` - Fix floating reference handling in `RTSPMedia::take_pipeline()` - Hold `GMutex` guards for the remainder of the function and warn if they're directly dropped - Work around empty/any caps handling bugs in `Caps::fixate()` ### Added - Add `BaseTransform::prepare_output_buffer()` subclassing support - `RTSPServer`, `RTSPClient`, `RTSPMedia` and `RTSPMediaFactory` subclassing support - Handle panicking in `appsrc`/`appsink` callbacks by posting an error message instead of killing the process ## [0.15.3] - 2020-02-15 ### Fixed - `UniqueFlowCombiner::clear()` should take a mutable reference. - `AudioStreamAlign` doesn't require mutable references for getters anymore. - Don't use bool return value of `gst_video_info_set_format()` and `gst_video_info_align()` with GStreamer < 1.11.1 as it returned void back then. We'd otherwise use some random value. - Make `VideoInfo::align()` is available since 1.8. - Fix changing/clearing of `AppSrc`, `AppSink` callbacks and `Bus` sync handler. Before 1.16.3 this was not thread-safe and caused crashes. When running with older versions changing them causes a panic now and unsetting the bus sync handler has not effect. With newer versions it works correctly. ### Added - Add `Clone` impls for `BufferPoolConfig` and `PlayerConfig`. - Add `VideoConverter` bindings. - Add `Future`s variant for `gst::Promise` constructor. - Add `Future`s variant for `gst_video::convert_sample_async()`. - Add `submit_input_buffer()`, `generate_output()`, `before_transform()`, `copy_metadata()` and `transform_meta()` virtual method support for `BaseTransform`. - Add `AppSink` `Stream` adapter and `AppSrc` `Sink` adapter for integrating both into Rust async contexts. ### Changed - More generic implementations of `VideoFrame` / `VideoFrameRef` functions to allow usage in more generic contexts. ## [0.15.2] - 2020-01-30 ### Fixed - Fix another race condition in the `gst::Bus` `Stream` that could cause it to not wake up although a message is available. ## [0.15.1] - 2020-01-23 ### Added - Use static inner lifetime for `VideoCodecState` so that it can be stored safely on the heap. - Getters/setters for `BinFlags` on `gst::Bin`. - `gst::Caps::builder_full()` for building caps with multiple structures conveniently. - `gst::Element::call_async_future()` for asynchronously spawning a closure and returning a `Future` for awaiting its return value. ### Fixed - Various clippy warnings. - Getters/setters for `PadFlags` on `gst::Pad` now provide the correct behaviour. - Take mutex before popping messages in the `gst::Bus` `Stream` to close a small race condition that could cause it to not be woken up. - `gst::ChildProxy` implementers do not have to provide `child_added()` and `child_removed()` functions anymore but these are optional now. - Manually implement `Debug` impls for various generic types where to `Debug` impl should not depend on their type parameters also implementing `Debug`. ## [0.15.0] - 2019-12-18 ### Added - `StructureRef::get_optional()` for returning `None` if the field does not exist instead of `Err` - Bindings for `gstreamer-rtp` library, mostly `RTPBuffer` - Support for writing `Preset`, `TagSetter`, `Clock`, `SystemClock` subclasses - Bindings for `Typefind::get_length()` - Bindings for `BaseSrcImpl::get_times()` - Bindings (incl. subclassing) for `AudioSink` and `AudioSrc` - Missing `Send`/`Sync` impl for various types ### Fixed - Cleanup of cargo features/dependencies to improve build times - Serde serialization with optional values. Attention: This changes the format of the serialization! - `VideoEncoder`/`VideoDecoder` `proxy_getcaps()` can't return `None` - Use non-panicking UTF8 conversion in log handler. We don't want to panic just because some C code printed a non-UTF8 string - Re-rexport all traits from the crate level and also ensure that all traits are actually included in the preludes - Actually export `is_video_overlay_prepare_window_handle_message()` function - Use `FnMut` for the `appsink` callbacks instead of `Fn` - `Promise` change function returns the actual reply to the promise now instead of just passing the promise itself - Memory leak in `Iterator::filter()` - `BinImpl::add()` takes ownership of floating references - `DeviceImpl::create_element()` preserves floating flag - `BinImpl::remove()` takes a strong reference of the element now as the last reference might be owned by the bin and otherwise we would potentially have a use-after-free afterwards - `BaseParseFrame` and `VideoCodecFrame` take a `&mut self` now for various functions that actually change the frame ### Changed - Minimum supported Rust version is 1.39 - Allow passing `None` to `VideoEncoder::finish_frame()` - Various `to_string()` methods were moved into the `Display` trait impl and for some types `to_str()` was added to return a `&'static str` - .gir files were updated to 1.16.2 release - `Sample` constructor uses the builder pattern now - `VideoMeta::add_full()` is simplified and requires parameters - `BasetransformImpl::set_caps()` returns a `Result` instead of `bool` - SDP data type getters for strings return an `Option` now as these can be `None` in practice although not allowed by the SDP spec - Various functions returning `Option`s were changed to return `Results` if `None` actually signalled an error instead of just a missing value ### Removed - "subclassing" and "futures" cargo features. These are enabled by default now ## [0.14.5] - 2019-09-17 ### Added - Support subclassing of `gst::Device`, `gst::DeviceProvider`, `gst_audio::AudioDecoder` and `::AudioEncoder` - Support for `Element::set_clock` and `::provide_clock` virtual methods - `ElementClass::add_metadata` was added - `gst_video::VideoDecoder` and `::VideoEncoder` got support for `get_caps`, `negotiate`, `src/sink_query/event` and the `drain` virtual methods - `Element::num_pads`, `::num_src_pads` and `::num_sink_pads` functions - `gst_video::VideoDecoder` and `::VideoEncoder` got `get_allocator` bindings - `gst::Iterator` implements `IntoIterator` now for providing `std::iter::Iterator>` adapter - Error macros for audio/video decoder subclasses to handle decoding errors more gracefully and only actually error out after many consecutive errors ### Fixed - Macros now also work in Rust 2018 edition without `#[macro_use]` but explicit imports - The log handler unit test runs reliable in parallel with other tests - Manually implement `Debug` for `gst::Iterator` to allow it for any `T` instead of `T: Debug` - `Device::create_element` has correct reference count handling now - Return `NotNegotiated` in the video codec base classes if setting the output state fails instead of `Error` ## [0.14.4] - 2019-08-14 ### Added - Bindings for adding/removing custom log functions - Bindings for `calculate_linear_regression()` - Constants for base class custom flow returns ### Fixed - Ownership of pad in `Element::release_pad()` virtual method implementations ## [0.14.3] - 2019-07-16 ### Added - `Buffer::unset_flags()` for unsetting specific buffer flags - `VideoBufferFlags` flags type and `VideoBufferExt::set_video_flags()`, `unset_video_flags()` and `get_video_flags()` for working with video buffer flags from safe code. ### Fixed - Setting buffer flags does not override arbitrary other flags anymore but only sets the flags in question. This is necessary to not override extension buffer flags like `gst_video::VideoBufferFlags`. ## [0.14.2] - 2019-07-15 ### Added - Support for `ReferenceTimestampMeta` ## [0.14.1] - 2019-07-06 ### Added - Various new WebRTC enum types from 1.14.1/1.16.0 ### Fixed - Correctly generate interlaced `VideoInfo` by using `gst_video_info_set_interlaced_format()` instead of the generic function. - serde serialization unit tests for `gst::format` succeed again now. ### Changed - `Debug` impls for `VideoFormatInfo` and `AudioFormatInfo` now print all the details of the format instead of only the name, and the `Debug` impls for `VideoInfo` and `AudioInfo` also print the format now. ## [0.14.0] - 2019-06-24 ### Added - Bindings for `GLSyncMeta`. - Bindings for setting/getting `TagScope` on a `TagList` - Bindings for `GLDisplayWayland` and `GLDisplayX11` in addition to the already existing `GLDisplayEGL` - Bindings for `Bus::pop_filtered()` and related functions - Bindings for getting/setting `Object`, `Element`, `Bin`, `Pipeline` and `Plugin` flags - Bindings for `VideoCaptionMeta` - `Debug` impl of `Buffer` now also shows the metas of the buffers - Expose flow return in `PadProbeInfo` for overriding the return value - Bindings for `VideoDecoder` and `VideoEncoder`, including subclassing support - Bindings for `Memory`, `Allocator` and `VideoBufferPool` - Bindings for `VideoFormatInfo::pack` and `::unpack` for format conversion - Bindings for `BaseParse`, including subclassing support - Various new arithmetic operation impls for fractions, formatted values and `ClockTime` - Bindings for `VideoInfo::align()` ### Changed - The `SDPMessage` and `SDPMedia` bindings were completely rewritten as they were broken before and caused crashes in various usages. As part of this there's also some more convenience API available on these types, like iterators for example, and API to modify the `SDPMedia` contained in a `SDPMessage`. - Update to GStreamer 1.16. - Regenerate with latest gir. - Run all autogenerated code through rustfmt after generation too. - Updated to latest versions of GLib/GIO/etc crates. - Updated to futures 0.3 / `std::future` - `ProxyPad` default functions moved to an extension trait instead of plain functions on `ProxyPad`, making them more in sync with the default `Pad` functions - GStreamer plugins are now exporting the new 1.14+ plugin symbols if they were configured for GStreamer 1.14+ - Arithmetic operations on formatted values and `ClockTime` do overflow checks now and replace the result with the `NONE` value on overflow - `TryFrom`/`TryInto` traits are used in various places now instead of the previous ad-hoc implementations of them. - Registering element/typefind/device monitor factories requires passing a value of `gst::Rank` now instead of an arbitrary `u32` ### Fixed - Use correct type for destroying pad task closure data. This was previously using the wrong type, causing crashes at runtime. - `DeviceAdded`/`DeviceRemoved` message getters are transfer full so we don't need to take an additional reference that would be leaked. - `AppSink` callbacks are correctly marked as `Send` instead of `Send+Sync`, allowing a wider range of closures to be used for them. - Handle `PadProbeReturn::Handled` return values from pad probes more correctly. - `ToOwned::to_owned()` on miniobjects has to create copies instead of only increasing the reference count. Otherwise it was possible to create multiple mutable and immutable references to the same object at the same time. - Various functions take references to owned miniobjects instead of borrowed references as it was otherwise possible to create multiple mutable or immutable references to the same object at the same time. - `URIHandler::set_uri` does not accept `None` anymore as this is not allowed by the C function. - Comparisons and addition of `TypeFindProbability` and `Rank` work correctly now - Various `Display` implementations were fixed to not cause a stack overflow due to infinite recursion anymore - Various `::to_string()` functions don't take ownership of C strings anymore that they do not own, which caused double frees before ### Removed - MIKEY related bindings from the SDP library. The bindings were broken and until someone needs them these are not available anymore. ## [0.13.0] - 2019-02-22 ### Added - Subclassing infrastructure was moved directly into the bindings, making the `gst-plugin` crate deprecated. This involves many API changes but generally cleans up code and makes it more flexible. Take a look at the `gst-plugins-rs` crate for various examples. - Bindings for GStreamer GL library - Bindings for `CapsFeatures` and `Meta` - Bindings for `ParentBufferMeta, `VideoMeta` and `VideoOverlayCompositionMeta` - Bindings for `VideoOverlayComposition` and `VideoOverlayRectangle` - Bindings for `VideoTimeCode` - Bindings for `NetAddressMeta` - Bindings for registering custom tags - `UniqueFlowCombiner` and `UniqueAdapter` wrappers that make use of the Rust compile-time mutability checks and expose more API in a safe way, and as a side-effect implement `Sync` and `Send` now - `Bus::add_watch_local()` and `gst_video::convert_frame_async_local()` that allows to use a closure that does not implement `Send` but can only be called from the thread owning the main context. - More complete bindings for `Allocation` `Query` - `pbutils` functions for codec descriptions - `TagList::iter()` for iterating over all tags while getting a single value per tag. The old `::iter_tag_list()` function was renamed to `::iter_generic()` and still provides access to each value for a tag - `Bus::iter()` and `Bus::iter_timed()` iterators around the corresponding `::pop*()` functions - Getters for `VideoColorimetry` to access its fields - `Debug` impls for various missing types. - serde serialization of `Value` can also handle `Buffer` now - Extensive comments to all examples with explanations - Transmuxing example showing how to use `typefind`, `multiqueue` and dynamic pads - basic-tutorial-12 was ported and added ### Changed - Rust 1.31 is the minimum supported Rust version now - Update to latest gir code generator and glib bindings - Functions returning e.g. `gst::FlowReturn` or other "combined" enums were changed to return split enums like `Result` to allow usage of the standard Rust error handling. - Various functions and callbacks returning `bool` or `Option<_>` were changed to return a `Result<_, glib::BoolError>` or `Result<_, gst::LoggableError>` or `Result<_, gst::ErrorMessage>` for better integration with Rust's error handling infrastructure. - Some infallible functions returning `bool` were changed to return `()`. - `MiniObject` subclasses are now newtype wrappers around the underlying `GstRc` wrapper. This does not change the API in any breaking way for the current usages, but allows `MiniObject`s to also be implemented in other crates and makes sure `rustdoc` places the documentation in the right places. - `BinExt` extension trait was renamed to `GstBinExt` to prevent conflicts with `gtk::Bin` if both are imported - `Buffer::from_slice()` can't possible return `None` ### Fixed - `gst::tag::Album` is the album tag now instead of artist sortname - Return `0` for the channel mask corresponding to negative `AudioChannelPosition`s. - `PartialOrd` and related traits are implemented via pointer equality on `ClockId` instead of using the compare function. Two clock ids with the same timestamp are not necessarily the same. - Various functions that are actually fallible are now returning an `Option<_>`. - Various `clippy` warnings ## [0.12.2] - 2018-11-26 ### Fixed - PTP clock constructor actually creates a PTP instead of NTP clock ### Added - Bindings for GStreamer Editing Services - Bindings for GStreamer Check testing library - Bindings for the encoding profile API (encodebin) - VideoFrame, VideoInfo, AudioInfo, StructureRef implements Send and Sync now - VideoFrame has a function to get the raw FFI pointer - From impls from the Error/Success enums to the combined enums like FlowReturn - Bin-to-dot file functions were added to the Bin trait - gst_base::Adapter implements SendUnique now ### Changed - All references were updated from GitHub to freedesktop.org GitLab - Fix various links in the README.md - Link to the correct location for the documentation - Remove GitLab badge as that only works with gitlab.com currently ## [0.12.1] - 2018-09-21 ### Added - More complete bindings for the gst_video::VideoOverlay interface, especially gst_video::is_video_overlay_prepare_window_handle_message() ## [0.12.0] - 2018-09-08 ### Added - Bindings for the GStreamer SDP and WebRTC libraries - Generic API for working with tags that is based on string tag names and glib::Value for the tag values - Bindings for Aggregator and AggregatorPad - Bindings for BaseTransform/BaseSrc::get_buffer_pool() - Optional serde implementations for the basic GStreamer data flow and metadata types ### Changed - Use ptr::NonNull in various places - Updated to muldiv 0.2, num-rational 0.2 - Bus::create_watch() can't return None - Remove CallbackGuard as unwinding across FFI boundaries is not undefined behaviour anymore but will directly cause a panic - Changed from the futures to the futures-preview crate as an optional dependency - Various Caps operations take a &CapsRef instead of &Caps - "deep-notify" signal takes the whole ParamSpec as parameter instead of only the signal name - Some structs were changed from empty struct to empty enums - Pad probe code does not take an additional reference to the data anymore, potentially passing writable events/buffers into the probe - ValueExt::compare() is implemented around std::cmp::Ordering now instead of a custom enum that was basically the same ### Fixed - Pad::add_probe() can return None if an IDLE probe was already called and removed in the meantime - Various compiler and clippy warnings ### Removed - std::Iterator impl for gst::Iterator. It was awkward to use because the gst::Iterator could fail at each iteration ## [0.11.6] - 2018-08-27 ### Fixed - Build with NLL/two-phase borrows - Explicitly define [bin] section for discoverer example to fix a cargo warning ### Added - Add unsafe gst::deinit() function - Ord/PartialOrd impls on gst::Seqnum - Getter for current pad mode - gst::Pad::sticky_events_foreach() for iterating over all sticky events in a thread-safe way ## [0.11.5] - 2018-07-24 ### Fixed - `gst::Bus`'s sync handler must unref every message if `gst::BusSyncReply::Drop` is returned, otherwise they are all leaked ## [0.11.4] - 2018-07-19 ### Fixed - `gst::Caps::subtract()` does not leak its arguments anymore - `gst::Caps::get_structure()` gracefully returns `None` if the index is out of bounds instead of a `g_return_val_if_fail()` - `gst::Structure::new()` has to give away ownership of the info structure but didn't. For 0.11 we internally copy, in 0.12 it will take the info structure by value - Typefind tests don't fail anymore if the system has typefind factories without caps ### Added - An additional assertion that ensures that miniobjects are actually writable before creating a mutable reference ## [0.11.3] - 2018-06-08 ### Added - `gst::Bus::remove_watch()` is now available to remove a bus watch again - `fmt::Debug` impls for `AudioInfo` and `VideoInfo` were added - `fmt::Debug` impls for mini objects also print the pointer value now to make it easier to track them in debug logs - `PlayerVisualization` has accessors for the name and description fields now, without which there is no sensible way to use them or to set a player visualization ## [0.11.2] - 2018-05-09 ### Fixed - Work-around various floating reference handling changes between 1.12 and 1.14 to be able to run with both versions without memory leaks or other reference count problems. This affects NetTimeProvider, BufferPool, DeviceMonitor, Stream, StreamCollection, and Player, NetClientClock, NetClock, PtpClock which were already previously fixed. ### Changed - Change the appsrc need-data and all appsink callbacks to not require the Sync bound anymore and change from Fn to FnMut. They can only be called from a single thread at a time. This change is only done for the corresponding callbacks, not the signals. ## [0.11.1] - 2018-04-07 ### Fixed - Fix Structure::to_string() to not run into an infinite recursion but call the method on the contained StructureRef instead of on itself ## [0.11.0] - 2018-03-20 ### Changed - Updated everything to GStreamer 1.14.0 - Event, Message and Query types were refactored to improve usability. Especially newly constructed queries allow to directly use the type-specific functions to be used without first creating a view - VideoFrameRef::copy_to_ref() and ::copy_plane_to_ref() are gone now and the original functions work with refs instead of full frames - PadProbeId and NotifyIds are not Copy/Clone anymore and are taken by value - GstPlayer has GstObject as parent class now ### Added - GstPbutils, GstSdp, GstRtsp and GstRtspServer bindings - GstPromise, GstAudioStreamAlign and various other 1.14 API - GstVideoFilter and GstBufferPool bindings - Element::call_async() - Debug impl For Toc and TocEntry - Various new examples (RTP FEC, RTSP server, tag usage, ...) ### Fixed - Memory leak in gst_video::convert_sample_async() ## [0.10.2] - 2018-02-18 ### Fixed - Fix building of messages with custom fields for types that don't have a GstStructure ### Added - VideoFrameRef::copy_to_ref() and ::copy_plane_to_ref(), which work with VideoFrameRefs instead of full VideoFrames - Getters for the BaseSrc/Sink/Transform configured segment - Document the gstreamer-player-1.0 dependency in the README.md ## [0.10.1] - 2018-01-03 ### Fixed - Don't require &mut self for TagSetterExtManual::add() ### Added - A TagSetter example application - Bindings for gst_video::convert_sample() and ::convert_sample_async() - Bindings for gst_video::VideoRectangle - Debug impl for Sample and ::with_buffer_list() constructor - A borrowing version of VideoFrame: VideoFrameRef - Bindings for GstVideoFilter ### Changed - Deprecated Sample::get_info() in favour of ::get_structure() - Player has gst::Object as another parent class now ## [0.10.0] - 2017-12-22 ### Fixed - Various clippy warnings - Memory leak of the tag list in Toc::merge_tags() - Property getters use Values of the correct type - Event::get_structure(), Message::get_structure() and Query::get_structure() can return None for the structure - Various other nullability fixes all over the API, changing functions to accept Option<> or returning Option<>, or only plain types - Functions taking paths/filenames now actually take Paths instead of &strs - Element::remove_pad() is not giving away a new reference to the pad anymore, which caused a memory leak of all pads ever removed - Precision handling in ClockTime's Display impl - Video/AudioInfo are only Send, not Sync ### Added - Various enums now also derive useful traits like Copy, Clone and Hash in addition to PartialEq, Eq and Debug - TagList::merge() and insert() for combining tag lists - EventType gained many useful functions to work with event types and a PartialOrd impl to check expected event order of event types where it matters - MessageRef/EventRef/QueryRef implement ToOwned - Bindings for Registry and PluginFeature - Event::set_running_time_offset() for adjusting the offset while events pass through the pipeline - Event/Message GroupIds and Seqnums now have a newtype wrapper around u32 instead of the plain value, making usage of them slightly more typesafe. Also add an "invalid" value for both, as exists in latest GStreamer now. - FormattedValue, GenericFormattedValue and related types were implemented now, which allows more convenient and type-safe usage of formatted values (time, bytes, etc) - Bindings for force-keyunit and still-frame events were added - MappedBuffer/BufferMap now implement various other useful traits, including AsRef<[u8]>, AsMut, Deref, DerefMut, Debug, PartialEq and Eq - Add VideoMultiviewFramePacking enum, and use it in Player - Bindings for the GStreamer Net library, including PTP/NTP/network client clocks and the GStreamer NetClock provider for network synchronization of pipelines - IteratorError implements std::error:Error - Plugin::add_dependency() and ::add_dependency_simple() was added - Rank and TypeFindProbability implement PartialOrd/Ord now - Bindings for TypeFind, TypeFindFactory and the typefind helpers - StreamCollection::iter() for iterating over all contained streams - ErrorMessage type that can be used e.g. in a Result for passing an error message from somewhere to upper layers to then be posted on an element the same way gst_element_error!() would've done ### Changed - Sample::new(), TagList::add(), Structure::set() and similar functions take the values (ToSendValue impls) by reference instead of value. They were not consumed by the function before. - The Debug impls of various types, including Event/Buffer/Message/Query/Structure were improved to print all the fields, similar to what GST_PTR_FORMAT would do in C - Switched to lazy_static 1.0 - Gap event and Duration tag are using ClockTimes now, as well as various Player signals - Segment is now based on a generic type FormattedSegment that can take any format (time, bytes, etc) or a GenericFormattedValue for more type-safety and convenience. Also functions for "casting" between a generic segment and a segment with a specific format exist on this now - AppSrc and AppSink now have a builder for the callbacks, making it unnecessary to always provide all callbacks even if only one is actually needed - Various functions that returned bool for errors, are now returning a Result - Player configuration is now a custom type with more convenient API - Player VideoInfo uses a Fraction instead of (u32,u32) for the framerate and pixel-aspect-ratio - VideoFrame API has more consistent API between writable and read-only variants - Buffer::copy_into() was added, and ::copy_region() now takes a BufferCopyFlags parameter instead of always using the default flags - ChildProxy::set_child_property() takes a &ToValue now to follow the API of Object::set_property() and improve usability - Proxy/GhostPad default pad functions use the correct specific pad type now instead of a generic Pad - Bus::add_signal_watch_full() takes a Priority for the priority instead of u32 - Clock::(un)adjust_with_calibration() takes no clock parameter anymore ### Removed - FormatValue was removed in favour of GenericFormattedValue and the connected traits and specific format impls ## [0.9.1] - 2017-11-26 ### Fixed - Export `FlowError`/`FlowSuccess`, `ClockError`/`ClockSuccess`, `PadLinkError`/`PadLinkSuccess` too ## [0.9.0] - 2017-11-26 ### Added - Bindings for (outputting to) the GStreamer logging system - Bindings for the GStreamer base library - Bindings for all the `Pad` functions to override pad behaviour, and pad task functions - Bindings for `StaticCaps` and `StaticPadTemplate` - Bindings for `deep-notify` signal on `Object` - Support for directly creating `Error`/`Warning`/`Info` `Messages` and posting them from an element with context information (file, line, module, etc.) similar to the C `GST_ELEMENT_ERROR` macro - Support for setting custom fields in `Messages`/`Events` during construction - Support for creating Buffers out of anything that is `AsRef<[u8]>` or `AsMut<[u8]>` - Support for using the `Read` trait on `Adapter` - Functions for getting all sink/src/all pads of an `Element`, and all children of a `Bin` - Builder for `Caps` and `Structures` in addition to the existing functions - `AppSrc`/`AppSink` implement `BaseSrc`/`BaseSink` and `URIHandler` - Rust ports of the basic tutorials 1 to 8 from https://gstreamer.freedesktop.org/documentation/tutorials/ - "Getting started" and "Installation" sections to the README.md - "dox" feature for generating documentation for all available configurations ### Fixed - `StackTraceFlags` are only available since 1.12 - Worked around macOS requiring a `NSRunLoop` running on the main thread in all examples and tutorials, to be able to show a window or anything else ### Changed - `ClockTime` is now a wrapper around `Option` to handle the `CLOCK_TIME_NONE` case better. This wrapper implements all the arithmetic and other traits as needed and ensures that no accidental calculations with `CLOCK_TIME_NONE` can happen - "Values with format", like in `Duration`/`Position`/`Convert` queries or `Seek` events now return a `FormatValue` type. This contains the actual `Format` together with the value and does any required conversions. This also makes it harder to accidentally mix e.g. values in bytes and time - `PadProbeId` does not implement `Clone`/`Copy` anymore - Property notify watches return a custom type instead of ulong - `Error`/`Warning`/`Info` `Messages` can only be created with specific kinds of `glib::Error` now. Using arbitrary ones does not work - `Iterator` bindings were completely rewritten and provide the item type as a generic type parameter now, greatly simplifying its usage - All `glib::Values` are now `glib::SendValue` instead, e.g. in `Caps` and `Structures`, as their content must be possible to send to different threads safely - `Message::get_src()` can return `None` - Allow `None` as `Caps` in `AppSrc`/`AppSink` - Allow everything implementing `Into>` to be used as a pad name - Moved `copy()` from `GstRc` directly to `MiniObject` - Success/Error enums (like `FlowReturn`, `PadLinkReturn`, `StateChangeReturn`) now implement an `into_result()` function that splits them into a `Result` with the good and bad cases. Also mark them as `#[must_use]` to make it harder to accidentally ignore errors. - Error enums implement the `Error` trait - Many examples use the `failure` crate for error handling now, cleaning up the error handling code quite a bit - Lots of other code cleanup, compiler/clippy warning cleanup, etc. ## [0.8.2] - 2017-11-11 ### Fixed - Implement StaticType of BufferRef instead of Buffer. Buffer aka GstRc already implements StaticType if BufferRef does, and without this it was not possible to use Buffers in GValues. - Free memory of the appsink/appsrc callbacks with the correct type. It was crashing because of using the wrong type before. - Fix documentation URLs in Cargo.toml. ### Added - Installation instructions and links to documentation for getting started to README.md. ## [0.8.1] - 2017-09-15 ### Added - Implement Send+Sync for Query, Message and Event, and their corresponding Ref types. ### Fixed - Constructor for gst_player::Player now works properly with GStreamer 1.12 when passing a video renderer or signal dispatcher. There was a reference counting bug. - Instead of returning &'static references from functions, return references with a generic, unbound lifetime instead. See https://github.com/rust-lang/rust/pull/42417#issue-233404573 - Various "unused external crate" warnings and clippy warnings everywhere. ### Changed - Remove Cargo.lock from GIT, it's not very useful for library crates. - Run everything through latest rustfmt-nightly. - Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of u64::MAX) in the examples. ## 0.8.0 - 2017-08-31 - Initial release of the autogenerated GStreamer bindings. Older versions (< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs). The API of the two is incompatible. [Unreleased]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.22.0...HEAD [0.22.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.21.3...0.22.0 [0.21.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.21.2...0.21.3 [0.21.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.21.1...0.21.2 [0.21.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.21.0...0.21.1 [0.21.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.7...0.21.0 [0.20.7]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.6...0.20.7 [0.20.6]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.5...0.20.6 [0.20.5]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.4...0.20.5 [0.20.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.3...0.20.4 [0.20.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.2...0.20.3 [0.20.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.1...0.20.2 [0.20.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.20.0...0.20.1 [0.20.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.8...0.20.0 [0.19.8]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.7...0.19.8 [0.19.7]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.6...0.19.7 [0.19.6]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.5...0.19.6 [0.19.5]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.4...0.19.5 [0.19.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.3...0.19.4 [0.19.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.2...0.19.3 [0.19.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.1...0.19.2 [0.19.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.19.0...0.19.1 [0.19.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.8...0.19.0 [0.18.8]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.7...0.18.8 [0.18.7]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.6...0.18.7 [0.18.6]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.5...0.18.6 [0.18.5]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.4...0.18.5 [0.18.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.3...0.18.4 [0.18.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.2...0.18.3 [0.18.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.1...0.18.2 [0.18.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.18.0...0.18.1 [0.18.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.17.4...0.18.0 [0.17.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.17.3...0.17.4 [0.17.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.17.2...0.17.3 [0.17.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.17.1...0.17.2 [0.17.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.17.0...0.17.1 [0.17.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.7...0.17.0 [0.16.7]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.6...0.16.7 [0.16.6]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.5...0.16.6 [0.16.5]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.4...0.16.5 [0.16.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.3...0.16.4 [0.16.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.2...0.16.3 [0.16.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.1...0.16.2 [0.16.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.16.0...0.16.1 [0.16.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.7...0.16.0 [0.15.7]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.6...0.15.7 [0.15.6]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.5...0.15.6 [0.15.5]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.4...0.15.5 [0.15.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.3...0.15.4 [0.15.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.2...0.15.3 [0.15.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.1...0.15.2 [0.15.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.15.0...0.15.1 [0.15.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.14.2...0.15.0 [0.14.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.14.1...0.14.2 [0.14.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.14.0...0.14.1 [0.14.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.13.0...0.14.0 [0.13.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.12.2...0.13.0 [0.12.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.12.1...0.12.2 [0.12.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.12.0...0.12.1 [0.12.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.6...0.12.0 [0.11.6]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.5...0.11.6 [0.11.5]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.4...0.11.5 [0.11.4]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.3...0.11.4 [0.11.3]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.2...0.11.3 [0.11.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.1...0.11.2 [0.11.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.11.0...0.11.1 [0.11.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.10.2...0.11.0 [0.10.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.10.1...0.10.2 [0.10.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.10.0...0.10.1 [0.10.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.9.1...0.10.0 [0.9.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.9.0...0.9.1 [0.9.0]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.8.1...0.9.0 [0.8.2]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.8.1...0.8.2 [0.8.1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/compare/0.8.0...0.8.1 gstreamer-pbutils-0.22.0/COPYRIGHT000064400000000000000000000022331046102023000146510ustar 00000000000000The gstreamer-rs project is dual-licensed under Apache 2.0 and MIT terms, with the exception of the sys crates which are licensed only under the terms of the MIT license. Copyrights in the gstreamer-rs project are retained by their contributors. No copyright assignment is required to contribute to the gstreamer-rs project. Some files include explicit copyright notices and/or license notices. For full authorship information, see the version control history. Except as otherwise noted (below and/or in individual files), gstreamer-rs is licensed under the Apache License, Version 2.0 or or the MIT license or , at your option. All the sys crates (e.g. gstreamer/sys and gstreamer-base/sys) are licensed only under the terms of the MIT license. This project provides interoperability with various GStreamer libraries but doesn't distribute any parts of them. Distributing compiled libraries and executables that link to those libraries may be subject to terms of the GNU LGPL or other licenses. For more information check the license of each GStreamer library. gstreamer-pbutils-0.22.0/Cargo.toml0000644000000045470000000000100125760ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.70" name = "gstreamer-pbutils" version = "0.22.0" authors = ["Sebastian Dröge "] description = "Rust bindings for GStreamer Base Utils library" homepage = "https://gstreamer.freedesktop.org" documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_pbutils/" readme = "README.md" keywords = [ "gstreamer", "multimedia", "audio", "pbutils", "gnome", ] categories = [ "api-bindings", "multimedia", ] license = "MIT OR Apache-2.0" repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition", ] [dependencies.ffi] version = "0.22" package = "gstreamer-pbutils-sys" [dependencies.glib] version = "0.19" [dependencies.gst] version = "0.22" package = "gstreamer" [dependencies.gst-audio] version = "0.22" package = "gstreamer-audio" [dependencies.gst-video] version = "0.22" package = "gstreamer-video" [dependencies.libc] version = "0.2" [dependencies.serde] version = "1.0" optional = true [dependencies.thiserror] version = "1.0" [dev-dependencies.gir-format-check] version = "0.1" [dev-dependencies.serde_json] version = "1.0" [features] default = [] serde = [ "dep:serde", "gst/serde", ] v1_16 = [ "gst/v1_16", "gst-audio/v1_16", "gst-video/v1_16", "ffi/v1_16", ] v1_18 = [ "gst/v1_18", "gst-audio/v1_18", "gst-video/v1_18", "ffi/v1_18", "v1_16", ] v1_20 = [ "gst/v1_20", "gst-audio/v1_20", "gst-video/v1_20", "ffi/v1_20", "v1_18", ] v1_22 = [ "gst/v1_22", "gst-audio/v1_22", "gst-video/v1_22", "ffi/v1_22", "v1_20", ] v1_24 = [ "gst/v1_24", "gst-audio/v1_24", "gst-video/v1_24", "ffi/v1_24", "v1_22", ] gstreamer-pbutils-0.22.0/Cargo.toml.orig000064400000000000000000000027241046102023000162520ustar 00000000000000[package] name = "gstreamer-pbutils" authors = ["Sebastian Dröge "] description = "Rust bindings for GStreamer Base Utils library" license = "MIT OR Apache-2.0" readme = "README.md" documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_pbutils/" keywords = ["gstreamer", "multimedia", "audio", "pbutils", "gnome"] version.workspace = true categories.workspace = true repository.workspace = true homepage.workspace = true edition.workspace = true rust-version.workspace = true [dependencies] libc = "0.2" ffi = { package = "gstreamer-pbutils-sys", path = "sys", version = "0.22" } glib.workspace = true gst.workspace = true gst-video.workspace = true gst-audio.workspace = true thiserror = "1.0" serde = { version = "1.0", optional = true } [dev-dependencies] gir-format-check = "0.1" serde_json = "1.0" [features] default = [] v1_16 = ["gst/v1_16", "gst-audio/v1_16", "gst-video/v1_16", "ffi/v1_16"] v1_18 = ["gst/v1_18", "gst-audio/v1_18", "gst-video/v1_18", "ffi/v1_18", "v1_16"] v1_20 = ["gst/v1_20", "gst-audio/v1_20", "gst-video/v1_20", "ffi/v1_20", "v1_18"] v1_22 = ["gst/v1_22", "gst-audio/v1_22", "gst-video/v1_22", "ffi/v1_22", "v1_20"] v1_24 = ["gst/v1_24", "gst-audio/v1_24", "gst-video/v1_24", "ffi/v1_24", "v1_22"] serde = ["dep:serde", "gst/serde"] [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] gstreamer-pbutils-0.22.0/Gir.toml000064400000000000000000000215201046102023000147740ustar 00000000000000[options] girs_directories = ["../gir-files", "../gst-gir-files"] library = "GstPbutils" version = "1.0" min_cfg_version = "1.14" work_mode = "normal" concurrency = "send+sync" generate_safety_asserts = true single_version_file = true generate_display_trait = false trust_return_value_nullability = true external_libraries = [ "GLib", "GObject", "Gst", ] generate = [ "GstPbutils.AudioVisualizer", "GstPbutils.AudioVisualizerShader", "GstPbutils.DiscovererInfo", "GstPbutils.DiscovererResult", "GstPbutils.PbUtilsCapsDescriptionFlags", ] manual = [ "GLib.DateTime", "GLib.Error", "GLib.MainContext", "GLib.MainLoop", "GLib.Source", "GLib.Type", "GLib.Variant", "GObject.Object", "Gst.Element", "Gst.Object", "Gst.Preset", ] [[object]] name = "Gst.Buffer" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Caps" status = "manual" ref_mode = "ref" [[object]] name = "Gst.ClockTime" status = "manual" conversion_type = "Option" [[object]] name = "Gst.Event" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Message" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Structure" status = "manual" ref_mode = "ref" [[object]] name = "Gst.TagList" status = "manual" ref_mode = "ref" [[object]] name = "Gst.Toc" status = "manual" ref_mode = "ref" [[object]] name = "GstPbutils.*" status = "generate" # We'll opt-in for constants at a later time [[object.constant]] pattern = ".+" ignore = true [[object.function]] pattern = "codec_utils_(aac_caps_set_level_and_profile|h264_caps_set_level_and_profile|h265_caps_set_level_tier_and_profile|mpeg4video_caps_set_level_and_profile)" # Needs mutable caps references and checks for the caps manual = true [[object.function]] name = "codec_utils_aac_get_level" [object.function.return] nullable_return_is_error = "Failed to get AAC level" [[object.function]] name = "codec_utils_aac_get_profile" [object.function.return] nullable_return_is_error = "Failed to get AAC profile" [[object.function]] name = "codec_utils_h264_get_level" [object.function.return] nullable_return_is_error = "Failed to get H264 level" [[object.function]] name = "codec_utils_h264_get_profile" [object.function.return] nullable_return_is_error = "Failed to get H264 profile" [[object.function]] name = "codec_utils_h264_get_profile_flags_level" manual = true [[object.function]] name = "codec_utils_h265_get_level" [object.function.return] nullable_return_is_error = "Failed to get H265 level" [[object.function]] name = "codec_utils_h265_get_profile" [object.function.return] nullable_return_is_error = "Failed to get H265 profile" [[object.function]] name = "codec_utils_h265_get_tier" [object.function.return] nullable_return_is_error = "Failed to get H265 tier" [[object.function]] name = "codec_utils_mpeg4video_get_level" [object.function.return] nullable_return_is_error = "Failed to get MPEG4 video level" [[object.function]] name = "codec_utils_mpeg4video_get_profile" [object.function.return] nullable_return_is_error = "Failed to get MPEG4 video profile" [[object.function]] name = "codec_utils_caps_get_mime_codec" [object.function.return] nullable_return_is_error = "Unsupported caps" [[object.function]] name = "codec_utils_opus_create_caps" # Manual checks manual = true [[object.function]] name = "codec_utils_opus_create_header" # Manual checks manual = true [[object.function]] name = "codec_utils_opus_parse_caps" # Manual checks manual = true [[object.function]] name = "codec_utils_opus_parse_header" # Manual checks manual = true [[object.function]] name = "codec_utils_opus_create_caps_from_header" # Use &CapsRef manual = true [[object.function]] pattern = "(codec_utils_caps_get_mime_codec|pb_utils_get_caps_description_flags|pb_utils_get_file_extension_from_caps)" # Use &CapsRef manual = true # Plugin installer API needs some manual impls [[object.function]] pattern = "install_plugins.*" ignore = true # Plugin installer API needs some manual impls [[object.function]] pattern = "missing_.*" ignore = true # Plugin installer API needs some manual impls [[object.function]] name = "is_missing_plugin_message" ignore = true # Initialization is handled implicitly [[object.function]] name = "pb_utils_init" ignore = true # Needs special handling for mutable taglists [[object.function]] name = "pb_utils_add_codec_description_to_tag_list" ignore = true # Needs special handling for caps refs [[object.function]] name = "pb_utils_get_codec_description" ignore = true # Needs special handling for caps refs [[object.function]] name = "pb_utils_get_decoder_description" ignore = true # Needs special handling for caps refs [[object.function]] name = "pb_utils_get_encoder_description" ignore = true [[object.function]] name = "plugins_base_version_string" assertion = "skip" [[object.function]] name = "plugins_base_version" assertion = "skip" [[object]] name = "GstPbutils.Discoverer" status = "generate" final_type = true [[object.function]] name = "discover_uri_async" [object.function.return] bool_return_is_error = "Failed to add URI to list of discovers" [[object.function]] name = "new" [[object.function.parameter]] name = "timeout" mandatory = true # Manually implemented to use ClockTime [[object.property]] name = "timeout" manual = true [[object.property]] name = "use-cache" version = "1.16" [[object]] name = "GstPbutils.DiscovererAudioInfo" status = "generate" final_type = true [[object]] name = "GstPbutils.DiscovererContainerInfo" status = "generate" final_type = true [[object]] name = "GstPbutils.DiscovererSerializeFlags" status = "generate" [[object.member]] name = "basic" ignore = true [[object.member]] name = "all" ignore = true [[object]] name = "GstPbutils.DiscovererStreamInfo" status = "generate" final_type = false # Not useful [[object.function]] name = "list_free" ignore = true [[object]] name = "GstPbutils.DiscovererSubtitleInfo" status = "generate" final_type = true [[object]] name = "GstPbutils.DiscovererVideoInfo" status = "generate" final_type = true # Implement manually to expose as gst::Fraction [[object.function]] name = "get_framerate_num" manual = true [[object.function]] name = "get_framerate_denom" manual = true [[object.function]] name = "get_par_num" manual = true [[object.function]] name = "get_par_denom" manual = true [[object]] name = "GstPbutils.EncodingAudioProfile" status = "generate" final_type = true # Ignore all setters, making it immutable. A builder will be provided. [[object.function]] name = "new" manual = true [[object.function]] pattern = "set_.*" manual = true [[object]] name = "GstPbutils.EncodingContainerProfile" status = "generate" # Make it immutable, only able to be constructed for a builder [[object.function]] name = "new" manual = true [[object.function]] name = "add_profile" manual = true [[object]] name = "GstPbutils.EncodingProfile" status = "generate" # Ignore all setters, making it immutable. A builder will be provided. [[object.function]] name = "new" manual = true [[object.function]] pattern = "set_.*" manual = true [[object.function]] pattern = "get_restriction" manual = true [[object.function]] name = "get_element_properties" # Use custom wrapper types manual = true [[object.property]] name = "restriction-caps" # encodingprofile is immutable after constructed ignore = true [[object.function]] name = "from_discoverer" [object.function.return] nullable_return_is_error = "Failed to create EncodingProfile from DiscovererInfo" [[object]] name = "GstPbutils.EncodingTarget" status = "generate" [[object.function]] name = "add_profile" # can be provided on constructor and we better # consider this immutable ignore = true [[object.function]] name = "new" [object.function.return] nullable_return_is_error = "Failed to create EncodingTarget" [[object]] name = "GstPbutils.EncodingVideoProfile" status = "generate" final_type = true # Ignore all setters, making it immutable. A builder will be provided. [[object.function]] name = "new" manual = true [[object.function]] pattern = "set_.*" manual = true gstreamer-pbutils-0.22.0/LICENSE-APACHE000064400000000000000000000251371046102023000153120ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. gstreamer-pbutils-0.22.0/LICENSE-MIT000064400000000000000000000017771046102023000150260ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gstreamer-pbutils-0.22.0/README.md000064400000000000000000000177121046102023000146450ustar 00000000000000# gstreamer-pbutils-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-pbutils.svg)](https://crates.io/crates/gstreamer-pbutils) [![pipeline status](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/badges/main/pipeline.svg)](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main) [GStreamer](https://gstreamer.freedesktop.org/) (Pbutils library) bindings for Rust. Documentation can be found [here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_pbutils/). These bindings are providing a safe API that can be used to interface with GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins. The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/) based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/) API metadata provided by the GStreamer project. ## Table of Contents 1. [Installation](#installation) 1. [Linux/BSDs](#installation-linux) 1. [macOS](#installation-macos) 1. [Windows](#installation-windows) 1. [Getting Started](#getting-started) 1. [License](#license) 1. [Contribution](#contribution) ## Installation To build the GStreamer bindings or anything depending on them, you need to have at least GStreamer 1.14 and gst-plugins-base 1.14 installed. In addition, some of the examples/tutorials require various GStreamer plugins to be available, which can be found in gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly and/or gst-libav. ### Linux/BSDs You need to install the above mentioned packages with your distributions package manager, or build them from source. On Debian/Ubuntu they can be installed with ```console $ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev ``` The minimum required version of the above libraries is >= 1.14. If you build the gstreamer-player sub-crate, or any of the examples that depend on gstreamer-player, you must ensure that in addition to the above packages, `libgstreamer-plugins-bad1.0-dev` is installed. See the `Cargo.toml` files for the full details, ```console $ apt-get install libgstreamer-plugins-bad1.0-dev ``` Package names on other distributions should be similar. Please submit a pull request with instructions for yours. ### macOS You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/) provided by the GStreamer project. We recommend using the official GStreamer binaries over Homebrew, especially as GStreamer in Homebrew is [currently broken](https://github.com/orgs/Homebrew/discussions/3740#discussioncomment-3804964). #### GStreamer Binaries You need to download the *two* `.pkg` files from the GStreamer website and install them, e.g. `gstreamer-1.0-1.20.4-universal.pkg` and `gstreamer-1.0-devel-1.20.4-universal.pkg`. After installation, you also need to set the `PATH` environment variable as follows ```console $ export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}" ``` Also note that the `pkg-config` from GStreamer should be the first one in the `PATH` as other versions have all kinds of quirks that will cause problems. #### Homebrew Homebrew only installs various plugins if explicitly enabled, so some extra `--with-*` flags may be required. ```console $ brew install gstreamer gst-plugins-base gst-plugins-good \ gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \ gst-editing-services --with-orc --with-libogg --with-opus \ --with-pango --with-theora --with-libvorbis --with-libvpx \ --enable-gtk3 ``` Make sure the version of these libraries is >= 1.14. ### Windows You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/) with `pacman` or by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by the GStreamer project. We recommend using the official GStreamer binaries over MSYS2. #### GStreamer Binaries You need to download the *two* `.msi` files for your platform from the GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.20.4.msi` and `gstreamer-1.0-devel-x86_64-1.20.4.msi`. Make sure to select the version that matches your Rust toolchain, i.e. MinGW or MSVC. After installation set the ``PATH` environment variable as follows: ```console # For a UNIX-style shell: $ export PATH="c:/gstreamer/1.0/msvc_x86_64/bin${PATH:+:$PATH}" # For cmd.exe: $ set PATH=C:\gstreamer\1.0\msvc_x86_64\bin;%PATH% ``` Make sure to update the path to where you have actually installed GStreamer and for the corresponding toolchain. Also note that the `pkg-config.exe` from GStreamer should be the first one in the `PATH` as other versions have all kinds of quirks that will cause problems. #### MSYS2 / pacman ```console $ pacman -S glib2-devel pkg-config \ mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \ mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \ mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \ mingw-w64-x86_64-gst-rtsp-server ``` Make sure the version of these libraries is >= 1.14. Note that the version of `pkg-config` included in `MSYS2` is [known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858) compiling GStreamer, so you may need to install another version. One option would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/). ## Getting Started The API reference can be found [here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is only the Rust API reference and does not explain any of the concepts. For getting started with GStreamer development, the best would be to follow the [documentation](https://gstreamer.freedesktop.org/documentation/) on the GStreamer website, especially the [Application Development Manual](https://gstreamer.freedesktop.org/documentation/application-development/). While being C-centric, it explains all the fundamental concepts of GStreamer and the code examples should be relatively easily translatable to Rust. The API is basically the same, function/struct names are the same and everything is only more convenient (hopefully) and safer. In addition there are [tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the GStreamer website. Many of them were ported to Rust already and the code can be found in the [tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials) directory. Some further examples for various aspects of GStreamer and how to use it from Rust can be found in the [examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples) directory. Various GStreamer plugins written in Rust can be found in the [gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs) repository. ## LICENSE gstreamer-rs and all crates contained in here are licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. GStreamer itself is licensed under the Lesser General Public License version 2.1 or (at your option) any later version: https://www.gnu.org/licenses/lgpl-2.1.html ## Contribution Any kinds of contributions are welcome as a pull request. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. gstreamer-pbutils-0.22.0/src/audio_visualizer.rs000064400000000000000000000045421046102023000200760ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use gst::prelude::*; use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken}; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AudioVisualizerExtManual: sealed::Sealed + IsA + IsA + 'static { // rustdoc-stripper-ignore-next /// Returns the number of samples per frame required before calling the render method fn req_spf(&self) -> u32 { let sinkpad = self.static_pad("sink").expect("sink pad presence"); let _stream_lock = sinkpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; unsafe { (*ptr).req_spf } } // rustdoc-stripper-ignore-next /// Modify the request of samples per frame required to be present in buffer before calling /// the render method fn set_req_spf(&self, spf: u32, token: &AudioVisualizerSetupToken) { assert_eq!( self.as_ptr() as *mut ffi::GstAudioVisualizer, token.0.as_ptr() ); let sinkpad = self.static_pad("sink").expect("sink pad presence"); let _stream_lock = sinkpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; unsafe { (*ptr).req_spf = spf; } } fn audio_info(&self) -> gst_audio::AudioInfo { let sinkpad = self.static_pad("sink").expect("sink pad presence"); let _stream_lock = sinkpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; unsafe { let info = &(*ptr).ainfo; glib::translate::from_glib_none(glib::translate::mut_override( info as *const gst_audio::ffi::GstAudioInfo, )) } } fn video_info(&self) -> gst_video::VideoInfo { let srcpad = self.static_pad("src").expect("src pad presence"); let _stream_lock = srcpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; unsafe { let info = &(*ptr).vinfo; glib::translate::from_glib_none(glib::translate::mut_override( info as *const gst_video::ffi::GstVideoInfo, )) } } } impl + IsA> AudioVisualizerExtManual for O {} gstreamer-pbutils-0.22.0/src/auto/audio_visualizer.rs000064400000000000000000000067711046102023000210540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::AudioVisualizerShader; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GstAudioVisualizer")] pub struct AudioVisualizer(Object) @extends gst::Element, gst::Object; match fn { type_ => || ffi::gst_audio_visualizer_get_type(), } } impl AudioVisualizer { pub const NONE: Option<&'static AudioVisualizer> = None; } unsafe impl Send for AudioVisualizer {} unsafe impl Sync for AudioVisualizer {} mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AudioVisualizerExt: IsA + sealed::Sealed + 'static { #[doc(alias = "shade-amount")] fn shade_amount(&self) -> u32 { ObjectExt::property(self.as_ref(), "shade-amount") } #[doc(alias = "shade-amount")] fn set_shade_amount(&self, shade_amount: u32) { ObjectExt::set_property(self.as_ref(), "shade-amount", shade_amount) } fn shader(&self) -> AudioVisualizerShader { ObjectExt::property(self.as_ref(), "shader") } fn set_shader(&self, shader: AudioVisualizerShader) { ObjectExt::set_property(self.as_ref(), "shader", shader) } #[doc(alias = "shade-amount")] fn connect_shade_amount_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_shade_amount_trampoline< P: IsA, F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstAudioVisualizer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::shade-amount\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_shade_amount_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "shader")] fn connect_shader_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_shader_trampoline< P: IsA, F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstAudioVisualizer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::shader\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_shader_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AudioVisualizerExt for O {} gstreamer-pbutils-0.22.0/src/auto/discoverer.rs000064400000000000000000000213361046102023000176350ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::DiscovererInfo; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GstDiscoverer")] pub struct Discoverer(Object); match fn { type_ => || ffi::gst_discoverer_get_type(), } } impl Discoverer { #[doc(alias = "gst_discoverer_new")] pub fn new(timeout: gst::ClockTime) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::gst_discoverer_new(timeout.into_glib(), &mut error); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "gst_discoverer_discover_uri")] pub fn discover_uri(&self, uri: &str) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::gst_discoverer_discover_uri( self.to_glib_none().0, uri.to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "gst_discoverer_discover_uri_async")] pub fn discover_uri_async(&self, uri: &str) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_discoverer_discover_uri_async(self.to_glib_none().0, uri.to_glib_none().0), "Failed to add URI to list of discovers" ) } } #[doc(alias = "gst_discoverer_start")] pub fn start(&self) { unsafe { ffi::gst_discoverer_start(self.to_glib_none().0); } } #[doc(alias = "gst_discoverer_stop")] pub fn stop(&self) { unsafe { ffi::gst_discoverer_stop(self.to_glib_none().0); } } #[cfg(feature = "v1_16")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[doc(alias = "use-cache")] pub fn uses_cache(&self) -> bool { ObjectExt::property(self, "use-cache") } #[cfg(feature = "v1_16")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[doc(alias = "use-cache")] pub fn set_use_cache(&self, use_cache: bool) { ObjectExt::set_property(self, "use-cache", use_cache) } #[doc(alias = "discovered")] pub fn connect_discovered< F: Fn(&Self, &DiscovererInfo, Option<&glib::Error>) + Send + Sync + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn discovered_trampoline< F: Fn(&Discoverer, &DiscovererInfo, Option<&glib::Error>) + Send + Sync + 'static, >( this: *mut ffi::GstDiscoverer, info: *mut ffi::GstDiscovererInfo, error: *mut glib::ffi::GError, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(info), Option::::from_glib_borrow(error) .as_ref() .as_ref(), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"discovered\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( discovered_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "finished")] pub fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn finished_trampoline( this: *mut ffi::GstDiscoverer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( finished_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_24")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[doc(alias = "load-serialized-info")] pub fn connect_load_serialized_info< F: Fn(&Self, &str) -> Option + Send + Sync + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn load_serialized_info_trampoline< F: Fn(&Discoverer, &str) -> Option + Send + Sync + 'static, >( this: *mut ffi::GstDiscoverer, uri: *mut libc::c_char, f: glib::ffi::gpointer, ) -> *mut ffi::GstDiscovererInfo { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &glib::GString::from_glib_borrow(uri), ) .to_glib_full() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"load-serialized-info\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( load_serialized_info_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "source-setup")] pub fn connect_source_setup( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn source_setup_trampoline< F: Fn(&Discoverer, &gst::Element) + Send + Sync + 'static, >( this: *mut ffi::GstDiscoverer, source: *mut gst::ffi::GstElement, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(source)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"source-setup\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( source_setup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "starting")] pub fn connect_starting(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn starting_trampoline( this: *mut ffi::GstDiscoverer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"starting\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( starting_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v1_16")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[doc(alias = "use-cache")] pub fn connect_use_cache_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_use_cache_trampoline< F: Fn(&Discoverer) + Send + Sync + 'static, >( this: *mut ffi::GstDiscoverer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::use-cache\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_use_cache_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } unsafe impl Send for Discoverer {} unsafe impl Sync for Discoverer {} gstreamer-pbutils-0.22.0/src/auto/discoverer_audio_info.rs000064400000000000000000000044341046102023000220310ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::DiscovererStreamInfo; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstDiscovererAudioInfo")] pub struct DiscovererAudioInfo(Object) @extends DiscovererStreamInfo; match fn { type_ => || ffi::gst_discoverer_audio_info_get_type(), } } impl DiscovererAudioInfo { #[doc(alias = "gst_discoverer_audio_info_get_bitrate")] #[doc(alias = "get_bitrate")] pub fn bitrate(&self) -> u32 { unsafe { ffi::gst_discoverer_audio_info_get_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_audio_info_get_channel_mask")] #[doc(alias = "get_channel_mask")] pub fn channel_mask(&self) -> u64 { unsafe { ffi::gst_discoverer_audio_info_get_channel_mask(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_audio_info_get_channels")] #[doc(alias = "get_channels")] pub fn channels(&self) -> u32 { unsafe { ffi::gst_discoverer_audio_info_get_channels(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_audio_info_get_depth")] #[doc(alias = "get_depth")] pub fn depth(&self) -> u32 { unsafe { ffi::gst_discoverer_audio_info_get_depth(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_audio_info_get_language")] #[doc(alias = "get_language")] pub fn language(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_audio_info_get_language( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_audio_info_get_max_bitrate")] #[doc(alias = "get_max_bitrate")] pub fn max_bitrate(&self) -> u32 { unsafe { ffi::gst_discoverer_audio_info_get_max_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_audio_info_get_sample_rate")] #[doc(alias = "get_sample_rate")] pub fn sample_rate(&self) -> u32 { unsafe { ffi::gst_discoverer_audio_info_get_sample_rate(self.to_glib_none().0) } } } unsafe impl Send for DiscovererAudioInfo {} unsafe impl Sync for DiscovererAudioInfo {} gstreamer-pbutils-0.22.0/src/auto/discoverer_container_info.rs000064400000000000000000000025701046102023000227110ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::DiscovererStreamInfo; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstDiscovererContainerInfo")] pub struct DiscovererContainerInfo(Object) @extends DiscovererStreamInfo; match fn { type_ => || ffi::gst_discoverer_container_info_get_type(), } } impl DiscovererContainerInfo { #[doc(alias = "gst_discoverer_container_info_get_streams")] #[doc(alias = "get_streams")] pub fn streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_container_info_get_streams( self.to_glib_none().0, )) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_discoverer_container_info_get_tags")] #[doc(alias = "get_tags")] pub fn tags(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_container_info_get_tags( self.to_glib_none().0, )) } } } unsafe impl Send for DiscovererContainerInfo {} unsafe impl Sync for DiscovererContainerInfo {} gstreamer-pbutils-0.22.0/src/auto/discoverer_info.rs000064400000000000000000000144131046102023000206460ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT #![allow(deprecated)] use crate::{ DiscovererAudioInfo, DiscovererContainerInfo, DiscovererResult, DiscovererSerializeFlags, DiscovererStreamInfo, DiscovererSubtitleInfo, DiscovererVideoInfo, }; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstDiscovererInfo")] pub struct DiscovererInfo(Object); match fn { type_ => || ffi::gst_discoverer_info_get_type(), } } impl DiscovererInfo { #[doc(alias = "gst_discoverer_info_copy")] #[must_use] pub fn copy(&self) -> DiscovererInfo { unsafe { from_glib_full(ffi::gst_discoverer_info_copy(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_audio_streams")] #[doc(alias = "get_audio_streams")] pub fn audio_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_audio_streams( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_info_get_container_streams")] #[doc(alias = "get_container_streams")] pub fn container_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_container_streams( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_info_get_duration")] #[doc(alias = "get_duration")] pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_discoverer_info_get_duration(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_live")] #[doc(alias = "get_live")] pub fn is_live(&self) -> bool { unsafe { from_glib(ffi::gst_discoverer_info_get_live(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_misc")] #[doc(alias = "get_misc")] pub fn misc(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_info_get_misc(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_missing_elements_installer_details")] #[doc(alias = "get_missing_elements_installer_details")] pub fn missing_elements_installer_details(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none( ffi::gst_discoverer_info_get_missing_elements_installer_details( self.to_glib_none().0, ), ) } } #[doc(alias = "gst_discoverer_info_get_result")] #[doc(alias = "get_result")] pub fn result(&self) -> DiscovererResult { unsafe { from_glib(ffi::gst_discoverer_info_get_result(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_seekable")] #[doc(alias = "get_seekable")] pub fn is_seekable(&self) -> bool { unsafe { from_glib(ffi::gst_discoverer_info_get_seekable(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_stream_info")] #[doc(alias = "get_stream_info")] pub fn stream_info(&self) -> Option { unsafe { from_glib_full(ffi::gst_discoverer_info_get_stream_info( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_info_get_stream_list")] #[doc(alias = "get_stream_list")] pub fn stream_list(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_stream_list( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_info_get_streams")] #[doc(alias = "get_streams")] pub fn streams(&self, streamtype: glib::types::Type) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_streams( self.to_glib_none().0, streamtype.into_glib(), )) } } #[doc(alias = "gst_discoverer_info_get_subtitle_streams")] #[doc(alias = "get_subtitle_streams")] pub fn subtitle_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_subtitle_streams( self.to_glib_none().0, )) } } #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")] #[allow(deprecated)] #[doc(alias = "gst_discoverer_info_get_tags")] #[doc(alias = "get_tags")] pub fn tags(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_info_get_tags(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_toc")] #[doc(alias = "get_toc")] pub fn toc(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_info_get_toc(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_uri")] #[doc(alias = "get_uri")] pub fn uri(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_discoverer_info_get_uri(self.to_glib_none().0)) } } #[doc(alias = "gst_discoverer_info_get_video_streams")] #[doc(alias = "get_video_streams")] pub fn video_streams(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_video_streams( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_info_to_variant")] pub fn to_variant(&self, flags: DiscovererSerializeFlags) -> glib::Variant { unsafe { from_glib_full(ffi::gst_discoverer_info_to_variant( self.to_glib_none().0, flags.into_glib(), )) } } #[doc(alias = "gst_discoverer_info_from_variant")] pub fn from_variant(variant: &glib::Variant) -> DiscovererInfo { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_discoverer_info_from_variant( variant.to_glib_none().0, )) } } } unsafe impl Send for DiscovererInfo {} unsafe impl Sync for DiscovererInfo {} gstreamer-pbutils-0.22.0/src/auto/discoverer_stream_info.rs000064400000000000000000000073231046102023000222230ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GstDiscovererStreamInfo")] pub struct DiscovererStreamInfo(Object); match fn { type_ => || ffi::gst_discoverer_stream_info_get_type(), } } impl DiscovererStreamInfo { pub const NONE: Option<&'static DiscovererStreamInfo> = None; } unsafe impl Send for DiscovererStreamInfo {} unsafe impl Sync for DiscovererStreamInfo {} mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait DiscovererStreamInfoExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gst_discoverer_stream_info_get_caps")] #[doc(alias = "get_caps")] fn caps(&self) -> Option { unsafe { from_glib_full(ffi::gst_discoverer_stream_info_get_caps( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_stream_info_get_misc")] #[doc(alias = "get_misc")] fn misc(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_stream_info_get_misc( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_stream_info_get_next")] #[doc(alias = "get_next")] #[must_use] fn next(&self) -> Option { unsafe { from_glib_full(ffi::gst_discoverer_stream_info_get_next( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_stream_info_get_previous")] #[doc(alias = "get_previous")] #[must_use] fn previous(&self) -> Option { unsafe { from_glib_full(ffi::gst_discoverer_stream_info_get_previous( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_stream_info_get_stream_id")] #[doc(alias = "get_stream_id")] fn stream_id(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_stream_info_get_stream_id( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_discoverer_stream_info_get_stream_number")] #[doc(alias = "get_stream_number")] fn stream_number(&self) -> i32 { unsafe { ffi::gst_discoverer_stream_info_get_stream_number(self.as_ref().to_glib_none().0) } } #[doc(alias = "gst_discoverer_stream_info_get_stream_type_nick")] #[doc(alias = "get_stream_type_nick")] fn stream_type_nick(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_discoverer_stream_info_get_stream_type_nick( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_stream_info_get_tags")] #[doc(alias = "get_tags")] fn tags(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_stream_info_get_tags( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_stream_info_get_toc")] #[doc(alias = "get_toc")] fn toc(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_stream_info_get_toc( self.as_ref().to_glib_none().0, )) } } } impl> DiscovererStreamInfoExt for O {} gstreamer-pbutils-0.22.0/src/auto/discoverer_subtitle_info.rs000064400000000000000000000017311046102023000225600ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::DiscovererStreamInfo; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstDiscovererSubtitleInfo")] pub struct DiscovererSubtitleInfo(Object) @extends DiscovererStreamInfo; match fn { type_ => || ffi::gst_discoverer_subtitle_info_get_type(), } } impl DiscovererSubtitleInfo { #[doc(alias = "gst_discoverer_subtitle_info_get_language")] #[doc(alias = "get_language")] pub fn language(&self) -> Option { unsafe { from_glib_none(ffi::gst_discoverer_subtitle_info_get_language( self.to_glib_none().0, )) } } } unsafe impl Send for DiscovererSubtitleInfo {} unsafe impl Sync for DiscovererSubtitleInfo {} gstreamer-pbutils-0.22.0/src/auto/discoverer_video_info.rs000064400000000000000000000043161046102023000220350ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::DiscovererStreamInfo; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstDiscovererVideoInfo")] pub struct DiscovererVideoInfo(Object) @extends DiscovererStreamInfo; match fn { type_ => || ffi::gst_discoverer_video_info_get_type(), } } impl DiscovererVideoInfo { #[doc(alias = "gst_discoverer_video_info_get_bitrate")] #[doc(alias = "get_bitrate")] pub fn bitrate(&self) -> u32 { unsafe { ffi::gst_discoverer_video_info_get_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_video_info_get_depth")] #[doc(alias = "get_depth")] pub fn depth(&self) -> u32 { unsafe { ffi::gst_discoverer_video_info_get_depth(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_video_info_get_height")] #[doc(alias = "get_height")] pub fn height(&self) -> u32 { unsafe { ffi::gst_discoverer_video_info_get_height(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_video_info_get_max_bitrate")] #[doc(alias = "get_max_bitrate")] pub fn max_bitrate(&self) -> u32 { unsafe { ffi::gst_discoverer_video_info_get_max_bitrate(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_video_info_get_width")] #[doc(alias = "get_width")] pub fn width(&self) -> u32 { unsafe { ffi::gst_discoverer_video_info_get_width(self.to_glib_none().0) } } #[doc(alias = "gst_discoverer_video_info_is_image")] pub fn is_image(&self) -> bool { unsafe { from_glib(ffi::gst_discoverer_video_info_is_image( self.to_glib_none().0, )) } } #[doc(alias = "gst_discoverer_video_info_is_interlaced")] pub fn is_interlaced(&self) -> bool { unsafe { from_glib(ffi::gst_discoverer_video_info_is_interlaced( self.to_glib_none().0, )) } } } unsafe impl Send for DiscovererVideoInfo {} unsafe impl Sync for DiscovererVideoInfo {} gstreamer-pbutils-0.22.0/src/auto/encoding_audio_profile.rs000064400000000000000000000012201046102023000221450ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::EncodingProfile; glib::wrapper! { #[doc(alias = "GstEncodingAudioProfile")] pub struct EncodingAudioProfile(Object) @extends EncodingProfile; match fn { type_ => || ffi::gst_encoding_audio_profile_get_type(), } } impl EncodingAudioProfile {} unsafe impl Send for EncodingAudioProfile {} unsafe impl Sync for EncodingAudioProfile {} gstreamer-pbutils-0.22.0/src/auto/encoding_container_profile.rs000064400000000000000000000026321046102023000230360ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::EncodingProfile; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "GstEncodingContainerProfile")] pub struct EncodingContainerProfile(Object) @extends EncodingProfile; match fn { type_ => || ffi::gst_encoding_container_profile_get_type(), } } impl EncodingContainerProfile { #[doc(alias = "gst_encoding_container_profile_contains_profile")] pub fn contains_profile(&self, profile: &impl IsA) -> bool { unsafe { from_glib(ffi::gst_encoding_container_profile_contains_profile( self.to_glib_none().0, profile.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_container_profile_get_profiles")] #[doc(alias = "get_profiles")] pub fn profiles(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_container_profile_get_profiles( self.to_glib_none().0, )) } } } unsafe impl Send for EncodingContainerProfile {} unsafe impl Sync for EncodingContainerProfile {} gstreamer-pbutils-0.22.0/src/auto/encoding_profile.rs000064400000000000000000000164511046102023000210000ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::DiscovererInfo; #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] use glib::signal::{connect_raw, SignalHandlerId}; use glib::{prelude::*, translate::*}; #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "GstEncodingProfile")] pub struct EncodingProfile(Object); match fn { type_ => || ffi::gst_encoding_profile_get_type(), } } impl EncodingProfile { pub const NONE: Option<&'static EncodingProfile> = None; #[doc(alias = "gst_encoding_profile_find")] pub fn find( targetname: &str, profilename: Option<&str>, category: Option<&str>, ) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_encoding_profile_find( targetname.to_glib_none().0, profilename.to_glib_none().0, category.to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_from_discoverer")] pub fn from_discoverer(info: &DiscovererInfo) -> Result { skip_assert_initialized!(); unsafe { Option::<_>::from_glib_full(ffi::gst_encoding_profile_from_discoverer( info.to_glib_none().0, )) .ok_or_else(|| { glib::bool_error!("Failed to create EncodingProfile from DiscovererInfo") }) } } } unsafe impl Send for EncodingProfile {} unsafe impl Sync for EncodingProfile {} mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait EncodingProfileExt: IsA + sealed::Sealed + 'static { #[doc(alias = "gst_encoding_profile_copy")] #[must_use] fn copy(&self) -> EncodingProfile { unsafe { from_glib_full(ffi::gst_encoding_profile_copy( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_allow_dynamic_output")] #[doc(alias = "get_allow_dynamic_output")] fn allows_dynamic_output(&self) -> bool { unsafe { from_glib(ffi::gst_encoding_profile_get_allow_dynamic_output( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_description")] #[doc(alias = "get_description")] fn description(&self) -> Option { unsafe { from_glib_none(ffi::gst_encoding_profile_get_description( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_file_extension")] #[doc(alias = "get_file_extension")] fn file_extension(&self) -> Option { unsafe { from_glib_none(ffi::gst_encoding_profile_get_file_extension( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_format")] #[doc(alias = "get_format")] fn format(&self) -> gst::Caps { unsafe { from_glib_full(ffi::gst_encoding_profile_get_format( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_input_caps")] #[doc(alias = "get_input_caps")] fn input_caps(&self) -> gst::Caps { unsafe { from_glib_full(ffi::gst_encoding_profile_get_input_caps( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_name")] #[doc(alias = "get_name")] fn name(&self) -> Option { unsafe { from_glib_none(ffi::gst_encoding_profile_get_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_presence")] #[doc(alias = "get_presence")] fn presence(&self) -> u32 { unsafe { ffi::gst_encoding_profile_get_presence(self.as_ref().to_glib_none().0) } } #[doc(alias = "gst_encoding_profile_get_preset")] #[doc(alias = "get_preset")] fn preset(&self) -> Option { unsafe { from_glib_none(ffi::gst_encoding_profile_get_preset( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_preset_name")] #[doc(alias = "get_preset_name")] fn preset_name(&self) -> Option { unsafe { from_glib_none(ffi::gst_encoding_profile_get_preset_name( self.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_encoding_profile_get_single_segment")] #[doc(alias = "get_single_segment")] fn is_single_segment(&self) -> bool { unsafe { from_glib(ffi::gst_encoding_profile_get_single_segment( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_get_type_nick")] #[doc(alias = "get_type_nick")] fn type_nick(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_encoding_profile_get_type_nick( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_is_enabled")] fn is_enabled(&self) -> bool { unsafe { from_glib(ffi::gst_encoding_profile_is_enabled( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "gst_encoding_profile_is_equal")] fn is_equal(&self, b: &impl IsA) -> bool { unsafe { from_glib(ffi::gst_encoding_profile_is_equal( self.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, )) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "element-properties")] fn connect_element_properties_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_element_properties_trampoline< P: IsA, F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstEncodingProfile, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(EncodingProfile::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::element-properties\0".as_ptr() as *const _, Some(std::mem::transmute::<_, unsafe extern "C" fn()>( notify_element_properties_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> EncodingProfileExt for O {} gstreamer-pbutils-0.22.0/src/auto/encoding_target.rs000064400000000000000000000125361046102023000206260ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::EncodingProfile; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstEncodingTarget")] pub struct EncodingTarget(Object); match fn { type_ => || ffi::gst_encoding_target_get_type(), } } impl EncodingTarget { #[doc(alias = "gst_encoding_target_new")] pub fn new( name: &str, category: &str, description: &str, profiles: &[EncodingProfile], ) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::gst_encoding_target_new( name.to_glib_none().0, category.to_glib_none().0, description.to_glib_none().0, profiles.to_glib_none().0, )) .ok_or_else(|| glib::bool_error!("Failed to create EncodingTarget")) } } #[doc(alias = "gst_encoding_target_get_category")] #[doc(alias = "get_category")] pub fn category(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_encoding_target_get_category(self.to_glib_none().0)) } } #[doc(alias = "gst_encoding_target_get_description")] #[doc(alias = "get_description")] pub fn description(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_encoding_target_get_description( self.to_glib_none().0, )) } } #[doc(alias = "gst_encoding_target_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_encoding_target_get_name(self.to_glib_none().0)) } } #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_encoding_target_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { unsafe { from_glib_none(ffi::gst_encoding_target_get_path(self.to_glib_none().0)) } } #[doc(alias = "gst_encoding_target_get_profile")] #[doc(alias = "get_profile")] pub fn profile(&self, name: &str) -> Option { unsafe { from_glib_full(ffi::gst_encoding_target_get_profile( self.to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "gst_encoding_target_get_profiles")] #[doc(alias = "get_profiles")] pub fn profiles(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_target_get_profiles( self.to_glib_none().0, )) } } #[doc(alias = "gst_encoding_target_save")] pub fn save(&self) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::gst_encoding_target_save(self.to_glib_none().0, &mut error); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "gst_encoding_target_save_to_file")] pub fn save_to_file(&self, filepath: impl AsRef) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::gst_encoding_target_save_to_file( self.to_glib_none().0, filepath.as_ref().to_glib_none().0, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "gst_encoding_target_load")] pub fn load(name: &str, category: Option<&str>) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::gst_encoding_target_load( name.to_glib_none().0, category.to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "gst_encoding_target_load_from_file")] pub fn load_from_file( filepath: impl AsRef, ) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::gst_encoding_target_load_from_file( filepath.as_ref().to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } } impl std::fmt::Display for EncodingTarget { #[inline] fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(&self.name()) } } unsafe impl Send for EncodingTarget {} unsafe impl Sync for EncodingTarget {} gstreamer-pbutils-0.22.0/src/auto/encoding_video_profile.rs000064400000000000000000000023041046102023000221560ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::EncodingProfile; use glib::translate::*; glib::wrapper! { #[doc(alias = "GstEncodingVideoProfile")] pub struct EncodingVideoProfile(Object) @extends EncodingProfile; match fn { type_ => || ffi::gst_encoding_video_profile_get_type(), } } impl EncodingVideoProfile { #[doc(alias = "gst_encoding_video_profile_get_pass")] #[doc(alias = "get_pass")] pub fn pass(&self) -> u32 { unsafe { ffi::gst_encoding_video_profile_get_pass(self.to_glib_none().0) } } #[doc(alias = "gst_encoding_video_profile_get_variableframerate")] #[doc(alias = "get_variableframerate")] pub fn is_variableframerate(&self) -> bool { unsafe { from_glib(ffi::gst_encoding_video_profile_get_variableframerate( self.to_glib_none().0, )) } } } unsafe impl Send for EncodingVideoProfile {} unsafe impl Sync for EncodingVideoProfile {} gstreamer-pbutils-0.22.0/src/auto/enums.rs000064400000000000000000000203711046102023000166150ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use glib::{prelude::*, translate::*}; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstAudioVisualizerShader")] pub enum AudioVisualizerShader { #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_NONE")] None, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE")] Fade, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP")] FadeAndMoveUp, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN")] FadeAndMoveDown, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT")] FadeAndMoveLeft, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT")] FadeAndMoveRight, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT")] FadeAndMoveHorizOut, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN")] FadeAndMoveHorizIn, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT")] FadeAndMoveVertOut, #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN")] FadeAndMoveVertIn, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for AudioVisualizerShader { type GlibType = ffi::GstAudioVisualizerShader; #[inline] fn into_glib(self) -> ffi::GstAudioVisualizerShader { match self { Self::None => ffi::GST_AUDIO_VISUALIZER_SHADER_NONE, Self::Fade => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE, Self::FadeAndMoveUp => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP, Self::FadeAndMoveDown => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN, Self::FadeAndMoveLeft => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT, Self::FadeAndMoveRight => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT, Self::FadeAndMoveHorizOut => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT, Self::FadeAndMoveHorizIn => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN, Self::FadeAndMoveVertOut => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT, Self::FadeAndMoveVertIn => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for AudioVisualizerShader { #[inline] unsafe fn from_glib(value: ffi::GstAudioVisualizerShader) -> Self { skip_assert_initialized!(); match value { ffi::GST_AUDIO_VISUALIZER_SHADER_NONE => Self::None, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE => Self::Fade, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP => Self::FadeAndMoveUp, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN => Self::FadeAndMoveDown, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT => Self::FadeAndMoveLeft, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT => Self::FadeAndMoveRight, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT => Self::FadeAndMoveHorizOut, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN => Self::FadeAndMoveHorizIn, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT => Self::FadeAndMoveVertOut, ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN => Self::FadeAndMoveVertIn, value => Self::__Unknown(value), } } } impl StaticType for AudioVisualizerShader { #[inline] #[doc(alias = "gst_audio_visualizer_shader_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_audio_visualizer_shader_get_type()) } } } impl glib::HasParamSpec for AudioVisualizerShader { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for AudioVisualizerShader { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for AudioVisualizerShader { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for AudioVisualizerShader { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: AudioVisualizerShader) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "GstDiscovererResult")] pub enum DiscovererResult { #[doc(alias = "GST_DISCOVERER_OK")] Ok, #[doc(alias = "GST_DISCOVERER_URI_INVALID")] UriInvalid, #[doc(alias = "GST_DISCOVERER_ERROR")] Error, #[doc(alias = "GST_DISCOVERER_TIMEOUT")] Timeout, #[doc(alias = "GST_DISCOVERER_BUSY")] Busy, #[doc(alias = "GST_DISCOVERER_MISSING_PLUGINS")] MissingPlugins, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for DiscovererResult { type GlibType = ffi::GstDiscovererResult; #[inline] fn into_glib(self) -> ffi::GstDiscovererResult { match self { Self::Ok => ffi::GST_DISCOVERER_OK, Self::UriInvalid => ffi::GST_DISCOVERER_URI_INVALID, Self::Error => ffi::GST_DISCOVERER_ERROR, Self::Timeout => ffi::GST_DISCOVERER_TIMEOUT, Self::Busy => ffi::GST_DISCOVERER_BUSY, Self::MissingPlugins => ffi::GST_DISCOVERER_MISSING_PLUGINS, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for DiscovererResult { #[inline] unsafe fn from_glib(value: ffi::GstDiscovererResult) -> Self { skip_assert_initialized!(); match value { ffi::GST_DISCOVERER_OK => Self::Ok, ffi::GST_DISCOVERER_URI_INVALID => Self::UriInvalid, ffi::GST_DISCOVERER_ERROR => Self::Error, ffi::GST_DISCOVERER_TIMEOUT => Self::Timeout, ffi::GST_DISCOVERER_BUSY => Self::Busy, ffi::GST_DISCOVERER_MISSING_PLUGINS => Self::MissingPlugins, value => Self::__Unknown(value), } } } impl StaticType for DiscovererResult { #[inline] #[doc(alias = "gst_discoverer_result_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_discoverer_result_get_type()) } } } impl glib::HasParamSpec for DiscovererResult { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for DiscovererResult { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for DiscovererResult { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for DiscovererResult { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: DiscovererResult) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } gstreamer-pbutils-0.22.0/src/auto/flags.rs000064400000000000000000000155311046102023000165640ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use glib::{bitflags::bitflags, prelude::*, translate::*}; bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GstDiscovererSerializeFlags")] pub struct DiscovererSerializeFlags: u32 { #[doc(alias = "GST_DISCOVERER_SERIALIZE_CAPS")] const CAPS = ffi::GST_DISCOVERER_SERIALIZE_CAPS as _; #[doc(alias = "GST_DISCOVERER_SERIALIZE_TAGS")] const TAGS = ffi::GST_DISCOVERER_SERIALIZE_TAGS as _; #[doc(alias = "GST_DISCOVERER_SERIALIZE_MISC")] const MISC = ffi::GST_DISCOVERER_SERIALIZE_MISC as _; } } #[doc(hidden)] impl IntoGlib for DiscovererSerializeFlags { type GlibType = ffi::GstDiscovererSerializeFlags; #[inline] fn into_glib(self) -> ffi::GstDiscovererSerializeFlags { self.bits() } } #[doc(hidden)] impl FromGlib for DiscovererSerializeFlags { #[inline] unsafe fn from_glib(value: ffi::GstDiscovererSerializeFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for DiscovererSerializeFlags { #[inline] #[doc(alias = "gst_discoverer_serialize_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_discoverer_serialize_flags_get_type()) } } } impl glib::HasParamSpec for DiscovererSerializeFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for DiscovererSerializeFlags { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for DiscovererSerializeFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for DiscovererSerializeFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: DiscovererSerializeFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[cfg(feature = "v1_20")] bitflags! { #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "GstPbUtilsCapsDescriptionFlags")] pub struct PbUtilsCapsDescriptionFlags: u32 { #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_CONTAINER")] const CONTAINER = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_CONTAINER as _; #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO")] const AUDIO = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO as _; #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO")] const VIDEO = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO as _; #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_IMAGE")] const IMAGE = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_IMAGE as _; #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE")] const SUBTITLE = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE as _; #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_TAG")] const TAG = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_TAG as _; #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_GENERIC")] const GENERIC = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_GENERIC as _; #[cfg(feature = "v1_22")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))] #[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_METADATA")] const METADATA = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_METADATA as _; } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(hidden)] impl IntoGlib for PbUtilsCapsDescriptionFlags { type GlibType = ffi::GstPbUtilsCapsDescriptionFlags; #[inline] fn into_glib(self) -> ffi::GstPbUtilsCapsDescriptionFlags { self.bits() } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(hidden)] impl FromGlib for PbUtilsCapsDescriptionFlags { #[inline] unsafe fn from_glib(value: ffi::GstPbUtilsCapsDescriptionFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] impl StaticType for PbUtilsCapsDescriptionFlags { #[inline] #[doc(alias = "gst_pb_utils_caps_description_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::gst_pb_utils_caps_description_flags_get_type()) } } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] impl glib::HasParamSpec for PbUtilsCapsDescriptionFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] impl glib::value::ValueType for PbUtilsCapsDescriptionFlags { type Type = Self; } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] unsafe impl<'a> glib::value::FromValue<'a> for PbUtilsCapsDescriptionFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] impl ToValue for PbUtilsCapsDescriptionFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] impl From for glib::Value { #[inline] fn from(v: PbUtilsCapsDescriptionFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } gstreamer-pbutils-0.22.0/src/auto/functions.rs000064400000000000000000000213131046102023000174730ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use crate::EncodingTarget; use glib::translate::*; #[doc(alias = "gst_codec_utils_aac_get_channels")] pub fn codec_utils_aac_get_channels(audio_config: &[u8]) -> u32 { assert_initialized_main_thread!(); let len = audio_config.len() as _; unsafe { ffi::gst_codec_utils_aac_get_channels(audio_config.to_glib_none().0, len) } } #[doc(alias = "gst_codec_utils_aac_get_index_from_sample_rate")] pub fn codec_utils_aac_get_index_from_sample_rate(rate: u32) -> i32 { assert_initialized_main_thread!(); unsafe { ffi::gst_codec_utils_aac_get_index_from_sample_rate(rate) } } #[doc(alias = "gst_codec_utils_aac_get_level")] pub fn codec_utils_aac_get_level(audio_config: &[u8]) -> Result { assert_initialized_main_thread!(); let len = audio_config.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_aac_get_level( audio_config.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get AAC level")) } } #[doc(alias = "gst_codec_utils_aac_get_profile")] pub fn codec_utils_aac_get_profile(audio_config: &[u8]) -> Result { assert_initialized_main_thread!(); let len = audio_config.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_aac_get_profile( audio_config.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get AAC profile")) } } #[doc(alias = "gst_codec_utils_aac_get_sample_rate")] pub fn codec_utils_aac_get_sample_rate(audio_config: &[u8]) -> u32 { assert_initialized_main_thread!(); let len = audio_config.len() as _; unsafe { ffi::gst_codec_utils_aac_get_sample_rate(audio_config.to_glib_none().0, len) } } #[doc(alias = "gst_codec_utils_aac_get_sample_rate_from_index")] pub fn codec_utils_aac_get_sample_rate_from_index(sr_idx: u32) -> u32 { assert_initialized_main_thread!(); unsafe { ffi::gst_codec_utils_aac_get_sample_rate_from_index(sr_idx) } } #[cfg(feature = "v1_22")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))] #[doc(alias = "gst_codec_utils_caps_from_mime_codec")] pub fn codec_utils_caps_from_mime_codec(codecs_field: &str) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_codec_utils_caps_from_mime_codec( codecs_field.to_glib_none().0, )) } } #[doc(alias = "gst_codec_utils_h264_get_level")] pub fn codec_utils_h264_get_level(sps: &[u8]) -> Result { assert_initialized_main_thread!(); let len = sps.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_h264_get_level( sps.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get H264 level")) } } #[doc(alias = "gst_codec_utils_h264_get_level_idc")] pub fn codec_utils_h264_get_level_idc(level: &str) -> u8 { assert_initialized_main_thread!(); unsafe { ffi::gst_codec_utils_h264_get_level_idc(level.to_glib_none().0) } } #[doc(alias = "gst_codec_utils_h264_get_profile")] pub fn codec_utils_h264_get_profile(sps: &[u8]) -> Result { assert_initialized_main_thread!(); let len = sps.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_h264_get_profile( sps.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get H264 profile")) } } #[doc(alias = "gst_codec_utils_h265_get_level")] pub fn codec_utils_h265_get_level( profile_tier_level: &[u8], ) -> Result { assert_initialized_main_thread!(); let len = profile_tier_level.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_h265_get_level( profile_tier_level.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get H265 level")) } } #[doc(alias = "gst_codec_utils_h265_get_level_idc")] pub fn codec_utils_h265_get_level_idc(level: &str) -> u8 { assert_initialized_main_thread!(); unsafe { ffi::gst_codec_utils_h265_get_level_idc(level.to_glib_none().0) } } #[doc(alias = "gst_codec_utils_h265_get_profile")] pub fn codec_utils_h265_get_profile( profile_tier_level: &[u8], ) -> Result { assert_initialized_main_thread!(); let len = profile_tier_level.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_h265_get_profile( profile_tier_level.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get H265 profile")) } } #[doc(alias = "gst_codec_utils_h265_get_tier")] pub fn codec_utils_h265_get_tier( profile_tier_level: &[u8], ) -> Result { assert_initialized_main_thread!(); let len = profile_tier_level.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_h265_get_tier( profile_tier_level.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get H265 tier")) } } #[doc(alias = "gst_codec_utils_mpeg4video_get_level")] pub fn codec_utils_mpeg4video_get_level( vis_obj_seq: &[u8], ) -> Result { assert_initialized_main_thread!(); let len = vis_obj_seq.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_mpeg4video_get_level( vis_obj_seq.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get MPEG4 video level")) } } #[doc(alias = "gst_codec_utils_mpeg4video_get_profile")] pub fn codec_utils_mpeg4video_get_profile( vis_obj_seq: &[u8], ) -> Result { assert_initialized_main_thread!(); let len = vis_obj_seq.len() as _; unsafe { Option::<_>::from_glib_none(ffi::gst_codec_utils_mpeg4video_get_profile( vis_obj_seq.to_glib_none().0, len, )) .ok_or_else(|| glib::bool_error!("Failed to get MPEG4 video profile")) } } #[doc(alias = "gst_encoding_list_all_targets")] pub fn encoding_list_all_targets(categoryname: Option<&str>) -> Vec { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_all_targets( categoryname.to_glib_none().0, )) } } #[doc(alias = "gst_encoding_list_available_categories")] pub fn encoding_list_available_categories() -> Vec { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_available_categories()) } } #[doc(alias = "gst_pb_utils_get_element_description")] pub fn pb_utils_get_element_description(factory_name: &str) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_element_description( factory_name.to_glib_none().0, )) } } #[doc(alias = "gst_pb_utils_get_sink_description")] pub fn pb_utils_get_sink_description(protocol: &str) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_sink_description( protocol.to_glib_none().0, )) } } #[doc(alias = "gst_pb_utils_get_source_description")] pub fn pb_utils_get_source_description(protocol: &str) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_source_description( protocol.to_glib_none().0, )) } } #[doc(alias = "gst_plugins_base_version")] pub fn plugins_base_version() -> (u32, u32, u32, u32) { skip_assert_initialized!(); unsafe { let mut major = std::mem::MaybeUninit::uninit(); let mut minor = std::mem::MaybeUninit::uninit(); let mut micro = std::mem::MaybeUninit::uninit(); let mut nano = std::mem::MaybeUninit::uninit(); ffi::gst_plugins_base_version( major.as_mut_ptr(), minor.as_mut_ptr(), micro.as_mut_ptr(), nano.as_mut_ptr(), ); ( major.assume_init(), minor.assume_init(), micro.assume_init(), nano.assume_init(), ) } } #[doc(alias = "gst_plugins_base_version_string")] pub fn plugins_base_version_string() -> glib::GString { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gst_plugins_base_version_string()) } } gstreamer-pbutils-0.22.0/src/auto/mod.rs000064400000000000000000000034141046102023000162440ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT mod audio_visualizer; pub use self::audio_visualizer::AudioVisualizer; mod discoverer; pub use self::discoverer::Discoverer; mod discoverer_audio_info; pub use self::discoverer_audio_info::DiscovererAudioInfo; mod discoverer_container_info; pub use self::discoverer_container_info::DiscovererContainerInfo; mod discoverer_info; pub use self::discoverer_info::DiscovererInfo; mod discoverer_stream_info; pub use self::discoverer_stream_info::DiscovererStreamInfo; mod discoverer_subtitle_info; pub use self::discoverer_subtitle_info::DiscovererSubtitleInfo; mod discoverer_video_info; pub use self::discoverer_video_info::DiscovererVideoInfo; mod encoding_audio_profile; pub use self::encoding_audio_profile::EncodingAudioProfile; mod encoding_container_profile; pub use self::encoding_container_profile::EncodingContainerProfile; mod encoding_profile; pub use self::encoding_profile::EncodingProfile; mod encoding_target; pub use self::encoding_target::EncodingTarget; mod encoding_video_profile; pub use self::encoding_video_profile::EncodingVideoProfile; mod enums; pub use self::enums::AudioVisualizerShader; pub use self::enums::DiscovererResult; mod flags; pub use self::flags::DiscovererSerializeFlags; #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] pub use self::flags::PbUtilsCapsDescriptionFlags; pub(crate) mod functions; pub(crate) mod traits { pub use super::audio_visualizer::AudioVisualizerExt; pub use super::discoverer_stream_info::DiscovererStreamInfoExt; pub use super::encoding_profile::EncodingProfileExt; } gstreamer-pbutils-0.22.0/src/auto/versions.txt000064400000000000000000000003421046102023000175250ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 0e476ab5c1de) from gir-files (https://github.com/gtk-rs/gir-files @ cfc0305f903b) from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 63e90a30193b) gstreamer-pbutils-0.22.0/src/discoverer.rs000064400000000000000000000071541046102023000166670ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::{boxed::Box as Box_, fmt, mem::transmute}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use crate::{auto::Discoverer, DiscovererInfo}; impl Discoverer { pub fn set_timeout(&self, timeout: gst::ClockTime) { self.set_property("timeout", timeout); } pub fn timeout(&self) -> gst::ClockTime { self.property("timeout") } #[doc(alias = "timeout")] pub fn connect_timeout_notify( &self, f: F, ) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_timeout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } unsafe extern "C" fn notify_timeout_trampoline( this: *mut ffi::GstDiscoverer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(Discoverer::from_glib_borrow(this).unsafe_cast_ref()) } pub struct DebugInfo<'a>(&'a DiscovererInfo); impl<'a> fmt::Debug for DebugInfo<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let stream_info = self.0.stream_info(); let stream_list = self.0.stream_list(); let container_streams = self.0.container_streams(); let audio_streams = self.0.audio_streams(); let video_streams = self.0.video_streams(); let subtitle_streams = self.0.subtitle_streams(); f.debug_struct("DiscovererInfo") .field("uri", &self.0.uri()) .field("result", &self.0.result()) .field("duration", &self.0.duration()) .field("is-live", &self.0.is_live()) .field("is-seekable", &self.0.is_seekable()) .field( "stream-info", &stream_info.as_ref().map(|info| info.debug()), ) .field( "stream-list", &stream_list .iter() .map(|info| info.debug()) .collect::>(), ) .field( "container-streams", &container_streams .iter() .map(|info| info.debug()) .collect::>(), ) .field( "audio-streams", &audio_streams .iter() .map(|info| info.debug()) .collect::>(), ) .field( "video-streams", &video_streams .iter() .map(|info| info.debug()) .collect::>(), ) .field( "subtitle-streams", &subtitle_streams .iter() .map(|info| info.debug()) .collect::>(), ) .field("toc", &self.0.toc()) .field("misc", &self.0.misc()) .field( "missing-elements-installer-details", &self.0.missing_elements_installer_details(), ) .finish() } } impl DiscovererInfo { pub fn debug(&self) -> DebugInfo { DebugInfo(self) } } gstreamer-pbutils-0.22.0/src/discoverer_audio_info.rs000064400000000000000000000017041046102023000210560ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::fmt; use glib::prelude::*; use crate::{DiscovererAudioInfo, DiscovererStreamInfo}; pub struct Debug<'a>(&'a DiscovererAudioInfo); impl<'a> fmt::Debug for Debug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let info = self.0.upcast_ref::(); f.debug_struct("DiscovererAudioInfo") .field("channels", &self.0.channels()) .field("sample-rate", &self.0.sample_rate()) .field("depth", &self.0.depth()) .field("bitrate", &self.0.bitrate()) .field("max-bitrate", &self.0.max_bitrate()) .field("channel-mask", &self.0.channel_mask()) .field("language", &self.0.language()) .field("stream", &info.debug()) .finish() } } impl DiscovererAudioInfo { pub fn debug(&self) -> Debug { Debug(self) } } gstreamer-pbutils-0.22.0/src/discoverer_container_info.rs000064400000000000000000000015151046102023000217370ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::fmt; use crate::{prelude::*, DiscovererContainerInfo}; pub struct Debug<'a>(&'a DiscovererContainerInfo); impl<'a> fmt::Debug for Debug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let streams = self.0.streams(); let mut d = f.debug_struct("DiscovererContainerInfo"); d.field("tags", &self.0.tags()).field( "streams", &streams.iter().map(|info| info.debug()).collect::>(), ); #[cfg(feature = "v1_20")] d.field("stream-number", &self.0.stream_number()); #[cfg(feature = "v1_20")] d.field("tags", &self.0.tags()); d.finish() } } impl DiscovererContainerInfo { pub fn debug(&self) -> Debug { Debug(self) } } gstreamer-pbutils-0.22.0/src/discoverer_stream_info.rs000064400000000000000000000040531046102023000212500ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::fmt; use crate::{prelude::*, DiscovererStreamInfo}; #[derive(Debug)] pub struct Iter { stream_info: Option, direction_forward: bool, } impl Iterator for Iter { type Item = DiscovererStreamInfo; fn next(&mut self) -> Option { let current = self.stream_info.take(); self.stream_info = match current { Some(ref c) => { // Decide on the direction if self.direction_forward { c.next() } else { c.previous() } } None => None, }; current } } impl std::iter::FusedIterator for Iter {} mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait DiscovererStreamInfoExtManual: sealed::Sealed + IsA + 'static { fn next_iter(&self) -> Iter { Iter { stream_info: self.next(), direction_forward: true, } } fn previous_iter(&self) -> Iter { Iter { stream_info: self.previous(), direction_forward: false, } } } impl> DiscovererStreamInfoExtManual for O {} pub struct Debug<'a>(&'a DiscovererStreamInfo); impl<'a> fmt::Debug for Debug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut d = f.debug_struct("DiscovererStreamInfo"); d.field("caps", &self.0.caps()) .field("stream-id", &self.0.stream_id()) .field("misc", &self.0.misc()) .field("stream-type-nick", &self.0.stream_type_nick()) .field("tags", &self.0.tags()) .field("toc", &self.0.toc()); #[cfg(feature = "v1_20")] d.field("stream-number", &self.0.stream_number()); d.finish() } } impl DiscovererStreamInfo { pub fn debug(&self) -> Debug { Debug(self) } } gstreamer-pbutils-0.22.0/src/discoverer_subtitle_info.rs000064400000000000000000000012221046102023000216030ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::fmt; use glib::prelude::*; use crate::{DiscovererStreamInfo, DiscovererSubtitleInfo}; pub struct Debug<'a>(&'a DiscovererSubtitleInfo); impl<'a> fmt::Debug for Debug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let info = self.0.upcast_ref::(); f.debug_struct("DiscovererSubtitleInfo") .field("language", &self.0.language()) .field("stream", &info.debug()) .finish() } } impl DiscovererSubtitleInfo { pub fn debug(&self) -> Debug { Debug(self) } } gstreamer-pbutils-0.22.0/src/discoverer_video_info.rs000064400000000000000000000035701046102023000210660ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::fmt; use glib::{prelude::*, translate::*}; use crate::{DiscovererStreamInfo, DiscovererVideoInfo}; impl DiscovererVideoInfo { #[doc(alias = "get_framerate")] #[doc(alias = "gst_discoverer_video_info_get_framerate_num")] #[doc(alias = "gst_discoverer_video_info_get_framerate_denom")] pub fn framerate(&self) -> gst::Fraction { unsafe { gst::Fraction::new( ffi::gst_discoverer_video_info_get_framerate_num(self.to_glib_none().0) as i32, ffi::gst_discoverer_video_info_get_framerate_denom(self.to_glib_none().0) as i32, ) } } #[doc(alias = "get_par")] #[doc(alias = "gst_discoverer_video_info_get_par_num")] #[doc(alias = "gst_discoverer_video_info_get_par_denom")] pub fn par(&self) -> gst::Fraction { unsafe { gst::Fraction::new( ffi::gst_discoverer_video_info_get_par_num(self.to_glib_none().0) as i32, ffi::gst_discoverer_video_info_get_par_denom(self.to_glib_none().0) as i32, ) } } pub fn debug(&self) -> Debug { Debug(self) } } pub struct Debug<'a>(&'a DiscovererVideoInfo); impl<'a> fmt::Debug for Debug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let info = self.0.upcast_ref::(); f.debug_struct("DiscovererVideoInfo") .field("width", &self.0.width()) .field("height", &self.0.height()) .field("depth", &self.0.depth()) .field("bitrate", &self.0.bitrate()) .field("max-bitrate", &self.0.max_bitrate()) .field("is-image", &self.0.is_image()) .field("is-interlaced", &self.0.is_interlaced()) .field("stream", &info.debug()) .finish() } } gstreamer-pbutils-0.22.0/src/element_properties.rs000064400000000000000000000217541046102023000204310ustar 00000000000000use std::ops::{Deref, DerefMut}; use gst::prelude::*; // rustdoc-stripper-ignore-next /// Wrapper around `gst::Structure` for `element-properties` /// property of `EncodingProfile`. /// /// # Examples /// /// ```rust /// # use gstreamer_pbutils::ElementProperties; /// # gst::init().unwrap(); /// ElementProperties::builder_general() /// .field("threads", 16) /// .build(); /// ``` /// /// ```rust /// # use gstreamer_pbutils::{ElementProperties, ElementPropertiesMapItem}; /// # gst::init().unwrap(); /// ElementProperties::builder_map() /// .item( /// ElementPropertiesMapItem::builder("vp8enc") /// .field("max-quantizer", 17) /// .field("buffer-size", 20000) /// .field("threads", 16) /// .build(), /// ) /// .build(); /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ElementProperties(pub(crate) gst::Structure); impl Default for ElementProperties { fn default() -> Self { Self::builder_general().build() } } impl Deref for ElementProperties { type Target = gst::StructureRef; #[inline] fn deref(&self) -> &Self::Target { self.0.as_ref() } } impl From for gst::Structure { #[inline] fn from(e: ElementProperties) -> Self { skip_assert_initialized!(); e.into_inner() } } impl ElementProperties { // rustdoc-stripper-ignore-next /// Creates an `ElementProperties` builder that build into /// something similar to the following: /// /// [element-properties, boolean-prop=true, string-prop="hi"] pub fn builder_general() -> ElementPropertiesGeneralBuilder { assert_initialized_main_thread!(); ElementPropertiesGeneralBuilder { structure: gst::Structure::new_empty("element-properties"), } } // rustdoc-stripper-ignore-next /// Creates an `ElementProperties` builder that build into /// something similar to the following: /// /// element-properties-map, map = { /// [openh264enc, gop-size=32, ], /// [x264enc, key-int-max=32, tune=zerolatency], /// } pub fn builder_map() -> ElementPropertiesMapBuilder { assert_initialized_main_thread!(); ElementPropertiesMapBuilder { map: Vec::new() } } // rustdoc-stripper-ignore-next /// Returns true if self is built with `ElementPropertiesGeneralBuilder`. pub fn is_general(&self) -> bool { let structure_name = self.0.name(); if structure_name != "element-properties" { debug_assert_eq!(structure_name, "element-properties-map"); return false; } true } // rustdoc-stripper-ignore-next /// Returns true if self is built with `ElementPropertiesMapBuilder`. pub fn is_map(&self) -> bool { !self.is_general() } // rustdoc-stripper-ignore-next /// Returns the inner vec of `ElementPropertiesMapItem` if self is_map() /// or `None` if self is_general(). pub fn map(&self) -> Option> { if !self.is_map() { return None; } Some( self.0 .get::("map") .unwrap() .as_slice() .iter() .map(|props_map| { ElementPropertiesMapItem(props_map.get::().unwrap()) }) .collect::>(), ) } #[inline] pub fn into_inner(self) -> gst::Structure { self.0 } } #[must_use = "The builder must be built to be used"] #[derive(Debug, Clone)] pub struct ElementPropertiesGeneralBuilder { structure: gst::Structure, } impl ElementPropertiesGeneralBuilder { pub fn field(mut self, property_name: &str, value: T) -> Self where T: Into + Send, { self.structure.set(property_name, value); self } pub fn field_value(mut self, property_name: &str, value: glib::SendValue) -> Self { self.structure.set_value(property_name, value); self } pub fn build(self) -> ElementProperties { ElementProperties(self.structure) } } #[must_use = "The builder must be built to be used"] #[derive(Debug, Clone)] pub struct ElementPropertiesMapBuilder { map: Vec, } impl ElementPropertiesMapBuilder { pub fn item(mut self, item: ElementPropertiesMapItem) -> Self { self.map.push(item.into_inner().to_send_value()); self } pub fn build(self) -> ElementProperties { ElementProperties( gst::Structure::builder("element-properties-map") .field("map", gst::List::new(self.map)) .build(), ) } } // rustdoc-stripper-ignore-next /// Wrapper around `gst::Structure` for `element-properties-map` map item. /// /// # Examples /// /// ```rust /// # use gstreamer_pbutils::{ElementProperties, ElementPropertiesMapItem}; /// # gst::init().unwrap(); /// ElementProperties::builder_map() /// .item( /// ElementPropertiesMapItem::builder("vp8enc") /// .field("max-quantizer", 17) /// .field("buffer-size", 20000) /// .field("threads", 16) /// .build(), /// ) /// .build(); /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ElementPropertiesMapItem(gst::Structure); impl Deref for ElementPropertiesMapItem { type Target = gst::StructureRef; #[inline] fn deref(&self) -> &Self::Target { self.0.as_ref() } } impl DerefMut for ElementPropertiesMapItem { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { self.0.deref_mut() } } impl From for gst::Structure { #[inline] fn from(e: ElementPropertiesMapItem) -> Self { skip_assert_initialized!(); e.into_inner() } } impl ElementPropertiesMapItem { pub fn builder(factory_name: &str) -> ElementPropertiesMapItemBuilder { assert_initialized_main_thread!(); ElementPropertiesMapItemBuilder { structure: gst::Structure::new_empty(factory_name), } } #[inline] pub fn into_inner(self) -> gst::Structure { self.0 } } #[must_use = "The builder must be built to be used"] #[derive(Debug, Clone)] pub struct ElementPropertiesMapItemBuilder { structure: gst::Structure, } impl ElementPropertiesMapItemBuilder { pub fn field(mut self, property_name: &str, value: T) -> Self where T: Into + Send, { self.structure.set(property_name, value); self } pub fn field_value(mut self, property_name: &str, value: glib::SendValue) -> Self { self.structure.set_value(property_name, value); self } pub fn build(self) -> ElementPropertiesMapItem { ElementPropertiesMapItem(self.structure) } } #[cfg(test)] mod test { use super::*; #[test] fn element_properties_getters() { gst::init().unwrap(); let elem_props_general = ElementProperties::builder_general() .field("string-prop", "hi") .field("boolean-prop", true) .build(); assert!(elem_props_general.is_general()); assert!(!elem_props_general.is_map()); assert_eq!(elem_props_general.map(), None); let elem_factory_props_map = ElementPropertiesMapItem::builder("vp8enc") .field("cq-level", 13) .field("resize-allowed", false) .build(); let elem_props_map = ElementProperties::builder_map() .item(elem_factory_props_map.clone()) .build(); assert!(elem_props_map.is_map()); assert!(!elem_props_map.is_general()); assert_eq!(elem_props_map.map(), Some(vec![elem_factory_props_map])); } #[test] fn element_properties_general_builder() { gst::init().unwrap(); let elem_props = ElementProperties::builder_general() .field("string-prop", "hi") .field("boolean-prop", true) .build(); assert_eq!(elem_props.n_fields(), 2); assert_eq!(elem_props.name(), "element-properties"); assert_eq!(elem_props.get::("string-prop").unwrap(), "hi"); assert!(elem_props.get::("boolean-prop").unwrap()); } #[test] fn element_properties_map_builder() { gst::init().unwrap(); let props_map = ElementPropertiesMapItem::builder("vp8enc") .field("cq-level", 13) .field("resize-allowed", false) .build(); assert_eq!(props_map.n_fields(), 2); assert_eq!(props_map.name(), "vp8enc"); assert_eq!(props_map.get::("cq-level").unwrap(), 13); assert!(!props_map.get::("resize-allowed").unwrap()); let elem_props = ElementProperties::builder_map() .item(props_map.clone()) .build(); assert_eq!(elem_props.n_fields(), 1); let list = elem_props.map().unwrap(); assert_eq!(list.len(), 1); assert_eq!(list.first().unwrap(), &props_map); } } gstreamer-pbutils-0.22.0/src/encoding_profile.rs000064400000000000000000000607231046102023000200310ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::{prelude::*, translate::*}; use crate::auto::{ EncodingAudioProfile, EncodingContainerProfile, EncodingProfile, EncodingVideoProfile, }; #[cfg(feature = "v1_20")] use crate::ElementProperties; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait EncodingProfileExtManual: sealed::Sealed + IsA + 'static { #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_encoding_profile_get_element_properties")] #[doc(alias = "get_element_properties")] fn element_properties(&self) -> Option { unsafe { from_glib_full::<_, Option<_>>(ffi::gst_encoding_profile_get_element_properties( self.as_ref().to_glib_none().0, )) .map(ElementProperties) } } } impl> EncodingProfileExtManual for O {} trait EncodingProfileBuilderCommon { fn set_allow_dynamic_output(&self, allow_dynamic_output: bool); fn set_description(&self, description: Option<&str>); fn set_enabled(&self, enabled: bool); fn set_format(&self, format: &gst::Caps); fn set_name(&self, name: Option<&str>); fn set_presence(&self, presence: u32); fn set_preset(&self, preset: Option<&str>); fn set_preset_name(&self, preset_name: Option<&str>); #[cfg(feature = "v1_18")] fn set_single_segment(&self, single_segment: bool); #[cfg(feature = "v1_20")] fn set_element_properties(&self, element_properties: ElementProperties); } impl> EncodingProfileBuilderCommon for O { // checker-ignore-item fn set_allow_dynamic_output(&self, allow_dynamic_output: bool) { unsafe { ffi::gst_encoding_profile_set_allow_dynamic_output( self.as_ref().to_glib_none().0, allow_dynamic_output.into_glib(), ); } } // checker-ignore-item fn set_description(&self, description: Option<&str>) { let description = description.to_glib_none(); unsafe { ffi::gst_encoding_profile_set_description( self.as_ref().to_glib_none().0, description.0, ); } } // checker-ignore-item fn set_enabled(&self, enabled: bool) { unsafe { ffi::gst_encoding_profile_set_enabled( self.as_ref().to_glib_none().0, enabled.into_glib(), ); } } // checker-ignore-item fn set_format(&self, format: &gst::Caps) { unsafe { ffi::gst_encoding_profile_set_format( self.as_ref().to_glib_none().0, format.to_glib_none().0, ); } } // checker-ignore-item fn set_name(&self, name: Option<&str>) { let name = name.to_glib_none(); unsafe { ffi::gst_encoding_profile_set_name(self.as_ref().to_glib_none().0, name.0); } } // checker-ignore-item fn set_presence(&self, presence: u32) { unsafe { ffi::gst_encoding_profile_set_presence(self.as_ref().to_glib_none().0, presence); } } // checker-ignore-item fn set_preset(&self, preset: Option<&str>) { let preset = preset.to_glib_none(); unsafe { ffi::gst_encoding_profile_set_preset(self.as_ref().to_glib_none().0, preset.0); } } // checker-ignore-item fn set_preset_name(&self, preset_name: Option<&str>) { let preset_name = preset_name.to_glib_none(); unsafe { ffi::gst_encoding_profile_set_preset_name( self.as_ref().to_glib_none().0, preset_name.0, ); } } // checker-ignore-item #[cfg(feature = "v1_18")] fn set_single_segment(&self, single_segment: bool) { unsafe { ffi::gst_encoding_profile_set_single_segment( self.as_ref().to_glib_none().0, single_segment.into_glib(), ); } } // checker-ignore-item #[cfg(feature = "v1_20")] fn set_element_properties(&self, element_properties: ElementProperties) { unsafe { ffi::gst_encoding_profile_set_element_properties( self.as_ref().to_glib_none().0, element_properties.into_inner().into_glib_ptr(), ); } } } // Split the trait as only the getter is public trait EncodingProfileHasRestrictionSetter { fn set_restriction(&self, restriction: Option); } pub trait EncodingProfileHasRestrictionGetter { #[doc(alias = "get_restriction")] #[doc(alias = "gst_encoding_profile_get_restriction")] fn restriction(&self) -> Option; } macro_rules! declare_encoding_profile_has_restriction( ($name:ident) => { impl EncodingProfileHasRestrictionSetter for $name { // checker-ignore-item fn set_restriction(&self, restriction: Option) { let profile: &EncodingProfile = glib::object::Cast::upcast_ref(self); unsafe { let restriction = match restriction { Some(restriction) => restriction.into_glib_ptr(), None => gst::ffi::gst_caps_new_any(), }; ffi::gst_encoding_profile_set_restriction( profile.to_glib_none().0, restriction, ); } } } impl EncodingProfileHasRestrictionGetter for $name { // checker-ignore-item fn restriction(&self) -> Option { let profile: &EncodingProfile = glib::object::Cast::upcast_ref(self); unsafe { from_glib_full(ffi::gst_encoding_profile_get_restriction( profile.to_glib_none().0, )) } } } } ); impl EncodingAudioProfile { // checker-ignore-item fn new( format: &gst::Caps, preset: Option<&str>, restriction: Option<&gst::Caps>, presence: u32, ) -> EncodingAudioProfile { skip_assert_initialized!(); let preset = preset.to_glib_none(); let restriction = restriction.to_glib_none(); unsafe { from_glib_full(ffi::gst_encoding_audio_profile_new( format.to_glib_none().0, preset.0, restriction.0, presence, )) } } #[doc(alias = "gst_encoding_audio_profile_new")] pub fn builder(format: &gst::Caps) -> EncodingAudioProfileBuilder { assert_initialized_main_thread!(); EncodingAudioProfileBuilder::new(format) } } declare_encoding_profile_has_restriction!(EncodingAudioProfile); impl EncodingVideoProfile { // checker-ignore-item fn new( format: &gst::Caps, preset: Option<&str>, restriction: Option<&gst::Caps>, presence: u32, ) -> EncodingVideoProfile { skip_assert_initialized!(); let preset = preset.to_glib_none(); let restriction = restriction.to_glib_none(); unsafe { from_glib_full(ffi::gst_encoding_video_profile_new( format.to_glib_none().0, preset.0, restriction.0, presence, )) } } #[doc(alias = "gst_encoding_video_profile_new")] pub fn builder(format: &gst::Caps) -> EncodingVideoProfileBuilder { assert_initialized_main_thread!(); EncodingVideoProfileBuilder::new(format) } // checker-ignore-item fn set_pass(&self, pass: u32) { unsafe { ffi::gst_encoding_video_profile_set_pass(self.to_glib_none().0, pass); } } // checker-ignore-item fn set_variableframerate(&self, variableframerate: bool) { unsafe { ffi::gst_encoding_video_profile_set_variableframerate( self.to_glib_none().0, variableframerate.into_glib(), ); } } } declare_encoding_profile_has_restriction!(EncodingVideoProfile); impl EncodingContainerProfile { // checker-ignore-item fn new( name: Option<&str>, description: Option<&str>, format: &gst::Caps, preset: Option<&str>, ) -> EncodingContainerProfile { skip_assert_initialized!(); let name = name.to_glib_none(); let description = description.to_glib_none(); let preset = preset.to_glib_none(); unsafe { from_glib_full(ffi::gst_encoding_container_profile_new( name.0, description.0, format.to_glib_none().0, preset.0, )) } } #[doc(alias = "gst_encoding_container_profile_new")] pub fn builder(format: &gst::Caps) -> EncodingContainerProfileBuilder { assert_initialized_main_thread!(); EncodingContainerProfileBuilder::new(format) } // checker-ignore-item fn add_profile(&self, profile: impl IsA) { unsafe { let res = ffi::gst_encoding_container_profile_add_profile( self.to_glib_none().0, profile.upcast().into_glib_ptr(), ); // Can't possibly fail unless we pass random pointers debug_assert_ne!(res, glib::ffi::GFALSE); } } } #[derive(Debug)] struct EncodingProfileBuilderCommonData<'a> { format: &'a gst::Caps, name: Option<&'a str>, description: Option<&'a str>, preset: Option<&'a str>, preset_name: Option<&'a str>, presence: u32, allow_dynamic_output: bool, enabled: bool, #[cfg(feature = "v1_18")] single_segment: bool, #[cfg(feature = "v1_20")] element_properties: Option, } impl<'a> EncodingProfileBuilderCommonData<'a> { fn new(format: &'a gst::Caps) -> EncodingProfileBuilderCommonData<'a> { skip_assert_initialized!(); EncodingProfileBuilderCommonData { name: None, description: None, format, preset: None, preset_name: None, presence: 0, allow_dynamic_output: true, enabled: true, #[cfg(feature = "v1_18")] single_segment: false, #[cfg(feature = "v1_20")] element_properties: None, } } } pub trait EncodingProfileBuilder<'a>: Sized { #[doc(alias = "gst_encoding_profile_set_name")] #[must_use] fn name(self, name: &'a str) -> Self; #[doc(alias = "gst_encoding_profile_set_description")] #[must_use] fn description(self, description: &'a str) -> Self; #[doc(alias = "gst_encoding_profile_set_preset")] #[must_use] fn preset(self, preset: &'a str) -> Self; #[doc(alias = "gst_encoding_profile_set_preset_name")] #[must_use] fn preset_name(self, preset_name: &'a str) -> Self; #[doc(alias = "gst_encoding_profile_set_presence")] #[must_use] fn presence(self, presence: u32) -> Self; #[doc(alias = "gst_encoding_profile_set_allow_dynamic_output")] #[must_use] fn allow_dynamic_output(self, allow: bool) -> Self; #[doc(alias = "gst_encoding_profile_set_enabled")] #[must_use] fn enabled(self, enabled: bool) -> Self; #[cfg(feature = "v1_18")] #[doc(alias = "gst_encoding_profile_set_single_segment")] #[must_use] fn single_segment(self, single_segment: bool) -> Self; #[cfg(feature = "v1_20")] #[doc(alias = "gst_encoding_profile_set_element_properties")] #[must_use] fn element_properties(self, element_properties: ElementProperties) -> Self; } macro_rules! declare_encoding_profile_builder_common( ($name:ident) => { impl<'a> EncodingProfileBuilder<'a> for $name<'a> { fn name(mut self, name: &'a str) -> $name<'a> { self.base.name = Some(name); self } fn description(mut self, description: &'a str) -> $name<'a> { self.base.description = Some(description); self } fn preset(mut self, preset: &'a str) -> $name<'a> { self.base.preset = Some(preset); self } fn preset_name(mut self, preset_name: &'a str) -> $name<'a> { self.base.preset_name = Some(preset_name); self } fn presence(mut self, presence: u32) -> $name<'a> { self.base.presence = presence; self } fn allow_dynamic_output(mut self, allow: bool) -> $name<'a> { self.base.allow_dynamic_output = allow; self } fn enabled(mut self, enabled: bool) -> $name<'a> { self.base.enabled = enabled; self } #[cfg(feature = "v1_18")] fn single_segment(mut self, single_segment: bool) -> $name<'a> { self.base.single_segment = single_segment; self } #[cfg(feature = "v1_20")] fn element_properties(mut self, element_properties: ElementProperties) -> $name<'a> { self.base.element_properties = Some(element_properties); self } } } ); fn set_common_fields( profile: &T, base_data: EncodingProfileBuilderCommonData, ) { skip_assert_initialized!(); profile.set_name(base_data.name); profile.set_description(base_data.description); profile.set_preset(base_data.preset); profile.set_preset_name(base_data.preset_name); profile.set_allow_dynamic_output(base_data.allow_dynamic_output); profile.set_enabled(base_data.enabled); profile.set_presence(base_data.presence); #[cfg(feature = "v1_18")] { profile.set_single_segment(base_data.single_segment); } #[cfg(feature = "v1_20")] { let mut base_data = base_data; if let Some(element_properties) = base_data.element_properties.take() { profile.set_element_properties(element_properties); } } } #[derive(Debug)] #[must_use = "The builder must be built to be used"] pub struct EncodingAudioProfileBuilder<'a> { base: EncodingProfileBuilderCommonData<'a>, restriction: Option<&'a gst::Caps>, } declare_encoding_profile_builder_common!(EncodingAudioProfileBuilder); impl<'a> EncodingAudioProfileBuilder<'a> { fn new(format: &'a gst::Caps) -> Self { skip_assert_initialized!(); EncodingAudioProfileBuilder { base: EncodingProfileBuilderCommonData::new(format), restriction: None, } } #[doc(alias = "gst_encoding_profile_set_restriction")] pub fn restriction(mut self, restriction: &'a gst::Caps) -> Self { self.restriction = Some(restriction); self } #[must_use = "Building the profile without using it has no effect"] pub fn build(self) -> EncodingAudioProfile { let profile = EncodingAudioProfile::new( self.base.format, self.base.preset, self.restriction, self.base.presence, ); set_common_fields(&profile, self.base); profile } } #[derive(Debug)] #[must_use = "The builder must be built to be used"] pub struct EncodingVideoProfileBuilder<'a> { base: EncodingProfileBuilderCommonData<'a>, restriction: Option<&'a gst::Caps>, pass: u32, variable_framerate: bool, } declare_encoding_profile_builder_common!(EncodingVideoProfileBuilder); impl<'a> EncodingVideoProfileBuilder<'a> { fn new(format: &'a gst::Caps) -> Self { skip_assert_initialized!(); EncodingVideoProfileBuilder { base: EncodingProfileBuilderCommonData::new(format), restriction: None, pass: 0, variable_framerate: false, } } #[doc(alias = "gst_encoding_video_profile_set_pass")] pub fn pass(mut self, pass: u32) -> Self { self.pass = pass; self } #[doc(alias = "gst_encoding_video_profile_set_variableframerate")] pub fn variable_framerate(mut self, variable_framerate: bool) -> Self { self.variable_framerate = variable_framerate; self } #[doc(alias = "gst_encoding_profile_set_restriction")] pub fn restriction(mut self, restriction: &'a gst::Caps) -> Self { self.restriction = Some(restriction); self } #[must_use = "Building the profile without using it has no effect"] pub fn build(self) -> EncodingVideoProfile { let video_profile = EncodingVideoProfile::new( self.base.format, self.base.preset, self.restriction, self.base.presence, ); video_profile.set_pass(self.pass); video_profile.set_variableframerate(self.variable_framerate); set_common_fields(&video_profile, self.base); video_profile } } #[derive(Debug)] #[must_use = "The builder must be built to be used"] pub struct EncodingContainerProfileBuilder<'a> { base: EncodingProfileBuilderCommonData<'a>, profiles: Vec, } declare_encoding_profile_builder_common!(EncodingContainerProfileBuilder); impl<'a> EncodingContainerProfileBuilder<'a> { fn new(format: &'a gst::Caps) -> Self { skip_assert_initialized!(); EncodingContainerProfileBuilder { base: EncodingProfileBuilderCommonData::new(format), profiles: Vec::new(), } } #[must_use = "Building the profile without using it has no effect"] pub fn build(self) -> EncodingContainerProfile { let container_profile = EncodingContainerProfile::new( self.base.name, self.base.description, self.base.format, self.base.preset, ); for profile in self.profiles { container_profile.add_profile(profile); } set_common_fields(&container_profile, self.base); container_profile } #[doc(alias = "gst_encoding_container_profile_add_profile")] pub fn add_profile(mut self, profile: impl IsA) -> Self { self.profiles.push(profile.upcast()); self } } #[cfg(test)] mod tests { use super::*; use crate::{ auto::{EncodingContainerProfile, EncodingVideoProfile}, prelude::*, }; const AUDIO_PROFILE_NAME: &str = "audio-profile"; const AUDIO_PROFILE_DESCRIPTION: &str = "audio-profile-description"; const PRESET: &str = "preset"; const PRESET_NAME: &str = "preset-name"; const PRESENCE: u32 = 5; const ALLOW_DYNAMIC_OUTPUT: bool = false; const ENABLED: bool = false; const VIDEO_PROFILE_NAME: &str = "video-profile"; const VIDEO_PROFILE_DESCRIPTION: &str = "video-profile-description"; const CONTAINER_PROFILE_NAME: &str = "container-profile"; const CONTAINER_PROFILE_DESCRIPTION: &str = "container-profile-description"; // Video profile exclusive attributes const PASS: u32 = 8; const VARIABLE_FRAMERATE: bool = true; #[test] fn test_encoding_audio_profile_builder() { gst::init().unwrap(); let caps = gst::Caps::builder("audio/x-raw").build(); let restriction = gst_audio::AudioCapsBuilder::new() .format(gst_audio::AudioFormat::S32le) .build(); let audio_profile = EncodingAudioProfile::builder(&caps) .name(AUDIO_PROFILE_NAME) .description(AUDIO_PROFILE_DESCRIPTION) .preset(PRESET) .preset_name(PRESET_NAME) .restriction(&restriction) .presence(PRESENCE) .allow_dynamic_output(ALLOW_DYNAMIC_OUTPUT) .enabled(ENABLED) .build(); assert_eq!(audio_profile.name().unwrap(), AUDIO_PROFILE_NAME); assert_eq!( audio_profile.description().unwrap(), AUDIO_PROFILE_DESCRIPTION ); assert_eq!(audio_profile.format(), caps); assert_eq!(audio_profile.preset().unwrap(), PRESET); assert_eq!(audio_profile.preset_name().unwrap(), PRESET_NAME); assert_eq!(audio_profile.restriction().unwrap(), restriction); assert_eq!(audio_profile.presence(), PRESENCE); assert_eq!(audio_profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(audio_profile.is_enabled(), ENABLED); let restriction = gst_audio::AudioCapsBuilder::new() .format(gst_audio::AudioFormat::S32be) .build(); audio_profile.set_restriction(Some(restriction.clone())); assert_eq!(audio_profile.restriction().unwrap(), restriction); } #[test] fn test_encoding_video_profile_builder() { gst::init().unwrap(); let caps = gst::Caps::builder("video/x-raw").build(); let restriction = gst_video::VideoCapsBuilder::new() .format(gst_video::VideoFormat::Rgba) .build(); let video_profile = EncodingVideoProfile::builder(&caps) .name(VIDEO_PROFILE_NAME) .description(VIDEO_PROFILE_DESCRIPTION) .preset(PRESET) .preset_name(PRESET_NAME) .restriction(&restriction) .presence(PRESENCE) .allow_dynamic_output(ALLOW_DYNAMIC_OUTPUT) .enabled(ENABLED) .pass(PASS) .variable_framerate(VARIABLE_FRAMERATE) .build(); assert_eq!(video_profile.name().unwrap(), VIDEO_PROFILE_NAME); assert_eq!( video_profile.description().unwrap(), VIDEO_PROFILE_DESCRIPTION ); assert_eq!(video_profile.format(), caps); assert_eq!(video_profile.preset().unwrap(), PRESET); assert_eq!(video_profile.preset_name().unwrap(), PRESET_NAME); assert_eq!(video_profile.restriction().unwrap(), restriction); assert_eq!(video_profile.presence(), PRESENCE); assert_eq!(video_profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(video_profile.is_enabled(), ENABLED); let video_profile: EncodingVideoProfile = glib::object::Cast::downcast(video_profile).ok().unwrap(); assert_eq!(video_profile.is_variableframerate(), VARIABLE_FRAMERATE); assert_eq!(video_profile.pass(), PASS); let restriction = gst_video::VideoCapsBuilder::new() .format(gst_video::VideoFormat::Nv12) .build(); video_profile.set_restriction(Some(restriction.clone())); assert_eq!(video_profile.restriction().unwrap(), restriction); } #[test] fn test_encoding_container_profile_builder() { gst::init().unwrap(); let container_caps = gst::Caps::builder("container/x-caps").build(); let video_caps = gst::Caps::builder("video/x-raw").build(); let audio_caps = gst::Caps::builder("audio/x-raw").build(); let video_profile = EncodingVideoProfile::builder(&video_caps) .name(VIDEO_PROFILE_NAME) .description(VIDEO_PROFILE_DESCRIPTION) .build(); let audio_profile = EncodingAudioProfile::builder(&audio_caps) .name(AUDIO_PROFILE_NAME) .description(AUDIO_PROFILE_DESCRIPTION) .build(); let profile = EncodingContainerProfile::builder(&container_caps) .name(CONTAINER_PROFILE_NAME) .description(CONTAINER_PROFILE_DESCRIPTION) .preset(PRESET) .preset_name(PRESET_NAME) .presence(PRESENCE) .allow_dynamic_output(ALLOW_DYNAMIC_OUTPUT) .enabled(ENABLED) .add_profile(audio_profile.clone()) .add_profile(video_profile.clone()) .build(); assert_eq!(profile.name().unwrap(), CONTAINER_PROFILE_NAME); assert_eq!( profile.description().unwrap(), CONTAINER_PROFILE_DESCRIPTION ); assert_eq!(profile.format(), container_caps); assert_eq!(profile.preset().unwrap(), PRESET); assert_eq!(profile.preset_name().unwrap(), PRESET_NAME); assert_eq!(profile.presence(), PRESENCE); assert_eq!(profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(profile.is_enabled(), ENABLED); let container_profile: EncodingContainerProfile = glib::object::Cast::downcast(profile).ok().unwrap(); assert!(container_profile.contains_profile(&video_profile)); assert!(container_profile.contains_profile(&audio_profile)); } } gstreamer-pbutils-0.22.0/src/flag_serde.rs000064400000000000000000000053441046102023000166140ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::{ prelude::*, translate::{from_glib, ToGlibPtr}, FlagsClass, }; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::DiscovererSerializeFlags); bitflags_serde_impl!(crate::PbUtilsCapsDescriptionFlags, "v1_20"); #[cfg(test)] mod tests { macro_rules! check_serialize { ($flags:expr, $expected:expr) => { let actual = serde_json::to_string(&$flags).unwrap(); assert_eq!(actual, $expected); }; } macro_rules! check_deserialize { ($ty:ty, $expected:expr, $json:expr) => { let actual: $ty = serde_json::from_str(&$json).unwrap(); assert_eq!(actual, $expected); }; } macro_rules! check_roundtrip { ($ty:ty, $flags:expr) => { let json = serde_json::to_string(&$flags).unwrap(); let deserialized: $ty = serde_json::from_str(&json).unwrap(); assert_eq!(deserialized, $flags); }; } #[test] fn test_serialize() { gst::init().unwrap(); check_serialize!(crate::DiscovererSerializeFlags::all(), "\"caps+tags+misc\""); #[cfg(feature = "v1_22")] check_serialize!( crate::PbUtilsCapsDescriptionFlags::all(), "\"container+audio+video+image+subtitle+tag+generic+metadata\"" ); #[cfg(all(feature = "v1_20", not(feature = "v1_22")))] check_serialize!( crate::PbUtilsCapsDescriptionFlags::all(), "\"container+audio+video+image+subtitle+tag+generic\"" ); } #[test] fn test_deserialize() { gst::init().unwrap(); check_deserialize!( crate::DiscovererSerializeFlags, crate::DiscovererSerializeFlags::all(), "\"caps+tags+misc\"" ); #[cfg(feature = "v1_22")] check_deserialize!( crate::PbUtilsCapsDescriptionFlags, crate::PbUtilsCapsDescriptionFlags::all(), "\"container+audio+video+image+subtitle+tag+generic+metadata\"" ); #[cfg(all(feature = "v1_20", not(feature = "v1_22")))] check_deserialize!( crate::PbUtilsCapsDescriptionFlags, crate::PbUtilsCapsDescriptionFlags::all(), "\"container+audio+video+image+subtitle+tag+generic\"" ); } #[test] fn test_serde_roundtrip() { gst::init().unwrap(); check_roundtrip!( crate::DiscovererSerializeFlags, crate::DiscovererSerializeFlags::all() ); #[cfg(feature = "v1_20")] check_roundtrip!( crate::PbUtilsCapsDescriptionFlags, crate::PbUtilsCapsDescriptionFlags::all() ); } } gstreamer-pbutils-0.22.0/src/functions.rs000064400000000000000000000332061046102023000165270ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use std::{mem, ptr}; pub use crate::auto::functions::*; use glib::translate::*; pub unsafe trait CodecTag<'a>: gst::Tag<'a, TagType = &'a str> {} unsafe impl<'a> CodecTag<'a> for gst::tags::ContainerFormat {} unsafe impl<'a> CodecTag<'a> for gst::tags::AudioCodec {} unsafe impl<'a> CodecTag<'a> for gst::tags::VideoCodec {} unsafe impl<'a> CodecTag<'a> for gst::tags::SubtitleCodec {} unsafe impl<'a> CodecTag<'a> for gst::tags::Codec {} pub fn pb_utils_add_codec_description_to_tag_list_for_tag<'a, T: CodecTag<'a>>( taglist: &mut gst::TagListRef, caps: &gst::CapsRef, ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); let codec_tag = T::TAG_NAME; unsafe { glib::result_from_gboolean!( ffi::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), codec_tag.as_ptr(), caps.as_ptr(), ), "Failed to find codec description", ) } } #[doc(alias = "gst_pb_utils_add_codec_description_to_tag_list")] pub fn pb_utils_add_codec_description_to_tag_list( taglist: &mut gst::TagListRef, caps: &gst::CapsRef, ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); unsafe { glib::result_from_gboolean!( ffi::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), ptr::null_mut(), caps.as_ptr(), ), "Failed to find codec description", ) } } #[doc(alias = "gst_pb_utils_get_encoder_description")] pub fn pb_utils_get_encoder_description(caps: &gst::CapsRef) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_encoder_description(caps.as_ptr())) } } #[doc(alias = "gst_pb_utils_get_decoder_description")] pub fn pb_utils_get_decoder_description(caps: &gst::CapsRef) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_decoder_description(caps.as_ptr())) } } #[doc(alias = "gst_pb_utils_get_codec_description")] pub fn pb_utils_get_codec_description(caps: &gst::CapsRef) -> glib::GString { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_codec_description(caps.as_ptr())) } } #[doc(alias = "gst_codec_utils_aac_caps_set_level_and_profile")] pub fn codec_utils_aac_caps_set_level_and_profile( caps: &mut gst::CapsRef, audio_config: &[u8], ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); assert_eq!(caps.size(), 1); let s = caps.structure(0).unwrap(); assert_eq!(s.name(), "audio/mpeg"); assert!(s .get::("mpegversion") .map_or(false, |v| v == 2 || v == 4)); let len = audio_config.len() as u32; unsafe { let res: bool = from_glib(ffi::gst_codec_utils_aac_caps_set_level_and_profile( caps.as_mut_ptr(), audio_config.to_glib_none().0, len, )); if res { Ok(()) } else { Err(glib::bool_error!("Failed to set AAC level/profile to caps")) } } } #[doc(alias = "gst_codec_utils_h264_caps_set_level_and_profile")] pub fn codec_utils_h264_caps_set_level_and_profile( caps: &mut gst::CapsRef, sps: &[u8], ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); assert_eq!(caps.size(), 1); let s = caps.structure(0).unwrap(); assert_eq!(s.name(), "video/x-h264"); let len = sps.len() as u32; unsafe { let res: bool = from_glib(ffi::gst_codec_utils_h264_caps_set_level_and_profile( caps.as_mut_ptr(), sps.to_glib_none().0, len, )); if res { Ok(()) } else { Err(glib::bool_error!( "Failed to set H264 level/profile to caps" )) } } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_codec_utils_h264_get_profile_flags_level")] pub fn codec_utils_h264_get_profile_flags_level( codec_data: &[u8], ) -> Result<(u8, u8, u8), glib::BoolError> { assert_initialized_main_thread!(); let len = codec_data.len() as u32; unsafe { let mut profile = mem::MaybeUninit::uninit(); let mut flags = mem::MaybeUninit::uninit(); let mut level = mem::MaybeUninit::uninit(); glib::result_from_gboolean!( ffi::gst_codec_utils_h264_get_profile_flags_level( codec_data.to_glib_none().0, len, profile.as_mut_ptr(), flags.as_mut_ptr(), level.as_mut_ptr() ), "Failed to get H264 profile, flags and level" )?; let profile = profile.assume_init(); let flags = flags.assume_init(); let level = level.assume_init(); Ok((profile, flags, level)) } } #[doc(alias = "gst_codec_utils_h265_caps_set_level_tier_and_profile")] pub fn codec_utils_h265_caps_set_level_tier_and_profile( caps: &mut gst::CapsRef, profile_tier_level: &[u8], ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); assert_eq!(caps.size(), 1); let s = caps.structure(0).unwrap(); assert_eq!(s.name(), "video/x-h265"); let len = profile_tier_level.len() as u32; unsafe { let res: bool = from_glib(ffi::gst_codec_utils_h265_caps_set_level_tier_and_profile( caps.as_mut_ptr(), profile_tier_level.to_glib_none().0, len, )); if res { Ok(()) } else { Err(glib::bool_error!( "Failed to set H265 level/tier/profile to caps" )) } } } #[doc(alias = "gst_codec_utils_mpeg4video_caps_set_level_and_profile")] pub fn codec_utils_mpeg4video_caps_set_level_and_profile( caps: &mut gst::CapsRef, vis_obj_seq: &[u8], ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); assert_eq!(caps.size(), 1); let s = caps.structure(0).unwrap(); assert_eq!(s.name(), "video/mpeg"); assert!(s.get::("mpegversion").map_or(false, |v| v == 4)); let len = vis_obj_seq.len() as u32; unsafe { let res: bool = from_glib(ffi::gst_codec_utils_mpeg4video_caps_set_level_and_profile( caps.as_mut_ptr(), vis_obj_seq.to_glib_none().0, len, )); if res { Ok(()) } else { Err(glib::bool_error!( "Failed to set MPEG4 video level/profile to caps" )) } } } #[doc(alias = "gst_codec_utils_opus_create_caps")] pub fn codec_utils_opus_create_caps( rate: u32, channels: u8, channel_mapping_family: u8, stream_count: u8, coupled_count: u8, channel_mapping: &[u8], ) -> Result { assert_initialized_main_thread!(); assert!(channel_mapping.is_empty() || channel_mapping.len() == channels as usize); unsafe { let caps = ffi::gst_codec_utils_opus_create_caps( rate, channels, channel_mapping_family, stream_count, coupled_count, if channel_mapping.is_empty() { ptr::null() } else { channel_mapping.to_glib_none().0 }, ); if caps.is_null() { Err(glib::bool_error!( "Failed to create caps from Opus configuration" )) } else { Ok(from_glib_full(caps)) } } } #[doc(alias = "gst_codec_utils_opus_create_caps_from_header")] pub fn codec_utils_opus_create_caps_from_header( header: &gst::BufferRef, comments: Option<&gst::BufferRef>, ) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::gst_codec_utils_opus_create_caps_from_header( mut_override(header.as_ptr()), comments .map(|b| mut_override(b.as_ptr())) .unwrap_or(ptr::null_mut()), )) .ok_or_else(|| glib::bool_error!("Failed to create caps from Opus headers")) } } #[doc(alias = "gst_codec_utils_opus_create_header")] #[allow(clippy::too_many_arguments)] pub fn codec_utils_opus_create_header( rate: u32, channels: u8, channel_mapping_family: u8, stream_count: u8, coupled_count: u8, channel_mapping: &[u8], pre_skip: u16, output_gain: i16, ) -> Result { assert_initialized_main_thread!(); assert!(channel_mapping.is_empty() || channel_mapping.len() == channels as usize); unsafe { let header = ffi::gst_codec_utils_opus_create_header( rate, channels, channel_mapping_family, stream_count, coupled_count, if channel_mapping.is_empty() { ptr::null() } else { channel_mapping.to_glib_none().0 }, pre_skip, output_gain, ); if header.is_null() { Err(glib::bool_error!( "Failed to create header from Opus configuration" )) } else { Ok(from_glib_full(header)) } } } #[doc(alias = "gst_codec_utils_opus_parse_caps")] pub fn codec_utils_opus_parse_caps( caps: &gst::CapsRef, channel_mapping: Option<&mut [u8; 256]>, ) -> Result<(u32, u8, u8, u8, u8), glib::BoolError> { assert_initialized_main_thread!(); unsafe { let mut rate = mem::MaybeUninit::uninit(); let mut channels = mem::MaybeUninit::uninit(); let mut channel_mapping_family = mem::MaybeUninit::uninit(); let mut stream_count = mem::MaybeUninit::uninit(); let mut coupled_count = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_codec_utils_opus_parse_caps( mut_override(caps.as_ptr()), rate.as_mut_ptr(), channels.as_mut_ptr(), channel_mapping_family.as_mut_ptr(), stream_count.as_mut_ptr(), coupled_count.as_mut_ptr(), if let Some(channel_mapping) = channel_mapping { channel_mapping.as_mut_ptr() as *mut [u8; 256] } else { ptr::null_mut() }, )); if res { Ok(( rate.assume_init(), channels.assume_init(), channel_mapping_family.assume_init(), stream_count.assume_init(), coupled_count.assume_init(), )) } else { Err(glib::bool_error!("Failed to parse Opus caps")) } } } #[doc(alias = "gst_codec_utils_opus_parse_header")] #[allow(clippy::type_complexity)] pub fn codec_utils_opus_parse_header( header: &gst::BufferRef, channel_mapping: Option<&mut [u8; 256]>, ) -> Result<(u32, u8, u8, u8, u8, u16, i16), glib::BoolError> { assert_initialized_main_thread!(); unsafe { let mut rate = mem::MaybeUninit::uninit(); let mut channels = mem::MaybeUninit::uninit(); let mut channel_mapping_family = mem::MaybeUninit::uninit(); let mut stream_count = mem::MaybeUninit::uninit(); let mut coupled_count = mem::MaybeUninit::uninit(); let mut pre_skip = mem::MaybeUninit::uninit(); let mut output_gain = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_codec_utils_opus_parse_header( mut_override(header.as_ptr()), rate.as_mut_ptr(), channels.as_mut_ptr(), channel_mapping_family.as_mut_ptr(), stream_count.as_mut_ptr(), coupled_count.as_mut_ptr(), if let Some(channel_mapping) = channel_mapping { channel_mapping.as_mut_ptr() as *mut [u8; 256] } else { ptr::null_mut() }, pre_skip.as_mut_ptr(), output_gain.as_mut_ptr(), )); if res { Ok(( rate.assume_init(), channels.assume_init(), channel_mapping_family.assume_init(), stream_count.assume_init(), coupled_count.assume_init(), pre_skip.assume_init(), output_gain.assume_init(), )) } else { Err(glib::bool_error!("Failed to parse Opus header")) } } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_codec_utils_caps_get_mime_codec")] pub fn codec_utils_caps_get_mime_codec( caps: &gst::CapsRef, ) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::gst_codec_utils_caps_get_mime_codec(mut_override( caps.as_ptr(), ))) .ok_or_else(|| glib::bool_error!("Unsupported caps")) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_pb_utils_get_caps_description_flags")] pub fn pb_utils_get_caps_description_flags( caps: &gst::CapsRef, ) -> crate::PbUtilsCapsDescriptionFlags { assert_initialized_main_thread!(); unsafe { from_glib(ffi::gst_pb_utils_get_caps_description_flags(caps.as_ptr())) } } #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_pb_utils_get_file_extension_from_caps")] pub fn pb_utils_get_file_extension_from_caps(caps: &gst::CapsRef) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_pb_utils_get_file_extension_from_caps( caps.as_ptr(), )) } } gstreamer-pbutils-0.22.0/src/lib.rs000064400000000000000000000033041046102023000152610ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #![cfg_attr(docsrs, feature(doc_cfg))] #![allow(clippy::missing_safety_doc)] #![doc = include_str!("../README.md")] use std::sync::Once; pub use ffi; pub use glib; pub use gst; static PBUTILS_INIT: Once = Once::new(); macro_rules! assert_initialized_main_thread { () => { if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) { gst::assert_initialized(); } crate::PBUTILS_INIT.call_once(|| { unsafe { ffi::gst_pb_utils_init() }; }); }; } macro_rules! skip_assert_initialized { () => {}; } mod auto; pub use crate::auto::*; #[cfg(feature = "v1_20")] pub mod element_properties; #[cfg(feature = "v1_20")] pub use crate::element_properties::{ElementProperties, ElementPropertiesMapItem}; #[cfg(feature = "serde")] mod flag_serde; mod discoverer; pub use crate::discoverer::*; mod discoverer_audio_info; mod discoverer_container_info; pub mod discoverer_stream_info; mod discoverer_subtitle_info; mod discoverer_video_info; pub mod encoding_profile; pub mod functions; pub use crate::functions::*; pub mod subclass; pub mod audio_visualizer; // Re-export all the traits in a prelude module, so that applications // can always "use gst_pbutils::prelude::*" without getting conflicts pub mod prelude { #[doc(hidden)] pub use gst::prelude::*; pub use crate::{ audio_visualizer::*, auto::traits::*, discoverer_stream_info::DiscovererStreamInfoExtManual, encoding_profile::{ EncodingProfileBuilder, EncodingProfileExtManual, EncodingProfileHasRestrictionGetter, }, functions::CodecTag, }; } gstreamer-pbutils-0.22.0/src/subclass/audio_visualizer.rs000064400000000000000000000144121046102023000217120ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use glib::{prelude::*, translate::*}; use gst::{result_from_gboolean, subclass::prelude::*, LoggableError, CAT_RUST}; use crate::AudioVisualizer; pub struct AudioVisualizerSetupToken<'a>(pub(crate) &'a AudioVisualizer); pub trait AudioVisualizerImpl: AudioVisualizerImplExt + ElementImpl { fn setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { self.parent_setup(token) } fn render( &self, audio_buffer: &gst::BufferRef, video_frame: &mut gst_video::VideoFrameRef<&mut gst::BufferRef>, ) -> Result<(), LoggableError> { self.parent_render(audio_buffer, video_frame) } fn decide_allocation( &self, query: &mut gst::query::Allocation, ) -> Result<(), gst::LoggableError> { self.parent_decide_allocation(query) } } mod sealed { pub trait Sealed {} impl Sealed for T {} } pub trait AudioVisualizerImplExt: sealed::Sealed + ObjectSubclass { fn parent_setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { assert_eq!( self.obj().as_ptr() as *mut ffi::GstAudioVisualizer, token.0.as_ptr() ); unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioVisualizerClass; (*parent_class) .setup .map(|f| { result_from_gboolean!( f(self .obj() .unsafe_cast_ref::() .to_glib_none() .0,), CAT_RUST, "Parent function `setup` failed", ) }) .unwrap_or(Ok(())) } } fn parent_render( &self, audio_buffer: &gst::BufferRef, video_frame: &mut gst_video::VideoFrameRef<&mut gst::BufferRef>, ) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioVisualizerClass; (*parent_class) .render .map(|f| { result_from_gboolean!( f( self.obj() .unsafe_cast_ref::() .to_glib_none() .0, audio_buffer.as_mut_ptr(), video_frame.as_mut_ptr(), ), CAT_RUST, "Parent function `render` failed", ) }) .unwrap_or(Ok(())) } } fn parent_decide_allocation( &self, query: &mut gst::query::Allocation, ) -> Result<(), gst::LoggableError> { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioVisualizerClass; (*parent_class) .decide_allocation .map(|f| { gst::result_from_gboolean!( f( self.obj() .unsafe_cast_ref::() .to_glib_none() .0, query.as_mut_ptr(), ), gst::CAT_RUST, "Parent function `decide_allocation` failed", ) }) .unwrap_or(Ok(())) } } } impl AudioVisualizerImplExt for T {} unsafe impl IsSubclassable for AudioVisualizer { fn class_init(klass: &mut glib::Class) { Self::parent_class_init::(klass); let klass = klass.as_mut(); klass.setup = Some(audio_visualizer_setup::); klass.render = Some(audio_visualizer_render::); klass.decide_allocation = Some(audio_visualizer_decide_allocation::); } } unsafe extern "C" fn audio_visualizer_setup( ptr: *mut ffi::GstAudioVisualizer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); gst::panic_to_error!(imp, false, { let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let token = AudioVisualizerSetupToken(instance); match imp.setup(&token) { Ok(()) => true, Err(err) => { err.log_with_imp(imp); false } } }) .into_glib() } unsafe extern "C" fn audio_visualizer_render( ptr: *mut ffi::GstAudioVisualizer, audio_buffer: *mut gst::ffi::GstBuffer, video_frame: *mut gst_video::ffi::GstVideoFrame, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); let buffer = gst::BufferRef::from_ptr(audio_buffer); gst::panic_to_error!(imp, false, { match imp.render( buffer, &mut gst_video::VideoFrameRef::from_glib_borrow_mut(video_frame), ) { Ok(()) => true, Err(err) => { err.log_with_imp(imp); false } } }) .into_glib() } unsafe extern "C" fn audio_visualizer_decide_allocation( ptr: *mut ffi::GstAudioVisualizer, query: *mut gst::ffi::GstQuery, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); let query = match gst::QueryRef::from_mut_ptr(query).view_mut() { gst::QueryViewMut::Allocation(allocation) => allocation, _ => unreachable!(), }; gst::panic_to_error!(imp, false, { match imp.decide_allocation(query) { Ok(()) => true, Err(err) => { err.log_with_imp(imp); false } } }) .into_glib() } gstreamer-pbutils-0.22.0/src/subclass/mod.rs000064400000000000000000000004051046102023000171100ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. mod audio_visualizer; pub use audio_visualizer::AudioVisualizerSetupToken; pub mod prelude { pub use super::audio_visualizer::{AudioVisualizerImpl, AudioVisualizerImplExt}; } gstreamer-pbutils-0.22.0/tests/check_gir.rs000064400000000000000000000003461046102023000170070ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. #[test] fn check_gir_file() { let res = gir_format_check::check_gir_file("Gir.toml"); println!("{res}"); assert_eq!(res.nb_errors, 0); }