From patchwork Tue Nov 8 22:03:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 1350 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1934007vsb; Tue, 8 Nov 2016 14:18:28 -0800 (PST) X-Received: by 10.194.87.130 with SMTP id ay2mr11679983wjb.44.1478643508054; Tue, 08 Nov 2016 14:18:28 -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 t126si18960936wmg.88.2016.11.08.14.18.16; Tue, 08 Nov 2016 14:18:28 -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 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 89236689C9B; Wed, 9 Nov 2016 00:18:10 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7885D689256 for ; Wed, 9 Nov 2016 00:18:03 +0200 (EET) Received: by mail-qt0-f195.google.com with SMTP id l20so7928140qta.1 for ; Tue, 08 Nov 2016 14:18:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=C+vmqHgril88D69Put29gHKuLRgRcJyHmmpXjBGFa+w=; b=MFqkoKdoztMT+5KTNL55k85A2zIqjPV3//3IGSCbY/PaefONlHVU+2wkQ1Xmnm3W1A ZJEEWwr3Uv+iH9NHX2e4sicPvkCoe3JwK7a/3GIuO+B05c7z4PiGKqlgqoUwBrTzw3r2 zxFgrSPJ1LIIKqHUVEjJK7htRigWk30sF0vAfpA2aBSQBs8i0N+EGFD+U80HfSv+7xB/ lpTktlAP49OiQ5w5yX6jJpAsVeAYbv9zPxDGspabEVJMMc9E6mFE9U2u+IZT8bOS6VS2 ZYs6IAAxTmIaLVQdm4X4ItQY/wgKK3hAM8zeHuKY8obalvLOUBS18/ZqY6w0mMAhAWZA pVXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=C+vmqHgril88D69Put29gHKuLRgRcJyHmmpXjBGFa+w=; b=biP5ydRxh/Yw3AIOGW+JNiMqa6FNo6AIyNra4GV9nHz3yiV9Cehcm7pFgieCwi6Fgt tKNVNJNDfx7r1VJT0B9vFlsEMwgsFO9bdFOqXKj9cZpM+m+Xc5qc5GVqqXg5cwIvDEFj GvVFYa+88AQzZhnsepGrfy22FAZ0sQPcT3XMLmDvvoI8q7+vwkIC3FHxjYyex1q1EG1J QYbe6hkGVcJHoT6D0DiJ0kuSHGZMt/80m7vQ2cLJ3EccR92q8jxDpDLj+0BoY9M1Ozg3 7BU3u1OR//BB4zC9Y6fp22DchU9CC1b+ytVkINAOOAD4yuyl4RmM9ctqyTUBOcdkmlbm fxAg== X-Gm-Message-State: ABUngvf4xUcLGXkWX2ruxz9i9DSzEkDjcIrpKEW/VYU38hF/+tQwkJjah6a6y0XOvrZZJA== X-Received: by 10.200.38.39 with SMTP id u36mr14685400qtu.31.1478642610403; Tue, 08 Nov 2016 14:03:30 -0800 (PST) Received: from vimacbookpro.vimeows.com (nyv-exweb.iac.com. [216.112.252.10]) by smtp.gmail.com with ESMTPSA id w12sm20517394qka.4.2016.11.08.14.03.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Nov 2016 14:03:29 -0800 (PST) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Nov 2016 17:03:26 -0500 Message-Id: <20161108220328.7397-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161107234405.GF4602@nb4> References: <20161107234405.GF4602@nb4> Subject: [FFmpeg-devel] [PATCH 1/3] hevc: Allow parsing external extradata buffers 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- As mentioned in the discussion. Please CC. Vittorio libavcodec/hevc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 29e0d49..02fd606 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -2973,17 +2973,15 @@ static int verify_md5(HEVCContext *s, AVFrame *frame) return 0; } -static int hevc_decode_extradata(HEVCContext *s) +static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length) { AVCodecContext *avctx = s->avctx; GetByteContext gb; int ret, i; - bytestream2_init(&gb, avctx->extradata, avctx->extradata_size); + bytestream2_init(&gb, buf, length); - if (avctx->extradata_size > 3 && - (avctx->extradata[0] || avctx->extradata[1] || - avctx->extradata[2] > 1)) { + if (avctx->extradata_size > 3 && (buf[0] || buf[1] || buf[2] > 1)) { /* It seems the extradata is encoded as hvcC format. * Temporarily, we support configurationVersion==0 until 14496-15 3rd * is finalized. When finalized, configurationVersion will be 1 and we @@ -3030,7 +3028,7 @@ static int hevc_decode_extradata(HEVCContext *s) s->nal_length_size = nal_len_size; } else { s->is_nalff = 0; - ret = decode_nal_units(s, avctx->extradata, avctx->extradata_size); + ret = decode_nal_units(s, buf, length); if (ret < 0) return ret; } @@ -3338,7 +3336,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx) s->threads_number = 1; if (avctx->extradata_size > 0 && avctx->extradata) { - ret = hevc_decode_extradata(s); + ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size); if (ret < 0) { hevc_decode_free(avctx); return ret;