From patchwork Tue Feb 7 10:05:55 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: 2444 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2436647vsb; Tue, 7 Feb 2017 12:19:43 -0800 (PST) X-Received: by 10.223.133.226 with SMTP id 31mr15121446wru.137.1486498783796; Tue, 07 Feb 2017 12:19:43 -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 z133si307526wmg.33.2017.02.07.12.19.43; Tue, 07 Feb 2017 12:19:43 -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=@gmail.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A77568995A; Tue, 7 Feb 2017 22:19:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB7EA689725 for ; Tue, 7 Feb 2017 12:28:17 +0200 (EET) Received: by mail-pg0-f68.google.com with SMTP id v184so11793344pgv.1 for ; Tue, 07 Feb 2017 02:28:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EHo7tkCp7u7HjLWsq23buf6UZVNWqf8GJ+9pUNNwjoQ=; b=ZNIKQi+5KMcxD6mTIZPm2YDmq/3wJCN840j/5q30iCevVlP9ijnrHFzy7eGZJ04ccM yd4SkzbkPcGCmScj5u5e1ySOss5fjRVGfEFcO5K8JDYuw5YPU+Wov92Sz6xDTNGSQ4MO X9GVc8nJOf2YvMuzXLdat8gI0JEfJDNM9l52hY/nODcjeNuswvhye/hsfGflv9xv41X3 X1EMVhWwPYXa/eInN+Iv2iOQuK98WmFyCi6umiltP1VNDq50fulhypYny2CAChUfI9Se Ps1mLyS7+05RvDVgG8CYCleWxC/MOCPmOZL6pAT0ZaIcSkk33YXhnU+iSaM5u60rL4YR biZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EHo7tkCp7u7HjLWsq23buf6UZVNWqf8GJ+9pUNNwjoQ=; b=l1rRdfYVQxAKG7Brert0HECeZUSeGk5Ju3W824PMcNTYeqIC6qMldTtIJ9HaTUko2S 6W/pcmjoDLDmrQ2+PM5v6Qe/CTdN0bEKais4DamGQd/0OEAWj9cqS5clmbQlNO2EB85i cHhXX7754wPtb39bztsPrrjslpcnFm9vwv5ohcAsKPjB7cby1V6q+N1Q3Qct7XX7gdKO yR6aZevriztW9mp/Lii1mk3Gi5idOUdcWf3Ld5fmhjMYdfBdOyS4YZ4mVd48OCCnhJgJ /PTgihfKWjAr2wn+mzgIwcOJoR/0DNEBMgaTUN0EREipW/Awq1NjVDPmCG2TDAlFdeZj Lb3g== X-Gm-Message-State: AIkVDXIRLDbXNC0SCtUqvnJ414xW7lzS0PyMbWuDRjaJwnm7ezq2G/gj2p0pkhg5H34x/Q== X-Received: by 10.84.162.204 with SMTP id o12mr24912016plg.132.1486461960742; Tue, 07 Feb 2017 02:06:00 -0800 (PST) Received: from localhost.localdomain (h175-177-005-129.catv02.itscom.jp. [175.177.5.129]) by smtp.gmail.com with ESMTPSA id 89sm9745647pfo.40.2017.02.07.02.05.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Feb 2017 02:06:00 -0800 (PST) From: Takayuki 'January June' Suwa To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Feb 2017 19:05:55 +0900 Message-Id: <1486461955-20438-1-git-send-email-jjsuwa.sys3175@gmail.com> X-Mailer: git-send-email 2.1.4 X-Mailman-Approved-At: Tue, 07 Feb 2017 22:19:36 +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 Cc: Takayuki 'January June' Suwa MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Takayuki 'January June' Suwa 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(+) 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); } @@ -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 } };