From 1723d916dd9dae9b3df8a32d155e1f3529b11f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 18 Apr 2007 09:48:25 +0000 Subject: [PATCH] gst/wavenc/gstwavenc.*: everything else results in a invalid block align and invalid files. Original commit message from CVS: * gst/wavenc/gstwavenc.c: (gst_wavenc_create_header_buf), (gst_wavenc_sink_setcaps), (gst_wavenc_change_state): * gst/wavenc/gstwavenc.h: Wav apparently only supports width==GST_ROUND_UP(depth), everything else results in a invalid block align and invalid files. --- ChangeLog | 8 ++++++++ gst/wavenc/gstwavenc.c | 31 +++++++++++++++++++++++-------- gst/wavenc/gstwavenc.h | 1 - 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68a20be5a1..0b84c215cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-04-18 Sebastian Dröge + + * gst/wavenc/gstwavenc.c: (gst_wavenc_create_header_buf), + (gst_wavenc_sink_setcaps), (gst_wavenc_change_state): + * gst/wavenc/gstwavenc.h: + Wav apparently only supports width==GST_ROUND_UP(depth), everything + else results in a invalid block align and invalid files. + 2007-04-17 Tim-Philipp Müller Patch by: Snaik diff --git a/gst/wavenc/gstwavenc.c b/gst/wavenc/gstwavenc.c index d72664ab33..46be5ac125 100644 --- a/gst/wavenc/gstwavenc.c +++ b/gst/wavenc/gstwavenc.c @@ -78,8 +78,24 @@ GST_ELEMENT_DETAILS ("WAV audio muxer", "rate = (int) [ 1, MAX ], " \ "channels = (int) [ 1, 2 ], " \ "endianness = (int) LITTLE_ENDIAN, " \ - "width = (int) { 16, 24, 32 }, " \ - "depth = (int) [ 1, 32 ], " \ + "width = (int) 32, " \ + "depth = (int) [ 25, 32 ], " \ + "signed = (boolean) true" \ + "; " \ + "audio/x-raw-int, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, 2 ], " \ + "endianness = (int) LITTLE_ENDIAN, " \ + "width = (int) 24, " \ + "depth = (int) [ 17, 24 ], " \ + "signed = (boolean) true" \ + "; " \ + "audio/x-raw-int, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, 2 ], " \ + "endianness = (int) LITTLE_ENDIAN, " \ + "width = (int) 16, " \ + "depth = (int) [ 9, 16 ], " \ "signed = (boolean) true" \ "; " \ "audio/x-raw-int, " \ @@ -179,9 +195,10 @@ gst_wavenc_create_header_buf (GstWavEnc * wavenc, guint audio_data_size) wave.format.len = 16; wave.common.wFormatTag = WAVE_FORMAT_PCM; - wave.common.wBlockAlign = (wavenc->width / 8) * wave.common.wChannels; - wave.common.dwAvgBytesPerSec = wave.common.wBlockAlign * - wave.common.dwSamplesPerSec; + wave.common.wBlockAlign = + (GST_ROUND_UP_8 (wavenc->depth) / 8) * wave.common.wChannels; + wave.common.dwAvgBytesPerSec = + wave.common.wBlockAlign * wave.common.dwSamplesPerSec; memcpy (wave.data.id, "data", 4); wave.data.len = audio_data_size; @@ -257,12 +274,11 @@ gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps) } wavenc->channels = chans; - wavenc->width = width; wavenc->depth = depth; wavenc->rate = rate; GST_LOG_OBJECT (wavenc, "accepted caps: chans=%u width=%u depth=%u rate=%u", - wavenc->channels, wavenc->width, wavenc->depth, wavenc->rate); + wavenc->channels, width, wavenc->depth, wavenc->rate); gst_object_unref (wavenc); return TRUE; @@ -636,7 +652,6 @@ gst_wavenc_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: wavenc->channels = 0; - wavenc->width = 0; wavenc->depth = 0; wavenc->rate = 0; wavenc->length = 0; diff --git a/gst/wavenc/gstwavenc.h b/gst/wavenc/gstwavenc.h index 8a34ab5730..3970dfd2e5 100644 --- a/gst/wavenc/gstwavenc.h +++ b/gst/wavenc/gstwavenc.h @@ -48,7 +48,6 @@ struct _GstWavEnc { /* useful audio data */ guint depth; - guint width; guint rate; guint channels; guint32 length;