From patchwork Tue Aug 7 02:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sanilraut X-Patchwork-Id: 9928 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp4861144jad; Tue, 7 Aug 2018 12:13:30 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzPBnDvZis0Yzkzl1ca+vF9gli0dvPdAASOucMRt3pUjq0MPFvu1ianQaByQhRwDiCdgg25 X-Received: by 2002:a1c:7e92:: with SMTP id z140-v6mr2415700wmc.48.1533669210327; Tue, 07 Aug 2018 12:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533669210; cv=none; d=google.com; s=arc-20160816; b=wYBLZ+xMbvFNYcOmX2myVV6QX67fh4ZIQep9FvmfCwv/4S5R+2ItBHcxkwRx1t6ao3 FEy6C6uTTcPKOgrBNhP49CzwIct64A4Zacj4Ae2+FT+D1032gzGADqGuKA1FHqwX1ZSc GFsT/aD4zL9ApFx6IxNTIXno2nEy1UevMRzKDy2FHyS6hxae0o5Jyvmxbv24Vnk2PG4j 7LKGkmAwvUKWr/Lrn6ZgCH/8F7lif0J1eq0UXwYPqeTt28u9Uoiye9BcP9LZE1uDVVG2 dgjCE9iulfzxPmemKHgNzoAi/qcAXVnESTfa9/JvNqlVMhxwPRuyI8s7vyjgziKZSpd1 Ir+A== 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=20K66REGwvduMNezQ0fu7ychx5jJ5OLCl7dXTrtTvG0=; b=pO5EHqnBY4srDDOVw94uHLcQqcoJoIXvTzXLwj66t/9bg1pXgpNvyslgYOj77hMIcL 7oK+d3ufYBSj+TeyPNUvq4ZrD2gikZds/suxPU5BJhKlSlqO2oYkD7Ar3pSkwx+t7j9/ 980UXaDG6GUXom6RRMD7RUCuFjttGlkqpXe76u9VNTMvwqsvkvYG+nuCFqg+jfRt44Mu 36TyMGaFl2mGa4QIyuPh6mMZ/UhAXef4j6v/LoF8c79pqM02FWGxjttmq4d1aPyBiRdZ E1Yv/fIyRE+2eVX7TgE9NRWpd7AmvMCBjYJ9Szh2PhdqlGfooa6WKRlyZ2H41w7dj0Ap FS0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ogtf3jkC; 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 e13-v6si1691246wrq.339.2018.08.07.12.13.30; Tue, 07 Aug 2018 12:13:30 -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=ogtf3jkC; 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 D8D4268A4B1; Tue, 7 Aug 2018 22:12:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yb0-f169.google.com (mail-yb0-f169.google.com [209.85.213.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 72A92688346 for ; Tue, 7 Aug 2018 05:25:38 +0300 (EEST) Received: by mail-yb0-f169.google.com with SMTP id c10-v6so6079459ybf.9 for ; Mon, 06 Aug 2018 19:25:58 -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=uE9+W35bzRTjmd50/akuZa5V3UE62yeNQju9q1iKL+8=; b=ogtf3jkCdzjQkqdbLNiEJLu/x9hIuRxILTLif/1ev1L9vHaearZIyB6/+zciGlnoRN piQUAZwpr0tu8L/vsMRYoC6s05n40/XYdRa39tMB2BQCaBOw8skg8ZCqzq005N1QN5nx LFW311A1KA9j0YyfugfNPEegXZvE3cQm2Zpnq9fgLwPaI3HgQDKHqZRAeRg89FN9gxzN 8rl++dFEEainzJ5TB9QD9diWo+FVir2iM/s8xlmdzJb7ekVPp5TZ3X4AxO6AYeQlIj4g lpa1O3lXjHJBybxtxNkC+Nxx+hbfmg7DEjuWstdopuxmvVPkcEek48SuT9+oNRygG2u3 C6Hg== 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=uE9+W35bzRTjmd50/akuZa5V3UE62yeNQju9q1iKL+8=; b=em9My5EkBG21PABIgUaZY1+MUlEnxJ3Qrk8ST4cFSYmKfg2V5+vnNDQUq5fhZwhshL O9dRuRq2jfcUhuX5Ac9w/xdHwTGR/rnNyIer3lqbOzE/U7w5MNqVNFXCXhwtDN3JCjZo 3RX+5oIDjdpMWp1HUvSbpPJQ/xhbxMSsWd69IL9oVYFH75nzbB1xB2w5unZT2o8zoSnV duEfvBqFp7cWVc8HX4mfRtmhwWoOxl1h4X6PfRFGgleeUO1bQdLnTuLpdtQp/ehoOkwR +EI3JfTZDjWqpoFGYa1ZJpSsjbnhlrdT0gxtlL/Ggc4mMTox1t5kuQkibvUWsy1QTkyT RlqA== X-Gm-Message-State: AOUpUlGs+Zs7g16LipWAnSYtVlSEsOdLFp4rQqANkkuBu0CUVuEbhKzX 5h1DxKyXLeWtGAf7OLJUEQciS0IM X-Received: by 2002:a5b:b81:: with SMTP id l1-v6mr8681700ybq.35.1533608352818; Mon, 06 Aug 2018 19:19:12 -0700 (PDT) Received: from sanilraut.attlocal.net ([2600:1700:38d0:45b0:5548:869f:cb13:cf4f]) by smtp.googlemail.com with ESMTPSA id t4-v6sm35907ywg.98.2018.08.06.19.19.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Aug 2018 19:19:12 -0700 (PDT) From: sanil To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Aug 2018 19:18:27 -0700 Message-Id: <1533608307-25358-1-git-send-email-raut.sanil@gmail.com> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Tue, 07 Aug 2018 22:12:59 +0300 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];