Commit 0c35e0c4 authored by Stefan Kost's avatar Stefan Kost
Browse files

matroskamux: use riff lib more

Remove BITMAPINFOHEADER and use the one from riff-lib. Also remove the
WAVEFORMATEX_SIZE define and use a sizeof together with the respective struct.
Besides better code reuse this lessens the ununsed symbols in the docs.
parent e7a5ff40
......@@ -741,8 +741,8 @@ skip_details:
|| !strcmp (mimetype, "video/x-h263")
|| !strcmp (mimetype, "video/x-msmpeg")
|| !strcmp (mimetype, "video/x-wmv")) {
BITMAPINFOHEADER *bih;
gint size = sizeof (BITMAPINFOHEADER);
gst_riff_strf_vids *bih;
gint size = sizeof (gst_riff_strf_vids);
guint32 fourcc = 0;
if (!strcmp (mimetype, "video/x-xvid"))
......@@ -802,22 +802,22 @@ skip_details:
if (!fourcc)
goto refuse_caps;
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_UINT32_LE (&bih->bi_compression, fourcc);
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 *
bih = g_new0 (gst_riff_strf_vids, 1);
GST_WRITE_UINT32_LE (&bih->size, size);
GST_WRITE_UINT32_LE (&bih->width, videocontext->pixel_width);
GST_WRITE_UINT32_LE (&bih->height, videocontext->pixel_height);
GST_WRITE_UINT32_LE (&bih->compression, fourcc);
GST_WRITE_UINT16_LE (&bih->planes, (guint16) 1);
GST_WRITE_UINT16_LE (&bih->bit_cnt, (guint16) 24);
GST_WRITE_UINT32_LE (&bih->image_size, videocontext->pixel_width *
videocontext->pixel_height * 3);
/* process codec private/initialization data, if any */
if (codec_buf) {
size += GST_BUFFER_SIZE (codec_buf);
bih = g_realloc (bih, size);
GST_WRITE_UINT32_LE (&bih->bi_size, size);
memcpy ((guint8 *) bih + sizeof (BITMAPINFOHEADER),
GST_WRITE_UINT32_LE (&bih->size, size);
memcpy ((guint8 *) bih + sizeof (gst_riff_strf_vids),
GST_BUFFER_DATA (codec_buf), GST_BUFFER_SIZE (codec_buf));
}
......@@ -1624,7 +1624,7 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
if (gst_structure_get_int (structure, "depth", &depth))
audiocontext->bitdepth = depth;
codec_priv_size = WAVEFORMATEX_SIZE;
codec_priv_size = sizeof (gst_riff_strf_auds);
if (buf)
codec_priv_size += GST_BUFFER_SIZE (buf);
......@@ -1643,7 +1643,7 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
/* process codec private/initialization data, if any */
if (buf) {
memcpy ((guint8 *) codec_priv + WAVEFORMATEX_SIZE,
memcpy ((guint8 *) codec_priv + sizeof (gst_riff_strf_auds),
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
}
......
......@@ -42,22 +42,6 @@ G_BEGIN_DECLS
#define GST_IS_MATROSKA_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MATROSKA_MUX))
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;
#define WAVEFORMATEX_SIZE 18
typedef enum {
GST_MATROSKA_MUX_STATE_START,
GST_MATROSKA_MUX_STATE_HEADER,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment