From patchwork Mon Jan 13 18:54:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 17330 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 4C3F744A9E2 for ; Mon, 13 Jan 2020 20:55:12 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A84068B03E; Mon, 13 Jan 2020 20:55:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp-2.arkena.net (smtp-2.arkena.net [95.81.173.75]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1EE0C68AF30 for ; Mon, 13 Jan 2020 20:55:04 +0200 (EET) Received: from secu2 (unknown [10.180.103.10]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-2.arkena.net (Postfix) with ESMTPSA id 47xN7W41YRzHh9Q; Mon, 13 Jan 2020 18:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cji.paris; s=20150421; t=1578941703; bh=d6YisKL0/DEwLc+reuYLkV0PtlPmSVD93VW9TKFTLFA=; h=From:To:Cc:Subject:Date:Message-Id; b=IB3XA3k8O2xFDqNbT4OHMnaTG39ECtKIeeFZYZQzGVwjb5JRm0e//rZGN3TH3Yx2K cU8BXoVwIoAtaSJdmWyxrELPktr2QNwM04b7eSVqacCC8pMxgGKO/lIMWLZPO5aIOn xrl0eGqHM0hulY3buJjQkGhgLTWBPQiOH0fxvmOA= Received: from arkena.com (unknown [172.16.3.159]) by secu2 (Postfix) with ESMTP id 24E383FA74; Mon, 13 Jan 2020 19:55:05 +0100 (CET) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Jan 2020 19:54:57 +0100 Message-Id: <20200113185459.8908-4-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20200113185459.8908-1-nicolas.gaullier@cji.paris> References: <20200113185459.8908-1-nicolas.gaullier@cji.paris> Subject: [FFmpeg-devel] [PATCH v6 3/5] fftools/ffmpeg: Use the new av_stream_add_coded_side_data() 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: Nicolas Gaullier MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This code is now shared with avformat_find_stream_info(). --- fftools/ffmpeg.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 6bcd7b94d2..a513e9f3cc 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3534,19 +3534,9 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len) if (ret < 0) return ret; - if (ost->enc_ctx->nb_coded_side_data) { - int i; - - for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) { - const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i]; - uint8_t *dst_data; - - dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size); - if (!dst_data) - return AVERROR(ENOMEM); - memcpy(dst_data, sd_src->data, sd_src->size); - } - } + ret = av_stream_add_coded_side_data(ost->st, ost->enc_ctx); + if (ret < 0) + return ret; /* * Add global input side data. For now this is naive, and copies it