From patchwork Tue Aug 7 02:50:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sanilraut X-Patchwork-Id: 9924 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp3973755jad; Mon, 6 Aug 2018 19:58:54 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwL2PH7qedzAmhAdHkmmx0qcmfndYCIP4jHEdTnBeZg/tj+z8g5ZLZRwWGeygnY/MDv0Gc0 X-Received: by 2002:a1c:228b:: with SMTP id i133-v6mr364127wmi.69.1533610734342; Mon, 06 Aug 2018 19:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533610734; cv=none; d=google.com; s=arc-20160816; b=loJwk5Mgw9GCbfGvaZuj+rpY9jvCNqQjBptB1NfZL1IUUp7JyWqHPSVzlXtBp5iOw1 JdMzpMFMZgbw82xSyPr5K8gGlL5S68O4yZ9mkXJSQ3yfw2f9dVnhahWwIDNByr2K/k5w U2lyRosqOGRIGEcxPUwCxNvEQDxOS/GqDkes+O8mAgfry/O0dbCney9ftWMMbqD/+6eO HAZ2+GvLcO/kfqe910p/5fCLgoktjdEImuAtnbjhgcfZ8Slp7yO9xc98tFP9tkjfJ7Mx Aa+vdktFxZ7IPhaVjuOF3+UuGATq74DxNXnKvmAKhhppPU8CVg0vGfDsLbHkXxkJkYg5 twjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=UiR3TebCk/kJyYWZfqzIRtuTAKUQb/lJNJRz6mJVxQc=; b=tXwkokkrHctOAhkpTQZUJ7Cm4ORxqD7vs8Dbhs82quA5nTE+u82dKRvUOvDQo3cExF 5PR1oR9kjKjwVpMUHl/Auts4GjjO5/nCGDbCc4N7N115gVcY3kUiX/1A5qn/4dHp33IY 2Z0tIVsFLW1NVxDK3tVAIZloVpkvpR3t21KXDTQitRCSP09S5rZAe1g92sdmri0XDIoA AT1W+ccHELlyEOtrE+K0ckQ178HuNC4fYwI6kVqgZwQIFH+8iZoFRRVALFVAbbX96QeV E9Rrs8j48wnN0lMnNgEuJE35fK+VximY0pQJ/EwMCDZtp6E8s6s6ZPXC4Hc8qPRYaAOa zKDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=nrL40GW6; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j19-v6si135796wrd.1.2018.08.06.19.58.53; Mon, 06 Aug 2018 19:58:54 -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 header.s=20161025 header.b=nrL40GW6; 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 sp=QUARANTINE 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 CC4DA689E50; Tue, 7 Aug 2018 05:58:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f44.google.com (mail-yw1-f44.google.com [209.85.161.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C21FB6891D2 for ; Tue, 7 Aug 2018 05:58:29 +0300 (EEST) Received: by mail-yw1-f44.google.com with SMTP id q129-v6so4405185ywg.8 for ; Mon, 06 Aug 2018 19:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Qn+lWMkC1Em/pMjLZxFI6qAYpnI9D7+KwZ0Zm/qlgao=; b=nrL40GW64Xx789UJEZNBLtB4kqjoh5WbMhJ5kouCSFl3zJW8P2p3M+nslmqKPQNYu9 d81rg5jFiIAYeD4S/NUyhOAYMi9uILcFrESmxZkfXXtacBD3U+sTR0ZEH+P+fBlIHqDA bMSL5l20z8va0ntjm3g8OSYepoejQKqvwwfSOY10y2Z8sMdS5zcCLgUPjHUAv0EiWztH 4rS7CDjDZbyJgvShOcro6jodmDo2jhyNBwlAdg9Zf9ph9YERAIo4OXFGVFH+dx6bmEfF 1oHXXbPKIh6DY3WL6CCXB26gfxoSNwgDrQDotyFVu6OXDgW+YNskAOUcrTisEM99O7i9 WZ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Qn+lWMkC1Em/pMjLZxFI6qAYpnI9D7+KwZ0Zm/qlgao=; b=Uyxn+YTG3u+sMSh3sB4au7ai/sV/mYAT0MHzFGae71NdIaL7cPVQtcPURb069RFtPB zbmVuKfjey/vBrfdEzhJbvhTPNcVAcS9Z8xV/dyVQtUQ0HFrh3jX5eAznKUaNBO9sCJV SoUdqc2cvoH0ys4f4UK5eKtNXvNPyHtPdPeVldN51Rzpf5KZjGOI7S4KzneJ3P9i5/vn /FOhCNWRwoAxffMnFIkyvK8qPJTyzbwlbTXBDYiIFnPQoKh6fau8S8bEBGSRbw9w9yZi mfG7g/SvE/jiW2CSYDgqsfhi5/9z2e+vrF7U2/rMaXGRn9ZksRBJW1hgr44ENz12GXl3 rXEA== X-Gm-Message-State: AOUpUlF4SQEzGVk/g4ar9z6QwQ4jBumu/C366M7teQkPWp1C8cfm8G+N fHDXFXe7XERpxp+okLglz4BTVSIX X-Received: by 2002:a81:2688:: with SMTP id m130-v6mr9132192ywm.322.1533610222488; Mon, 06 Aug 2018 19:50:22 -0700 (PDT) Received: from sanilraut.attlocal.net ([2600:1700:38d0:45b0:5548:869f:cb13:cf4f]) by smtp.googlemail.com with ESMTPSA id z190-v6sm74702ywz.89.2018.08.06.19.50.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Aug 2018 19:50:21 -0700 (PDT) From: sanil To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Aug 2018 19:50:14 -0700 Message-Id: <1533610214-26919-1-git-send-email-raut.sanil@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH] libavformat/dashdec: Support negative value of the @r attrbute of S in SegmentTimeline element 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: sanil MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi, The following patch supports parsing negative value of the @r attribute of S in SegmentTimeline element. Example streams: 1. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd 2. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/2/MultiRate.mpd --- libavformat/dashdec.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 89f3ac2..ea960bc 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -262,6 +262,12 @@ static int64_t get_segment_start_time_based_on_timeline(struct representation *p goto finish; start_time += pls->timelines[i]->duration; + + if (pls->timelines[i]->repeat == -1) { + start_time = pls->timelines[i]->duration * cur_seq_no; + goto finish; + } + for (j = 0; j < pls->timelines[i]->repeat; j++) { num++; if (num == cur_seq_no) @@ -1341,9 +1347,15 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c) } else if (pls->n_timelines) { int i = 0; num = pls->first_seq_no + pls->n_timelines - 1; - for (i = 0; i < pls->n_timelines; i++) { - num += pls->timelines[i]->repeat; + for (i = 0; i < pls->n_timelines; i++) { + if (pls->timelines[i]->repeat == -1) { + int length_of_each_segment = pls->timelines[i]->duration/pls->fragment_timescale; + num = c->period_duration/length_of_each_segment; + } else { + num += pls->timelines[i]->repeat; + } } + } else if (c->is_live && pls->fragment_duration) { num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragment_timescale) / pls->fragment_duration; } else if (pls->fragment_duration) { @@ -1952,7 +1964,7 @@ static int dash_read_header(AVFormatContext *s) ++stream_index; } - c->is_init_section_common_audio = is_common_init_section_exist(c->audios, c->n_audios); + c->is_init_section_common_audio = is_common_init_section_exist(c->audios, c->n_audios); for (i = 0; i < c->n_audios; i++) { struct representation *cur_audio = c->audios[i];