From patchwork Mon Feb 11 22:47:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 12045 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 108F94495AA for ; Tue, 12 Feb 2019 00:55:21 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E451268A0C3; Tue, 12 Feb 2019 00:55:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3B4726898BD for ; Tue, 12 Feb 2019 00:55:14 +0200 (EET) Received: by mail-wr1-f51.google.com with SMTP id v13so610657wrw.5 for ; Mon, 11 Feb 2019 14:55:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7fExVG48H07jddtSwU6NnDcEgzPrzg8ApaGiCtlN8Cs=; b=ZSWqzej3GDq1cIMgJLDxxL5oyNECAnpl2WAdC3wg8Hm8hJM1ntahZFf/VRg/bpEeGA RJx9Ffm8iLErJJhjg9m3Ra4tVrXSvrR32N1ZkzW7ouOueARYhkQdtDxYRPqWC4CkQy16 n0AyJIizh/nQVt7Aop1+VOlKiSs6C9tczyLHE9ZqWstEqF2DW5wB1uknYEI8yGdxYMu7 6qiq5g7NAgszlsvrdDxMQzJnPJqVfHUTMqQuj4e0QuW6mLcChPeZAzrSl+hi/hAJqmdM df/zRZMWysLpltnuJjUrTOxYCc2HHsDPx+/y8z2m0+zj3weEZwBxGq6GEmKliYMTqHKi bEBQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7fExVG48H07jddtSwU6NnDcEgzPrzg8ApaGiCtlN8Cs=; b=L2iFWM0xnxBzA4VTSme4oMz5JuwZjmP6IFqysoZrWAKk4QAh1lYUVCCqyaXFn92yrC fUOFrx0Bhl/qXOtr7a7Mb/t2lGa0qf6aU2s8/a1yFoJ/M2oLxrC1mvEITnQamlgqow3x 8nCOXoLv1iibMQpkz15trVvFM4ply2SsstJRwrFno1q6zUce/Uq1OXiHE0p3IDImtPkn lW8bA4l38Hhax9VRTewDxT+ILsr/MDVy3+edbBsRgeM92Cj2WCw3rO1oLk9xHxxWcCFx tF/5955Jv9QwkZdY9WxbEO3A5iX8xWMwCjqu65kcemnoWD4qmBfoQnqup2gf2eSNOsno P67Q== X-Gm-Message-State: AHQUAuasDB5JX/dHbL29lIExNrE3virM6BbNF1RFA0aJGQaIp7vvGneQ SsVPtDyAnFQaXSda4z8I+xuqiT8b X-Google-Smtp-Source: AHgI3IaamMrg8rHugoVcbZuSvcn34zL4UqnRVti2JXjgFAiwu/SPjrEMsGLtQ8SbE5PZNna6b/H+Fw== X-Received: by 2002:adf:e3d1:: with SMTP id k17mr371565wrm.143.1549925319536; Mon, 11 Feb 2019 14:48:39 -0800 (PST) Received: from localhost.localdomain (ipbcc08c44.dynamic.kabel-deutschland.de. [188.192.140.68]) by smtp.googlemail.com with ESMTPSA id q9sm631848wmc.10.2019.02.11.14.48.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 14:48:38 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Feb 2019 23:47:42 +0100 Message-Id: <20190211224743.3752-1-andreas.rheinhardt@googlemail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <4c738aed-7afe-3fc9-3e16-397922cfe380@jkqxz.net> References: <4c738aed-7afe-3fc9-3e16-397922cfe380@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] filter_units, trace_headers: Always use fragment from context 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is in preparation for another patch that will stop needless reallocations of the unit array. Signed-off-by: Andreas Rheinhardt --- libavcodec/filter_units_bsf.c | 8 ++++---- libavcodec/trace_headers_bsf.c | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libavcodec/filter_units_bsf.c b/libavcodec/filter_units_bsf.c index 1ee0afdf2b..0500dea6b2 100644 --- a/libavcodec/filter_units_bsf.c +++ b/libavcodec/filter_units_bsf.c @@ -199,18 +199,18 @@ static int filter_units_init(AVBSFContext *bsf) ctx->cbc->nb_decompose_unit_types = 0; if (bsf->par_in->extradata) { - CodedBitstreamFragment ps; + CodedBitstreamFragment *frag = &ctx->fragment; - err = ff_cbs_read_extradata(ctx->cbc, &ps, bsf->par_in); + err = ff_cbs_read_extradata(ctx->cbc, frag, bsf->par_in); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n"); } else { - err = ff_cbs_write_extradata(ctx->cbc, bsf->par_out, &ps); + err = ff_cbs_write_extradata(ctx->cbc, bsf->par_out, frag); if (err < 0) av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n"); } - ff_cbs_fragment_uninit(ctx->cbc, &ps); + ff_cbs_fragment_uninit(ctx->cbc, frag); } return err; diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c index 8322229d4c..61284e615e 100644 --- a/libavcodec/trace_headers_bsf.c +++ b/libavcodec/trace_headers_bsf.c @@ -28,6 +28,7 @@ typedef struct TraceHeadersContext { CodedBitstreamContext *cbc; + CodedBitstreamFragment fragment; } TraceHeadersContext; @@ -44,13 +45,13 @@ static int trace_headers_init(AVBSFContext *bsf) ctx->cbc->trace_level = AV_LOG_INFO; if (bsf->par_in->extradata) { - CodedBitstreamFragment ps; + CodedBitstreamFragment *frag = &ctx->fragment; av_log(bsf, AV_LOG_INFO, "Extradata\n"); - err = ff_cbs_read_extradata(ctx->cbc, &ps, bsf->par_in); + err = ff_cbs_read_extradata(ctx->cbc, frag, bsf->par_in); - ff_cbs_fragment_uninit(ctx->cbc, &ps); + ff_cbs_fragment_uninit(ctx->cbc, frag); } return err; @@ -66,7 +67,7 @@ static void trace_headers_close(AVBSFContext *bsf) static int trace_headers(AVBSFContext *bsf, AVPacket *pkt) { TraceHeadersContext *ctx = bsf->priv_data; - CodedBitstreamFragment au; + CodedBitstreamFragment *frag = &ctx->fragment; char tmp[256] = { 0 }; int err; @@ -92,9 +93,9 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt) av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp); - err = ff_cbs_read_packet(ctx->cbc, &au, pkt); + err = ff_cbs_read_packet(ctx->cbc, frag, pkt); - ff_cbs_fragment_uninit(ctx->cbc, &au); + ff_cbs_fragment_uninit(ctx->cbc, frag); if (err < 0) av_packet_unref(pkt);