From patchwork Sat Oct 2 07:02:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ekibun X-Patchwork-Id: 30884 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp2423036iob; Sat, 2 Oct 2021 00:03:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfTisDbn+uv9ObklRqggTnpvP2mb4u8N/MuAJoQ39/rvovEc1fAkwrN6nnsULJEiqEfv2g X-Received: by 2002:a50:e04e:: with SMTP id g14mr2435398edl.168.1633158188509; Sat, 02 Oct 2021 00:03:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633158188; cv=none; d=google.com; s=arc-20160816; b=Obmn5e6wVSea5NZ6jK/rhka4KhQHZyXZsA9pzrqTXPbNkLwkK/Hl42/2aSVlKOARMv cV13Jm5Qts2eu+/WM/kGTHjCPg1JUixyGWKnFPdIy8ZdSwO6JxDnvLfsbVlF3LrE5aYB v/ORxulx5+qAdmW7TDc/u16i5hTKqsnpOfx2hBWcdf/aSw7FavHprL6sAhFr01DGXn+F muK+kxuGGpD66w8mZTRX6RVV18qL6dG1gns6LN4f85xucROki6HgaqTdt2zTvBpQj0qG Qp7IiSbNEA80xj9mXSssyEYVQblphcCZv3PHowxxyG2H7B2CmpDuF45Lsdz6TH5orSjs Whfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=XXVcQO3X2hT1aBCJb0XXzFRbfuJVV1ozLrSO7+s0Z2w=; b=wBy6j1sAviJCRhTNkE0VLmK2PJyXEnnMuQRo6L9p8PKN++JQs1NcFbOaKpqkoCX2Vg ahzYUTbN0A5VT/S2gz+ifQhtMhJk/wZXZxhJcIXcT8mrnTOCzecNH1TUSAMc+VyUM2MR 2/UBAsxGa28H2v5093hNDMGu5ZwmwezR9zHl09WrlqHLNMyDuGeFKIMIgG/efdVPVGLf adTncZ2PtrT8SmcGwF8URAQRwJVFOh6rf/r+9h1p9FFjcplNfeZUK+fDMTNKhwmJoS+a dccOD2T0+CRTolkZaYbEJ6Zk33xahgpGP4tEtyY3rYLe3j4PcFXTpMSi3VbhPqixujs9 W1aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=cq1ppBRA; 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 co8si1389011edb.289.2021.10.02.00.03.04; Sat, 02 Oct 2021 00:03:08 -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=20210112 header.b=cq1ppBRA; 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 2BC4A68A0E7; Sat, 2 Oct 2021 10:03:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CAD2A689A15 for ; Sat, 2 Oct 2021 10:02:54 +0300 (EEST) Received: by mail-pf1-f169.google.com with SMTP id g14so9939346pfm.1 for ; Sat, 02 Oct 2021 00:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DsD5xflb8Zx/+Uh3JJeiVb6y9xk2LXW5IIO4kRtn99Q=; b=cq1ppBRAT823les8+zf69y6C77MIadVGyGJhycB1sAMASN3p9bF7PuWMFpP5BZY5vs jar5xctIZLAffwznOLIs3EEMyFi8osHSFHQ5/Ig+SKTZw5ymfWU6BW9hgG5Hr/XZPF/O ihKlWHhA4UKwCTy03sT9VNOjy8viW/R9pSlCnEwSu/aq6oL77fr08EO3/lSOUX1aF0eD oNTiGnryyEXHXq8J6FUwK/TeOXx9b1rcJkqKFIFIBg7vMpZswHvtMeiLzf9U1w1KMwCM mtLjvzzv17eB4ChPvuDgJ7ljBPjGj0K/OlJUz7ObPkTY3TNltdNDL/0QWaYr8L0sbu0D 0E2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DsD5xflb8Zx/+Uh3JJeiVb6y9xk2LXW5IIO4kRtn99Q=; b=qeD1osmJ5rzOrCBgiDkgH3uwBATEz63rrZvEouCqMWPhMgrVGGLkLdBIGMlJid7PGR WZgfTn3dgKLMsoTI0CjLITTwxm2NANlLSNAi9JKOczXKZ0ZjzwKKgWN72WLVJ+d2Sjvq ILgndjwZoMhV3NSi23EndQ6vAajguOCuPCtcSzep0s18vLP1STmAgC+F1k0BPWfZ15Ke AAmrnXiGMHSpO36KzQ4Yu0kQrZ5vYyaZnCwTwfBDob2uUaQ5aoI8rlA9DImtO8O6+8qP wZSudpxZQovmvvmFsZDGc1xXhzuqCFVN0UjpZPUORIP6Dx8jrAplH400x+DDKbUmVtHe 7h2A== X-Gm-Message-State: AOAM533dBQiDjMo7pv7JHYwPRkCg31RICD0pDuN5VJJScv1eB9WFkezi uT/Gk6iWLto+pB8vCNEYPX9lOQqas2Q= X-Received: by 2002:a63:ea48:: with SMTP id l8mr1838024pgk.99.1633158172566; Sat, 02 Oct 2021 00:02:52 -0700 (PDT) Received: from LAPTOP-S97QJC3H.localdomain ([52.187.72.174]) by smtp.gmail.com with ESMTPSA id u24sm8656273pfm.27.2021.10.02.00.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 00:02:52 -0700 (PDT) From: ekibun To: ffmpeg-devel@ffmpeg.org Date: Sat, 2 Oct 2021 15:02:45 +0800 Message-Id: <20211002070245.831-1-soekibun@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] do not check protocol on hls without network. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: ekibun Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ePiwEwELk+DQ Hi. I'm investigating in custom IO for HLS playing, and got errors while calling segments. I've compiled libav with `--disable-network` configure and tried custom IO by overriding `io_open` and `io_close` for `AVFormatContext`. Everything goes well until open segments urls. In the function `open_url` of `hls.c`, demuxer checks the protocol name before calling io_open. The protocol name is obtained by `avio_find_protocol_name` that always return `NULL` since no network protocol exists. And after I commented out all the protocol checks in `hls.c`, it functions properly. Curious to hear if you think it's a good solution or is there a better way around. Thanks! --- libavformat/hls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 9fd4ad9f32..e139922ab8 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -631,6 +631,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, int ret; int is_http = 0; +#if CONFIG_HTTP_PROTOCOL if (av_strstart(url, "crypto", NULL)) { if (url[6] == '+' || url[6] == ':') proto_name = avio_find_protocol_name(url + 7); @@ -669,6 +670,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ; else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) return AVERROR_INVALIDDATA; +#endif av_dict_copy(&tmp, *opts, 0); av_dict_copy(&tmp, opts2, 0);