From patchwork Wed Dec 13 00:35:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 6732 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp4769636jah; Tue, 12 Dec 2017 16:43:42 -0800 (PST) X-Google-Smtp-Source: ACJfBou9NVEA/HSZfkez15zaf1xfD36hS92zFuAiFmbUV6BNtBZfTEdhX2TB69RrelyA9fbiEmx9 X-Received: by 10.28.141.11 with SMTP id p11mr430988wmd.149.1513125821966; Tue, 12 Dec 2017 16:43:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513125821; cv=none; d=google.com; s=arc-20160816; b=L+bbaYwmqCq/RF1L+qoTWu3OT4c7CB7qFbJcojenNCGStbZTOIUd1n90cSzmGmMOSZ mZIgOmDLJhfeic0e3/evWkTE7P52M9hku3HUzSrU8J/G9/SgMrwgnDftKk4p6S1fVuMi mRlPIWGfkVi1r61b9qEQdA9bNvg2NwykhDg2ylxr6dJq5K9+wC17w02pTqwzb4fR1Pjd 8hPaX9pOVL7eXSIbiCRrd3nJw37wdP0DCiNS3pV5Szy7poROhLTDC0J9w1OML2N1GiMb 1XEti/bTqOOzowfrqqwJxYRkLh6umUDRrVZ7tqo8V/s9WvOZ87z5UZoow7RbgK4xXGBW Xg8g== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Sv8xazDODApweEDtYZLvfuQHK8JKcTgowUPAVY5aMqU=; b=dUQ60ZTy1VC6MsFNJQ4zu2TSjNFXJPjMVj8NhYzSiV7/VXjTwc2qj7E183J4tyh4Z+ tBik5q2EvtZlowfir5ZwUxDk6J7mdaaz2QXaabkq5Sel1ioS+SnZHJUwsXBIdrPH8wW/ a1KOPail3pvp2Lf+ceiG9vugM8PXSseZjjUj1YgNju77cdmtyh/AWhxaYugf5YV6uc+2 nTQ8r9pGkGYQ11gbF2JIo1xk1U+xbMpgFIMkAq+J7kW0NQMY6alF3osZ9Yry7DD+Cjw7 q9RT3VpqqIiSvSNaHx4diTzEo1SMLGxqBW89FkP6SRIdvVhvzwck++A+5W59hRJi0ZD5 cNcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=lf6Aq/Km; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e1si317664wrh.416.2017.12.12.16.43.41; Tue, 12 Dec 2017 16:43:41 -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=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=lf6Aq/Km; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A8B0368A351; Wed, 13 Dec 2017 02:43:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f48.google.com (mail-pg0-f48.google.com [74.125.83.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EDF29689CCD for ; Wed, 13 Dec 2017 02:43:26 +0200 (EET) Received: by mail-pg0-f48.google.com with SMTP id j9so521181pgc.11 for ; Tue, 12 Dec 2017 16:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KsQN2Nheuk1UZBxwYLKMT1rOy7qxQ21RYdJYM2D0n24=; b=lf6Aq/KmEwpz6QLWMMCwW9/02Op8995IZiue4EzPGSdujvrM34jDFEa2p0Aybv2nJ2 7KW4wxI67aieP9v0uYYxRVJr47KXSfdjOni5qdK6zOUpU8u4940pU3A3HPuUxwyPrNlH LkmtayE6pOeagCsO1gel+1OpGWVMJEKhwlAGrCyTxfrNFE4litHuXice280xodPWm7j8 G6ZPaaz7vI8sdNw6X1wwnFWCf2P+BdxHml/KbT8lf8pJyQbgDjV34mky9B5mmRvhAN2q NYidE75d4Pn/yxAlNhtDp/hQinmRgNUCatyzdtJkc1gv4rrD7jTgJ4skQZGdLzknNPqH /QLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KsQN2Nheuk1UZBxwYLKMT1rOy7qxQ21RYdJYM2D0n24=; b=P8e1Htzm/cMUThOaIHpBA07TN31j7DbgU42V3XT0LXi3r8wlERPueNF38Kziq9tB1F kQQLcFi+Q97cm1u/8c91TEPOMRArkzjac2Qb0QoaHvk6warAFNOVVD8Wbe3N/1clxCyv 4F+6n7onbXXJJ2LdaSJ78VYBhCl7SR7tMpV+CRAeU1TR6Sw9C+sJDCPA/trLobPYaRQt t4SbcX5bvoWcWZc3IFvazINQwRSfPV5fUWA6gQnakYrSrfigRVZbCs310NiqleBeMTg8 SDcrOxfl+myL6zfNQ+AF+B2I2IelQolQk8ApRsxKdHxPnMrgJ6O96G4KEpBTXZbK01uE EssQ== X-Gm-Message-State: AKGB3mKLgcsYOLKh2w0GnOK+OsJ/hYmK72grkDhrmG2VUJaGU1N5xYtI 3lMz6noxJwIGGSiwJxwR55mRC+2n X-Received: by 10.98.238.8 with SMTP id e8mr4089886pfi.23.1513125320750; Tue, 12 Dec 2017 16:35:20 -0800 (PST) Received: from localhost.localdomain (c-69-181-54-242.hsd1.ca.comcast.net. [69.181.54.242]) by smtp.gmail.com with ESMTPSA id b25sm394282pfd.182.2017.12.12.16.35.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Dec 2017 16:35:20 -0800 (PST) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Dec 2017 16:35:10 -0800 Message-Id: <20171213003511.25342-5-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.14.3 (Apple Git-98) In-Reply-To: <20171213003511.25342-1-ffmpeg@tmm1.net> References: <20171213003511.25342-1-ffmpeg@tmm1.net> Subject: [FFmpeg-devel] [PATCH v2 4/5] avformat/hls: allow open_input to be re-used 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: nfxjfg@googlemail.com, Aman Gupta , barsnick@gmx.net, kjeyapal@akamai.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta --- libavformat/hls.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 5c1895c180..f75c8f5eaa 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1145,7 +1145,7 @@ static void intercept_id3(struct playlist *pls, uint8_t *buf, pls->is_id3_timestamped = (pls->id3_mpegts_timestamp != AV_NOPTS_VALUE); } -static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) +static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, AVIOContext **in) { AVDictionary *opts = NULL; int ret; @@ -1172,7 +1172,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) seg->url, seg->url_offset, pls->index); if (seg->key_type == KEY_NONE) { - ret = open_url(pls->parent, &pls->input, seg->url, c->avio_opts, opts, &is_http); + ret = open_url(pls->parent, in, seg->url, c->avio_opts, opts, &is_http); } else if (seg->key_type == KEY_AES_128) { AVDictionary *opts2 = NULL; char iv[33], key[33], url[MAX_URL_SIZE]; @@ -1203,7 +1203,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) av_dict_set(&opts2, "key", key, 0); av_dict_set(&opts2, "iv", iv, 0); - ret = open_url(pls->parent, &pls->input, url, opts2, opts, &is_http); + ret = open_url(pls->parent, in, url, opts2, opts, &is_http); av_dict_free(&opts2); @@ -1230,11 +1230,11 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) * noticed without the call, though. */ if (ret == 0 && !is_http && seg->key_type == KEY_NONE && seg->url_offset) { - int64_t seekret = avio_seek(pls->input, seg->url_offset, SEEK_SET); + int64_t seekret = avio_seek(*in, seg->url_offset, SEEK_SET); if (seekret < 0) { av_log(pls->parent, AV_LOG_ERROR, "Unable to seek to offset %"PRId64" of HLS segment '%s'\n", seg->url_offset, seg->url); ret = seekret; - ff_format_io_close(pls->parent, &pls->input); + ff_format_io_close(pls->parent, in); } } @@ -1260,7 +1260,7 @@ static int update_init_section(struct playlist *pls, struct segment *seg) if (!seg->init_section) return 0; - ret = open_input(c, pls, seg->init_section); + ret = open_input(c, pls, seg->init_section, &pls->input); if (ret < 0) { av_log(pls->parent, AV_LOG_WARNING, "Failed to open an initialization section in playlist %d\n", @@ -1426,7 +1426,7 @@ reload: if (ret) return ret; - ret = open_input(c, v, seg); + ret = open_input(c, v, seg, &v->input); if (ret < 0) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT;