mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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.
This commit is contained in:
parent
e7a5ff40bd
commit
0c35e0c4db
2 changed files with 14 additions and 30 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue