From patchwork Sat Jan 21 14:39:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 2275 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp529194vsb; Sat, 21 Jan 2017 06:40:33 -0800 (PST) X-Received: by 10.223.153.15 with SMTP id x15mr16323805wrb.179.1485009633180; Sat, 21 Jan 2017 06:40:33 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v11si7343371wmg.13.2017.01.21.06.40.32; Sat, 21 Jan 2017 06:40:33 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 501A968A831; Sat, 21 Jan 2017 16:39:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from james.theweblords.de (james.theweblords.de [217.11.55.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 40C8E68A7D7 for ; Sat, 21 Jan 2017 16:39:14 +0200 (EET) Received: (qmail 28157 invoked by uid 210); 21 Jan 2017 14:39:25 -0000 X-Qmail-Scanner-Diagnostics: from x5d808bdc.dyn.telefonica.de (petronios@theweblords.de@x5d808bdc.dyn.telefonica.de) by james (envelope-from , uid 201) with qmail-scanner-2.10st (mhr: 1.0. spamassassin: 3.4.1. perlscan: 2.10st. Clear:RC:1(93.128.139.220):. Processed in 0.044174 secs); 21 Jan 2017 14:39:25 -0000 Received: from x5d808bdc.dyn.telefonica.de (HELO montepegro.fem.tu-ilmenau.de) (petronios@theweblords.de@93.128.139.220) by james.theweblords.de with ESMTPA; 21 Jan 2017 14:39:25 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 21 Jan 2017 15:39:07 +0100 Message-Id: <20170121143909.29028-7-pegro@friiks.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170121143909.29028-1-pegro@friiks.de> References: <20170121143909.29028-1-pegro@friiks.de> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] libavformat/dashenc: use avformat_alloc_output_context2 for initializing context 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: ischluff@mailbox.org, pegro@friiks.de Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Also copy stream metadata to output stream. Signed-off-by: Peter Große --- libavformat/dashenc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index fd1a304..0c0248f 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -572,7 +572,6 @@ static int dash_init(AVFormatContext *s) { DASHContext *c = s->priv_data; int ret = 0, i; - AVOutputFormat *oformat; char *ptr; char basename[1024]; @@ -596,10 +595,6 @@ static int dash_init(AVFormatContext *s) if (ptr) *ptr = '\0'; - oformat = av_guess_format("mp4", NULL, NULL); - if (!oformat) - return AVERROR_MUXER_NOT_FOUND; - c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams); if (!c->streams) return AVERROR(ENOMEM); @@ -623,23 +618,25 @@ static int dash_init(AVFormatContext *s) return AVERROR(EINVAL); } - ctx = avformat_alloc_context(); - if (!ctx) + ret = avformat_alloc_output_context2(&ctx, NULL, "mp4", NULL); + if (ret < 0) return AVERROR(ENOMEM); os->ctx = ctx; - ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; ctx->opaque = s->opaque; ctx->io_close = s->io_close; ctx->io_open = s->io_open; + av_dict_copy(&ctx->metadata, s->metadata, 0); if (!(st = avformat_new_stream(ctx, NULL))) return AVERROR(ENOMEM); avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; st->time_base = s->streams[i]->time_base; + st->avg_frame_rate = s->streams[i]->avg_frame_rate; ctx->avoid_negative_ts = s->avoid_negative_ts; ctx->flags = s->flags; + ctx->max_delay = s->max_delay; ret = avio_open_dyn_buf(&ctx->pb); if (ret < 0)