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
This commit is contained in:
Arwed v. Merkatz 2004-08-27 17:01:12 +00:00
parent 7e9f0b9582
commit ece91164c8
3 changed files with 50 additions and 4 deletions

View file

@ -2,6 +2,10 @@
* gst/matroska/ebml-read.c: (gst_ebml_peed_id), (gst_ebml_read_element_id),
handle EOS correctly
* gst/matroska/matroska-mux.c: (gst_matroska_mux_video_pad_link):
* gst/matroska/matroska-mux.h:
added BITMAPINFOHEADER structure, mux video/x-divx and video/x-xvid in
VFW compatibility mode
2004-08-27 Thomas Vander Stichele <thomas at apestaart dot org>

View file

@ -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")) {

View file

@ -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,