mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
ext/vorbis/vorbisdec.c: Use scale_int when we can, add some more scaling.
Original commit message from CVS: * ext/vorbis/vorbisdec.c: (vorbis_dec_convert), (vorbis_handle_header_packet), (vorbis_dec_push), (vorbis_handle_data_packet): Use scale_int when we can, add some more scaling. Check packettype before parsing it.
This commit is contained in:
parent
6ec9735673
commit
5ef4c13fb1
2 changed files with 20 additions and 11 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-01-31 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/vorbis/vorbisdec.c: (vorbis_dec_convert),
|
||||||
|
(vorbis_handle_header_packet), (vorbis_dec_push),
|
||||||
|
(vorbis_handle_data_packet):
|
||||||
|
Use scale_int when we can, add some more scaling.
|
||||||
|
Check packettype before parsing it.
|
||||||
|
|
||||||
2006-01-31 Wim Taymans <wim@fluendo.com>
|
2006-01-31 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* ext/theora/theoradec.c: (_theora_granule_time),
|
* ext/theora/theoradec.c: (_theora_granule_time),
|
||||||
|
|
|
@ -230,7 +230,9 @@ vorbis_dec_convert (GstPad * pad,
|
||||||
case GST_FORMAT_BYTES:
|
case GST_FORMAT_BYTES:
|
||||||
scale = sizeof (float) * dec->vi.channels;
|
scale = sizeof (float) * dec->vi.channels;
|
||||||
case GST_FORMAT_DEFAULT:
|
case GST_FORMAT_DEFAULT:
|
||||||
*dest_value = scale * (src_value * dec->vi.rate / GST_SECOND);
|
*dest_value =
|
||||||
|
scale * gst_util_uint64_scale_int (src_value, dec->vi.rate,
|
||||||
|
GST_SECOND);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
@ -243,7 +245,7 @@ vorbis_dec_convert (GstPad * pad,
|
||||||
break;
|
break;
|
||||||
case GST_FORMAT_TIME:
|
case GST_FORMAT_TIME:
|
||||||
*dest_value =
|
*dest_value =
|
||||||
gst_util_uint64_scale (src_value, GST_SECOND, dec->vi.rate);
|
gst_util_uint64_scale_int (src_value, GST_SECOND, dec->vi.rate);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
@ -255,7 +257,7 @@ vorbis_dec_convert (GstPad * pad,
|
||||||
*dest_value = src_value / (sizeof (float) * dec->vi.channels);
|
*dest_value = src_value / (sizeof (float) * dec->vi.channels);
|
||||||
break;
|
break;
|
||||||
case GST_FORMAT_TIME:
|
case GST_FORMAT_TIME:
|
||||||
*dest_value = gst_util_uint64_scale (src_value, GST_SECOND,
|
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
|
||||||
dec->vi.rate * sizeof (float) * dec->vi.channels);
|
dec->vi.rate * sizeof (float) * dec->vi.channels);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -651,20 +653,19 @@ vorbis_handle_header_packet (GstVorbisDec * vd, ogg_packet * packet)
|
||||||
if (vorbis_synthesis_headerin (&vd->vi, &vd->vc, packet))
|
if (vorbis_synthesis_headerin (&vd->vi, &vd->vc, packet))
|
||||||
goto header_read_error;
|
goto header_read_error;
|
||||||
|
|
||||||
/* FIXME: we should probably double-check if packet[0] is 1/3/5 for each
|
switch (packet->packet[0]) {
|
||||||
* of these */
|
case 0x01:
|
||||||
switch (packet->packetno) {
|
|
||||||
case 0:
|
|
||||||
res = vorbis_handle_identification_packet (vd);
|
res = vorbis_handle_identification_packet (vd);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 0x03:
|
||||||
res = vorbis_handle_comment_packet (vd, packet);
|
res = vorbis_handle_comment_packet (vd, packet);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 0x05:
|
||||||
res = vorbis_handle_type_packet (vd);
|
res = vorbis_handle_type_packet (vd);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* ignore */
|
/* ignore */
|
||||||
|
g_warning ("unknown vorbis header packet found");
|
||||||
res = GST_FLOW_OK;
|
res = GST_FLOW_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -725,7 +726,7 @@ vorbis_dec_push (GstVorbisDec * dec, GstBuffer * buf)
|
||||||
|
|
||||||
GST_BUFFER_OFFSET (buffer) = outoffset;
|
GST_BUFFER_OFFSET (buffer) = outoffset;
|
||||||
GST_BUFFER_TIMESTAMP (buffer) =
|
GST_BUFFER_TIMESTAMP (buffer) =
|
||||||
gst_util_uint64_scale (outoffset, GST_SECOND, dec->vi.rate);
|
gst_util_uint64_scale_int (outoffset, GST_SECOND, dec->vi.rate);
|
||||||
GST_DEBUG_OBJECT (dec, "patch buffer %" G_GUINT64_FORMAT
|
GST_DEBUG_OBJECT (dec, "patch buffer %" G_GUINT64_FORMAT
|
||||||
" offset %" G_GUINT64_FORMAT, size, outoffset);
|
" offset %" G_GUINT64_FORMAT, size, outoffset);
|
||||||
size--;
|
size--;
|
||||||
|
@ -793,7 +794,7 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet)
|
||||||
if (vd->granulepos != -1) {
|
if (vd->granulepos != -1) {
|
||||||
GST_BUFFER_OFFSET_END (out) = vd->granulepos + sample_count;
|
GST_BUFFER_OFFSET_END (out) = vd->granulepos + sample_count;
|
||||||
GST_BUFFER_TIMESTAMP (out) =
|
GST_BUFFER_TIMESTAMP (out) =
|
||||||
gst_util_uint64_scale (vd->granulepos, GST_SECOND, vd->vi.rate);
|
gst_util_uint64_scale_int (vd->granulepos, GST_SECOND, vd->vi.rate);
|
||||||
} else {
|
} else {
|
||||||
GST_BUFFER_TIMESTAMP (out) = -1;
|
GST_BUFFER_TIMESTAMP (out) = -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue