[FFmpeg-devel] [PATCH] better reporting of programs

Michael Niedermayer michaelni
Mon Oct 22 00:15:37 CEST 2007


Hi

On Sun, Oct 21, 2007 at 09:20:02PM +0200, Nico Sabbi wrote:
> Il Saturday 20 October 2007 21:00:47 Reimar D?ffinger ha scritto:
> > Hello,
> >
> > On Sat, Oct 20, 2007 at 08:27:45PM +0200, Michael Niedermayer wrote:
> > > On Wed, Oct 17, 2007 at 11:52:54PM +0200, Nico Sabbi wrote:
> > > > +                        AVFormatContext *ic = input_files[z];
> > > > +                        for(p=0; !found, p<ic->nb_programs;
> > > > p++) { +                            AVProgram *program =
> > > > ic->programs[p]; +                            if(program->id ==
> > > > opt_programid) { +                                for(q=0;
> > > > !found, q<program->nb_stream_indexes; q++) { +                 
> > > >                   int sidx = program->stream_index[q]; +       
> > > >                            
> > > > if(ic->streams[sidx]->codec->codec_type ==
> > > > ost->st->codec->codec_type) { +                                
> > > >        ost->source_index = file_table[z].ist_index + sidx; +   
> > > >                                     found = 1;
> > > > +                                        break;
> > >
> > > this is a classic case where goto should be used or it should be
> > > a seperate function which uses return
> >
> > Given the indentation level I'd say an additional function wouldn't
> > hurt...
> 
> updated

> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revisione 10817)
> +++ ffmpeg.c	(copia locale)
[...]
> @@ -1476,6 +1501,14 @@
>                  }
>  
>              } else {
> +                if(opt_programid) {
> +                    found = 0;
> +                    j = stream_index_from_inputs(input_files, nb_input_files, file_table, ost->st->codec->codec_type, opt_programid);
> +                    if(j != -1) {
> +                        ost->source_index = j;
> +                        found = 1;
> +                    }
> +                } else {

wont this fail if there are more than 1 audio (or video) stream?

why dont you just change the existing stream selection code to skip
streams of non selected programs?

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20071022/38dc0509/attachment.pgp>



More information about the ffmpeg-devel mailing list