From patchwork Thu Oct 26 16:17:31 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: 5704 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp998284jah; Thu, 26 Oct 2017 09:17:55 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QG7odBS2I0sJWPY15lMsnIR1FCROzEdFIR97FSMqb/tOIES85YSoTg+Tn+CMkZLbMNxBor X-Received: by 10.223.132.6 with SMTP id 6mr5743929wrf.93.1509034675433; Thu, 26 Oct 2017 09:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509034675; cv=none; d=google.com; s=arc-20160816; b=0JSW+3LlwbJVklrMdHiezoBDWdVDY7tKIhqFRHVpqxlMiFA5RK7eJtjtm0P4VF2kjc pcqlWXhT+4F2Vvi+yJWvWEtOJf9fDZXssqM0bRWnq5r7iNr3C9cybiK6QVVV6srtLtru vrM42LZVm5gfb7b4POd65+TugPfS2Wlf/ywXptpPFfyjWiSrbXIgTlBO6Lexg8UANHhn ZGFjeID2QgiafMgx0EKFgi7ehCPBcsk9Xcl2rj7/fzYFuzw6DN+szkEsigm0WjEmMKjc yAolEhrjoJpYEo4jcpOm3UPqnYX1FR7JN0rX4wtve6IUYjFuAlTuLr+oh6KcCC3emPsF SZyQ== 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=fRLk67rk6BhQ4qe9LPaUGMzurd6onFS+5yGqdos/tnpxK8bugqX14evRWBWgfW2t53 Ls6wvpjJP7hHrCMbbzB/182ZC0nMmDdva8LBYGO9NmvqchovRyC+8m79c9kvKCAc5e2Y QvRRIBbRA1aGt1x9f/vE72hZyRKC2neYyG1GImMYxd/hbmFC2IUCkmejkXrKJDTIcSu8 EvXJQJzxv4IfmSyW+fHHdePc4+/obHrTnEQvcB4ptEM8SGnFbS8HJC1Ofl0UDZsT3Mis UrV5xkpU/Y6XWHA4k/7aKEaLlVhbfesJ0oKQxwnM3t08aT6FbysPIt4narIksHUX7om3 ZNYQ== 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 l5si4013035wrf.98.2017.10.26.09.17.55; Thu, 26 Oct 2017 09:17:55 -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 5CD1F68A651; Thu, 26 Oct 2017 19:17:46 +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 6455C68A0EC for ; Thu, 26 Oct 2017 19:17:39 +0300 (EEST) Received: (qmail 25212 invoked by uid 210); 26 Oct 2017 16:17:47 -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.086189 secs); 26 Oct 2017 16:17:47 -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 16:17:46 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Oct 2017 18:17:31 +0200 Message-Id: <20171026161731.18769-1-pegro@friiks.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171026155840.16816-6-pegro@friiks.de> References: <20171026155840.16816-6-pegro@friiks.de> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] dashenc: allow AdaptationSets 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; }