From patchwork Sun Feb 23 23:41:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 17888 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 B506544A08D for ; Mon, 24 Feb 2020 01:49:24 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 99A9368B519; Mon, 24 Feb 2020 01:49:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9031D68B490 for ; Mon, 24 Feb 2020 01:49:18 +0200 (EET) Received: by mail-ed1-f67.google.com with SMTP id v28so9785992edw.12 for ; Sun, 23 Feb 2020 15:49:18 -0800 (PST) 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=5XqoqRIwZLdaPWIG0YwU48zasXFqIG/AnlSMBawDreU=; b=gucTORP9EdcrSbPEoz09zmIs85e3u3CwhfVsOXNvcg1+MgHntvemf+fP9IB6yCzCp/ cLo8sCr9sUvypHDFV6nZWLmdlPn+dr6hVwHTFzYpuWIeHAhHwM7AnhceThSXtlw9YUt+ nWALXmnEcdZ3CEuzp4kL3HCQdN7za4KrPbIL5yOgNCMBnQl6HdXqIW6XjGQgrR7EAuVB hkY9793KuxGzDj0H+iE0x47U7+PBFjqQW2S5zoSbt31as/8qygr4ipg/YYP+9oVhl+No s9Ndl5OKVhyGyOJDyh1RvgyFlFi7llTJqskjXXxuuViqzrPWq36hfuuGFYTUBAbTEs1S HmzQ== 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=5XqoqRIwZLdaPWIG0YwU48zasXFqIG/AnlSMBawDreU=; b=keVymKA2ljuHIPuNQZwttAlhOgOT4K7dXDhcRcKL2x6K8AYYIb5iGgWXcUVG0XxQCM WKQUSJxYg8GIfBYAemgzCRFy/rKXuKNuwi4M3yTkQEv+DSWLoN/FyNSqTbBAQf6vHJIV iatCDJCioD2mLpwN0C+6MSmi2D7CLMsQh8qNLtW0vDVGRJPJ9fZPYvtZ5eUN/Enmm8O4 tV1FPL/i0iwsK0qhzygQ9yD8SGIs9ObHqvnUd0ath0vyKnkt3aKoLzcf/HBCXwh2ACYt K276obHNAaM5QWrRzlIDnZIwdWx+OkGs1kgQviPdu4qfS6BOM2888ywjWLGjwyBx6lqC js4g== X-Gm-Message-State: APjAAAVDnEFCbTI6T0EO1FisBSUsaDRuDHCyCjLW24Xg6Rg1I+5Dvt7p ghlVSbSifXspmVFFyIA5AOVOuS0DNBE= X-Google-Smtp-Source: APXvYqzZHxacUUmANj+0nQW+EBuU3MqNwfJpV5QKW7yyFSK5+JU7dJIZl9x71xeEJFScDtqF1t+kdA== X-Received: by 2002:adf:e543:: with SMTP id z3mr61052474wrm.369.1582501305038; Sun, 23 Feb 2020 15:41:45 -0800 (PST) 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 y131sm16358070wmc.13.2020.02.23.15.41.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2020 15:41:44 -0800 (PST) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 23 Feb 2020 23:41:16 +0000 Message-Id: <20200223234124.17689-13-sw@jkqxz.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200223234124.17689-1-sw@jkqxz.net> References: <20200223234124.17689-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 13/21] 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 91788f6dfb..12a742b40a 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. *