]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/seek-test.c
configure: Group all hwaccels together in a separate variable
[ffmpeg] / libavformat / seek-test.c
index 3dd60dc1608ac6ccf62e6b74491b1038386924dc..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)
@@ -64,10 +60,10 @@ int main(int argc, char **argv)
     AVFormatContext *ic = NULL;
     int i, ret, stream_id;
     int64_t timestamp;
-    AVFormatParameters params, *ap= &params;
-    memset(ap, 0, sizeof(params));
-    ap->channels=1;
-    ap->sample_rate= 22050;
+    AVDictionary *format_opts = NULL;
+
+    av_dict_set(&format_opts, "channels", "1", 0);
+    av_dict_set(&format_opts, "sample_rate", "22050", 0);
 
     /* initialize libavcodec, and register all codecs and formats */
     av_register_all();
@@ -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 = av_open_input_file(&ic, filename, NULL, 0, ap);
+    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;
 }