diff options
author | Christian Schaller <uraeus@gnome.org> | 2002-12-08 12:23:48 +0000 |
---|---|---|
committer | Christian Schaller <uraeus@gnome.org> | 2002-12-08 12:23:48 +0000 |
commit | b1db900c741b487aa2d6d3f2456d9251aaa70085 (patch) | |
tree | 72c079e70c1e89c8549a502c8f0721c8304f448c /gst/wavparse/gstwavparse.c | |
parent | 46820010139599cf0ae77e5e75da04b9672f23bf (diff) |
Applied endianess fix and unsigned data fix from Jon Nall
Original commit message from CVS:
Applied endianess fix and unsigned data fix from Jon Nall
Diffstat (limited to 'gst/wavparse/gstwavparse.c')
-rw-r--r-- | gst/wavparse/gstwavparse.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 052f855f..27cda784 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -73,7 +73,10 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory, "format", GST_PROPS_STRING ("int"), "law", GST_PROPS_INT (0), "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), + "signed", GST_PROPS_LIST ( + GST_PROPS_BOOLEAN (FALSE), + GST_PROPS_BOOLEAN (TRUE) + ), "width", GST_PROPS_LIST ( GST_PROPS_INT (8), GST_PROPS_INT (16) @@ -290,6 +293,11 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf) /* we can gather format information now */ format = (GstWavParseFormat *)((guchar *) GST_BUFFER_DATA (buf) + fmt->offset); + wavparse->bps = GUINT16_FROM_LE(format->wBlockAlign); + wavparse->rate = GUINT32_FROM_LE(format->dwSamplesPerSec); + wavparse->channels = GUINT16_FROM_LE(format->wChannels); + wavparse->width = GUINT16_FROM_LE(format->wBitsPerSample); + /* set the caps on the src pad */ caps = GST_CAPS_NEW ( "parsewav_src", @@ -297,11 +305,11 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf) "format", GST_PROPS_STRING ("int"), "law", GST_PROPS_INT (0), /*FIXME */ "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), /*FIXME */ - "width", GST_PROPS_INT (format->wBitsPerSample), - "depth", GST_PROPS_INT (format->wBitsPerSample), - "rate", GST_PROPS_INT (format->dwSamplesPerSec), - "channels", GST_PROPS_INT (format->wChannels) + "signed", GST_PROPS_BOOLEAN ((wavparse->width > 8) ? TRUE : FALSE), + "width", GST_PROPS_INT (wavparse->width), + "depth", GST_PROPS_INT (wavparse->width), + "rate", GST_PROPS_INT (wavparse->rate), + "channels", GST_PROPS_INT (wavparse->channels) ); if (gst_pad_try_set_caps (wavparse->srcpad, caps) <= 0) { @@ -309,13 +317,8 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf) return; } - wavparse->bps = format->wBlockAlign; - wavparse->rate = format->dwSamplesPerSec; - wavparse->channels = format->wChannels; - wavparse->width = format->wBitsPerSample; - GST_DEBUG (0, "frequency %d, channels %d", - format->dwSamplesPerSec, format->wChannels); + wavparse->rate, wavparse->channels); /* we're now looking for the data chunk */ wavparse->state = GST_WAVPARSE_CHUNK_DATA; |