From patchwork Wed Jan 13 12:03:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu-Cheng Li X-Patchwork-Id: 8024321 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 929869F744 for ; Wed, 13 Jan 2016 12:04:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA49620458 for ; Wed, 13 Jan 2016 12:04:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D3C120461 for ; Wed, 13 Jan 2016 12:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934471AbcAMMEA (ORCPT ); Wed, 13 Jan 2016 07:04:00 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35972 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934373AbcAMMD7 (ORCPT ); Wed, 13 Jan 2016 07:03:59 -0500 Received: by mail-pa0-f53.google.com with SMTP id yy13so264910448pab.3 for ; Wed, 13 Jan 2016 04:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z1K6UsmaE4oN4l0uekC3kN7uvTNPkww/PNsj7WcCbuY=; b=DZC+fVj5o0ydL0ZJ9NKQf3F8jL+FQOYlEii5Bor3fEnw594GY5ydpaCARR/4yNd/28 M8Fryx3cvxdM5lac2SXVqNwT4S6wf5R69MoNpr/us0djMEA96ggBZgRbs5yp/g26KCqv /nUo0Xwg1HOv/Ss/Ycn/EB6Oqb8G+aWzB5FHE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z1K6UsmaE4oN4l0uekC3kN7uvTNPkww/PNsj7WcCbuY=; b=fD5ybGSZpCtF2s+Zb3gIwJzM3xzXYFNPqsc0Y7gNTfZYePXZN5nM23OeivXrEinhRn yjk0LnrlBHpTO57K1oEx8/ug6DYzNa6qIwm1Rlqz8lmnKMBfpxz47Wpnz8pt6ymLfHdl UH8na6btYy2HGgI6/KJFAeSwLQdEJNFSQ7vz/+MBjTCp9ElJUIm/Ro8Pb8mE7bxq6pnX mOwmW8Z1jUuzRD2ZuS2akPlU19u9AFl6vjQRqSYjhCK2EiEvBhnQ/o2zzuYIq2Gi46d7 9XAGN0Aj6smGowmJTXzOT9ybX+kJ0U2Jh2MFynYM4bfLhjX0LQXSJl/xlHUhRjd019Zm e0/w== X-Gm-Message-State: ALoCoQnaWcidhgmzOCMR3KIofhvqfCwTHRp2Qe0DetTR06/ViNKJTi7EG46on0x+fCgnxRGcORq1/DDNGFrKJieojU0v0bA1Fw== X-Received: by 10.66.252.102 with SMTP id zr6mr111080595pac.66.1452686638595; Wed, 13 Jan 2016 04:03:58 -0800 (PST) Received: from wuchengli-z840.tpe.corp.google.com ([172.30.210.26]) by smtp.gmail.com with ESMTPSA id xz6sm2163768pab.42.2016.01.13.04.03.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jan 2016 04:03:58 -0800 (PST) From: Wu-Cheng Li To: pawel@osciak.com, mchehab@osg.samsung.com, hverkuil@xs4all.nl, k.debski@samsung.com, crope@iki.fi, standby24x7@gmail.com, wuchengli@chromium.org, nicolas.dufresne@collabora.com, ricardo.ribalda@gmail.com, ao2@ao2.it, bparrot@ti.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH] v4l: add V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE. Date: Wed, 13 Jan 2016 20:03:31 +0800 Message-Id: <1452686611-145620-2-git-send-email-wuchengli@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1452686611-145620-1-git-send-email-wuchengli@chromium.org> References: <1452686611-145620-1-git-send-email-wuchengli@chromium.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some drivers also need a control like V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE to force an encoder frame type. Add a general V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE so the new drivers and applications can use it. Signed-off-by: Wu-Cheng Li --- Documentation/DocBook/media/v4l/controls.xml | 23 +++++++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 13 +++++++++++++ include/uapi/linux/v4l2-controls.h | 5 +++++ 3 files changed, 41 insertions(+) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index f13a429..326947c 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -2330,6 +2330,29 @@ vertical search range for motion estimation module in video encoder. + + V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE  + enum v4l2_mpeg_video_force_frame_type + + Force a frame type for the next queued buffer. Applicable to encoders. +This is a general, codec-agnostic keyframe control. This is a write-only and execute-on-write control. Possible values are: + + + + + + V4L2_MPEG_FORCE_FRAME_TYPE_DISABLED  + Force a specific frame type disabled. + + + V4L2_MPEG_FORCE_FRAME_TYPE_I_FRAME  + Force an I-frame. + + + + + + V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE  integer diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c9d5537..53a8f72 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -315,6 +315,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "Max Bytes", NULL, }; + static const char * const force_frame_type[] = { + "Disabled", + "I Frame", + NULL, + }; static const char * const entropy_mode[] = { "CAVLC", "CABAC", @@ -533,6 +538,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return header_mode; case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return multi_slice; + case V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE: + return force_frame_type; case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: return entropy_mode; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: @@ -747,6 +754,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE: return "Horizontal MV Search Range"; case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE: return "Vertical MV Search Range"; case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: return "Repeat Sequence Header"; + case V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE: return "Force an encoded frame type"; /* VPX controls */ case V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS: return "VPX Number of Partitions"; @@ -1045,6 +1053,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DETECT_MD_MODE: *type = V4L2_CTRL_TYPE_MENU; break; + case V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE: + *type = V4L2_CTRL_TYPE_MENU; + *flags |= V4L2_CTRL_FLAG_WRITE_ONLY | + V4L2_CTRL_FLAG_EXECUTE_ON_WRITE; + break; case V4L2_CID_LINK_FREQ: *type = V4L2_CTRL_TYPE_INTEGER_MENU; break; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 2d225bc..c2be60c 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -390,6 +390,11 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226) #define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227) #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) +#define V4L2_CID_MPEG_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_BASE+229) +enum v4l2_mpeg_video_force_frame_type { + V4L2_MPEG_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0, + V4L2_MPEG_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1, +}; #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)