"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 6 ], "
"endianness = (int) BYTE_ORDER, "
- "width = (int) { 16, 32 }, "
- "depth = (int) 16, " "signed = (boolean) true")
+ "width = (int) 32, " "depth = (int) 16, " "signed = (boolean) true")
);
static GstStaticPadTemplate vorbis_dec_sink_factory =
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_BYTES:
- scale = dec->width * dec->vi.channels;
+ scale = sizeof (gint32) * dec->vi.channels;
case GST_FORMAT_DEFAULT:
*dest_value =
scale * gst_util_uint64_scale_int (src_value, dec->vi.rate,
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_BYTES:
- *dest_value = src_value * dec->width * dec->vi.channels;
+ *dest_value = src_value * sizeof (gint32) * dec->vi.channels;
break;
case GST_FORMAT_TIME:
*dest_value =
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_DEFAULT:
- *dest_value = src_value / (dec->width * dec->vi.channels);
+ *dest_value = src_value / (sizeof (gint32) * dec->vi.channels);
break;
case GST_FORMAT_TIME:
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
- dec->vi.rate * dec->width * dec->vi.channels);
+ dec->vi.rate * sizeof (gint32) * dec->vi.channels);
break;
default:
res = FALSE;
{
GstCaps *caps;
const GstAudioChannelPosition *pos = NULL;
- gint width = 16;
switch (vd->vi.channels) {
case 1:
goto channel_count_error;
}
- /* negotiate with downstream */
- caps = gst_pad_get_allowed_caps (vd->srcpad);
- if (caps) {
- if (!gst_caps_is_empty (caps)) {
- GstStructure *s;
-
- s = gst_caps_get_structure (caps, 0);
- /* template ensures 16 or 32 */
- gst_structure_get_int (s, "width", &width);
- }
- gst_caps_unref (caps);
- }
- vd->width = width >> 3;
-
caps = gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT, vd->vi.rate,
"channels", G_TYPE_INT, vd->vi.channels,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, width,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
"depth", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
if (pos) {
}
}
-static void
-copy_samples_16 (gint16 * out, ogg_int32_t ** in, guint samples, gint channels)
-{
- gint i, j;
-
- for (j = 0; j < samples; j++) {
- for (i = 0; i < channels; i++) {
- *out++ = CLIP_TO_15 (in[i][j] >> 9);
- }
- }
-}
-
/* clip output samples to the segment boundaries
*/
static gboolean
/* bring clipped time to samples */
diff = gst_util_uint64_scale_int (diff, dec->vi.rate, GST_SECOND);
/* samples to bytes */
- diff *= (dec->width * dec->vi.channels);
+ diff *= (sizeof (gint32) * dec->vi.channels);
GST_DEBUG_OBJECT (dec, "clipping start to %" GST_TIME_FORMAT " %"
G_GUINT64_FORMAT " bytes", GST_TIME_ARGS (cstart), diff);
GST_BUFFER_DATA (buf) += diff;
/* bring clipped time to samples and then to bytes */
diff = gst_util_uint64_scale_int (diff, dec->vi.rate, GST_SECOND);
- diff *= (dec->width * dec->vi.channels);
+ diff *= (sizeof (gint32) * dec->vi.channels);
GST_DEBUG_OBJECT (dec, "clipping stop to %" GST_TIME_FORMAT " %"
G_GUINT64_FORMAT " bytes", GST_TIME_ARGS (cstop), diff);
GST_BUFFER_SIZE (buf) -= diff;
walk = g_list_previous (walk)) {
GstBuffer *buffer = GST_BUFFER (walk->data);
- outoffset -= GST_BUFFER_SIZE (buffer) / (dec->width * dec->vi.channels);
+ outoffset -=
+ GST_BUFFER_SIZE (buffer) / (sizeof (gint32) * dec->vi.channels);
GST_BUFFER_OFFSET (buffer) = outoffset;
GST_BUFFER_TIMESTAMP (buffer) =
if ((sample_count = vorbis_synthesis_pcmout (&vd->vd, NULL)) == 0)
goto done;
- size = sample_count * vd->vi.channels * vd->width;
+ size = sample_count * vd->vi.channels * sizeof (gint32);
/* alloc buffer for it */
result =
goto wrong_samples;
/* copy samples in buffer */
- if (vd->width == 4) {
- copy_samples ((gint32 *) GST_BUFFER_DATA (out), pcm, sample_count,
- vd->vi.channels);
- } else if (vd->width == 2) {
- copy_samples_16 ((gint16 *) GST_BUFFER_DATA (out), pcm, sample_count,
- vd->vi.channels);
- } else {
- g_assert_not_reached ();
- }
+ copy_samples ((gint32 *) GST_BUFFER_DATA (out), pcm, sample_count,
+ vd->vi.channels);
GST_BUFFER_SIZE (out) = size;
GST_BUFFER_OFFSET (out) = vd->granulepos;
vorbis_info_init (&vd->vi);
vorbis_comment_init (&vd->vc);
vd->initialized = FALSE;
- vd->width = 2;
gst_ivorbis_dec_reset (vd);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: