From patchwork Tue Sep 27 23:14:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 760 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp119800vsd; Tue, 27 Sep 2016 16:14:38 -0700 (PDT) X-Received: by 10.28.22.6 with SMTP id 6mr5237478wmw.55.1475018076089; Tue, 27 Sep 2016 16:14:36 -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 y77si16482133wme.72.2016.09.27.16.14.34; Tue, 27 Sep 2016 16:14:36 -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=@gmail.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=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D448C689F4D; Wed, 28 Sep 2016 02:14:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E925C689BCB for ; Wed, 28 Sep 2016 02:14:13 +0300 (EEST) Received: by mail-lf0-f68.google.com with SMTP id s29so2456687lfg.3 for ; Tue, 27 Sep 2016 16:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zLrs++tUk5TQZymiu+UjhVIhHCtMR1MJLjzNlP3MzVU=; b=LoxqW1+BcoywZ8yHjoD0VOdOh5W4vuc+O+Jl9N9Y9CVuL0LYozrrasY8jUo6cOqCeW zW2/3EGcUBsxDpK5FJy9k3tQ9LHIJj8BxJp5vQANMjmG91wxAMvynaZBRpnjqSl4obSx 8oPsOBId60sQDHlB+tVRbtLYF1t+p9l7CsDBM5vyn3AzVdEFK1YPauXcsjzNOYxbZYw9 zxG6dwSaapzndDTtps5Y9nUkxtKTJPtmdVHrB4dkhGmwrLZljhPhNLD+b45v2c21Utht EJASil9CE6apMZ9AXi3MM750kyF2ojo+p63Z2i+0TxBJnDPnAD9pj33j8FzC5HzJM+6B ocBQ== 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zLrs++tUk5TQZymiu+UjhVIhHCtMR1MJLjzNlP3MzVU=; b=WqQS8F/4pjVIm8rsyAxkQE8T8XcgFb/DHkb1C+2Y7Fb3SISdNsPAs7O8af7sMJm7Q2 jFvjO6uZMuCzmEBST0WaYPNUyapwUIP/MjOf+mDj8J9GPxCs2Oujk87OPXzd9n8g9kq9 dEnr+/hDhR/PbXtr6vJ0NBFtF+IZyXYugXzmPpzsQHy2H3foeEvKNp9CosRrpCI05fRU csVoy1tTfA1fKxWIMK7o5HSZiYmAB6sHGqP8RlH0eUI77l7K2l/8g7g6kfm8HBJ8Mt24 n4PvBKf/Iwqm0q3cTVH8fAh3Q4ZaFtJkKwdystE6nuIYvJa4r6bT+ylcD5cnUfD73iN/ 49YQ== X-Gm-Message-State: AE9vXwMYZIKy34mFFJ3qFqeU9+OKI2+HQBG+/xXHEc2IGgevBbN7oeMbi+8b6DIf2p5c8w== X-Received: by 10.25.159.76 with SMTP id i73mr9786709lfe.45.1475018065025; Tue, 27 Sep 2016 16:14:25 -0700 (PDT) Received: from saten.lan (dsl-hkibrasgw4-50df5e-23.dhcp.inet.fi. [80.223.94.23]) by smtp.gmail.com with ESMTPSA id z139sm818942lff.16.2016.09.27.16.14.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 16:14:24 -0700 (PDT) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Sep 2016 02:14:23 +0300 Message-Id: <1475018063-2387-1-git-send-email-jeebjp@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474927822-6802-2-git-send-email-jeebjp@gmail.com> References: <1474927822-6802-2-git-send-email-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2 v2] movenc: use similar logic to DASH when writing bit rate to ISML 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 way, in case of bit rate not being set, max_bitrate will be used instead. This enables, for example, re-using max_bitrate information from the input or doing transcoding with a rate control mode that is not bit rate based. Signed-off-by: Jan Ekström --- libavformat/movenc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 449d0b5..8992782 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3581,6 +3581,9 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat { int64_t pos = avio_tell(pb); int i; + int64_t manifest_bit_rate = 0; + AVCPBProperties *props = NULL; + static const uint8_t uuid[] = { 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd, 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 @@ -3615,9 +3618,18 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat } else { continue; } + + props = (AVCPBProperties*)av_stream_get_side_data(track->st, AV_PKT_DATA_CPB_PROPERTIES, NULL); + + if (track->par->bit_rate) { + manifest_bit_rate = track->par->bit_rate; + } else if (props) { + manifest_bit_rate = props->max_bitrate; + } + avio_printf(pb, "<%s systemBitrate=\"%"PRId64"\">\n", type, - (int64_t)track->par->bit_rate); - param_write_int(pb, "systemBitrate", track->par->bit_rate); + manifest_bit_rate); + param_write_int(pb, "systemBitrate", manifest_bit_rate); param_write_int(pb, "trackID", track_id); if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->par->codec_id == AV_CODEC_ID_H264) {