From patchwork Thu Oct 26 15:58:38 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: 5700 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp976314jah; Thu, 26 Oct 2017 08:59:51 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RksteVdwKAChCTM4mJfGzJ8+jwiS2QK7ChtvvDczXRwvVbldfhNAmB0j1aFTNHFbRXJLd6 X-Received: by 10.28.98.65 with SMTP id w62mr1934365wmb.73.1509033591896; Thu, 26 Oct 2017 08:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509033591; cv=none; d=google.com; s=arc-20160816; b=bP0Rh3YrkvK/WDhDoefhRBoqs49+fs0ddfVsE4kTUXo0YG78hzVNve9CSuUPfldEAp nQLYlgqNIeO+ftWaEGQx5nAOcqz3bBXJgfbgcgJl/+itm9m51T+XfaAUg6b+VXvULa8y BiY3SWSaVBbZNTJ2cj0pprERKwT73Z3AYuY0MHO1lBDE0F8vWI+jXCYc16uVZakBislD 2BYaHsG9fRjPfYKAAD3nzZ1xkTvVC1hXsyvyqLJ20eV52BjQhPS9XqV06IYT/HXwQcbD n/rwwRFKoWVGk+WtjfXBuaUdjJKXgk3Ju5fkwyoi3zbXhs7RpcH1zyWts69CEN1tKzO/ 0ofw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to:arc-authentication-results; bh=TbSH66+SiJW6yW9BumWZJPDNoPRFWw5SUm1U/bXE5LY=; b=s0cpkdy2ACJLdiO2a/47a0Js0O86St8ANfeeUsWz0M1CCbYpgTIUJvVLMAc0hjQM/w rR48+6cFGPc8bbrHr/MDL2uYrCFFQfD7y1rXzJWtDXW1LxhJTgUB2o2rqX+1+rWc2qZc pA250mVl5X9TJ2L7I64TiTCDKb555eUNx2LHq2h7wyiCuXp9iioKoP565ItDumt4dHd5 CIrXDlAXa3XXwnFrdAC2iloLO16rs0ZS6pAid5E4wYLMOUzGTo00f6r3LW1nWvnOQ8d3 SWLtF1LedBCHqZcugbH75bw5ZvXExvAfepIj2X5hI9v6ERxlAnNZCD6hMAsae9c/kgnI 4x5g== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w7si4148159wre.56.2017.10.26.08.59.51; Thu, 26 Oct 2017 08:59:51 -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; 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 93FDD68A607; Thu, 26 Oct 2017 18:58:58 +0300 (EEST) 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 EF66A68A5F2 for ; Thu, 26 Oct 2017 18:58:49 +0300 (EEST) Received: (qmail 24005 invoked by uid 210); 26 Oct 2017 15:58:57 -0000 X-Qmail-Scanner-Diagnostics: from wl-r3-231.rz.tu-ilmenau.de (petronios@theweblords.de@wl-r3-231.rz.tu-ilmenau.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(141.24.16.231):. Processed in 0.046187 secs); 26 Oct 2017 15:58:57 -0000 Received: from wl-r3-231.rz.tu-ilmenau.de (HELO montepegro.fem.tu-ilmenau.de) (petronios@theweblords.de@141.24.16.231) by james.theweblords.de with ESMTPA; 26 Oct 2017 15:58:57 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Oct 2017 17:58:38 +0200 Message-Id: <20171026155840.16816-6-pegro@friiks.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171026155840.16816-1-pegro@friiks.de> References: <20171026155840.16816-1-pegro@friiks.de> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] dashenc: allow AdaptaionSets to have different average frame rates 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: =?UTF-8?q?Peter=20Gro=C3=9Fe?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Peter Große --- libavformat/dashenc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index c09b22bf7b..f3a12462be 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -55,6 +55,8 @@ typedef struct AdaptationSet { char id[10]; enum AVMediaType media_type; AVDictionary *metadata; + AVRational min_frame_rate, max_frame_rate; + int ambiguous_frame_rate; } AdaptationSet; typedef struct OutputStream { @@ -97,8 +99,6 @@ typedef struct DASHContext { const char *single_file_name; const char *init_seg_name; const char *media_seg_name; - AVRational min_frame_rate, max_frame_rate; - int ambiguous_frame_rate; const char *utc_timing_url; } DASHContext; @@ -393,8 +393,8 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); - if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && !c->ambiguous_frame_rate) - avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); + if (as->media_type == AVMEDIA_TYPE_VIDEO && as->max_frame_rate.num && !as->ambiguous_frame_rate) + avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(as->min_frame_rate, as->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", as->max_frame_rate.num, as->max_frame_rate.den); lang = av_dict_get(as->metadata, "language", NULL, 0); if (lang) avio_printf(out, " lang=\"%s\"", lang->value); @@ -675,7 +675,6 @@ static int dash_init(AVFormatContext *s) c->single_file = 1; if (c->single_file) c->use_template = 0; - c->ambiguous_frame_rate = 0; av_strlcpy(c->dirname, s->filename, sizeof(c->dirname)); ptr = strrchr(c->dirname, '/'); @@ -803,12 +802,12 @@ static int dash_init(AVFormatContext *s) if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { AVRational avg_frame_rate = s->streams[i]->avg_frame_rate; if (avg_frame_rate.num > 0) { - if (av_cmp_q(avg_frame_rate, c->min_frame_rate) < 0) - c->min_frame_rate = avg_frame_rate; - if (av_cmp_q(c->max_frame_rate, avg_frame_rate) < 0) - c->max_frame_rate = avg_frame_rate; + if (av_cmp_q(avg_frame_rate, as->min_frame_rate) < 0) + as->min_frame_rate = avg_frame_rate; + if (av_cmp_q(as->max_frame_rate, avg_frame_rate) < 0) + as->max_frame_rate = avg_frame_rate; } else { - c->ambiguous_frame_rate = 1; + as->ambiguous_frame_rate = 1; } c->has_video = 1; }