[FFmpeg-devel] [PATCH 6/7] Factorize opt_new_{audio, video, subtitle} definitions.
Michael Niedermayer
michaelni
Tue Aug 24 17:08:10 CEST 2010
On Sat, Aug 14, 2010 at 02:15:24AM +0200, Stefano Sabatini wrote:
> On date Friday 2010-08-13 22:05:52 +0200, Aurelien Jacobs encoded:
> > On Mon, Jul 26, 2010 at 01:53:09PM +0200, Stefano Sabatini wrote:
> > > ---
> > > ffmpeg.c | 36 ++++++++++--------------------------
> > > 1 files changed, 10 insertions(+), 26 deletions(-)
> > >
> > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > index 5c035b4..ff5bfcc 100644
> > > --- a/ffmpeg.c
> > > +++ b/ffmpeg.c
> > > @@ -3603,37 +3603,21 @@ static void new_subtitle_stream(AVFormatContext *oc)
> > > subtitle_stream_copy = 0;
> > > }
> > >
> > > -static void opt_new_audio_stream(void)
> > > +static void opt_new_stream(const char *opt, const char *arg)
> > > {
> > > AVFormatContext *oc;
> > > - if (nb_output_files <= 0) {
> > > - fprintf(stderr, "At least one output file must be specified\n");
> > > - ffmpeg_exit(1);
> > > - }
> > > - oc = output_files[nb_output_files - 1];
> > > - new_audio_stream(oc);
> > > -}
> > > + static void (*fn)(AVFormatContext *oc);
> > > + fn = !strcmp(opt, "newvideo" ) ? new_video_stream :
> > > + !strcmp(opt, "newaudio" ) ? new_audio_stream :
> > > + !strcmp(opt, "newsubtitle") ? new_subtitle_stream : NULL;
> > > + assert(fn);
> >
> > I think it would be simpler without fn. Something like:
> >
> > if (!strcmp(opt, "newvideo" )) new_video_stream(oc);
> > else if (!strcmp(opt, "newaudio" )) new_audio_stream(oc);
> > else if (!strcmp(opt, "newsubtitle")) new_subtitle_stream(oc);
> > else assert(0);
>
> Good point, updated.
> --
> FFmpeg = Fabulous and Freak Mega Proud Erotic Gargoyle
> ffmpeg.c | 34 ++++++++--------------------------
> 1 file changed, 8 insertions(+), 26 deletions(-)
> 14929fa1bb03a4670a809191a14ba7a5baa34768 0004-Factorize-opt_new_-audio-video-subtitle-definitions.patch
> From 7eaccdc0d09304b825272240480216e1ac7a92ad Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Mon, 26 Jul 2010 13:49:53 +0200
> Subject: [PATCH 4/5] Factorize opt_new_{audio,video,subtitle} definitions.
whichever way people prefer ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100824/2e90dcd7/attachment.pgp>
More information about the ffmpeg-devel
mailing list