]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/hdsenc.c
avformat/nutdec: remove unused variable
[ffmpeg] / libavformat / hdsenc.c
index c0932933d4139489ae03f75d43c4fed5b12bbdc1..f22875d0cc1e8b0c1e015806349e4abaaa2a5843 100644 (file)
@@ -2,20 +2,20 @@
  * Live HDS fragmenter
  * Copyright (c) 2013 Martin Storsjo
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -204,7 +204,10 @@ static int write_manifest(AVFormatContext *s, int final)
     avio_printf(out, "</manifest>\n");
     avio_flush(out);
     avio_close(out);
-    rename(temp_filename, filename);
+    if (rename(temp_filename, filename) == -1) {
+        av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", temp_filename, filename);
+        return AVERROR(errno);
+    }
     return 0;
 }
 
@@ -286,7 +289,10 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
     update_size(out, afrt_pos);
     update_size(out, 0);
     avio_close(out);
-    rename(temp_filename, filename);
+    if (rename(temp_filename, filename) == -1) {
+        av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", temp_filename, filename);
+        return AVERROR(errno);
+    }
     return 0;
 }
 
@@ -412,7 +418,9 @@ static int hds_write_header(AVFormatContext *s)
 
         snprintf(os->temp_filename, sizeof(os->temp_filename),
                  "%s/stream%d_temp", s->filename, i);
-        init_file(s, os, 0);
+        ret = init_file(s, os, 0);
+        if (ret < 0)
+            goto fail;
 
         if (!os->has_video && c->min_frag_duration <= 0) {
             av_log(s, AV_LOG_WARNING,
@@ -475,7 +483,10 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
 
     snprintf(target_filename, sizeof(target_filename),
              "%s/stream%dSeg1-Frag%d", s->filename, index, os->fragment_index);
-    rename(os->temp_filename, target_filename);
+    if (rename(os->temp_filename, target_filename) == -1) {
+        av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", os->temp_filename, target_filename);
+        return AVERROR(errno);
+    }
     add_fragment(os, target_filename, os->frag_start_ts, end_ts - os->frag_start_ts);
 
     if (!final) {
@@ -509,7 +520,7 @@ static int hds_write_packet(AVFormatContext *s, AVPacket *pkt)
     HDSContext *c = s->priv_data;
     AVStream *st = s->streams[pkt->stream_index];
     OutputStream *os = &c->streams[s->streams[pkt->stream_index]->id];
-    int64_t end_dts = os->fragment_index * (int64_t) c->min_frag_duration;
+    int64_t end_dts = os->fragment_index * (int64_t)c->min_frag_duration;
     int ret;
 
     if (st->first_dts == AV_NOPTS_VALUE)