diff mbox series

[FFmpeg-devel,2/2] avformat/dashenc: use ff_rename instead of avpriv_io_move

Message ID 20200108002340.24949-2-cus@passwd.hu
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avformat/avio: fix ff_rename to respect used protocol | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Marton Balint Jan. 8, 2020, 12:23 a.m. UTC
ff_rename always logs the error message.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/dashenc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Jeyapal, Karthick Jan. 9, 2020, 4:49 a.m. UTC | #1
On 1/8/20 5:53 AM, Marton Balint wrote:
> ff_rename always logs the error message.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavformat/dashenc.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index b84736881f..6b82ca9450 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -540,9 +540,7 @@ static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s,
>      dashenc_io_close(s, &c->m3u8_out, temp_filename_hls);
>  
>      if (use_rename)
> -        if (avpriv_io_move(temp_filename_hls, filename_hls) < 0) {
> -            av_log(os->ctx, AV_LOG_WARNING, "renaming file %s to %s failed\n\n", temp_filename_hls, filename_hls);
> -        }
> +        ff_rename(temp_filename_hls, filename_hls, os->ctx);
>  }
>  
>  static int flush_init_segment(AVFormatContext *s, OutputStream *os)
> @@ -1037,7 +1035,7 @@ static int write_manifest(AVFormatContext *s, int final)
>      dashenc_io_close(s, &c->mpd_out, temp_filename);
>  
>      if (use_rename) {
> -        if ((ret = avpriv_io_move(temp_filename, s->url)) < 0)
> +        if ((ret = ff_rename(temp_filename, s->url, s)) < 0)
>              return ret;
>      }
>  
> @@ -1119,7 +1117,7 @@ static int write_manifest(AVFormatContext *s, int final)
>          }
>          dashenc_io_close(s, &c->m3u8_out, temp_filename);
>          if (use_rename)
> -            if ((ret = avpriv_io_move(temp_filename, filename_hls)) < 0)
> +            if ((ret = ff_rename(temp_filename, filename_hls, s)) < 0)
>                  return ret;
>          c->master_playlist_created = 1;
>      }
> @@ -1619,7 +1617,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
>              dashenc_io_close(s, &os->out, os->temp_path);
>  
>              if (use_rename) {
> -                ret = avpriv_io_move(os->temp_path, os->full_path);
> +                ret = ff_rename(os->temp_path, os->full_path, os->ctx);
>                  if (ret < 0)
>                      break;
>              }
LGTM

Regards,
Karthick
diff mbox series

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index b84736881f..6b82ca9450 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -540,9 +540,7 @@  static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s,
     dashenc_io_close(s, &c->m3u8_out, temp_filename_hls);
 
     if (use_rename)
-        if (avpriv_io_move(temp_filename_hls, filename_hls) < 0) {
-            av_log(os->ctx, AV_LOG_WARNING, "renaming file %s to %s failed\n\n", temp_filename_hls, filename_hls);
-        }
+        ff_rename(temp_filename_hls, filename_hls, os->ctx);
 }
 
 static int flush_init_segment(AVFormatContext *s, OutputStream *os)
@@ -1037,7 +1035,7 @@  static int write_manifest(AVFormatContext *s, int final)
     dashenc_io_close(s, &c->mpd_out, temp_filename);
 
     if (use_rename) {
-        if ((ret = avpriv_io_move(temp_filename, s->url)) < 0)
+        if ((ret = ff_rename(temp_filename, s->url, s)) < 0)
             return ret;
     }
 
@@ -1119,7 +1117,7 @@  static int write_manifest(AVFormatContext *s, int final)
         }
         dashenc_io_close(s, &c->m3u8_out, temp_filename);
         if (use_rename)
-            if ((ret = avpriv_io_move(temp_filename, filename_hls)) < 0)
+            if ((ret = ff_rename(temp_filename, filename_hls, s)) < 0)
                 return ret;
         c->master_playlist_created = 1;
     }
@@ -1619,7 +1617,7 @@  static int dash_flush(AVFormatContext *s, int final, int stream)
             dashenc_io_close(s, &os->out, os->temp_path);
 
             if (use_rename) {
-                ret = avpriv_io_move(os->temp_path, os->full_path);
+                ret = ff_rename(os->temp_path, os->full_path, os->ctx);
                 if (ret < 0)
                     break;
             }