mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
Add gst_base_video_decoder_update_src_caps().
Don't forcibly set "interlaced" field if upstream elements did not have any.
This commit is contained in:
parent
e708f89b67
commit
781a7edd57
2 changed files with 25 additions and 6 deletions
|
@ -1448,18 +1448,26 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
|
|||
if (base_video_decoder->have_src_caps)
|
||||
return;
|
||||
|
||||
caps = GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder));
|
||||
if (caps)
|
||||
caps = gst_caps_copy (caps);
|
||||
else {
|
||||
caps = gst_pad_get_allowed_caps
|
||||
(GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder));
|
||||
if (!caps)
|
||||
goto null_caps;
|
||||
if (gst_caps_is_empty (caps))
|
||||
goto empty_caps;
|
||||
}
|
||||
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, state->width,
|
||||
"height", G_TYPE_INT, state->height,
|
||||
"framerate", GST_TYPE_FRACTION, state->fps_n, state->fps_d,
|
||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, state->par_d,
|
||||
NULL);
|
||||
if (state->have_interlaced)
|
||||
gst_caps_set_simple (caps,
|
||||
"interlaced", G_TYPE_BOOLEAN, state->interlaced, NULL);
|
||||
gst_pad_fixate_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), caps);
|
||||
|
||||
|
@ -1482,6 +1490,16 @@ empty_caps:
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
gst_base_video_decoder_update_src_caps (GstBaseVideoDecoder *
|
||||
base_video_decoder)
|
||||
{
|
||||
g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (base_video_decoder));
|
||||
|
||||
base_video_decoder->have_src_caps = FALSE;
|
||||
gst_base_video_decoder_set_src_caps (base_video_decoder);
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *
|
||||
base_video_decoder, GstVideoFrame * frame)
|
||||
|
|
|
@ -167,6 +167,7 @@ void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder);
|
|||
void gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder *base_video_decoder);
|
||||
|
||||
void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder *base_video_decoder);
|
||||
void gst_base_video_decoder_update_src_caps (GstBaseVideoDecoder *base_video_decoder);
|
||||
|
||||
GstFlowReturn gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *base_video_decoder,
|
||||
GstVideoFrame *frame);
|
||||
|
|
Loading…
Reference in a new issue