[Ffmpeg-devel] [PATCH] Add True Audio Seeking Support

Michael Niedermayer michaelni
Sat Mar 31 00:28:24 CEST 2007


Hi

On Sat, Mar 31, 2007 at 12:39:16AM +0900, Masahiro Kiyota wrote:
> Hi,
> 
> The attached patch enables applications using libavc/libavf as backend
> (e.g. mplayer) to seek True Audio streams.
> 
> In order to enable seeking true audio stream in mplayer, I made some
> changes to tta_read_header() and tta_read_packet() in addition to
> implementing tta_read_seek().
> 
> Tested on mplayer and ffplay.

[...]
> @@ -36,6 +38,16 @@ static int tta_probe(AVProbeData *p)
>      return 0;
>  }
>  
> +static uint32_t get_pos(uint32_t *seek_table, int frm)
> +{
> +    uint32_t *st, ret = 0;
> +    

trailing whitespace


[...]

> +    s->start_time = 0;
> +    s->duration = FRAME_TIME * c->totalframes * AV_TIME_BASE; // not precise?

our docs must be unclear ...
    /** decoding: position of the first frame of the component, in
       AV_TIME_BASE fractional seconds. NEVER set this value directly:
       it is deduced from the AVStream values.  */
    int64_t start_time;
    /** decoding: duration of the stream, in AV_TIME_BASE fractional
       seconds. NEVER set this value directly: it is deduced from the
       AVStream values.  */
    int64_t duration;


>      return 0;
>  }
>  
> @@ -109,18 +124,18 @@ static int tta_read_packet(AVFormatConte
>      int ret, size;
>  
>      // FIXME!
> -    if (c->currentframe > c->totalframes)
> +    if (c->currentframe >= c->totalframes)
>          size = 0;
>      else

looks ok, but such a bugfix should be in a seperate patch


>          size = c->seektable[c->currentframe];
>  
> -    c->currentframe++;
> -
>      if (av_new_packet(pkt, size) < 0)
>          return AVERROR_IO;
>  
>      pkt->pos = url_ftell(&s->pb);
>      pkt->stream_index = 0;
> +    pkt->pts = (c->currentframe > 0) ? (FRAME_TIME * (c->currentframe) / av_q2d(s->streams[0]->time_base)) : 1;

set the timebase with av_set_pts_info() correctly

also av_add_index_entry() and related functions could be used for
index and seeking


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070331/3b0505d9/attachment.pgp>



More information about the ffmpeg-devel mailing list