diff options
author | James Stembridge <jstembridge@users.sourceforge.net> | 2005-06-04 13:49:25 +0000 |
---|---|---|
committer | James Stembridge <jstembridge@users.sourceforge.net> | 2005-06-04 13:49:25 +0000 |
commit | 17e6a4940076d81331ebcd4e490bc4423e0e9642 (patch) | |
tree | 1d3682546ba3fc1d565bc8d26b563c95ebc85f2d | |
parent | 3315dcb3b24a5ab071aa5aef75754e946e0e0fee (diff) | |
download | xine-lib-17e6a4940076d81331ebcd4e490bc4423e0e9642.tar.gz xine-lib-17e6a4940076d81331ebcd4e490bc4423e0e9642.tar.bz2 |
Estimate input time from bitrate
CVS patchset: 7605
CVS date: 2005/06/04 13:49:25
-rw-r--r-- | src/demuxers/demux_aac.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 9ef717307..a2ca6b92e 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -21,7 +21,7 @@ * This demuxer detects ADIF and ADTS headers in AAC files. * Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.9 2005/06/04 10:59:36 jstembridge Exp $ + * $Id: demux_aac.c,v 1.10 2005/06/04 13:49:25 jstembridge Exp $ */ #ifdef HAVE_CONFIG_H @@ -126,17 +126,26 @@ static int open_aac_file(demux_aac_t *this) { static int demux_aac_send_chunk(demux_plugin_t *this_gen) { demux_aac_t *this = (demux_aac_t *) this_gen; int bytes_read; + off_t current_pos, length; + uint32_t bitrate; buf_element_t *buf = NULL; /* just load an entire buffer from wherever the audio happens to be */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_AAC; - if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * - 65535 / this->input->get_length (this->input) ); buf->pts = 0; + length = this->input->get_length(this->input); + current_pos = this->input->get_current_pos(this->input); + bitrate = _x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE); + + if (length) + buf->extra_info->input_normpos = (int)((double) current_pos * 65535/length); + + if (bitrate) + buf->extra_info->input_time = (8*current_pos) / (bitrate/1000); + bytes_read = this->input->read(this->input, buf->content, buf->max_size); if (bytes_read == 0) { buf->free_buffer(buf); |