[FFmpeg-devel] [PATCH 4/9] ffmpeg_opt: allow to force codec in new_output_stream

Michael Niedermayer michaelni at gmx.at
Tue Nov 11 13:07:40 CET 2014


On Tue, Nov 11, 2014 at 08:31:26AM +0100, Lukasz Marek wrote:
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>  ffmpeg_opt.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 77ef0c4..1b3f73a 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1036,11 +1036,12 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
>      return ret;
>  }
>  
> -static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
> +static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost, const AVCodec *forced_codec)
>  {
> -    char *codec_name = NULL;
> +    const char *codec_name = forced_codec ? forced_codec->name : NULL;
>  
> -    MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
> +    if (!codec_name)
> +        MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
>      if (!codec_name) {
>          ost->st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename,
>                                                    NULL, ost->st->codec->codec_type);

i think its simpler to set the codec name than to add a way to bypass
it, see opt_target()


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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141111/4348f323/attachment.asc>


More information about the ffmpeg-devel mailing list