From patchwork Thu Apr 20 16:18:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amine KABAB X-Patchwork-Id: 3454 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp883416vsd; Thu, 20 Apr 2017 09:26:56 -0700 (PDT) X-Received: by 10.28.174.195 with SMTP id x186mr3988419wme.129.1492705615118; Thu, 20 Apr 2017 09:26:55 -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 b34si863856wrb.130.2017.04.20.09.26.53; Thu, 20 Apr 2017 09:26: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; 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 sp=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 ED49D68991D; Thu, 20 Apr 2017 19:26:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C776D6808D1 for ; Thu, 20 Apr 2017 19:26:35 +0300 (EEST) Received: by mail-wm0-f67.google.com with SMTP id z129so11836489wmb.1 for ; Thu, 20 Apr 2017 09:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=EKLLV4lPM4Kw1DxJQ8gIaXV+MX90hhLOJQSth4KMZLc=; b=aEd3WJUg9CSd8JtFp4bSCEohWh0h0meZU1O1wM4xRvz64G8g8SdjssAQHs4oW/Ve1p T2NfvYbX5YM8Rwi0iQT+B89LyYTbGnjNPBcsPAQnInS5O4nqJ5g3mgipW7mGE+Oa2XeC rn2PsXiHLMZWdTzcaD/Xqe9gy9yavt+GxGLqd7jwVYf2nSs0xx6VS5crph2lTJAXVI5S bvoN98R6yN2niNqXjpBRkmer27+gWpSZBSH1eUi7f4J4poG/8VwljccWKWEZDCScVbbk Ci/rD4vqoWP5Jybl9uTuCdLCZTF6hVafC7vnKi9WvIQZgfpeosikEeDLSQKEyjpU2TWr eabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=EKLLV4lPM4Kw1DxJQ8gIaXV+MX90hhLOJQSth4KMZLc=; b=Wj4IGdoRlsl9F5+aiLKHI3qU1h+Ttrfzb2uW8UknsnUVOGEAsmDSzzfw84Hd2mlgxh +QBfM2GFEZ6JKmn+y7Oj8UGF7iaP4Bglrca9a6opw1ZzI2CAml6/78Inv0sqOJCZSah4 6J/HqMEKdojznIW8XBgXBy8XHMAI9dp/KZy1xSRfjqYMojQnyAN7KVZ///lM3GylUw6F u7wFFecTaQCOgnBgK6f4QlqTpqoElnP0FYzxuHmKR70mdlPphp9aG/EXSOn57K3Cx/A+ PZoQ0CHIeh5beQ/t1aHlzLQGFq8k/ZwvvMmkKXrCqxnby2rZhpRg6T5dgMslryRU5OO1 1n+A== X-Gm-Message-State: AN3rC/6eKZajp59T+ayxjWUmR0QQa3+dHWyEZMt/2tWlBk088O3+Wev3 4K3nJGIvK4F6Mibmww0= X-Received: by 10.28.7.18 with SMTP id 18mr3886770wmh.80.1492705120978; Thu, 20 Apr 2017 09:18:40 -0700 (PDT) Received: from MacBook-Pro-de-Amine.local (adsl-244-111-192-81.adsl.iam.net.ma. [81.192.111.244]) by smtp.gmail.com with ESMTPSA id w76sm8162287wrb.49.2017.04.20.09.18.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 09:18:40 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org References: From: Amine kabab Message-ID: Date: Thu, 20 Apr 2017 17:18:37 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] [UPDATE] HLS, add option to skip down streams, 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" On 18/04/2017 17:00, Amine kabab wrote: > option to skip down streams in HLS > From 5079f9b7114589626a4c9fff0fbb8f6e0d2f4fd9 Mon Sep 17 00:00:00 2001 From: amine kabab Date: Thu, 20 Apr 2017 15:59:42 +0000 Subject: [PATCH] HLS skip down streams --- libavformat/hls.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index bac53a4..26d7679 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -194,6 +194,7 @@ typedef struct HLSContext { int cur_seq_no; int live_start_index; + int skip_down_streams; int first_packet; int64_t first_timestamp; int64_t cur_timestamp; @@ -1652,11 +1653,20 @@ static int hls_read_header(AVFormatContext *s) /* If the playlist only contained playlists (Master Playlist), * parse each individual playlist. */ if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) { + int all_failed = 1; for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; - if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0) + av_log(NULL, AV_LOG_WARNING, "Trying %s\n", pls->url); + ret = parse_playlist(c, pls->url, pls, NULL); + if (c->skip_down_streams && ret >= 0) { + all_failed = 0; + } else if (!c->skip_down_streams && ret < 0){ goto fail; + } } + + if (all_failed) + goto fail; } if (c->variants[0]->playlists[0]->n_segments == 0) { @@ -2126,6 +2136,8 @@ static int hls_probe(AVProbeData *p) static const AVOption hls_options[] = { {"live_start_index", "segment index to start live streams at (negative values are from the end)", OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, INT_MAX, FLAGS}, + {"skip_down_streams", "continue playback of HLS when one of the variant streams are down", + OFFSET(skip_down_streams), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, {NULL} };