mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
v4l2object: Add MPEG1/2 support
https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
parent
0c8ec43a12
commit
fdd7bcc78c
1 changed files with 35 additions and 7 deletions
|
@ -61,6 +61,15 @@
|
|||
#ifndef V4L2_PIX_FMT_NV21M
|
||||
#define V4L2_PIX_FMT_NV21M GST_MAKE_FOURCC ('N', 'M', '2', '1')
|
||||
#endif
|
||||
#ifndef V4L2_PIX_FMT_MPEG1
|
||||
#define V4L2_PIX_FMT_MPEG1 GST_MAKE_FOURCC ('M', 'P', 'G', '1')
|
||||
#endif
|
||||
#ifndef V4L2_PIX_FMT_MPEG2
|
||||
#define V4L2_PIX_FMT_MPEG2 GST_MAKE_FOURCC ('M', 'P', 'G', '2')
|
||||
#endif
|
||||
#ifndef V4L2_PIX_FMT_MPEG4
|
||||
#define V4L2_PIX_FMT_MPEG4 GST_MAKE_FOURCC ('M', 'P', 'G', '4')
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (v4l2_debug);
|
||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
|
||||
|
@ -1020,9 +1029,9 @@ static const GstV4L2FormatDesc gst_v4l2_formats[] = {
|
|||
#endif
|
||||
{V4L2_PIX_FMT_DV, TRUE, GST_V4L2_TRANSPORT},
|
||||
{V4L2_PIX_FMT_MPEG, FALSE, GST_V4L2_TRANSPORT},
|
||||
#ifdef V4L2_PIX_FMT_MPEG4
|
||||
{V4L2_PIX_FMT_MPEG1, TRUE, GST_V4L2_CODEC},
|
||||
{V4L2_PIX_FMT_MPEG2, TRUE, GST_V4L2_CODEC},
|
||||
{V4L2_PIX_FMT_MPEG4, TRUE, GST_V4L2_CODEC},
|
||||
#endif
|
||||
|
||||
#ifdef V4L2_PIX_FMT_H263
|
||||
{V4L2_PIX_FMT_H263, TRUE, GST_V4L2_CODEC},
|
||||
|
@ -1454,13 +1463,19 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc)
|
|||
case V4L2_PIX_FMT_HI240: /* 8 8-bit color */
|
||||
/* FIXME: get correct fourccs here */
|
||||
break;
|
||||
#ifdef V4L2_PIX_FMT_MPEG4
|
||||
case V4L2_PIX_FMT_MPEG1:
|
||||
structure = gst_structure_new ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 2, NULL);
|
||||
break;
|
||||
case V4L2_PIX_FMT_MPEG2:
|
||||
structure = gst_structure_new ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 2, NULL);
|
||||
break;
|
||||
case V4L2_PIX_FMT_MPEG4:
|
||||
structure = gst_structure_new ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 4, "systemstream",
|
||||
G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
break;
|
||||
#endif
|
||||
#ifdef V4L2_PIX_FMT_H263
|
||||
case V4L2_PIX_FMT_H263:
|
||||
structure = gst_structure_new ("video/x-h263",
|
||||
|
@ -1741,10 +1756,23 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
|
|||
fourcc = V4L2_PIX_FMT_DV;
|
||||
} else if (g_str_equal (mimetype, "image/jpeg")) {
|
||||
fourcc = V4L2_PIX_FMT_JPEG;
|
||||
#ifdef V4L2_PIX_FMT_MPEG4
|
||||
} else if (g_str_equal (mimetype, "video/mpeg")) {
|
||||
fourcc = V4L2_PIX_FMT_MPEG4;
|
||||
#endif
|
||||
gint version;
|
||||
if (gst_structure_get_int (structure, "mpegversion", &version)) {
|
||||
switch (version) {
|
||||
case 1:
|
||||
fourcc = V4L2_PIX_FMT_MPEG1;
|
||||
break;
|
||||
case 2:
|
||||
fourcc = V4L2_PIX_FMT_MPEG2;
|
||||
break;
|
||||
case 4:
|
||||
fourcc = V4L2_PIX_FMT_MPEG4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef V4L2_PIX_FMT_H263
|
||||
} else if (g_str_equal (mimetype, "video/x-h263")) {
|
||||
fourcc = V4L2_PIX_FMT_H263;
|
||||
|
|
Loading…
Reference in a new issue