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
@ -1048,12 +1048,28 @@ gst_v4l2_codec_mpeg2_dec_subclass_init (GstV4l2CodecMpeg2DecClass * klass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin,
|
gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin, GstV4l2Decoder * decoder,
|
||||||
GstV4l2CodecDevice * device, guint rank)
|
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,
|
gst_v4l2_decoder_register (plugin, GST_TYPE_V4L2_CODEC_MPEG2_DEC,
|
||||||
(GClassInitFunc) gst_v4l2_codec_mpeg2_dec_subclass_init,
|
(GClassInitFunc) gst_v4l2_codec_mpeg2_dec_subclass_init,
|
||||||
gst_mini_object_ref (GST_MINI_OBJECT (device)),
|
gst_mini_object_ref (GST_MINI_OBJECT (device)),
|
||||||
(GInstanceInitFunc) gst_v4l2_codec_mpeg2_dec_subinit,
|
(GInstanceInitFunc) gst_v4l2_codec_mpeg2_dec_subinit,
|
||||||
"v4l2sl%smpeg2dec", device, rank, NULL);
|
"v4l2sl%smpeg2dec", device, rank, NULL);
|
||||||
|
|
||||||
|
done:
|
||||||
|
gst_caps_unref (src_caps);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ struct _GstV4l2CodecMpeg2DecClass
|
|||||||
|
|
||||||
GType gst_v4l2_codec_mpeg2_dec_get_type (void);
|
GType gst_v4l2_codec_mpeg2_dec_get_type (void);
|
||||||
void gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin,
|
void gst_v4l2_codec_mpeg2_dec_register (GstPlugin * plugin,
|
||||||
|
GstV4l2Decoder * decoder,
|
||||||
GstV4l2CodecDevice * device,
|
GstV4l2CodecDevice * device,
|
||||||
guint rank);
|
guint rank);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ register_video_decoder (GstPlugin * plugin, GstV4l2CodecDevice * device)
|
|||||||
case V4L2_PIX_FMT_MPEG2_SLICE:
|
case V4L2_PIX_FMT_MPEG2_SLICE:
|
||||||
GST_INFO_OBJECT (decoder, "Registering %s as Mpeg2 Decoder",
|
GST_INFO_OBJECT (decoder, "Registering %s as Mpeg2 Decoder",
|
||||||
device->name);
|
device->name);
|
||||||
gst_v4l2_codec_mpeg2_dec_register (plugin, device,
|
gst_v4l2_codec_mpeg2_dec_register (plugin, decoder, device,
|
||||||
GST_RANK_PRIMARY + 1);
|
GST_RANK_PRIMARY + 1);
|
||||||
break;
|
break;
|
||||||
case V4L2_PIX_FMT_VP9_FRAME:
|
case V4L2_PIX_FMT_VP9_FRAME:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user