summaryrefslogtreecommitdiff
path: root/src/libflac
diff options
context:
space:
mode:
Diffstat (limited to 'src/libflac')
-rw-r--r--src/libflac/decoder_flac.c2
-rw-r--r--src/libflac/demux_flac.c15
2 files changed, 11 insertions, 6 deletions
diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c
index 631c5a294..ffafb0f13 100644
--- a/src/libflac/decoder_flac.c
+++ b/src/libflac/decoder_flac.c
@@ -418,7 +418,7 @@ static decoder_info_t dec_info_audio = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 24, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class },
+ { PLUGIN_DEMUX, 25, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class },
{ PLUGIN_AUDIO_DECODER, 15, "flacdec", XINE_VERSION_CODE, &dec_info_audio, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c
index dadc03e2e..94cb96c47 100644
--- a/src/libflac/demux_flac.c
+++ b/src/libflac/demux_flac.c
@@ -274,7 +274,7 @@ static int
demux_flac_send_chunk (demux_plugin_t *this_gen) {
demux_flac_t *this = (demux_flac_t *) this_gen;
buf_element_t *buf = NULL;
- off_t current_file_pos;
+ off_t current_file_pos, file_size = 0;
int64_t current_pts;
unsigned int remaining_sample_bytes = 0;
@@ -282,11 +282,13 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) {
current_file_pos = this->input->get_current_pos (this->input)
- this->data_start;
+ if( (this->data_size - this->data_start) > 0 )
+ file_size = (this->data_size - this->data_start);
current_pts = current_file_pos;
current_pts *= this->length_in_msec * 90;
- if( (this->data_size - this->data_start) > 0 )
- current_pts /= (this->data_size - this->data_start);
+ if( file_size )
+ current_pts /= file_size;
if (this->seek_flag) {
#ifdef USE_ESTIMATED_PTS
@@ -307,8 +309,8 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
buf->type = BUF_AUDIO_FLAC;
- buf->extra_info->input_pos = current_file_pos;
- buf->extra_info->input_length = this->data_size - this->data_start;
+ if( file_size )
+ buf->extra_info->input_normpos = (int) ((double)current_file_pos * 65535 / file_size);
buf->extra_info->input_time = current_pts / 90;
#ifdef USE_ESTIMATED_PTS
buf->pts = current_pts;
@@ -406,6 +408,9 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int
lprintf("demux_flac_seek\n");
+ start_pos = (off_t) ( (double) start_pos / 65535 *
+ this->input->get_length (this->input) );
+
if (!start_pos && start_time) {
double distance = (double)start_time;