mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
gst/wavenc/gstwavenc.*: Add support for float/double as input and remove the (nowadays) useless parsing of the depth ...
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: Add support for float/double as input and remove the (nowadays) useless parsing of the depth as we require width==depth.
This commit is contained in:
parent
d1dc70efd8
commit
bab5d042b2
4 changed files with 29 additions and 12 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-10-30 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* gst/wavenc/gstwavenc.c: (gst_wavenc_create_header_buf),
|
||||||
|
(gst_wavenc_sink_setcaps), (gst_wavenc_change_state):
|
||||||
|
* gst/wavenc/gstwavenc.h:
|
||||||
|
Add support for float/double as input and remove the (nowadays)
|
||||||
|
useless parsing of the depth as we require width==depth.
|
||||||
|
|
||||||
2008-10-30 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-10-30 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_setcaps):
|
* gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_setcaps):
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 2802bb17517a6cfbbb1be6da61ec19151be0750b
|
Subproject commit edfb4b44ea433b0b83b8a2f27a6e0bcbccdc3f2f
|
|
@ -32,6 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (wavenc_debug);
|
||||||
#define GST_CAT_DEFAULT wavenc_debug
|
#define GST_CAT_DEFAULT wavenc_debug
|
||||||
|
|
||||||
#define WAVE_FORMAT_PCM 0x0001
|
#define WAVE_FORMAT_PCM 0x0001
|
||||||
|
#define WAVE_FORMAT_FLOAT 0x0003
|
||||||
|
|
||||||
struct riff_struct
|
struct riff_struct
|
||||||
{
|
{
|
||||||
|
@ -103,7 +104,13 @@ GST_ELEMENT_DETAILS ("WAV audio muxer",
|
||||||
"channels = (int) [ 1, 2 ], " \
|
"channels = (int) [ 1, 2 ], " \
|
||||||
"width = (int) 8, " \
|
"width = (int) 8, " \
|
||||||
"depth = (int) 8, " \
|
"depth = (int) 8, " \
|
||||||
"signed = (boolean) false"
|
"signed = (boolean) false" \
|
||||||
|
"; " \
|
||||||
|
"audio/x-raw-float, " \
|
||||||
|
"rate = (int) [ 1, MAX ], " \
|
||||||
|
"channels = (int) [ 1, 2 ], " \
|
||||||
|
"endianness = (int) LITTLE_ENDIAN, " \
|
||||||
|
"width = (int) { 32, 64 } "
|
||||||
|
|
||||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
|
@ -183,7 +190,7 @@ gst_wavenc_create_header_buf (GstWavEnc * wavenc, guint audio_data_size)
|
||||||
memset (header, 0, WAV_HEADER_LEN);
|
memset (header, 0, WAV_HEADER_LEN);
|
||||||
|
|
||||||
wave.common.wChannels = wavenc->channels;
|
wave.common.wChannels = wavenc->channels;
|
||||||
wave.common.wBitsPerSample = wavenc->depth;
|
wave.common.wBitsPerSample = wavenc->width;
|
||||||
wave.common.dwSamplesPerSec = wavenc->rate;
|
wave.common.dwSamplesPerSec = wavenc->rate;
|
||||||
|
|
||||||
/* Fill out our wav-header with some information */
|
/* Fill out our wav-header with some information */
|
||||||
|
@ -194,7 +201,7 @@ gst_wavenc_create_header_buf (GstWavEnc * wavenc, guint audio_data_size)
|
||||||
memcpy (wave.format.id, "fmt ", 4);
|
memcpy (wave.format.id, "fmt ", 4);
|
||||||
wave.format.len = 16;
|
wave.format.len = 16;
|
||||||
|
|
||||||
wave.common.wFormatTag = WAVE_FORMAT_PCM;
|
wave.common.wFormatTag = (wavenc->fp) ? WAVE_FORMAT_FLOAT : WAVE_FORMAT_PCM;
|
||||||
wave.common.wBlockAlign = (wavenc->width / 8) * wave.common.wChannels;
|
wave.common.wBlockAlign = (wavenc->width / 8) * wave.common.wChannels;
|
||||||
wave.common.dwAvgBytesPerSec =
|
wave.common.dwAvgBytesPerSec =
|
||||||
wave.common.wBlockAlign * wave.common.dwSamplesPerSec;
|
wave.common.wBlockAlign * wave.common.dwSamplesPerSec;
|
||||||
|
@ -252,7 +259,7 @@ gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstWavEnc *wavenc;
|
GstWavEnc *wavenc;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gint chans, rate, width, depth;
|
gint chans, rate, width;
|
||||||
|
|
||||||
wavenc = GST_WAVENC (gst_pad_get_parent (pad));
|
wavenc = GST_WAVENC (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
@ -266,19 +273,21 @@ gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
if (!gst_structure_get_int (structure, "channels", &chans) ||
|
if (!gst_structure_get_int (structure, "channels", &chans) ||
|
||||||
!gst_structure_get_int (structure, "rate", &rate) ||
|
!gst_structure_get_int (structure, "rate", &rate) ||
|
||||||
!gst_structure_get_int (structure, "width", &width) ||
|
!gst_structure_get_int (structure, "width", &width)) {
|
||||||
!gst_structure_get_int (structure, "depth", &depth)) {
|
|
||||||
GST_WARNING_OBJECT (wavenc, "caps incomplete");
|
GST_WARNING_OBJECT (wavenc, "caps incomplete");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wavenc->fp =
|
||||||
|
(g_str_equal (gst_structure_get_name (structure), "audio/x-raw-float"));
|
||||||
|
|
||||||
wavenc->channels = chans;
|
wavenc->channels = chans;
|
||||||
wavenc->depth = depth;
|
|
||||||
wavenc->width = width;
|
wavenc->width = width;
|
||||||
wavenc->rate = rate;
|
wavenc->rate = rate;
|
||||||
|
|
||||||
GST_LOG_OBJECT (wavenc, "accepted caps: chans=%u width=%u depth=%u rate=%u",
|
GST_LOG_OBJECT (wavenc,
|
||||||
wavenc->channels, wavenc->width, wavenc->depth, wavenc->rate);
|
"accepted caps: chans=%u width=%u rate=%u floating point=%d",
|
||||||
|
wavenc->channels, wavenc->width, wavenc->rate, wavenc->fp);
|
||||||
|
|
||||||
gst_object_unref (wavenc);
|
gst_object_unref (wavenc);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -653,10 +662,10 @@ gst_wavenc_change_state (GstElement * element, GstStateChange transition)
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
wavenc->channels = 0;
|
wavenc->channels = 0;
|
||||||
wavenc->depth = 0;
|
|
||||||
wavenc->width = 0;
|
wavenc->width = 0;
|
||||||
wavenc->rate = 0;
|
wavenc->rate = 0;
|
||||||
wavenc->length = 0;
|
wavenc->length = 0;
|
||||||
|
wavenc->fp = FALSE;
|
||||||
wavenc->sent_header = FALSE;
|
wavenc->sent_header = FALSE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -48,10 +48,10 @@ struct _GstWavEnc {
|
||||||
|
|
||||||
/* useful audio data */
|
/* useful audio data */
|
||||||
guint width;
|
guint width;
|
||||||
guint depth;
|
|
||||||
guint rate;
|
guint rate;
|
||||||
guint channels;
|
guint channels;
|
||||||
guint32 length;
|
guint32 length;
|
||||||
|
gboolean fp;
|
||||||
|
|
||||||
gboolean sent_header;
|
gboolean sent_header;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue