From patchwork Tue Dec 26 11:11:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jeyapal, Karthick" X-Patchwork-Id: 6984 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp6724110jad; Tue, 26 Dec 2017 03:12:10 -0800 (PST) X-Google-Smtp-Source: ACJfBov9SR94aJWdGSJUp1FIZ6kdjVTf4+Psxe5Zo4pin20arlfl5gtNsmf+xTapaWfB3XWFy9Cf X-Received: by 10.223.159.18 with SMTP id l18mr19064612wrf.156.1514286730549; Tue, 26 Dec 2017 03:12:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514286730; cv=none; d=google.com; s=arc-20160816; b=szs8XsI/OLjgn/56fVbY+R+KNeijQ3/ONS8uwIajZ60KI0FWoaPfxIhEYbkvWrNdgz 7o/3zeLY6weC1uQQfLU6guSvllHEWaWPvxA4uVYlxRtnVmQe5LB+M2Wf0MZzJZ4B/9XZ WqHV5qw/23f2S2EB4SLl3PcLeEKGhbEd+bzTcC7hUU90GHwuP0ZsPUUd4VbugWIwLOu0 8pklr21VTJtzzPfdxB2IQcPfPJP9ymojUn9uyBi1wI1+rh8Wox729VjS1M6SJ2HdDR2k EUNa2a0qPT0RHv77D1/R2LlrEcGtQmmTyt03ZIXJjdwfyhR8y0XIfgk/aOlLNGJTk5Ka A7GQ== 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:feedback-id:message-id:date:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=Dm2/orKuCA7sILJAjtLuyozQ3oZAB7ry9GSlWnjcyYk=; b=ySiNfeLWF7WvdSm81Lul8o4UnXJwVAbNIKK5ss4yZZCPhCIGyW3GjIwqkOEPyJiRdE wMVwm+vtEruCDC+g1+gyP6WDCnjtbjNjw2GFpSZh08BoPuPjNIo6MxS2CpCz2gbyC/jy TXxrTQfrx47EJpXjbjPMASjArsPmo6jjgoTRkIe/pMUMGkGeg6v42LDgQf4YtpfMjxn9 4AjvP0jfidVY28/Ym6KyJjLZyo7kNtnP8mPIqaooywYw7SusyvJKgOEoyHA1b1apI0xr LISUSbmXWmO7RVhXXau/6POJyNf760HWz1N4tDibBTyy3bmSZ4aVPOjaXXr+O+XvOlr8 efgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=d565/sYi; 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=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f18si12359098wre.14.2017.12.26.03.12.09; Tue, 26 Dec 2017 03:12:10 -0800 (PST) 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=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=d565/sYi; 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=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A0E46882E8; Tue, 26 Dec 2017 13:11:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a2i831.smtp2go.com (a2i831.smtp2go.com [103.47.207.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA517688284 for ; Tue, 26 Dec 2017 13:11:47 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1514287626; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=a/XM86HxQE71p1xSMfOuP4onGWgdOCwurAX+4hWqMUo=; b=d565/sYi 6iGLWc5ezl5WWNEKv1pGSZ8iAeo/vqx5+lFIzbf2cew1IEFOCbNVAh8JjcO6MSRyttho3/x+JaWX4 n7uyQnwTzeSiaOK4P1IN0Mpy00D9UhN1v57Gwkj3HUrCvrfpJtuJ+U7TSqTYoHE4Rr7YHTF6mL1YN TIDFTA9bVcm2diC0n/n1BdcbxPo7HuaDCA6+qh1NAXKTRalaLO0i9GOPGAvafu3lGAL0nuDQU5o9L oB/5LiTZf7+3rjNo+Sf1KV37PoMEPwhlrskYu45YPBaIygk5PD2j9F4dCMFAGHHJ/dBqf8GghB2L2 vcvGN3V3n3ubEuJ01Ljma/+ADg==; From: Karthick J To: ffmpeg-devel@ffmpeg.org Date: Tue, 26 Dec 2017 16:41:38 +0530 Message-Id: <1514286700-21147-1-git-send-email-kjeyapal@akamai.com> X-Mailer: git-send-email 1.9.1 X-Smtpcorp-Track: 1-Tn9mNmF489RY.QX59JTIl0 Feedback-ID: 337386m:337386asVRLGB:337386sYEOIivrtR:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH 1/3] avformat/hlsenc: Modularized audio rendition playlist write to allow reuse 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 Jeyapal MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Karthick Jeyapal --- libavformat/hlsenc.c | 6 ++---- libavformat/hlsplaylist.c | 9 +++++++++ libavformat/hlsplaylist.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 74f66ce..fe531fb 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1169,10 +1169,8 @@ static int create_master_playlist(AVFormatContext *s, goto fail; } - avio_printf(hls->m3u8_out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", - vs->agroup); - avio_printf(hls->m3u8_out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", - m3u8_rel_name); + ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name); + av_freep(&m3u8_rel_name); } diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c index 42f059a..a065eda 100644 --- a/libavformat/hlsplaylist.c +++ b/libavformat/hlsplaylist.c @@ -35,6 +35,15 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) { avio_printf(out, "#EXT-X-VERSION:%d\n", version); } +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, + char *filename) { + if (!out || !agroup || !filename) + return; + + avio_printf(out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup); + avio_printf(out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", filename); +} + void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename, char *agroup) { if (!out || !filename) diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index ac03550..518cfc2 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -37,6 +37,7 @@ typedef enum { } PlaylistType; void ff_hls_write_playlist_version(AVIOContext *out, int version); +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char *filename); void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename, char *agroup); void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,