From patchwork Thu Oct 27 19:19:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1205 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp732376vsd; Thu, 27 Oct 2016 12:19:35 -0700 (PDT) X-Received: by 10.28.30.143 with SMTP id e137mr249138wme.96.1477595975239; Thu, 27 Oct 2016 12:19:35 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d9si10296503wjw.121.2016.10.27.12.19.34; Thu, 27 Oct 2016 12:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4CBF8689F01; Thu, 27 Oct 2016 22:19:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 305AB689992 for ; Thu, 27 Oct 2016 22:19:23 +0300 (EEST) Received: by mail-wm0-f67.google.com with SMTP id c17so4138342wmc.3 for ; Thu, 27 Oct 2016 12:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=cCsKwOl5Xmooz/AzjjWLYs5FkojOWOF6g7LVrX89hU4=; b=gQVN7mv+OsTQoYa+9ZXbpk2Xwucm2UgaG0q+ZSNduJweygilcWnXTvuq56GfEufeQT LbfVECYcP4DM+kuViQfLrHr2pXK2xWh5xYr5PadevkreD5zfl9PmDj5I2Pj0rnQZ/mhH CFefxcnCdMQfC6Bd7s/bOnfXai+2CvHMRT8KUpGiD5uvF1v9NCFSwKdqENm1JLB0kS43 3su9MHuaGn/yeXRga9xGBAaxirnZslE6YuMI4xFSDzVVdXaUWze9tw+VrNQMbW1JMZ8W hRWdSwR5GV6cx7SBBhJ8ra5g30zrlCaS3IIB2f2dO5sIc//RidIUhpNgYHBv+IV3ff16 YUdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=cCsKwOl5Xmooz/AzjjWLYs5FkojOWOF6g7LVrX89hU4=; b=I45JgCn6Y1Ler0cBX+LwO7jJ26RMQ5tyOuROvQTE/RbJuFnGwE5Y911JMQ9jWP2d9v ZHzjGPet4/htf5M5SEiv4IjTdEZoFfqA2R8fbRppAMDQ/GurV4xyy7FIe9ER6tCkrv5B 9nU6uQovGsWfzNa/VgkRXOZAoN0ROGqAk/3wSRZsAjcoa8HsgW5Lir6hYcqkgD+p1/NO FBdh4rM/oaZiOHJ9U02tKzccWuLmQoMi647PmwGoYZ1sT/qdya2q9ahrGQ9CbLGSFCNt FrSKXyT4R8+B3lZE7VLpBBbXzfc42NuUtQV7IZsO3l4eGu5QyEL2r4QXiDKYOcbitrbB ZmYg== X-Gm-Message-State: ABUngvebdq0WCH6v/M35+MmTzr/0OMNEckTGledxM+35uq4RbAG7k/OxkOcMjjnafUJHmQ== X-Received: by 10.194.175.200 with SMTP id cc8mr4699332wjc.79.1477595965953; Thu, 27 Oct 2016 12:19:25 -0700 (PDT) Received: from [192.168.2.21] (p5B095458.dip0.t-ipconnect.de. [91.9.84.88]) by smtp.googlemail.com with ESMTPSA id e5sm4879316wma.10.2016.10.27.12.19.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 12:19:25 -0700 (PDT) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches Message-ID: Date: Thu, 27 Oct 2016 21:19:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] ffmpeg: copy the extradata from encoder to muxer 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 fixes creating apng files. This partly reverts commit 5ef19590802f000299e418143fc2301e3f43affe. Signed-off-by: Andreas Cadhalpun --- ffmpeg.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index 3b91710..9971148 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -646,6 +646,7 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) { AVFormatContext *s = of->ctx; AVStream *st = ost->st; + AVCodecContext *avctx = ost->encoding_needed ? ost->enc_ctx : ost->st->codec; int ret; if (!of->header_written) { @@ -709,6 +710,16 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) } } + if (!st->codecpar->extradata_size && avctx->extradata_size) { + st->codecpar->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!st->codecpar->extradata) { + av_log(NULL, AV_LOG_ERROR, "Could not allocate extradata buffer to copy parser data.\n"); + exit_program(1); + } + st->codecpar->extradata_size = avctx->extradata_size; + memcpy(st->codecpar->extradata, avctx->extradata, avctx->extradata_size); + } + if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE &&