summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--gst/matroska/matroska-demux.c14
-rw-r--r--gst/matroska/matroska-mux.c84
3 files changed, 76 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 6fbae5ac..97e71939 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
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>
* gst/matroska/matroska-mux.c:
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 8f6a1463..99ae00a7 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -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;
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 4750172c..7ce6ab5d 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -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;
+ }
}
- 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);
+ /* 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);
+ context->codec_priv_size = size;
return TRUE;
} else if (!strcmp (mimetype, "video/x-h264")) {