[FFmpeg-devel] [PATCH] mov reference files search improvement

Maksym Veremeyenko verem
Fri Sep 18 08:30:48 CEST 2009


Baptiste Coudurier ???????(??):
> Hi,
> 
> On 09/17/2009 07:59 AM, Maksym Veremeyenko wrote:
>> Hi!
>>
>> Another one attempt to post an updated patched to support $subj
>>
>> Please, comment, commit or reject.
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: libavformat/isom.h
>> ===================================================================
>> --- libavformat/isom.h    (revision 19804)
>> +++ libavformat/isom.h    (working copy)
[...]
> 
> 
> This part is ok.
Is possible to commit *mov_refs_alis_read_extend_v2.patch* ?


>> ------------------------------------------------------------------------
>>
>> --- libavformat/mov.c.step1    2009-09-10 08:47:11.000000000 +0300
>> +++ libavformat/mov.c    2009-09-10 11:11:40.000000000 +0300
>> @@ -1542,6 +1542,52 @@
>>       }
>>   }
>>
>> +static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
>> +{
>> +    /* probe absolute path */
>> +    if (!url_fopen(pb, ref->path, URL_RDONLY))
>> +        return 0;
>> +
>> +    /* probe relative path */
>> +    if (ref->nlvl_to>  0&&  ref->nlvl_from>  0) {
>> +        char filename[1024];
>> +        char *src_path;
>> +        int i, l;
>> +
>> +        /* find a source dir */
>> +        src_path = FFMAX(strrchr(src, '/'), strrchr(src, '\\'));
> 
> \ is allowed on unix.

i replaced with code:
[...]
         /* find a source dir */
#ifdef __MINGW32__
         src_path = FFMAX(strrchr(src, '/'), strrchr(src, '\\'));
#else
         src_path = strrchr(src, '/');
#endif
[...]
so make \ been supported only in a case of MINGW

> 
>  > [...]
>  >
>> +        /* find tail by ref->path and nlvl_To */
> 
> grammar problem
fixed?


> 
>> +        for (i = 0, l = strlen(ref->path) - 1; l>= 0; l--)
>> +            if ('/' == ref->path[l]) {
>> +                if(i == ref->nlvl_to - 1) break;
>> +                else                      i++;
>> +            }
>> +
> 
> strrchr ?
In this section we should find a nlvl_to-th level from end of path. 
Using *strrchr* will require temporarily storage for *ref->path* 
variable because it has to be terminated nlvl_to-th times. So using 
simple reverse looking up for nlvl_to-th slash is more optimal than 
looking nlvl_to times for last slash using strrchr ...

> 
>> +        /* check if it found */
> 
> grammar problem
> 
fixed?

> You don't use dref->dir at all ?
Currently *dref->dir* not used, because method #2 from my testcases 
(http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-September/075246.html) 
is useless, so may be someone later could add more heuristic method for 
relative search of references bases on *dref->dir* and *dref->filename*....

> I thought nlvl_to was useless after all ?
> 
No. *nlvl_to* and *nlvl_from* are used for building path to reference. 
*nlvl_From* is used to build _rising_ part of reference filename (../) 
and *nlvl_to* is used to build _descend_ part.

Newer patch attached.
Please, comment that one.

-- 
________________________________________
Maksym Veremeyenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mov_refs_open_dref_v4.patch
Type: text/x-patch
Size: 2573 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090918/0dbc3476/attachment.bin>



More information about the ffmpeg-devel mailing list