flacparse: set _OFFSET and _OFFSET_END on outgoing buffers

This commit is contained in:
Mark Nauwelaerts 2009-12-17 12:45:36 +01:00 committed by Tim-Philipp Müller
parent 4db789a18c
commit 0d53b6ad62

View file

@ -1208,17 +1208,25 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBuffer * buffer)
flacparse->state = GST_FLAC_PARSE_STATE_DATA; flacparse->state = GST_FLAC_PARSE_STATE_DATA;
} }
/* also cater for oggmux metadata */
if (flacparse->blocking_strategy == 0) { if (flacparse->blocking_strategy == 0) {
GST_BUFFER_TIMESTAMP (buffer) = GST_BUFFER_TIMESTAMP (buffer) =
gst_util_uint64_scale (flacparse->sample_number, gst_util_uint64_scale (flacparse->sample_number,
flacparse->block_size * GST_SECOND, flacparse->samplerate); flacparse->block_size * GST_SECOND, flacparse->samplerate);
GST_BUFFER_OFFSET_END (buffer) =
flacparse->sample_number * flacparse->block_size +
flacparse->block_size;
} else { } else {
GST_BUFFER_TIMESTAMP (buffer) = GST_BUFFER_TIMESTAMP (buffer) =
gst_util_uint64_scale (flacparse->sample_number, GST_SECOND, gst_util_uint64_scale (flacparse->sample_number, GST_SECOND,
flacparse->samplerate); flacparse->samplerate);
GST_BUFFER_OFFSET_END (buffer) =
flacparse->sample_number + flacparse->block_size;
} }
GST_BUFFER_DURATION (buffer) = GST_BUFFER_DURATION (buffer) =
GST_FRAMES_TO_CLOCK_TIME (flacparse->block_size, flacparse->samplerate); GST_FRAMES_TO_CLOCK_TIME (flacparse->block_size, flacparse->samplerate);
GST_BUFFER_OFFSET (buffer) =
GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer);
/* Minimal size of a frame header */ /* Minimal size of a frame header */
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), MAX (16, gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), MAX (16,