mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
videodecoder: Add API for marking output frames as corrupted
This can be used by subclasses to mark output frames as known to be corrupted, for example if reference frames were missing. ffmpeg's decoders can signal this. In addition this flag is propagated downstream if the input frame had it set. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
This commit is contained in:
parent
74889206eb
commit
06bcf95ebf
2 changed files with 24 additions and 1 deletions
|
@ -3171,6 +3171,14 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder,
|
|||
GST_BUFFER_FLAG_SET (output_buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
|
||||
if (GST_VIDEO_CODEC_FRAME_FLAG_IS_SET (frame,
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED)) {
|
||||
GST_DEBUG_OBJECT (decoder,
|
||||
"marking frame %" GST_TIME_FORMAT " as corrupted",
|
||||
GST_TIME_ARGS (frame->pts));
|
||||
GST_BUFFER_FLAG_SET (output_buffer, GST_BUFFER_FLAG_CORRUPTED);
|
||||
}
|
||||
|
||||
if (decoder_class->transform_meta) {
|
||||
if (G_LIKELY (frame->input_buffer)) {
|
||||
CopyMetaData data;
|
||||
|
@ -3487,6 +3495,12 @@ gst_video_decoder_have_frame (GstVideoDecoder * decoder)
|
|||
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (priv->current_frame);
|
||||
}
|
||||
|
||||
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_CORRUPTED)) {
|
||||
GST_LOG_OBJECT (decoder, "Marking as corrupted");
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_SET (priv->current_frame,
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED);
|
||||
}
|
||||
|
||||
/* In reverse playback, just capture and queue frames for later processing */
|
||||
if (decoder->input_segment.rate < 0.0) {
|
||||
priv->parse_gather =
|
||||
|
|
|
@ -82,6 +82,7 @@ struct _GstVideoCodecState
|
|||
* @GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT: is the frame a synchronization point (keyframe)
|
||||
* @GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME: should the output frame be made a keyframe
|
||||
* @GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS: should the encoder output stream headers
|
||||
* @GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED: the buffer data is corrupted (Since: 1.20)
|
||||
*
|
||||
* Flags for #GstVideoCodecFrame
|
||||
*/
|
||||
|
@ -90,7 +91,15 @@ typedef enum
|
|||
GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY = (1<<0),
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT = (1<<1),
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME = (1<<2),
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS = (1<<3)
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS = (1<<3),
|
||||
/**
|
||||
* GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED:
|
||||
*
|
||||
* The buffer data is corrupted.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_CORRUPTED = (1<<4),
|
||||
} GstVideoCodecFrameFlags;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue