[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-devel
Subject:    [xine-devel] [PATCH] demux: Fix the pts values for the TrueAudio
From:       Kelvie Wong <kelvie () ieee ! org>
Date:       2010-03-21 8:06:30
Message-ID: d054728bc89a8bff4ad0.1269158790 () gargantua
[Download RAW message or body]

# HG changeset patch
# User Kelvie Wong <kelvie@ieee.org>
# Date 1269154371 25200
# Branch mine
# Node ID d054728bc89a8bff4ad04784fc533b1fec5c9392
# Parent  4b73ce100882e81722349b3cfee26039384e1860
demux: Fix the pts values for the TrueAudio demux

This makes seeking more accurate, I believe.

diff -r 4b73ce100882 -r d054728bc89a src/demuxers/demux_tta.c
--- a/src/demuxers/demux_tta.c	Sun Mar 14 15:06:02 2010 +0000
+++ b/src/demuxers/demux_tta.c	Sat Mar 20 23:52:51 2010 -0700
@@ -129,7 +129,7 @@
     /* Get a buffer */
     buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
     buf->type = BUF_AUDIO_TTA;
-    buf->pts = 0;
+    buf->pts = (int64_t)(FRAME_TIME * this->currentframe) * 90000;
     buf->extra_info->total_time = (int)(le2me_32(this->header.tta.data_length) * \
1000.0 / le2me_32(this->header.tta.samplerate)); /* milliseconds */   \
buf->decoder_flags = 0;  
@@ -231,6 +231,7 @@
   demux_tta_t *this = (demux_tta_t *) this_gen;
   uint32_t start_frame;
   uint32_t frame_index;
+  int64_t pts;
   off_t start_off = this->datastart;
 
   /* if thread is not running, initialize demuxer */
@@ -244,10 +245,14 @@
   } else {
 
     /* Get the starting frame */
-    if( start_pos )
+    if( start_pos ) {
+        pts = start_pos * le2me_32(this->header.tta.data_length) * 1000.0 / \
le2me_32(this->header.tta.samplerate) * 90 / 65535;  start_frame = start_pos * \
                this->totalframes / 65535;
-    else
+
+    } else {
+      pts = start_time * 90;
       start_frame = (uint32_t)((double)start_time/ 1000.0 / FRAME_TIME);
+    }
 
     /* Now we find the offset */
     for( frame_index = 0; frame_index < start_frame; frame_index++ )
@@ -258,7 +263,7 @@
     _x_demux_flush_engine(this->stream);
     this->input->seek(this->input, start_off, SEEK_SET);
     this->currentframe = start_frame;
-    _x_demux_control_newpts(this->stream, (int)(FRAME_TIME * start_frame) * 90000, \
BUF_FLAG_SEEK); +    _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK);
 
     this->status = DEMUX_OK;
   }

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
xine-devel mailing list
xine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic