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

Maksym Veremeyenko verem
Fri Sep 4 08:29:25 CEST 2009


Baptiste Coudurier ???????(??):
[...]
>>  
>> -            volume_len = get_byte(pb);
>> -            volume_len = FFMIN(volume_len, 27);
>> -            get_buffer(pb, volume, 27);
>> -            volume[volume_len] = 0;
>> -            av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len);
>> +            /* read volume name */
>> +            len = get_byte(pb);
>> +            len = FFMIN(len, 27);
>> +            dref->volume_name = av_mallocz(28);
> 
> use volume[28] in MOVDref structure.
> 
>> +            get_buffer(pb, dref->volume_name, 27);
>> +            dref->volume_name[len] = 0;
>> +            av_log(c->fc, AV_LOG_DEBUG, "volume name [%s], len %d\n",
>> +                   dref->volume_name, len);
>>  
>> -            url_fskip(pb, 112);
>> +            url_fskip(pb, 12);
>>  
>> +            /* read file name */
>> +            len = get_byte(pb);
>> +            len = FFMIN(len, 63);
>> +            dref->file_name = av_mallocz(64);
>> +            get_buffer(pb, dref->file_name, 63);
> 
> use filename[64] in MOVDref structure.
> 
>> [...]
>>
>>                  if (len&1)
>>                      len += 1;
>>                  if (type == 2) { // absolute path
>> -                    av_free(dref->path);
>> -                    dref->path = av_mallocz(len+1);
>> -                    if (!dref->path)
>> +                    av_free(dref->absolute_path);
>> +                    dref->absolute_path = av_mallocz(len + 1);
>> +                    if (!dref->absolute_path)
>>                          return AVERROR(ENOMEM);
> 
> Renaming the field can be done in a separate patch.
I can live with current naming....

> 
>> [...]
>>
>> +                } else if (type == 0) { // directory name
>> +                    av_free(dref->directory_name);
>> +                    dref->directory_name = av_mallocz(len + 1);
>> +                    if (!dref->directory_name)
>> +                        return AVERROR(ENOMEM);
>> +                    get_buffer(pb, dref->directory_name, len);
>> +                    dref->directory_name[len] = 0;
> 
> If you mallocz you don't need to set last byte to 0.
Thanks for comments.

I decide to split a patch into two parts.
First part attached. It almost cosmetic and do nothing with changing 
functionality, just extend *MOVDref* and reading procedure.

> Probe and build can be simplified by avoiding building the list:
> Just iterate through the possible until one open sucessfully.
> Use a char path[1024] for one possible path.
> 
> I hope I'm clear enough :>
Yeah.
I will post it as separate as patch that "just change" probing method...

Are there any objections about attached patch?

-- 
________________________________________
Maksym Veremeyenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mov_refs_alis_read_extend.patch
Type: text/x-patch
Size: 3812 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090904/19c34065/attachment.bin>



More information about the ffmpeg-devel mailing list