summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-06-01 00:57:41 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-06-01 00:57:41 +0000
commita099d01dd980c772258afe76b8c4443bc9777838 (patch)
tree2b780eae722b84ada252ee58146de94abeb376c7
parent3af8417632b7793e2455018599e1f3539e8d5914 (diff)
downloadxine-lib-a099d01dd980c772258afe76b8c4443bc9777838.tar.gz
xine-lib-a099d01dd980c772258afe76b8c4443bc9777838.tar.bz2
trying to fix seeking to time position. general seeking improvements.
https://sourceforge.net/tracker/?func=detail&atid=109655&aid=962609&group_id=9655 CVS patchset: 6618 CVS date: 2004/06/01 00:57:41
-rw-r--r--src/libflac/demux_flac.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c
index 8bc55ac6d..7d5c7619a 100644
--- a/src/libflac/demux_flac.c
+++ b/src/libflac/demux_flac.c
@@ -288,10 +288,15 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) {
current_pts /= (this->data_size - this->data_start);
if (this->seek_flag) {
- _x_demux_control_newpts (this->stream, current_pts, 0);
+#ifdef USE_ESTIMATED_PTS
+ _x_demux_control_newpts (this->stream, current_pts, BUF_FLAG_SEEK);
+#else
+ _x_demux_control_newpts (this->stream, 0, BUF_FLAG_SEEK);
+#endif
this->seek_flag = 0;
}
+
while (remaining_sample_bytes)
{
if(!this->audio_fifo) {
@@ -304,7 +309,11 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) {
buf->extra_info->input_pos = current_file_pos;
buf->extra_info->input_length = this->data_size - this->data_start;
buf->extra_info->input_time = current_pts / 90;
- //buf->pts = current_pts;
+#ifdef USE_ESTIMATED_PTS
+ buf->pts = current_pts;
+#else
+ buf->pts = 0;
+#endif
if (remaining_sample_bytes > buf->max_size)
buf->size = buf->max_size;
@@ -404,14 +413,14 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int
} else {
double distance = (double)start_time;
- uint64_t target_sample = (uint64_t)(distance * this->total_samples);
+ uint64_t target_sample;
FLAC__bool s = false;
if (this->length_in_msec != 0)
{
distance /= (double)this->length_in_msec;
}
-
+ target_sample = (uint64_t)(distance * this->total_samples);
s = FLAC__seekable_stream_decoder_seek_absolute (this->flac_decoder,
target_sample);
@@ -423,6 +432,7 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int
}
_x_demux_flush_engine (this->stream);
+ this->seek_flag = 1;
return this->status;
}