summaryrefslogtreecommitdiff
path: root/ext/flac
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2011-09-28 19:10:27 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-09-28 19:10:27 +0100
commit3d01b9f398d49d1ba012bdbdee350bd38aac526f (patch)
tree6cbccc111d6f0d1a5b381fc2ac8c0966eaafe927 /ext/flac
parent5c28f426d7d63957c79f42fcaa3f3659504b2bf5 (diff)
downloadgstreamer-plugins-good-3d01b9f398d49d1ba012bdbdee350bd38aac526f.tar.gz
flacdec: get rid of granulepos handling
Leave that to the parser or demuxer. There's still some code for operating in DEFAULT (samples) format, but that will be removed later.
Diffstat (limited to 'ext/flac')
-rw-r--r--ext/flac/gstflacdec.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index ee0e29482..b54400dc1 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -38,8 +38,6 @@
* </refsect2>
*/
-/* FIXME: remove all granulepos handling if there's any left */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -708,13 +706,6 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
GST_BUFFER_OFFSET (outbuf) = flacdec->segment.position;
- if (flacdec->cur_granulepos != GST_BUFFER_OFFSET_NONE) {
- /* this should be fine since it should be one flac frame per ogg packet */
- flacdec->segment.position = flacdec->cur_granulepos - samples;
- GST_LOG_OBJECT (flacdec, "granulepos = %" G_GINT64_FORMAT ", samples = %u",
- flacdec->cur_granulepos, samples);
- }
-
GST_BUFFER_TIMESTAMP (outbuf) =
gst_util_uint64_scale_int (flacdec->segment.position, GST_SECOND,
frame->header.sample_rate);
@@ -948,6 +939,7 @@ gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
FLAC__stream_decoder_flush (dec->decoder);
}
+ /* FIXME: should always be framed */
if (dec->framed) {
gint64 unused;
guint8 *data;
@@ -958,25 +950,17 @@ gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
got_audio_frame = gst_flac_dec_scan_got_frame (dec, data, size, &unused);
gst_buffer_unmap (buf, data, size);
- /* oggdemux will set granulepos in OFFSET_END instead of timestamp */
if (G_LIKELY (got_audio_frame)) {
- /* old oggdemux for now */
- if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
- dec->cur_granulepos = GST_BUFFER_OFFSET_END (buf);
- } else {
- GstFormat dformat = GST_FORMAT_DEFAULT;
- gint64 position;
-
- /* upstream (e.g. demuxer) presents us time,
- * convert to default samples */
- gst_flac_dec_convert_src (dec->srcpad, GST_FORMAT_TIME,
- GST_BUFFER_TIMESTAMP (buf), &dformat, &position);
- dec->segment.position = position;
- dec->cur_granulepos = GST_BUFFER_OFFSET_NONE;
- }
+ GstFormat dformat = GST_FORMAT_DEFAULT; /* FIXME: remove var */
+ gint64 position;
+
+ /* upstream (e.g. demuxer) presents us time,
+ * convert to default samples */
+ gst_flac_dec_convert_src (dec->srcpad, GST_FORMAT_TIME,
+ GST_BUFFER_TIMESTAMP (buf), &dformat, &position);
+ dec->segment.position = position;
}
} else {
- dec->cur_granulepos = GST_BUFFER_OFFSET_NONE;
got_audio_frame = TRUE;
}