From patchwork Sat Aug 11 00:20:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sanilraut X-Patchwork-Id: 9953 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp598402jad; Fri, 10 Aug 2018 17:27:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzJU5L/YOytDLutaF1gCeNUSBgIYIEhMxZTTnHgd1746QWqUdkv/jnPgA3fhfaM4x6KPnkT X-Received: by 2002:a5d:434c:: with SMTP id u12-v6mr5120376wrr.189.1533947241189; Fri, 10 Aug 2018 17:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533947241; cv=none; d=google.com; s=arc-20160816; b=r77PSgoni9k260Cw9+QqY9B8Bo0RAv29vnw/+eIw6IN5/Bf72tzaddVVq7gvC8ZB/J E+9ylBa1hVLKpKoXBvAcOnPyaH/fBBJeseEpCpbbltB1TAglVlbgU1E7ra4AsjsOSHQR GM+g3gLCJfD8zVkJdWi2YWBGPfhs9E4OgnpHCANQB0AkZFIprVuu4JMpCbCREN8Busnz uZgow6LvQI+z6uEpw7IwDHFKLh9ROKa8PZ2TO8He6N3sO5qBpWA+YJYXIy+dDXVkFjwY F7lACmnoZHV+xnP4/4qRAvhKYUMBlEU8TkJENgEAgXN1deJ/R0q4EYOBf3SJAzk7D5Rd 61bg== 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=XLCYeQvUrn007UJaRvmdC6mh51LBynGywxp9HsZf0og=; b=tYFs17Tq5nEEP9whFmktE5VBakjJ1mkSLlz60XSMqIRiDO2MS8IDNFU/weTw7BJXEH JVnTnKSIaWEW0sbp9PudKnT+ANTb4xv6auUfTEXhFmsnsVX0C+PgMEw//zo/1NMCHXTc ILpAeE2qGTwK1s+Ps3yIrfkWh3Xk28Rej5JCyDl8RjEHtow10oh7HHazfim/y+hWVMKv vFltLPnFxW1ilzwFpFJfF/DQ0Qv/m3pED2mK+ZRlXwgDmhslC4061mrBRECE/avGdFkU akjV9yQiM9emcq4CCyCUOUd2whTcN23ylKvu6szIWz7JlEBYhMsvVl0xNmj0NK0EqXsD NxHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Vf2x11xx; 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 z5-v6si2582295wmd.93.2018.08.10.17.27.20; Fri, 10 Aug 2018 17:27:21 -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=Vf2x11xx; 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 7B59868A4DC; Sat, 11 Aug 2018 03:26:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f52.google.com (mail-yw1-f52.google.com [209.85.161.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E57A68A3DF for ; Sat, 11 Aug 2018 03:26:49 +0300 (EEST) Received: by mail-yw1-f52.google.com with SMTP id y203-v6so9864059ywd.9 for ; Fri, 10 Aug 2018 17:27:11 -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=8lxVdlgWGf4HskXk6+eaMlYpIAl65lm9gZTlf9ES348=; b=Vf2x11xxkQIQQ4UI3L1uWJmX90m5F8yidZdkc/oOfLlYrlOkLcoxszPUhfaQvwPHF+ 76YJkHu3Blmmue8SJhVPB/KGZPtx2Bf5I18hh5RuYO5o4sWf+OZMcAYeT8GWSV+Aw2cH jpysNB2c88Q2lnmrDkOg1swd3G1aObhgWlVym4g44lqUAOP55S/v989ZeXWiujGb0ayc lQ7KqYfxCG4rclaCfpy1z0VuJ2s8ypcXrMQtvaFpDnwDhG4Z/Rro/TChysoeHKq+fETe Lc7JNIKBr7plZJQZ77+0RYSbFP/Snsga5ybFqnbmFhLhvIWflLEuI8cBuiqNNzjb2+Bh kp7A== 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=8lxVdlgWGf4HskXk6+eaMlYpIAl65lm9gZTlf9ES348=; b=RSONSjZOlCGt7DrPrkwQgrfKCOpQK2JRAVbTAjLeH6R7aeizbJp5YP5QjZcP/7Ry1K nQ1pUs15HuuQHMh1rK/Zz+ZH/eCV7pJ+HrizKbDrHNDUfkwiKjTZR39xvGmuIurp5mQd QQqjg92Yekdygo5DcTrQg0zSHckdvPrEKseORXaHQ2MwIZDx8TU/EF9lOZqPPKIWd4Ju +xjc7+PhiGbqlh3fj1hsFnYG9SiWC/NNHb2ma+RxcQ/YLqhCwa98tlU3G4S1RGF4SC0u ID2kGd5qGPydqDWeGEY384+B50609o/NC+lRHlQEzxXs8Vw4csX1sTeqXrV5keC49T6O wgeg== X-Gm-Message-State: AOUpUlHiD/d5V4rSASmnShqzLTX5Ivg8+dJPfvoW/hDzQQj13X6gAbnC 5LohCQkh7d3t8B8EvpNmfpDcAoLO X-Received: by 2002:a25:7756:: with SMTP id s83-v6mr4669493ybc.71.1533946865349; Fri, 10 Aug 2018 17:21:05 -0700 (PDT) Received: from sanilraut.attlocal.net ([2600:1700:38d0:45b0:e9ed:3afb:ca0e:c34f]) by smtp.googlemail.com with ESMTPSA id e134-v6sm11151291ywa.59.2018.08.10.17.21.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Aug 2018 17:21:04 -0700 (PDT) From: sanil To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Aug 2018 17:20:57 -0700 Message-Id: <1533946857-11282-1-git-send-email-raut.sanil@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH v2] 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 5730252..f851bbf 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -259,6 +259,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) @@ -1322,7 +1328,12 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c) 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; + 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;