[FFmpeg-devel] [PATCH] ffmpeg_opt: Add -hwaccels option that lists all supported hwaccels

Ganesh Ajjanagadde gajjanag at mit.edu
Wed Aug 26 02:05:52 CEST 2015


On Tue, Aug 25, 2015 at 7:47 PM, Timothy Gu <timothygu99 at gmail.com> wrote:
> ---
>  doc/ffmpeg.texi |  4 ++++
>  ffmpeg_opt.c    | 14 ++++++++++++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> index 51a4ec5..e1d8562 100644
> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi
> @@ -698,6 +698,10 @@ is not specified, the value of the @var{DISPLAY} environment variable is used
>  For DXVA2, this option should contain the number of the display adapter to use.
>  If this option is not specified, the default adapter is used.
>  @end table
> +
> + at item -hwaccels
> +List all hardware acceleration methods supported in this build of avconv.
> +

This is ffmpeg, not avconv.

>  @end table
>
>  @section Audio Options
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index a369224..b8b9022 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -205,6 +205,18 @@ static int opt_video_standard(void *optctx, const char *opt, const char *arg)
>      return opt_default(optctx, "standard", arg);
>  }
>
> +static int show_hwaccels(void *optctx, const char *opt, const char *arg)
> +{
> +    int i;
> +
> +    printf("Hardware acceleration methods:\n");
> +    for (i = 0; i < FF_ARRAY_ELEMS(hwaccels) - 1; i++) {
> +        printf("%s\n", hwaccels[i].name);
> +    }
> +    printf("\n");
> +    return 0;
> +}

Doesn't this belong in cmdutils.c?
What was your rationale for placing it here?

> +
>  static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
>  {
>      OptionsContext *o = optctx;
> @@ -3241,6 +3253,8 @@ const OptionDef options[] = {
>  #if CONFIG_VDA || CONFIG_VIDEOTOOLBOX
>      { "videotoolbox_pixfmt", HAS_ARG | OPT_STRING | OPT_EXPERT, { &videotoolbox_pixfmt}, "" },
>  #endif
> +    { "hwaccels",         OPT_EXIT,                                              { .func_arg = show_hwaccels },
> +        "show available HW acceleration methods" },

Likewise, shouldn't this be in cmdutils_common_opts.h?
There is no OPT_EXIT option in this table; they are all in
cmdutils_common_opts.h.

>      { "autorotate",       HAS_ARG | OPT_BOOL | OPT_SPEC |
>                            OPT_EXPERT | OPT_INPUT,                                { .off = OFFSET(autorotate) },
>          "automatically insert correct rotate filters" },
> --
> 1.9.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list