[FFmpeg-devel] [PATCH] First shot at AVCHD seeking via new seeking API

Michael Niedermayer michaelni
Mon Sep 7 19:48:18 CEST 2009


On Sun, Sep 06, 2009 at 06:33:35PM +0200, Ivan Schreter wrote:
> Michael Niedermayer wrote:
>> On Sat, Sep 05, 2009 at 09:52:49PM +0200, Ivan Schreter wrote:
>>   
>>> Hi Michael,
>>>
>>> Michael Niedermayer wrote:
>>>     
>>>> On Sun, Aug 30, 2009 at 10:11:21AM +0200, Ivan Schreter wrote:
>>>> [...]
>>>>         
>>>>> BTW, I found out that pure seeking routine time can be reduced about 
>>>>> factor 3 for full-HD AVCHD files, when using higher initial step size 
>>>>> (32KB) for back-off. I will investigate how this step size could be 
>>>>> automagically determined optimally.
>>>>>             
>>>> the initial size should be at least ByteIOContext.buffer_size which is 
>>>> 32kb
>>>> by default
>>>>
>>>>         
>>> So I suppose something like this should be more suitable, right?
>>>
>>> Index: libavformat/seek.c
>>> ===================================================================
>>> --- libavformat/seek.c  (revision 19773)
>>> +++ libavformat/seek.c  (working copy)
>>> @@ -342,8 +342,10 @@
>>>
>>>     // Find keyframes in all active streams with timestamp/position just 
>>> before
>>>     // and just after requested timestamp/position.
>>> -    step = 1024;
>>> -    curpos = pos;
>>> +    step = 32768;
>>>     
>>
>> i think it should be ByteIOContext.buffer_size, not 32768, yes i meant
>> that litterally
>>   
>
> So like this, then:
>
> Index: libavformat/seek.c
> ===================================================================
> --- libavformat/seek.c  (revision 19788)
> +++ libavformat/seek.c  (working copy)
> @@ -342,8 +342,8 @@
>
>     // Find keyframes in all active streams with timestamp/position just 
> before
>     // and just after requested timestamp/position.
> -    step = 1024;
> -    curpos = pos;
> +    step = s->pb->buffer_size;
> +    curpos = FFMAX(pos - step / 2, 0);
>     for (;;) {
>         url_fseek(s->pb, curpos, SEEK_SET);
>         search_hi_lo_keyframes(s,
>
> I also addressed the comment from Reimar regarding FFMAX.
>

> I suppose, you are OK with me committing incremental improvements on 
> seek.[ch] to svn, now that it's disabled?

yes


>
> I also would like to commit the new read_seek2 and read_seek routines in 
> lavf/mpeg.c (basically same as in mpegts), similarly disabled as now in 
> lavf/mpegts.c, so interested people can test. Would that be OK?

please send a patch, ill try to look at it in the next days

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090907/504e6d11/attachment.pgp>



More information about the ffmpeg-devel mailing list