X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_opt.c;h=55818e1b7341c6a684b14e42bbe0252d45c8fd9f;hb=84cca0644a6157feac74d24a600249986e87e147;hp=d912cb02b5bb1a9529263dd6835435893bcbc6fc;hpb=9f56aceaec5c2e2acd3df91527c95d14ac910bdc;p=ffmpeg diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index d912cb02b5b..55818e1b734 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -74,7 +74,10 @@ const HWAccel hwaccels[] = { { "dxva2", dxva2_init, HWACCEL_DXVA2, AV_PIX_FMT_DXVA2_VLD }, #endif #if CONFIG_VDA - { "vda", vda_init, HWACCEL_VDA, AV_PIX_FMT_VDA }, + { "vda", videotoolbox_init, HWACCEL_VDA, AV_PIX_FMT_VDA }, +#endif +#if CONFIG_VIDEOTOOLBOX + { "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, AV_PIX_FMT_VIDEOTOOLBOX }, #endif { 0 }, }; @@ -163,6 +166,18 @@ static void init_options(OptionsContext *o) o->accurate_seek = 1; } +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; +} + /* return a copy of the input with the stream specifiers removed from the keys */ static AVDictionary *strip_specifiers(AVDictionary *dict) { @@ -659,9 +674,11 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) case AVMEDIA_TYPE_VIDEO: if(!ist->dec) ist->dec = avcodec_find_decoder(dec->codec_id); +#if FF_API_EMU_EDGE if (av_codec_get_lowres(dec)) { dec->flags |= CODEC_FLAG_EMU_EDGE; } +#endif ist->resample_height = ist->dec_ctx->height; ist->resample_width = ist->dec_ctx->width; @@ -1237,7 +1254,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e if (oc->oformat->flags & AVFMT_GLOBALHEADER) ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; - av_opt_get_int(o->g->sws_opts, "sws_flags", 0, &ost->sws_flags); + av_dict_copy(&ost->sws_dict, o->g->sws_dict, 0); av_dict_copy(&ost->swr_opts, o->g->swr_opts, 0); if (ost->enc && av_get_exact_bits_per_sample(ost->enc->id) == 24) @@ -1989,12 +2006,14 @@ static int open_output_file(OptionsContext *o, const char *filename) /* audio: most channels */ if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) { - int channels = 0, idx = -1; + int best_score = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { + int score; ist = input_streams[i]; + score = ist->st->codec->channels + 100000000*!!ist->st->codec_info_nb_frames; if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && - ist->st->codec->channels > channels) { - channels = ist->st->codec->channels; + score > best_score) { + best_score = score; idx = i; } } @@ -3066,8 +3085,8 @@ const OptionDef options[] = { OPT_INPUT, { .off = OFFSET(rate_emu) }, "read input at native frame rate", "" }, { "target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_target }, - "specify target file type (\"vcd\", \"svcd\", \"dvd\"," - " \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, + "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" " + "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" }, { "vsync", HAS_ARG | OPT_EXPERT, { opt_vsync }, "video sync method", "" }, { "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold }, @@ -3229,10 +3248,15 @@ const OptionDef options[] = { "use HW accelerated decoding", "hwaccel name" }, { "hwaccel_device", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) }, - "select a device for HW acceleration" "devicename" }, + "select a device for HW acceleration", "devicename" }, #if HAVE_VDPAU_X11 { "vdpau_api_ver", HAS_ARG | OPT_INT | OPT_EXPERT, { &vdpau_api_ver }, "" }, #endif +#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" }, { "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) }, "automatically insert correct rotate filters" },