From patchwork Wed Oct 2 23:04:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 15472 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 92DC544A176 for ; Thu, 3 Oct 2019 02:10:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6EE306880D6; Thu, 3 Oct 2019 02:10:17 +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 9F2F9680B4C for ; Thu, 3 Oct 2019 02:10:11 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id l3so784576wru.7 for ; Wed, 02 Oct 2019 16:10:11 -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=/KdtDuHw2rNPUHYd8co4ne72+61Y2A/XObUdQQTsuGU=; b=tDo2etme6RwroWs3IUhhebY4ZV3/634POgZNkB6rNvzU452awv17H7ZW9CZXMix6Dc fGxxQMjqOnzDmi4jG3WqjBUc8elZncqh3Mpmy5oUh/0Qtv/+GCOiPgIVw98x7ThoXAAg qD2z8DFfmKInh2k3AUhVlOoJVbRpLKy/v2ugrclZ0rCObi8Ehf0I6A2wELHhytIU0lqp iEGYe6qvC+11ZoWBFUYkYLOj//VG3odxtT6+UcEBbS3hu86CwlS/D8XDPTUTlBuFFcQq 9tYBMaquYBOTgGyvDp4wwReYiiimx5+Z1E0t9s56viaTob7CfSWb8+MM1RnJUisvfMn+ r4bw== 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=/KdtDuHw2rNPUHYd8co4ne72+61Y2A/XObUdQQTsuGU=; b=CDbVp8PcXhDo8rq6Rb5ZObsAVn7VeFhqGG/L2etQsQeU1YGCx1Q4n0SRziclvHxzNz bBLDhL0l64qwHzxWeZQTspcDY6/D/9xIv7CV4l5ITX2d/v3EBx45jHhOlxmcOihheWG6 o1mKRRlq6HqAUw5MfnRcp6Y4h/QmC6BZGEVJRMaunzXpM/62p+ixZngMYRSQ8OIA1fE6 4tWD+QynCP7ReKlQ1QVeNg7QXFeK4T436LDNO/Gl+OiGbq+ucOA0nJVG+ydr9kBJESuI Ukh9ub5s76i8PrRos+HHsJ4Qp2C25kCjY9WX2n0rMo84GqGf1FtqMv60tiUqeOakXacr ubYA== X-Gm-Message-State: APjAAAXboOvZVlJb4lN8Q4r+w62JCwZ5NfbLCNwpGoDdvB51nKJ1VhkA WQ4HnYNvmFgel/up36AI7jcEU2Z6bIs= X-Google-Smtp-Source: APXvYqzxoYThOj1OSI93soc3p56UmmkSoIu/EmiNDcKRmloa8xhcYVGwqEV6v2LzV+51dx5hs9yocw== X-Received: by 2002:adf:a1d2:: with SMTP id v18mr4547803wrv.302.1570057507826; Wed, 02 Oct 2019 16:05:07 -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 o9sm1489808wrh.46.2019.10.02.16.05.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 16:05:07 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2019 00:04:47 +0100 Message-Id: <20191002230453.6462-12-sw@jkqxz.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191002230453.6462-1-sw@jkqxz.net> References: <20191002230453.6462-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/18] 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 f689221945..c9098b09b5 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -624,9 +624,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; @@ -686,7 +686,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; @@ -722,7 +722,7 @@ int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx, if (!data_ref) 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 1144b9f186..0770d6c7cb 100644 --- a/libavcodec/cbs.h +++ b/libavcodec/cbs.h @@ -363,6 +363,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. *