[−]Struct gstreamer_video::VideoDecoder
This base class is for video decoders turning encoded data into raw video frames.
The GstVideoDecoder base class and derived subclasses should cooperate as follows:
Configuration
-
Initially, GstVideoDecoder calls
start
when the decoder element is activated, which allows the subclass to perform any global setup. -
GstVideoDecoder calls
set_format
to inform the subclass of caps describing input video data that it is about to receive, including possibly configuration data. While unlikely, it might be called more than once, if changing input parameters require reconfiguration. -
Incoming data buffers are processed as needed, described in Data Processing below.
-
GstVideoDecoder calls
stop
at end of all processing.
Data processing
-
The base class gathers input data, and optionally allows subclass to parse this into subsequently manageable chunks, typically corresponding to and referred to as 'frames'.
-
Each input frame is provided in turn to the subclass'
handle_frame
callback. The ownership of the frame is given to thehandle_frame
callback. -
If codec processing results in decoded data, the subclass should call
VideoDecoder::finish_frame
to have decoded data pushed. downstream. Otherwise, the subclass must callVideoDecoder::drop_frame
, to allow the base class to do timestamp and offset tracking, and possibly to requeue the frame for a later attempt in the case of reverse playback.
Shutdown phase
- The GstVideoDecoder class calls
stop
to inform the subclass that data parsing will be stopped.
Additional Notes
-
Seeking/Flushing
-
When the pipeline is seeked or otherwise flushed, the subclass is informed via a call to its
reset
callback, with the hard parameter set to true. This indicates the subclass should drop any internal data queues and timestamps and prepare for a fresh set of buffers to arrive for parsing and decoding. -
End Of Stream
-
At end-of-stream, the subclass
parse
function may be called some final times with the at_eos parameter set to true, indicating that the element should not expect any more data to be arriving, and it should parse and remaining frames and callVideoDecoder::have_frame
if possible.
The subclass is responsible for providing pad template caps for
source and sink pads. The pads need to be named "sink" and "src". It also
needs to provide information about the ouptput caps, when they are known.
This may be when the base class calls the subclass' set_format
function,
though it might be during decoding, before calling
VideoDecoder::finish_frame
. This is done via
VideoDecoder::set_output_state
The subclass is also responsible for providing (presentation) timestamps (likely based on corresponding input ones). If that is not applicable or possible, the base class provides limited framerate based interpolation.
Similarly, the base class provides some limited (legacy) seeking support
if specifically requested by the subclass, as full-fledged support
should rather be left to upstream demuxer, parser or alike. This simple
approach caters for seeking and duration reporting using estimated input
bitrates. To enable it, a subclass should call
VideoDecoderExt::set_estimate_rate
to enable handling of incoming
byte-streams.
The base class provides some support for reverse playback, in particular in case incoming data is not packetized or upstream does not provide fragments on keyframe boundaries. However, the subclass should then be prepared for the parsing and frame processing stage to occur separately (in normal forward processing, the latter immediately follows the former), The subclass also needs to ensure the parsing stage properly marks keyframes, unless it knows the upstream elements will do so properly for incoming data.
The bare minimum that a functional subclass needs to implement is:
-
Provide pad templates
-
Inform the base class of output caps via
VideoDecoder::set_output_state
-
Parse input data, if it is not considered packetized from upstream Data will be provided to
parse
which should invokeVideoDecoderExt::add_to_frame
andVideoDecoder::have_frame
to separate the data belonging to each video frame. -
Accept data in
handle_frame
and provide decoded results toVideoDecoder::finish_frame
, or callVideoDecoder::drop_frame
.
Implements
VideoDecoderExt
, gst::ElementExt
, gst::ObjectExt
, glib::object::ObjectExt
Trait Implementations
impl Clone for VideoDecoder
[+]
impl Debug for VideoDecoder
[+]
impl Eq for VideoDecoder
impl Hash for VideoDecoder
[+]
impl IsA<Element> for VideoDecoder
impl IsA<Object> for VideoDecoder
impl Ord for VideoDecoder
[+]
impl<T: ObjectType> PartialEq<T> for VideoDecoder
[+]
impl<T: ObjectType> PartialOrd<T> for VideoDecoder
[+]
impl Send for VideoDecoder
[src]
impl StaticType for VideoDecoder
[+]
impl Sync for VideoDecoder
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<Super, Sub> CanDowncast<Sub> for Super where
Sub: IsA<Super>,
Super: IsA<Super>,
[src]
Sub: IsA<Super>,
Super: IsA<Super>,
impl<T> Cast for T where
T: ObjectType,
[src][+]
T: ObjectType,
impl<O> ElementExt for O where
O: IsA<Element>,
[src][+]
O: IsA<Element>,
impl<O> ElementExtManual for O where
O: IsA<Element>,
[src][+]
O: IsA<Element>,
impl<T> From<T> for T
[src][+]
impl<O> GObjectExtManualGst for O where
O: IsA<Object>,
[src][+]
O: IsA<Object>,
impl<O> GstObjectExt for O where
O: IsA<Object>,
[src][+]
O: IsA<Object>,
impl<O> GstObjectExtManual for O where
O: IsA<Object>,
[src][+]
O: IsA<Object>,
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ObjectExt for T where
T: ObjectType,
[src][+]
T: ObjectType,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src][+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src][+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src][+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src][+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src][+]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToSendValue for T where
T: ToValue + SetValue + Send + ?Sized,
[src][+]
T: ToValue + SetValue + Send + ?Sized,
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src][+]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,