From patchwork Sun May 3 22:05:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 19462 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 0D85D44B916 for ; Mon, 4 May 2020 01:06:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EB97268C170; Mon, 4 May 2020 01:06:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D51368C0D3 for ; Mon, 4 May 2020 01:06:04 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id s8so8350188wrt.9 for ; Sun, 03 May 2020 15:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gNOaQJ/fzaboTZI8tqv+UPwzLnGQqn2G3uVJIR4BFNI=; b=do9Zd8qHWl+qAOGx2Cu9MCQifjs6gNIJmDRkEZMpMfaR64CY07TuzJd82ujMtjzvgM G6zaPRy/nYLY/whZxViLOQaHBSAK7rb1FhzQ3exDVa9hCgBqpKIrUuUJOwCve7c0c6uC uaV/EmCsjpIIsh0Fv4EKcMrPEdC167iaWzucA2CPpPo+VNSJySvTNw6+t/Awtf8WAqil ETKiQhHfXaAGGqXS3RGJj05TmNbZJr2X6uYws89au5GBLrA4aTHzLWtBhTtlOh641Mwt +QO+1rA/9Kl8KKgohCfnlFEcHUDglQXuejnhjRM08XofW5MR/OrN6GMfjsgYqFNXOvR7 zt4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gNOaQJ/fzaboTZI8tqv+UPwzLnGQqn2G3uVJIR4BFNI=; b=RpAGgJmjl/FAOndV6LxMWvolN5g6JkvZIPpyCN5v/kh8ri/eoZtyJzyB64no14OFia nyLwe7YDQ+J9FSLfFWMA0qzSqDDZh4UELwW34xyXNz6lgCo0ySHp3oBTyaPsIZX96zz0 Tx5dDBdrXzrC/G729KXMOQ1rR7i6j5cS2fS48SyVtCtUnrDOSdnjOPnHnKJkkK2rfDn1 PSewKFuosawtBu5vnltJ9OvKmIX89kf5gy3/uI7TnjCJ0kCEs6DK8aw2QkwnC2uVwTiq 37eyb8r6nojNDHrOVHlxPIo3EXSA3ZsRG5ScZYFJrVXRIt8Ne0+Mxcj3IVqJzNUC+1j5 QGTQ== X-Gm-Message-State: AGi0Pub1htQAYZ6yCYKQfTEs8RV5yGEYEcjjdNZbW2fyWgNMUvJ7p4Ka AY6NtsO2GICrCaODrT+6Ie7NJF/exFk= X-Google-Smtp-Source: APiQypLa3GR6hQGSE57BQbVoly7XhwE0zjzw2T+bBgJgNWQynwSpBkDz7bvhY0cspocVadp81yPujg== X-Received: by 2002:adf:fcc8:: with SMTP id f8mr15548256wrs.230.1588543563263; Sun, 03 May 2020 15:06:03 -0700 (PDT) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id a24sm10307285wmb.24.2020.05.03.15.06.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2020 15:06:02 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 3 May 2020 23:05:39 +0100 Message-Id: <20200503220548.23543-13-sw@jkqxz.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200503220548.23543-1-sw@jkqxz.net> References: <20200503220548.23543-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 13/22] cbs: Expose the function to insert a new empty unit into a fragment 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" This will be helpful when adding new SEI to an existing access unit. --- libavcodec/cbs.c | 10 +++++----- libavcodec/cbs.h | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 2f39ddbfb4..2346b1621b 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -680,9 +680,9 @@ int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx, return 0; } -static int cbs_insert_unit(CodedBitstreamContext *ctx, - CodedBitstreamFragment *frag, - int position) +int ff_cbs_insert_unit(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag, + int position) { CodedBitstreamUnit *units; @@ -742,7 +742,7 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx, content_ref = NULL; } - err = cbs_insert_unit(ctx, frag, position); + err = ff_cbs_insert_unit(ctx, frag, position); if (err < 0) { av_buffer_unref(&content_ref); return err; @@ -781,7 +781,7 @@ int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx, return AVERROR(ENOMEM); } - err = cbs_insert_unit(ctx, frag, position); + err = ff_cbs_insert_unit(ctx, frag, position); if (err < 0) { av_buffer_unref(&data_ref); return err; diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h index eb7f4b878b..09b06a047d 100644 --- a/libavcodec/cbs.h +++ b/libavcodec/cbs.h @@ -370,6 +370,13 @@ int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, size_t size); +/** + * Insert a new empty unit into a fragment. + */ +int ff_cbs_insert_unit(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag, + int position); + /** * Insert a new unit into a fragment with the given content. *