From patchwork Fri May 8 02:09:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olly Woodman X-Patchwork-Id: 19551 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 DB88B44AC27 for ; Fri, 8 May 2020 05:17:38 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B424668ABB4; Fri, 8 May 2020 05:17:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C28646882B6 for ; Fri, 8 May 2020 05:17:32 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id l18so64767wrn.6 for ; Thu, 07 May 2020 19:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xxVAQY7azQiivFeZp0bq9BiYYmS4ogaxM9fAgFRAasY=; b=u0slA8CnAF4S5EXRP4wWewcJKlo2gUt6wmwOyESawhYkw4IbEaqbH+rq/onxjS+btI nrvutbtNnAg/vqEm1ofYQLxPrLp9qOhvCMFmjuqd74deRAnDPx6/wWfzKjsK18I/hcb3 fMGMqPdDdsdc5+JZ+m4BiYlOzVyVbmGNjqPQhz7q+TLCxH98yaHfExUo50iANFKjmGzX Vo3isO6QG+MixL54K24BnV495rdBY/YWrj38r2hDP4ykYFJHZdRrgUuN9rcBi68yYxbK YJ5GytborJWVF+Xaf7JD2688TyBMFDdlj+Ziy2syZDzbA81FmRsoQe2kQ631ceelC4ck 6sPw== 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:mime-version :content-transfer-encoding; bh=xxVAQY7azQiivFeZp0bq9BiYYmS4ogaxM9fAgFRAasY=; b=JQZNynUO/Gz3T4r2N84E5X/szQt2/iQ2/foMG9iR1DBnPep75SXiRBfRezd4AokPu/ wFUIedh2F2NqoAwuLDWluj50M3T8ZFNMZiJs7yehmYV6hSUJgcAYszdc4vrS9jt8fd8f k9fPh+HFN0nEopD6B/N/yEhRfAgwZdkRxRYH5VNeaucIaPj3lZNFBOmKTuFPF4JoMotE p2ioLb/Z/yWXWPeWkILAIMbALX/GoURKjQB6xULqfF7XbKxn2IaEeplrVExpokMKN+Ex RQeWpFXI1/G4oxeGavRJI9cI1p365OCmUPDm7VxDqlS9nQWGiQdDArbVX0aue8RAsTsD Nubg== X-Gm-Message-State: AGi0PubbEE3BPmzu6fPFH+n2btGqjoMiWxeaNIsOKiqXW+JiI+JwWM30 /LW9R1FZgMaiXa9bpWuZShHKy4Smf9g= X-Google-Smtp-Source: APiQypIEU2xr0S1GBigJD2tyGUhUKlUMVbUpEP8RmCg7j2htVbfWUOec8mHYx4oj3xcOEH37ILzDlg== X-Received: by 2002:a5d:4092:: with SMTP id o18mr66296wrp.227.1588903807570; Thu, 07 May 2020 19:10:07 -0700 (PDT) Received: from olly-macbookpro.roam.corp.google.com.roam.corp.google.com (cpc121670-lewi24-2-0-cust235.2-4.cable.virginm.net. [81.98.238.236]) by smtp.gmail.com with ESMTPSA id h17sm11029135wmm.6.2020.05.07.19.10.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 19:10:07 -0700 (PDT) From: Oliver Woodman To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 May 2020 03:09:29 +0100 Message-Id: <20200508020929.68603-1-ollywoodman@gmail.com> X-Mailer: git-send-email 2.26.0.110.g2183baf09c-goog MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATA 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: Oliver Woodman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" https://github.com/FFmpeg/FFmpeg/commit/601c238 added support for AV_PKT_DATA_NEW_EXTRADATA, but only for avcC extradata. This commit adds support for sps/pps extradata as well. This makes support consistent for passing new extradata consistent with the types of extradata that can be passed when initializing the decoder. Signed-off-by: Oliver Woodman --- libavcodec/h264dec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 4c355feb18..c1d103a474 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -829,7 +829,7 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) return 0; } -static int is_extra(const uint8_t *buf, int buf_size) +static int is_avcc_extradata(const uint8_t *buf, int buf_size) { int cnt= buf[5]&0x1f; const uint8_t *p= buf+6; @@ -956,16 +956,15 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, if (buf_size == 0) return send_next_delayed_frame(h, pict, got_frame, 0); - if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) { + if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) { int side_size; uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); - if (is_extra(side, side_size)) - ff_h264_decode_extradata(side, side_size, - &h->ps, &h->is_avc, &h->nal_length_size, - avctx->err_recognition, avctx); + ff_h264_decode_extradata(side, side_size, + &h->ps, &h->is_avc, &h->nal_length_size, + avctx->err_recognition, avctx); } if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC) { - if (is_extra(buf, buf_size)) + if (is_avcc_extradata(buf, buf_size)) return ff_h264_decode_extradata(buf, buf_size, &h->ps, &h->is_avc, &h->nal_length_size, avctx->err_recognition, avctx);