]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sauce.c
lavf/utils: rewrite real fps calculation code.
[ffmpeg] / libavformat / sauce.c
index e861b14e16d17b776f92f532e0777568017d84c4..21cc95bccb71d34b17cc7a2394fba3fb06a6333b 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include "libavutil/intreadwrite.h"
+#include "libavutil/dict.h"
 #include "avformat.h"
 #include "sauce.h"
 
@@ -32,10 +33,10 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
 {
     AVIOContext *pb = avctx->pb;
     char buf[36];
-    int datatype, filetype, t1, t2, nb_comments, flags;
-    uint64_t start_pos = url_fsize(pb) - 128;
+    int datatype, filetype, t1, t2, nb_comments;
+    uint64_t start_pos = avio_size(pb) - 128;
 
-    url_fseek(pb, start_pos, SEEK_SET);
+    avio_seek(pb, start_pos, SEEK_SET);
     if (avio_read(pb, buf, 7) != 7)
         return -1;
     if (memcmp(buf, "SAUCE00", 7))
@@ -44,21 +45,21 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
 #define GET_SAUCE_META(name,size) \
     if (avio_read(pb, buf, size) == size && buf[0]) { \
         buf[size] = 0; \
-        av_metadata_set2(&avctx->metadata, name, buf, 0); \
+        av_dict_set(&avctx->metadata, name, buf, 0); \
     }
 
     GET_SAUCE_META("title",     35)
     GET_SAUCE_META("artist",    20)
     GET_SAUCE_META("publisher", 20)
     GET_SAUCE_META("date",      8)
-    url_fskip(pb, 4);
+    avio_skip(pb, 4);
     datatype    = avio_r8(pb);
     filetype    = avio_r8(pb);
     t1          = avio_rl16(pb);
     t2          = avio_rl16(pb);
     nb_comments = avio_r8(pb);
-    flags       = avio_r8(pb);
-    url_fskip(pb, 4);
+    avio_skip(pb, 1); /* flags */
+    avio_skip(pb, 4);
     GET_SAUCE_META("encoder",   22);
 
     if (got_width && datatype && filetype) {
@@ -82,7 +83,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
     *fsize -= 128;
 
     if (nb_comments > 0) {
-        url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
+        avio_seek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
         if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
             int i;
             char *str = av_malloc(65*nb_comments + 1);
@@ -95,7 +96,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
                 str[65*i + 64] = '\n';
             }
             str[65*i] = 0;
-            av_metadata_set2(&avctx->metadata, "comment", str, AV_METADATA_DONT_STRDUP_VAL);
+            av_dict_set(&avctx->metadata, "comment", str, AV_DICT_DONT_STRDUP_VAL);
         }
     }