[FFmpeg-devel] dv_read_seek fix for audio stream seek

Michael Niedermayer michaelni
Wed Jun 13 22:05:44 CEST 2007


Hi

On Wed, Jun 13, 2007 at 01:41:39PM +0300, Maksym Veremeyenko wrote:
> Dear Developers!
> 
> I found a problem with seeking with raw DV format. Problem that seeking 
> function 'dv_read_seek' do not depends on stream and use video timebase 
> to calc offset in file. If i point audio stream as argument - it seek to 
> wrong position due to audio has fixed 1/30000 timebase but video 1/25 or 
> 1001/30000 depends on format.
> 
> Attached patch fix that problem - add recalculating of timestamp if 
> stream index is greater 0 (audio streams).
[...]
> Index: libavformat/dv.c
> ===================================================================
> --- libavformat/dv.c	(revision 9168)
> +++ libavformat/dv.c	(working copy)
> @@ -422,7 +422,15 @@
>  {
>      RawDVContext *r = s->priv_data;
>      DVDemuxContext *c = r->dv_demux;
> -    int64_t offset= dv_frame_offset(s, c, timestamp, flags);
> +    int64_t offset;
> +    
> +    /* fix timestamp depends on stream_index */
> +    if(stream_index > 0)
> +	/* audio timebase is 1/30000 */
> +	timestamp = (timestamp * c->sys->frame_rate) / 
> +	    (30000LL * c->sys->frame_rate_base);
> +    
> +    offset= dv_frame_offset(s, c, timestamp, flags);
>  

tabs and trailing whitespace are forbidden in svn

also depending on flags the rounding direction will be wrong and will
lead to a +-1 incorrect destination frame

and the seek regression test checksums might need updating

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- 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/20070613/21aac3f6/attachment.pgp>



More information about the ffmpeg-devel mailing list