From patchwork Mon Apr 8 08:53:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zachary Zhou X-Patchwork-Id: 12639 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 45CBB449305 for ; Mon, 8 Apr 2019 11:54:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2779F68AB03; Mon, 8 Apr 2019 11:54:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 77B7A68A9D9 for ; Mon, 8 Apr 2019 11:54:08 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 01:54:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,324,1549958400"; d="scan'208";a="334782914" Received: from jiandon-desk.sh.intel.com ([10.239.193.48]) by fmsmga006.fm.intel.com with ESMTP; 08 Apr 2019 01:54:05 -0700 From: Zachary Zhou To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Apr 2019 16:53:32 +0800 Message-Id: <20190408085334.23947-1-zachary.zhou@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH RFC v2 1/3] fftools: Add thumbnail output to vaapi_h264 decoder X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: zachary.zhou@intel.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is sample code for reference HW support for decode+scaling in a single HW command (VDBOX+SFC). The primary target usage is video analytics, but can be used playback, transcoding, etc. For VAAPI - https://github.com/intel/libva basically, it allows multiple outputs (in different resolutions) using the decode context in a single call (you can search for “additional_outputs” in va.h). VAAPI sample code - https://github.com/intel/libva-utils/commit/957a269f02b00760b7e807643c821ee26abc529b --- fftools/ffmpeg_opt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 53d688b764..c0dc376541 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -111,6 +111,10 @@ int filter_nbthreads = 0; int filter_complex_nbthreads = 0; int vstats_version = 2; +int thumbnail_flags = 0; +int thumbnail_width = 0; +int thumbnail_height = 0; +char *thumbnail_format; static int intra_only = 0; static int file_overwrite = 0; @@ -1100,6 +1104,13 @@ static int open_input_file(OptionsContext *o, const char *filename) av_dict_set(&o->g->format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE); scan_all_pmts_set = 1; } + + //thumbnail opt + av_dict_set_int(&o->g->codec_opts, "thumbnail_flags", thumbnail_flags, AV_DICT_DONT_OVERWRITE); + av_dict_set_int(&o->g->codec_opts, "thumbnail_width", thumbnail_width, AV_DICT_DONT_OVERWRITE); + av_dict_set_int(&o->g->codec_opts, "thumbnail_height", thumbnail_height, AV_DICT_DONT_OVERWRITE); + av_dict_set(&o->g->codec_opts, "thumbnail_format", thumbnail_format, AV_DICT_DONT_OVERWRITE); + /* open the input file with generic avformat function */ err = avformat_open_input(&ic, filename, file_iformat, &o->g->format_opts); if (err < 0) { @@ -2898,6 +2909,13 @@ static int opt_vstats_file(void *optctx, const char *opt, const char *arg) return 0; } +static int opt_thumbnail_format(void *optctx, const char *opt, const char *arg) +{ + av_free (thumbnail_format); + thumbnail_format = av_strdup (arg); + return 0; +} + static int opt_vstats(void *optctx, const char *opt, const char *arg) { char filename[40]; @@ -3746,5 +3764,15 @@ const OptionDef options[] = { { "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_hw_device }, "set hardware device used when filtering", "device" }, + //thumbnail opt + { "thumbnail_flags", OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT, { &thumbnail_flags }, + "set thumbnail flags", "thumbnail" }, + { "thumbnail_width", OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT, { &thumbnail_width }, + "set thumbnail width", "thumbnail" }, + { "thumbnail_height", OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT, { &thumbnail_height }, + "set thumbnail height", "thumbnail" }, + { "thumbnail_format", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_thumbnail_format }, + "set thumbnail format", "thumbnail" }, + { NULL, }, };