1 --- gst-plugins-ugly-0.10.6/ext/mad/gstmad.c.orig 2007-06-13 11:21:25.000000000 +0200
2 +++ gst-plugins-ugly-0.10.6/ext/mad/gstmad.c 2007-09-16 22:45:04.000000000 +0200
4 GST_STATIC_CAPS ("audio/x-raw-int, "
5 "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
6 "signed = (boolean) true, "
10 + "depth = (int) 16, "
11 "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
12 "channels = (int) [ 1, 2 ]")
16 mad = GST_MAD (GST_PAD_PARENT (pad));
18 - bytes_per_sample = MAD_NCHANNELS (&mad->frame.header) * 4;
19 + bytes_per_sample = MAD_NCHANNELS (&mad->frame.header) << 1;
22 case GST_FORMAT_BYTES:
29 scale (mad_fixed_t sample)
31 -#if MAD_F_FRACBITS < 28
33 - sample += (1L << (28 - MAD_F_FRACBITS - 1));
35 + sample += (1L << (MAD_F_FRACBITS - 16));
38 if (sample >= MAD_F_ONE)
40 else if (sample < -MAD_F_ONE)
43 -#if MAD_F_FRACBITS < 28
45 - sample >>= (28 - MAD_F_FRACBITS);
48 - /* convert from 29 bits to 32 bits */
49 - return (gint32) (sample << 3);
50 + return sample >> (MAD_F_FRACBITS + 1 - 16);
53 /* do we need this function? */
55 caps = gst_caps_new_simple ("audio/x-raw-int",
56 "endianness", G_TYPE_INT, G_BYTE_ORDER,
57 "signed", G_TYPE_BOOLEAN, TRUE,
58 - "width", G_TYPE_INT, 32,
59 - "depth", G_TYPE_INT, 32,
60 + "width", G_TYPE_INT, 16,
61 + "depth", G_TYPE_INT, 16,
62 "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, nchannels, NULL);
64 gst_pad_set_caps (mad->srcpad, caps);
66 to skip and send the remaining pcm samples */
68 GstBuffer *outbuffer = NULL;
71 mad_fixed_t const *left_ch, *right_ch;
73 if (mad->need_newsegment) {
75 /* will attach the caps to the buffer */
77 gst_pad_alloc_buffer_and_set_caps (mad->srcpad, 0,
78 - nsamples * mad->channels * 4, GST_PAD_CAPS (mad->srcpad),
79 + nsamples * mad->channels * 2, GST_PAD_CAPS (mad->srcpad),
81 if (result != GST_FLOW_OK) {
82 /* Head for the exit, dropping samples as we go */
84 left_ch = mad->synth.pcm.samples[0];
85 right_ch = mad->synth.pcm.samples[1];
87 - outdata = (gint32 *) GST_BUFFER_DATA (outbuffer);
88 + outdata = (gint16 *) GST_BUFFER_DATA (outbuffer);
90 GST_DEBUG ("mad out timestamp %" GST_TIME_FORMAT,
91 GST_TIME_ARGS (time_offset));
92 @@ -1621,14 +1614,14 @@
93 gint count = nsamples;
96 - *outdata++ = scale (*left_ch++) & 0xffffffff;
97 + *outdata++ = scale (*left_ch++) & 0xffff;
100 gint count = nsamples;
103 - *outdata++ = scale (*left_ch++) & 0xffffffff;
104 - *outdata++ = scale (*right_ch++) & 0xffffffff;
105 + *outdata++ = scale (*left_ch++) & 0xffff;
106 + *outdata++ = scale (*right_ch++) & 0xffff;