mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
gst/matroska/matroska-demux.c: Handle codec_data for VfW compatibility codec IDs (#339451)
Original commit message from CVS: Patch by: Mark Nauwelaerts <manauw at skynet dot be> * gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps): Handle codec_data for VfW compatibility codec IDs (#339451) * gst/matroska/matroska-mux.c: (gst_matroska_mux_video_pad_setcaps): Same here, handle codec_data and add additional caps we can handle now to the pad template (huffyuv, dv and h263 video) (#339451)
This commit is contained in:
parent
2e1a9a0472
commit
a0b8e8176a
3 changed files with 77 additions and 35 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-04-25 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Patch by: Mark Nauwelaerts <manauw at skynet dot be>
|
||||
|
||||
* gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps):
|
||||
Handle codec_data for VfW compatibility codec IDs (#339451)
|
||||
|
||||
* gst/matroska/matroska-mux.c:
|
||||
(gst_matroska_mux_video_pad_setcaps):
|
||||
Same here, handle codec_data and add additional caps we can handle
|
||||
now to the pad template (huffyuv, dv and h263 video) (#339451)
|
||||
|
||||
2006-04-25 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Patch by: Josef Zlomek <josef dot zlomek at itonis dot tv>
|
||||
|
|
|
@ -2976,6 +2976,8 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
|||
gst_riff_strf_vids *vids = NULL;
|
||||
|
||||
if (data) {
|
||||
GstBuffer *buf = NULL;
|
||||
|
||||
vids = (gst_riff_strf_vids *) data;
|
||||
|
||||
/* assure size is big enough */
|
||||
|
@ -3002,8 +3004,18 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
|||
vids->num_colors = GUINT32_FROM_LE (vids->num_colors);
|
||||
vids->imp_colors = GUINT32_FROM_LE (vids->imp_colors);
|
||||
|
||||
if (size > sizeof (gst_riff_strf_vids)) { /* some extra_data */
|
||||
buf = gst_buffer_new_and_alloc (size - sizeof (gst_riff_strf_vids));
|
||||
memcpy (GST_BUFFER_DATA (buf),
|
||||
(guint8 *) vids + sizeof (gst_riff_strf_vids),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
}
|
||||
|
||||
caps = gst_riff_create_video_caps (vids->compression, NULL, vids,
|
||||
NULL, NULL, codec_name);
|
||||
buf, NULL, codec_name);
|
||||
|
||||
if (buf)
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
|
||||
guint32 fourcc = 0;
|
||||
|
|
|
@ -72,6 +72,12 @@ static GstStaticPadTemplate videosink_templ =
|
|||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-xvid, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-huffyuv, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-dv, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-h263, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-msmpeg, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"image/jpeg, "
|
||||
|
@ -484,12 +490,17 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
|
|||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MJPEG);
|
||||
|
||||
return TRUE;
|
||||
} else if (!strcmp (mimetype, "video/x-divx")) {
|
||||
gint divxversion;
|
||||
} else if (!strcmp (mimetype, "video/x-xvid") /* MS/VfW compatibility cases */
|
||||
||!strcmp (mimetype, "video/x-huffyuv")
|
||||
|| !strcmp (mimetype, "video/x-divx")
|
||||
|| !strcmp (mimetype, "video/x-dv")
|
||||
|| !strcmp (mimetype, "video/x-h263")) {
|
||||
BITMAPINFOHEADER *bih;
|
||||
const GValue *codec_data;
|
||||
gint size = sizeof (BITMAPINFOHEADER);
|
||||
|
||||
bih = (BITMAPINFOHEADER *) g_malloc0 (sizeof (BITMAPINFOHEADER));
|
||||
GST_WRITE_UINT32_LE (&bih->bi_size, sizeof (BITMAPINFOHEADER));
|
||||
bih = g_new0 (BITMAPINFOHEADER, 1);
|
||||
GST_WRITE_UINT32_LE (&bih->bi_size, size);
|
||||
GST_WRITE_UINT32_LE (&bih->bi_width, videocontext->pixel_width);
|
||||
GST_WRITE_UINT32_LE (&bih->bi_height, videocontext->pixel_height);
|
||||
GST_WRITE_UINT16_LE (&bih->bi_planes, (guint16) 1);
|
||||
|
@ -497,40 +508,47 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
|
|||
GST_WRITE_UINT32_LE (&bih->bi_size_image, videocontext->pixel_width *
|
||||
videocontext->pixel_height * 3);
|
||||
|
||||
gst_structure_get_int (structure, "divxversion", &divxversion);
|
||||
switch (divxversion) {
|
||||
case 3:
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DIV3"));
|
||||
break;
|
||||
case 4:
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DIVX"));
|
||||
break;
|
||||
case 5:
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DX50"));
|
||||
break;
|
||||
if (!strcmp (mimetype, "video/x-xvid"))
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("XVID"));
|
||||
else if (!strcmp (mimetype, "video/x-huffyuv"))
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("HFYU"));
|
||||
else if (!strcmp (mimetype, "video/x-dv"))
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DVSD"));
|
||||
else if (!strcmp (mimetype, "video/x-h263"))
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("H263"));
|
||||
else if (!strcmp (mimetype, "video/x-divx")) {
|
||||
gint divxversion;
|
||||
|
||||
gst_structure_get_int (structure, "divxversion", &divxversion);
|
||||
switch (divxversion) {
|
||||
case 3:
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DIV3"));
|
||||
break;
|
||||
case 4:
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DIVX"));
|
||||
break;
|
||||
case 5:
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DX50"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* process codec private/initialization data, if any */
|
||||
codec_data = gst_structure_get_value (structure, "codec_data");
|
||||
if (codec_data) {
|
||||
GstBuffer *codec_data_buf;
|
||||
|
||||
codec_data_buf = g_value_peek_pointer (codec_data);
|
||||
size += GST_BUFFER_SIZE (codec_data_buf);
|
||||
bih = g_realloc (bih, size);
|
||||
GST_WRITE_UINT32_LE (&bih->bi_size, size);
|
||||
memcpy ((guint8 *) bih + sizeof (BITMAPINFOHEADER),
|
||||
GST_BUFFER_DATA (codec_data_buf), GST_BUFFER_SIZE (codec_data_buf));
|
||||
}
|
||||
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC);
|
||||
context->codec_priv = (gpointer) bih;
|
||||
context->codec_priv_size = sizeof (BITMAPINFOHEADER);
|
||||
|
||||
return TRUE;
|
||||
} else if (!strcmp (mimetype, "video/x-xvid")) {
|
||||
BITMAPINFOHEADER *bih;
|
||||
|
||||
bih = (BITMAPINFOHEADER *) g_malloc0 (sizeof (BITMAPINFOHEADER));
|
||||
GST_WRITE_UINT32_LE (&bih->bi_size, sizeof (BITMAPINFOHEADER));
|
||||
GST_WRITE_UINT32_LE (&bih->bi_width, videocontext->pixel_width);
|
||||
GST_WRITE_UINT32_LE (&bih->bi_height, videocontext->pixel_height);
|
||||
GST_WRITE_UINT16_LE (&bih->bi_planes, (guint16) 1);
|
||||
GST_WRITE_UINT16_LE (&bih->bi_bit_count, (guint16) 24);
|
||||
GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("XVID"));
|
||||
GST_WRITE_UINT32_LE (&bih->bi_size_image, videocontext->pixel_width *
|
||||
videocontext->pixel_height * 3);
|
||||
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC);
|
||||
context->codec_priv = (gpointer) bih;
|
||||
context->codec_priv_size = sizeof (BITMAPINFOHEADER);
|
||||
context->codec_priv_size = size;
|
||||
|
||||
return TRUE;
|
||||
} else if (!strcmp (mimetype, "video/x-h264")) {
|
||||
|
|
Loading…
Reference in a new issue