[Ffmpeg-cvslog] r8715 - in trunk/libavformat: asf.c utils.c

Benoit Fouet benoit.fouet
Fri Apr 13 12:22:00 CEST 2007


M?ns Rullg?rd wrote:
> Benoit Fouet wrote:
>   
>> Hi Baptiste,
>>
>> Baptiste Coudurier wrote:
>>     
>>> Hi
>>>
>>> benoit wrote:
>>>
>>>       
>>>> Author: benoit
>>>> Date: Thu Apr 12 10:11:33 2007
>>>> New Revision: 8715
>>>>
>>>> Modified:
>>>>    trunk/libavformat/asf.c
>>>>    trunk/libavformat/utils.c
>>>>
>>>> Log:
>>>>
>>>> DVR-MS probe audio format
>>>> patch by John Donaghy \ johnfdonaghy chez gmail dot com /
>>>> Original thread:
>>>> date: 03/13/2007 04:56 PM
>>>> subject: [Ffmpeg-devel] [PATCH] DVR-MS probe audio format - was DVR-MS bug
>>>> (MP2 decoding)
>>>>
>>>> [...]
>>>>
>>>> +static int set_codec_from_probe_data(AVStream *st, AVProbeData *pd, int
>>>> score)
>>>> +{
>>>> +    AVInputFormat *fmt;
>>>> +    fmt = av_probe_input_format2(pd, 1, &score);
>>>> +
>>>> +    if (fmt) {
>>>> +        if (strncmp(fmt->name, "mp3", 3) == 0)
>>>> +            st->codec->codec_id = CODEC_ID_MP3;
>>>> +        else if (strncmp(fmt->name, "ac3", 3) == 0)
>>>> +            st->codec->codec_id = CODEC_ID_AC3;
>>>> +    }
>>>> +    return fmt;
>>>> +}
>>>>
>>>>         
>>> utils.c:1661: warning: return makes integer from pointer without a cast
>>>       
>> what is prefered ?
>> casting the return, or change function return type and table type ?
>>     
>
> Casting a pointer to int is almost always wrong.
>
> What is the function supposed to return?  If it is meant to return an
> integer indicating whether a format was found
it seems so:

+                codec_identified[st->index] = set_codec_from_probe_data(st, &(probe_data[st->index]), 0);
+                if (codec_identified[st->index]) {
+                    st->need_parsing = 1;

and

+        if (codec_identified[st->index]) {
+            av_read_frame_flush(ic);
+            av_seek_frame(ic, st->index, 0.0, 0);
+            url_fseek(&ic->pb, ic->data_offset, SEEK_SET);
+        }


> , use !!fmt.  That still
> doesn't seem quite right though, as only mp3 and ac3 cause any action
> to be taken.
>
>   
this is the simplest thing to do, i think
(and btw, sorry for this commit, i sure need to check a bit more
compilation warnings from now on...)

Ben





More information about the ffmpeg-cvslog mailing list