]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/seek-test.c
avformat: Report the duration analysis reached
[ffmpeg] / libavformat / seek-test.c
index 771036087a418abe9fbbcb5f02b55b3db6a6857a..143f0b5ace46043c7b1d7284aec13ae5e454160b 100644 (file)
 #include "libavutil/mathematics.h"
 #include "libavformat/avformat.h"
 
-#undef exit
-#undef printf
-#undef fprintf
-
 static char buffer[20];
 
 static const char *ret_str(int v)
@@ -75,29 +71,29 @@ int main(int argc, char **argv)
     if (argc != 2) {
         printf("usage: %s input_file\n"
                "\n", argv[0]);
-        exit(1);
+        return 1;
     }
 
     filename = argv[1];
 
     ret = avformat_open_input(&ic, filename, NULL, &format_opts);
+    av_dict_free(&format_opts);
     if (ret < 0) {
         fprintf(stderr, "cannot open %s\n", filename);
-        exit(1);
+        return 1;
     }
 
     ret = avformat_find_stream_info(ic, NULL);
     if (ret < 0) {
         fprintf(stderr, "%s: could not find codec parameters\n", filename);
-        exit(1);
+        return 1;
     }
 
     for(i=0; ; i++){
-        AVPacket pkt;
+        AVPacket pkt = { 0 };
         AVStream *av_uninit(st);
         char ts_buf[60];
 
-        memset(&pkt, 0, sizeof(pkt));
         if(ret>=0){
             ret= av_read_frame(ic, &pkt);
             if(ret>=0){
@@ -127,7 +123,7 @@ int main(int argc, char **argv)
         printf("ret:%-10s st:%2d flags:%d  ts:%s\n", ret_str(ret), stream_id, i&1, ts_buf);
     }
 
-    av_close_input_file(ic);
+    avformat_close_input(&ic);
 
     return 0;
 }