From patchwork Mon Feb 6 21:28:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 2438 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp1994649vsb; Mon, 6 Feb 2017 15:12:53 -0800 (PST) X-Received: by 10.28.5.72 with SMTP id 69mr9857188wmf.6.1486422773852; Mon, 06 Feb 2017 15:12:53 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 91si2690198wrs.143.2017.02.06.15.12.30; Mon, 06 Feb 2017 15:12:53 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@yahoo.co.jp; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0FFA9680A24; Tue, 7 Feb 2017 01:12:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nh604-vm13.bullet.mail.ssk.yahoo.co.jp (nh604-vm13.bullet.mail.ssk.yahoo.co.jp [182.22.90.70]) by ffbox0-bg.mplayerhq.hu (Postfix) with SMTP id 37BE968058C for ; Mon, 6 Feb 2017 23:28:11 +0200 (EET) Received: from [182.22.66.104] by nh604.bullet.mail.ssk.yahoo.co.jp with NNFMP; 06 Feb 2017 21:28:12 -0000 Received: from [182.22.91.129] by t602.bullet.mail.ssk.yahoo.co.jp with NNFMP; 06 Feb 2017 21:28:12 -0000 Received: from [127.0.0.1] by omp602.mail.ssk.yahoo.co.jp with NNFMP; 06 Feb 2017 21:28:12 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 434730.88996.bm@omp602.mail.ssk.yahoo.co.jp Received: (qmail 33775 invoked by alias); 6 Feb 2017 21:28:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.jp; s=yj20110701; t=1486416492; bh=diKrlWbFx3vuHcCaLTE9K4iUY2vfkUlF3Qrql378Z4Q=; h=Received:X-YMail-JAS:X-Apparently-From:X-YMail-OSG:Reply-To:From:Subject:To:Message-ID:Date:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; b=u0lNQf00ba7+Vxo+4Nhj7ytssWHidBUhKIf3IwTSNq6WCHE758veVj6X1056Gy2FBfAtcWyTvg8kUYdq3EoHQ4wU9nYRC/vCW6DJWlarfoB3r2cO/H5BgMjaZYppUKmSGLP0Hd1BWzZyK8O8kingZNkpmHoTgctB9ewLgHaY1bY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Received:X-YMail-JAS:X-Apparently-From:X-YMail-OSG:Reply-To:From:Subject:To:Message-ID:Date:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; b=GzYLdG3b9ooS0xJ3ZLC8SH/S2mIWfgYJ7GjsDkeaH/Zc5/ayPBhtwKMqIxSP1q8yZTvJjxV32zd+c2gcyyvBSais4Tq7DcNgclSQC7aRgtqwMcQrR9JswGwioRHz8EeMMHeb2OgxHc371nWQiQ7UBojCxjqeCDEEh2KxpDBsB1s= ; Received: from unknown (HELO ?192.168.2.3?) (175.177.5.129 with plain) by smtp529.mail.kks.yahoo.co.jp with SMTP; 6 Feb 2017 21:28:12 -0000 X-YMail-JAS: wiO8ktEVM1mdLjgtoXemFhhWMxcdY3N2YhezyViENsO4QDKtNd0tGGi0MTUxglSRxKPztsNmhlbndJ6yRYbyRAi7wDZm5zhwETgXYN0oSfohG5dkyjwYgHu9A.w_ZpSYtA-- X-Apparently-From: X-YMail-OSG: CQ2sNzQVM1kJuYgGZFBBl9xBQaFC8swf1DSZ2homzJmPkw9 MgzHhYGpCiB5igRojzAN7StlX7mD7.Ti8t0BgkHnY3ZQL2NoOnZ5C92lzemP SSKXIw6G6VuHVG8G.uf_5R89SJ3IJqWbiE2SIIhQwJrDCIpbNYrCqeeSUgf. z2u5jlR3NBHQFu5PyZgMfxtBv1Ij5.UOQGsdoFCPCfds5ZBLzsAIWbqZniBI W6sOiXd70ZJk.S9Wo6Ga15_vAvSIxcAAzTodQ04ovmCfmucBn7.vTMlS.gxW NI3I8_VWMkp_XkMyXXcKZE7v.I39.3fG9wHv_KGTUu.I6IdhX38_UileAveQ uRRlRoLC9gVUTQXkT9Z_fJv6VAKecB5W_FKQMaB9OhS5jtNEAnYl8zwsIqiY 4B2OKqoaN8Vi7LA1i.Ss34WEhyyX7d5w3NVE3k._z3DlsyDvScw8ex4ig5R_ xzqG0xjttVPvoex7L8BeZUd0y3zvbMULhc0YXRaxU1XZfY6Z9ne3ZyusBU3f WfNQAHlX0vY4F1AZaN0oy_vDak00kuMmzVLv1E.qxhy59huwN From: Takayuki 'January June' Suwa To: ffmpeg-devel@ffmpeg.org Message-ID: <8f101a2d-650e-1200-a8ee-b9ca48f9f753@yahoo.co.jp> Date: Tue, 7 Feb 2017 06:28:11 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 07 Feb 2017 01:12:24 +0200 Subject: [FFmpeg-devel] [PATCH] omx: Add support for specifying H.264 profile [v2] 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This adds "-profile[:v] profile_name"-style option IOW. Thanks for reviewing my poor ugly patch, Mark... and I get back to an original purpose - forcing OMX to use baseline profile. (eg. RasPiCam-to-Ustream webcasting w/o additional xcoding) --- libavcodec/omx.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) } @@ -884,6 +899,10 @@ static const AVOption options[] = { { "omx_libname", "OpenMAX library name", OFFSET(libname), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE }, { "omx_libprefix", "OpenMAX library prefix", OFFSET(libprefix), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE }, { "zerocopy", "Try to avoid copying input frames if possible", OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, + { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, FF_PROFILE_H264_HIGH, VE, "profile" }, + { "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE }, 0, 0, VE, "profile" }, + { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN }, 0, 0, VE, "profile" }, + { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_HIGH }, 0, 0, VE, "profile" }, { NULL } }; diff --git a/libavcodec/omx.c b/libavcodec/omx.c index 16df50e..faa70ae 100644 --- a/libavcodec/omx.c +++ b/libavcodec/omx.c @@ -226,6 +226,7 @@ typedef struct OMXCodecContext { int output_buf_size; int input_zerocopy; + int profile; } OMXCodecContext; static void append_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond, @@ -523,6 +524,20 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role) CHECK(err); avc.nBFrames = 0; avc.nPFrames = avctx->gop_size - 1; + switch (s->profile) { + case FF_PROFILE_H264_BASELINE: + avctx->profile = s->profile; + avc.eProfile = OMX_VIDEO_AVCProfileBaseline; + break; + case FF_PROFILE_H264_MAIN: + avctx->profile = s->profile; + avc.eProfile = OMX_VIDEO_AVCProfileMain; + break; + case FF_PROFILE_H264_HIGH: + avctx->profile = s->profile; + avc.eProfile = OMX_VIDEO_AVCProfileHigh; + break; + } err = OMX_SetParameter(s->handle, OMX_IndexParamVideoAvc, &avc); CHECK(err);