Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/hlsenc: use a slash separator even in win32
@ 2024-03-31 20:35 Marton Balint
  2024-04-06  9:14 ` Marton Balint
  0 siblings, 1 reply; 2+ messages in thread
From: Marton Balint @ 2024-03-31 20:35 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

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 <cus@passwd.hu>
---
 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)) {
-- 
2.35.3

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: use a slash separator even in win32
  2024-03-31 20:35 [FFmpeg-devel] [PATCH] avformat/hlsenc: use a slash separator even in win32 Marton Balint
@ 2024-04-06  9:14 ` Marton Balint
  0 siblings, 0 replies; 2+ messages in thread
From: Marton Balint @ 2024-04-06  9:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On Sun, 31 Mar 2024, Marton Balint wrote:

> 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.

Will apply soon.

Regards,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> 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)) {
> -- 
> 2.35.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-06  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-31 20:35 [FFmpeg-devel] [PATCH] avformat/hlsenc: use a slash separator even in win32 Marton Balint
2024-04-06  9:14 ` Marton Balint

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git