From patchwork Sat Jun 13 22:52:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Scholz X-Patchwork-Id: 20342 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 E208C44A05F for ; Sun, 14 Jun 2020 01:53:00 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CCAEF68B69F; Sun, 14 Jun 2020 01:53:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E6F5868AE9A for ; Sun, 14 Jun 2020 01:52:54 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id j198so11474385wmj.0 for ; Sat, 13 Jun 2020 15:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+NlgGyf3zvPb9+DJgdDsXR9KqMQkfIcose9k82tonLc=; b=CzVBWbE5Qny0u6lV7Bbt3DtOOcI1/CFTcQRHNHuEOZ7YcWPQPESrSSp2K+8NydwuB9 rEb6K4BKnBDNunpdpov+51kIIJlefRq200zPqQEeVlVce4VZT6x+RRJZAD+9WPABnrDz +WuxL5L5ggw2rB1Hbb/fsTNW5tJ8itxcMY3yIdaMHcdRJAfMUO3LWoZQqHgkEUmQNXiT EnjzPXKNiOdUloLoEd/gUmnni/7QI3CdS2XMdWP7XcsDyN3BGuUDJopACRGhjBVeZ7WA zEAlz6Rj43LPhXbSx38Q/S5DDgVs4PiZ3jEpzNLuG6Rm12jmHvwfRfDLA4ASFUlfwC4e ZUqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+NlgGyf3zvPb9+DJgdDsXR9KqMQkfIcose9k82tonLc=; b=VX1Ye99LwPhrdQOtQq6km5IVeEGgbrUKok44ibLmZAYPpcGIBiRPy08Kodl/q+HfZ5 ncitE144zJBqtyqFLnKK4iuEVI2P5eZWZjJdiwcK2xvhJGNL6g1prS1lImEc4nnaLGqF Qkhme4qSoGQ8/8JcIWDOnkJv1Fl80NXuofw4ZUx8AW9E5HI8RGw1uN1xjoHFcPyONx44 bE9oJoqiOBGZM/fw7xDQhp7T+erBQighALjOtnW6VkU8sd/06l1xg9xHwZwyVuGiTtK5 kqhCmusu6O1lb1Vid05UwuPEkIC4JnY0cojKiOhxNGyhU8D4j5YRkYG+iOTV4gucZMih XTRA== X-Gm-Message-State: AOAM531LhJ6IlaCyy/txxjlDvDbHpTNZGrLutKCOP5E5vQe8MBOc4W5W HGmTkcYMG/YTPJpeqUARUU98A6Jx/1Q= X-Google-Smtp-Source: ABdhPJwuXO3cuPx5o/ZZxdX822xtp9TxLxptf0rThYjKGkX6hOFIZreZzPiZusTwsAiHm+9s7Iqg/w== X-Received: by 2002:a7b:cb91:: with SMTP id m17mr5820538wmi.126.1592088774165; Sat, 13 Jun 2020 15:52:54 -0700 (PDT) Received: from localhost.localdomain (h082218239149.host.wavenet.at. [82.218.239.149]) by smtp.gmail.com with ESMTPSA id y5sm17534964wrs.63.2020.06.13.15.52.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jun 2020 15:52:53 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Sun, 14 Jun 2020 00:52:44 +0200 Message-Id: <20200613225244.64116-1-epirat07@gmail.com> X-Mailer: git-send-email 2.24.1 (Apple Git-126) In-Reply-To: <20200613215808.62675-1-epirat07@gmail.com> References: <20200613215808.62675-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] avformat/icecast: Add option to use TLS connection 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: Marvin Scholz Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- doc/protocols.texi | 3 +++ libavformat/icecast.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index 7aa758541c..32c829d2a3 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -520,6 +520,9 @@ audio/mpeg. This enables support for Icecast versions < 2.4.0, that do not support the HTTP PUT method but the SOURCE method. +@item tls +Establish a TLS (HTTPS) connection to Icecast. + @end table @example diff --git a/libavformat/icecast.c b/libavformat/icecast.c index 38af16b99e..b06c53cabd 100644 --- a/libavformat/icecast.c +++ b/libavformat/icecast.c @@ -43,6 +43,7 @@ typedef struct IcecastContext { int public; char *url; char *user_agent; + int tls; } IcecastContext; #define DEFAULT_ICE_USER "source" @@ -62,6 +63,7 @@ static const AVOption options[] = { { "password", "set password", OFFSET(pass), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, { "content_type", "set content-type, MUST be set if not audio/mpeg", OFFSET(content_type), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, { "legacy_icecast", "use legacy SOURCE method, for Icecast < v2.4", OFFSET(legacy_icecast), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, + { "tls", "use a TLS connection", OFFSET(tls), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, { NULL } }; @@ -162,7 +164,9 @@ static int icecast_open(URLContext *h, const char *uri, int flags) } // Build new URI for passing to http protocol - ff_url_join(h_url, sizeof(h_url), "http", auth, host, port, "%s", path); + ff_url_join(h_url, sizeof(h_url), + s->tls ? "https" : "http", + auth, host, port, "%s", path); // Finally open http proto handler ret = ffurl_open_whitelist(&s->hd, h_url, AVIO_FLAG_READ_WRITE, NULL, &opt_dict, h->protocol_whitelist, h->protocol_blacklist, h);