[FFmpeg-devel] [PATCH] print streams no associated with any program
Baptiste Coudurier
baptiste.coudurier
Mon Oct 19 04:15:03 CEST 2009
On 10/18/09 5:07 PM, Michael Niedermayer wrote:
> 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
>
Applied.
>
>>
>>>
>>>
>>>>
>>>> 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
Well I didn't add the check.
Here is patch to check stream index in av_program_add_stream_index.
--
Baptiste COUDURIER
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: program_check_stream_index.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091018/b5d4497b/attachment.asc>
More information about the ffmpeg-devel
mailing list