From patchwork Thu Jun 11 04:43:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rcombs X-Patchwork-Id: 20277 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 F04CF448CDE for ; Thu, 11 Jun 2020 07:43:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D172B68B485; Thu, 11 Jun 2020 07:43:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from so254-54.mailgun.net (so254-54.mailgun.net [198.61.254.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F76C68B4E8 for ; Thu, 11 Jun 2020 07:43:40 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=rcombs.me; q=dns/txt; s=mx; t=1591850623; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: To: From: Sender; bh=SewwJPq9ihPqkVAul5FWiklPr9ZCB3CmTPvYXdvygPY=; b=hILKBxLMGMNU0My0BFZLoZbxL82wfRc4UUBMF9+oqj8BNZEM2BneiHdvxsMe6kHwLVucHIuR kEajJjXmRMxyt3jcF5Ip69OpgwzkzlGM0rKcDLEhm3bm1v0fmYC0EtUcXWxmJlonPL/nhzWB ffkKBRoUwczQLy6MlSruLC4AgXY= X-Mailgun-Sending-Ip: 198.61.254.54 X-Mailgun-Sid: WyJiZDU1MSIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICJiMGJhIl0= Received: from rcombs-mbp.localdomain ( [24.14.135.13]) by smtp-out-n12.prod.us-west-2.postgun.com with SMTP id 5ee1b667117610c7ffd62c7c (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 11 Jun 2020 04:43:19 GMT From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Jun 2020 23:43:09 -0500 Message-Id: <20200611044312.38981-2-rcombs@rcombs.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611044312.38981-1-rcombs@rcombs.me> References: <20200611044312.38981-1-rcombs@rcombs.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] lavc: add avpriv_h264_get_profile 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" --- libavcodec/h264_parse.c | 21 +++++++++++++++++---- libavcodec/h264_parse.h | 2 ++ libavcodec/version.h | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c index 352ffea948..3069579926 100644 --- a/libavcodec/h264_parse.c +++ b/libavcodec/h264_parse.c @@ -528,18 +528,31 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, */ int ff_h264_get_profile(const SPS *sps) { - int profile = sps->profile_idc; + return avpriv_h264_get_profile(sps->profile_idc, sps->constraint_set_flags); +} + +/** + * Compute profile from profile_idc and constraint_set?_flags. + * + * @param profile_idc profile_idc field from SPS + * @param constraint_set_flags constraint_set_flags field from SPS + * + * @return profile as defined by FF_PROFILE_H264_* + */ +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags) +{ + int profile = profile_idc; - switch (sps->profile_idc) { + switch (profile_idc) { case FF_PROFILE_H264_BASELINE: // constraint_set1_flag set to 1 - profile |= (sps->constraint_set_flags & 1 << 1) ? FF_PROFILE_H264_CONSTRAINED : 0; + profile |= (constraint_set_flags & 1 << 1) ? FF_PROFILE_H264_CONSTRAINED : 0; break; case FF_PROFILE_H264_HIGH_10: case FF_PROFILE_H264_HIGH_422: case FF_PROFILE_H264_HIGH_444_PREDICTIVE: // constraint_set3_flag set to 1 - profile |= (sps->constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0; + profile |= (constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0; break; } diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h index 4d01620125..a1462ad8fd 100644 --- a/libavcodec/h264_parse.h +++ b/libavcodec/h264_parse.h @@ -90,4 +90,6 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, */ int ff_h264_get_profile(const SPS *sps); +int avpriv_h264_get_profile(int profile_idc, int constraint_set_flags); + #endif /* AVCODEC_H264_PARSE_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index 60c0f2460d..03593026b3 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 92 +#define LIBAVCODEC_VERSION_MINOR 93 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \