summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorArwed v. Merkatz <v.merkatz@gmx.net>2004-08-27 17:01:12 +0000
committerArwed v. Merkatz <v.merkatz@gmx.net>2004-08-27 17:01:12 +0000
commitece91164c88e5af4f1a1d99bb17d8f7295606b41 (patch)
tree77c1108721c9cd2617b846bf177cceaf8eec1800 /gst
parent7e9f0b9582399a1e6194cf6d0ba2091674e61d01 (diff)
Mux video/x-divx and video/x-xvid in VFW compatibility mode so it actually works
Original commit message from CVS: Mux video/x-divx and video/x-xvid in VFW compatibility mode so it actually works
Diffstat (limited to 'gst')
-rw-r--r--gst/matroska/matroska-mux.c36
-rw-r--r--gst/matroska/matroska-mux.h14
2 files changed, 46 insertions, 4 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 4ddc4aea..fc39cb67 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -363,23 +363,51 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps)
return GST_PAD_LINK_OK;
} else if (!strcmp (mimetype, "video/x-divx")) {
gint divxversion;
+ 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_size_image, videocontext->pixel_width *
+ videocontext->pixel_height * 3);
gst_structure_get_int (structure, "divxversion", &divxversion);
switch (divxversion) {
case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
+ GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DIV3"));
break;
case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
+ GST_WRITE_UINT32_LE (&bih->bi_compression, GST_STR_FOURCC ("DIVX"));
break;
case 5:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ 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 GST_PAD_LINK_OK;
} else if (!strcmp (mimetype, "video/x-xvid")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ 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);
return GST_PAD_LINK_OK;
} else if (!strcmp (mimetype, "video/mpeg")) {
diff --git a/gst/matroska/matroska-mux.h b/gst/matroska/matroska-mux.h
index 78f31faf..f923ce86 100644
--- a/gst/matroska/matroska-mux.h
+++ b/gst/matroska/matroska-mux.h
@@ -42,6 +42,20 @@ G_BEGIN_DECLS
#define GST_MATROSKA_MUX_MAX_STREAMS 64
+typedef struct _BITMAPINFOHEADER {
+ guint32 bi_size;
+ guint32 bi_width;
+ guint32 bi_height;
+ guint16 bi_planes;
+ guint16 bi_bit_count;
+ guint32 bi_compression;
+ guint32 bi_size_image;
+ guint32 bi_x_pels_per_meter;
+ guint32 bi_y_pels_per_meter;
+ guint32 bi_clr_used;
+ guint32 bi_clr_important;
+} BITMAPINFOHEADER;
+
typedef enum {
GST_MATROSKA_MUX_STATE_START,
GST_MATROSKA_MUX_STATE_HEADER,