From patchwork Sun Mar 31 20:35:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 47688 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp394407pzb; Sun, 31 Mar 2024 13:35:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUKjUCQ2OPnvZJDPz8Vse1L/504cYaVjXXLfbEw8kYEXqg2Un6MgXJExol93A4KOza3sSMN8ye3b2xjB2W9dXJhStLhoxofdsmlnQ== X-Google-Smtp-Source: AGHT+IHrm6x59tHHqgn/tw9GzH6293EEClX70VVDVVh9iZbLgsKkvXIdUBTSrV3y7mEE7HLReKuA X-Received: by 2002:a05:6512:38c2:b0:515:d30d:9abf with SMTP id p2-20020a05651238c200b00515d30d9abfmr3847831lft.7.1711917321507; Sun, 31 Mar 2024 13:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711917321; cv=none; d=google.com; s=arc-20160816; b=AEyXgVRkYXaViMYx4mepmA0jft83WyJVc3Jl3nGRh9MjcpcJ3FhIh223IgM4vf2JxV 0glJx/5RJR2YtpfWuO99SYTd/qLqV3GEq6o4vafxiYQOz97BEQK1bsQ1VCuyiN7o1zCz 2p77VhvaoW5acIpHTzGSn6CEgLfJQqURV/2Q0pkOqN0uFu+eAbmAWvRXcd0Ra1rA5fuC K8kHLUqOkyMJ8LQG2CcIUtc4zHmLLD9Nc4a8kk3Y5j9Cs+0zHzl1Fs77VnlPCo7o/sZH CsW3V4X1SKRZB1a0Kp7PkzUsjgGfv/cKwkEZf4z0xk9X/WsqOvkgwj9/AiUO5SSvAl5Y 83PQ== 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 :delivered-to; bh=fifNez+1pQI6OqIP1ojGaWjV0TkehzUmIWej+JIwGeM=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=f8TvewerGxb9VkeLPd5c4jiLGYxxcJKFFytUn0viTeApkxO/EIumSUtFOZcAcdfA8s a0985lfTlKZncoovvDsg2NWA/XSheZb7IA0RpEdQmreWeyzTKaf8IVPZlk+itOVokwtJ R3ohAN32uPNZ5vg67sSaGg3VigJ92lmN8ksCPvOiRPRUe+eI/PQ/IOmYxBOrLmD0RZU+ C23jn/mUBISl1LrAm0vg37sgQXw5USYJi1NfZpl+HbzvegnOIYv1OdJNXmUUDAgXBb6z XXtkJ7R7TcrWs21LqNUY7yzNzaxWOZxyE66d/GGofIgkSciUr9a0wg580FiwuoWgNJ1Z ShOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 cm22-20020a170906f59600b00a47063ddeadsi4211712ejd.376.2024.03.31.13.35.20; Sun, 31 Mar 2024 13:35:21 -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; 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 41AD168CD53; Sun, 31 Mar 2024 23:35:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 196C268C1C6 for ; Sun, 31 Mar 2024 23:35:10 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9B01EEA1DB; Sun, 31 Mar 2024 22:35:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id unFV2NJZ0K9G; Sun, 31 Mar 2024 22:35:07 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 21005EA1CE; Sun, 31 Mar 2024 22:35:07 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 31 Mar 2024 22:35:05 +0200 Message-Id: <20240331203505.12760-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/hlsenc: use a slash separator even in win32 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XVTHBQ7qE7Po We don't know if the protocol used is referring to a local file or a remote resource, so it is better to simply use slash as separator which works all the time. (well, except in very special cases when the user specified a \\?\ path) Fixes ticket #9780. Signed-off-by: Marton Balint --- libavformat/hlsenc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index ac8bb189f0..bde7230036 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -570,12 +570,6 @@ static void reflush_dynbuf(VariantStream *vs, int *range_length) avio_write(vs->out, vs->temp_buffer, *range_length); } -#if HAVE_DOS_PATHS -#define SEPARATOR '\\' -#else -#define SEPARATOR '/' -#endif - static int hls_delete_file(HLSContext *hls, AVFormatContext *avf, char *path, const char *proto) { @@ -668,7 +662,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, av_log(hls, AV_LOG_DEBUG, "deleting old segment %s\n", segment->filename); if (!hls->use_localtime_mkdir) // segment->filename contains basename only - av_bprintf(&path, "%s%c", dirname, SEPARATOR); + av_bprintf(&path, "%s/", dirname); av_bprintf(&path, "%s", segment->filename); if (!av_bprint_is_complete(&path)) { @@ -685,8 +679,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, vtt_dirname = av_dirname(vtt_dirname_r); av_bprint_clear(&path); - av_bprintf(&path, "%s%c%s", vtt_dirname, SEPARATOR, - segment->sub_filename); + av_bprintf(&path, "%s/%s", vtt_dirname, segment->sub_filename); av_freep(&vtt_dirname_r); if (!av_bprint_is_complete(&path)) {