mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
v4l2codecs: mpeg2: Check that the decoder output formats
This is to avoid exposing a decoder for which we don't support any output format. This happens on platform using vendor formats or not yet supported tiles formats. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1439>
This commit is contained in:
parent
91b7a9497b
commit
c4216a693c
3 changed files with 21 additions and 4 deletions
|
@ -1048,12 +1048,28 @@ gst_v4l2_codec_mpeg2_dec_subclass_init (GstV4l2CodecMpeg2DecClass * klass,
|
|||
}
|
||||
|
||||
void
|
||||
gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin,
|
||||
gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin, GstV4l2Decoder * decoder,
|
||||
GstV4l2CodecDevice * device, guint rank)
|
||||
{
|
||||
GstCaps *src_caps;
|
||||
|
||||
if (!gst_v4l2_decoder_set_sink_fmt (decoder, V4L2_PIX_FMT_MPEG2_SLICE,
|
||||
320, 240, 8))
|
||||
return;
|
||||
src_caps = gst_v4l2_decoder_enum_src_formats (decoder);
|
||||
|
||||
if (gst_caps_is_empty (src_caps)) {
|
||||
GST_WARNING ("Not registering MPEG2 decoder since it produces no "
|
||||
"supported format");
|
||||
goto done;
|
||||
}
|
||||
|
||||
gst_v4l2_decoder_register (plugin, GST_TYPE_V4L2_CODEC_MPEG2_DEC,
|
||||
(GClassInitFunc) gst_v4l2_codec_mpeg2_dec_subclass_init,
|
||||
gst_mini_object_ref (GST_MINI_OBJECT (device)),
|
||||
(GInstanceInitFunc) gst_v4l2_codec_mpeg2_dec_subinit,
|
||||
"v4l2sl%smpeg2dec", device, rank, NULL);
|
||||
|
||||
done:
|
||||
gst_caps_unref (src_caps);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,9 @@ struct _GstV4l2CodecMpeg2DecClass
|
|||
|
||||
GType gst_v4l2_codec_mpeg2_dec_get_type (void);
|
||||
void gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin,
|
||||
GstV4l2CodecDevice * device,
|
||||
guint rank);
|
||||
GstV4l2Decoder * decoder,
|
||||
GstV4l2CodecDevice * device,
|
||||
guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ register_video_decoder (GstPlugin * plugin, GstV4l2CodecDevice * device)
|
|||
case V4L2_PIX_FMT_MPEG2_SLICE:
|
||||
GST_INFO_OBJECT (decoder, "Registering %s as Mpeg2 Decoder",
|
||||
device->name);
|
||||
gst_v4l2_codec_mpeg2_dec_register (plugin, device,
|
||||
gst_v4l2_codec_mpeg2_dec_register (plugin, decoder, device,
|
||||
GST_RANK_PRIMARY + 1);
|
||||
break;
|
||||
case V4L2_PIX_FMT_VP9_FRAME:
|
||||
|
|
Loading…
Reference in a new issue