]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/hls.c
Merge commit '747cd9560c2248ff2834f29cd2190646330e4676'
[ffmpeg] / libavformat / hls.c
index 3897723b7defac135e7a4e3ab49b51acfdedf78a..0c86461f0f1f1ff38d0eee6195f907c50620d2d3 100644 (file)
@@ -541,7 +541,7 @@ static int parse_playlist(HLSContext *c, const char *url,
         pls->finished = 0;
         pls->type = PLS_TYPE_UNSPECIFIED;
     }
-    while (!url_feof(in)) {
+    while (!avio_feof(in)) {
         read_chomp_line(in, line, sizeof(line));
         if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
             is_variant = 1;
@@ -919,14 +919,8 @@ static int open_input(HLSContext *c, struct playlist *pls)
     if (seg->size >= 0) {
         /* try to restrict the HTTP request to the part we want
          * (if this is in fact a HTTP request) */
-        char offset[24] = { 0 };
-        char end_offset[24] = { 0 };
-        snprintf(offset, sizeof(offset) - 1, "%"PRId64,
-                 seg->url_offset);
-        snprintf(end_offset, sizeof(end_offset) - 1, "%"PRId64,
-                 seg->url_offset + seg->size);
-        av_dict_set(&opts, "offset", offset, 0);
-        av_dict_set(&opts, "end_offset", end_offset, 0);
+        av_dict_set_int(&opts, "offset", seg->url_offset, 0);
+        av_dict_set_int(&opts, "end_offset", seg->url_offset + seg->size, 0);
     }
 
     av_log(pls->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset %"PRId64", playlist %d\n",
@@ -1397,15 +1391,12 @@ static int hls_read_header(AVFormatContext *s)
     /* Create a program for each variant */
     for (i = 0; i < c->n_variants; i++) {
         struct variant *v = c->variants[i];
-        char bitrate_str[20];
         AVProgram *program;
 
-        snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
-
         program = av_new_program(s, i);
         if (!program)
             goto fail;
-        av_dict_set(&program->metadata, "variant_bitrate", bitrate_str, 0);
+        av_dict_set_int(&program->metadata, "variant_bitrate", v->bandwidth, 0);
 
         for (j = 0; j < v->n_playlists; j++) {
             struct playlist *pls = v->playlists[j];
@@ -1419,7 +1410,7 @@ static int hls_read_header(AVFormatContext *s)
 
                 /* Set variant_bitrate for streams unique to this variant */
                 if (!is_shared && v->bandwidth)
-                    av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, 0);
+                    av_dict_set_int(&st->metadata, "variant_bitrate", v->bandwidth, 0);
             }
         }
     }
@@ -1532,7 +1523,7 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
                 AVRational tb;
                 ret = av_read_frame(pls->ctx, &pls->pkt);
                 if (ret < 0) {
-                    if (!url_feof(&pls->pb) && ret != AVERROR_EOF)
+                    if (!avio_feof(&pls->pb) && ret != AVERROR_EOF)
                         return ret;
                     reset_packet(&pls->pkt);
                     break;