[FFmpeg-devel] [PATCH] print streams no associated with any program

Michael Niedermayer michaelni
Mon Oct 19 02:07:36 CEST 2009


On Sun, Oct 18, 2009 at 03:54:33PM -0700, Baptiste Coudurier wrote:
> On 10/18/09 3:30 PM, Michael Niedermayer wrote:
>> On Sun, Oct 18, 2009 at 02:56:28PM -0700, Baptiste Coudurier wrote:
>>> Hi guys,
>>>
>>> $subject, based on patch by wg in issue #835, this patch should fix issue
>>> #1366.
>>>
>>> I decided to malloc the array to avoid MAX_STREAMS usage which ideally
>>> should be removed in the future.
>>>
>>> --
>>> Baptiste COUDURIER
>>> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
>>> FFmpeg maintainer                                  http://www.ffmpeg.org
>>
>>>   utils.c |   21 +++++++++++++++------
>>>   1 file changed, 15 insertions(+), 6 deletions(-)
>>> 26d08598f98529d8a6b1d7da5074a36dc41b08de  
>>> print_streams_not_associated_with_any_program.patch
>>> Index: libavformat/utils.c
>>> ===================================================================
>>> --- libavformat/utils.c	(revision 20289)
>>> +++ libavformat/utils.c	(working copy)
>>> @@ -2902,6 +2902,9 @@
>>>                    int is_output)
>>>   {
>>>       int i;
>>> +    uint8_t *printed = av_mallocz(ic->nb_streams);
>>> +    if (!printed)
>>> +        return;
>>
>> IIRC malloc(0) can be NULL
>> its a odd case but i think this shouldnt return in that case here
>>
>> except that your patch is ok
>
> Patch updated.

ok


>
>>
>>
>>>
>>>       av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
>>>               is_output ? "Output" : "Input",
>>> @@ -2940,19 +2943,25 @@
>>>           av_log(NULL, AV_LOG_INFO, "\n");
>>>       }
>>>       if(ic->nb_programs) {
>>> -        int j, k;
>>> +        int j, k, total = 0;
>>>           for(j=0; j<ic->nb_programs; j++) {
>>>               AVMetadataTag *name = 
>>> av_metadata_get(ic->programs[j]->metadata,
>>>                                                     "name", NULL, 0);
>>>               av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", 
>>> ic->programs[j]->id,
>>>                      name ? name->value : "");
>>> -            for(k=0; k<ic->programs[j]->nb_stream_indexes; k++)
>>> +            for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) {
>>>                   dump_stream_format(ic, 
>>> ic->programs[j]->stream_index[k], index, is_output);
>>> +                printed[ic->programs[j]->stream_index[k]] = 1;
>>
>> off topic but this line made me think that av_program_add_stream_index()
>> should check that idx is within the valid range
>>
>
> Do you want me to add a check here as well ?

hmm, dunno, do as you prefer

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- 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/20091019/12ed19ed/attachment.pgp>



More information about the ffmpeg-devel mailing list