From patchwork Tue Feb 19 06:48:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jeyapal, Karthick" X-Patchwork-Id: 12103 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 45FBF447BAB for ; Tue, 19 Feb 2019 08:49:15 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B6CB68AB32; Tue, 19 Feb 2019 08:49:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a1i868.smtp2go.com (a1i868.smtp2go.com [43.228.187.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1F12C68AAF8 for ; Tue, 19 Feb 2019 08:49:08 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1550559853; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=Szxc+olk14RTOR+ciFEmzsZ1xvQBPXKjZsYz/JHWQlY=; b=kpUhE9B3 qvrHo7wfJwchrYZAvxZj9lx8u7X6V3/789CdVBJh6wz7mI5OeQexC7koJbnZDgAW0OyNJMeF+t61z MfKfc+ggfrqt48JAXMubulKdXbMHwzfR9nvE+5+wXT39+L49VSzuBC1ZWxlFS7SEJxdgW1mRDp0M8 1Y2aHU/j5XSrPPxGjk0a0DqQIK0LX+yqmB3JCxXL6OptHgw/lL9YEgngwocQQ1iDM2jTCRAi4pQJc XnPGyd5IGfPJQ+iR5s6nj9F0jI+b8RZSgjLGqQbUjqVPEoxrQlQ74isWTu+Fict+HPtP5PitMaehw 2DpOwxW4quPOe7PUTo/4DoF1wg==; Received: from [10.66.228.43] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1gvzDE-4pkQpi-N4; Tue, 19 Feb 2019 06:49:04 +0000 Received: from [10.63.208.195] (helo=blr-mp4tf.bangalore.corp.akamai.com) by smtpcorp.com with esmtpa (Exim 4.91) (envelope-from ) id 1gvzDD-wSEUyF-HV; Tue, 19 Feb 2019 06:49:04 +0000 From: Karthick J To: ffmpeg-devel@ffmpeg.org Date: Tue, 19 Feb 2019 12:18:53 +0530 Message-Id: <20190219064854.24186-1-kjeyapal@akamai.com> X-Mailer: git-send-email 2.17.1 (Apple Git-112) X-Smtpcorp-Track: 1gvzDDwSElyFHV.aAP-8Lgak Feedback-ID: 337386m:337386asVRLGB:337386sUmtyvuRKn X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH 1/2] avformat/dashenc: Added option to repeatedly publish master playlist 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: Karthick J MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The master playlist can be published at a specified interval with this option --- doc/muxers.texi | 3 +++ libavformat/dashenc.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 36010cf2d1..372fab2f92 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -315,6 +315,9 @@ This option will also try to comply with the above open spec, till Apple's spec Applicable only when @var{streaming} and @var{hls_playlist} options are enabled. This is an experimental feature. +@item -master_m3u8_publish_rate @var{master_m3u8_publish_rate} +Publish master playlist repeatedly every after specified number of segment intervals. + @end table @anchor{framecrc} diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 37a7547b12..a0b44a0ec3 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -141,6 +141,7 @@ typedef struct DASHContext { SegmentType segment_type_option; /* segment type as specified in options */ int ignore_io_errors; int lhls; + int master_publish_rate; } DASHContext; static struct codec_string { @@ -965,13 +966,18 @@ static int write_manifest(AVFormatContext *s, int final) return ret; } - if (c->hls_playlist && !c->master_playlist_created) { + if (c->hls_playlist) { char filename_hls[1024]; const char *audio_group = "A1"; char audio_codec_str[128] = "\0"; int is_default = 1; int max_audio_bitrate = 0; + // Publish master playlist only the configured rate + if (c->master_playlist_created && (!c->master_publish_rate || + c->streams[0].segment_index % c->master_publish_rate)) + return 0; + if (*c->dirname) snprintf(filename_hls, sizeof(filename_hls), "%smaster.m3u8", c->dirname); else @@ -1798,6 +1804,7 @@ static const AVOption options[] = { { "webm", "make segment file in WebM format", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_TYPE_WEBM }, 0, UINT_MAX, E, "segment_type"}, { "ignore_io_errors", "Ignore IO errors during open and write. Useful for long-duration runs with network output", OFFSET(ignore_io_errors), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, { "lhls", "Enable Low-latency HLS(Experimental). Adds #EXT-X-PREFETCH tag with current segment's URI", OFFSET(lhls), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, + { "master_m3u8_publish_rate", "Publish master playlist every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, E}, { NULL }, };