]> git.sesse.net Git - ffmpeg/blobdiff - ffplay.c
Remove ancient code that hasnt worked in many years.
[ffmpeg] / ffplay.c
index 2e194afb3b3594fe7f3ca146539e10e3d9b83c90..6e55e0f18b569bf6fbd7697ab57974f07ac205c3 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
 
 #include <math.h>
 #include <limits.h>
-#include "avformat.h"
-#include "avdevice.h"
-#include "rtsp.h"
-#include "swscale.h"
-#include "avstring.h"
+#include "libavutil/avstring.h"
+#include "libavformat/avformat.h"
+#include "libavformat/rtsp.h"
+#include "libavdevice/avdevice.h"
+#include "libswscale/swscale.h"
 
-#include "version.h"
 #include "cmdutils.h"
 
 #include <SDL.h>
@@ -39,8 +38,8 @@
 
 #undef exit
 
-static const char program_name[] = "FFplay";
-static const int program_birth_year = 2003;
+const char program_name[] = "FFplay";
+const int program_birth_year = 2003;
 
 //#define DEBUG_SYNC
 
@@ -169,7 +168,7 @@ typedef struct VideoState {
     int width, height, xleft, ytop;
 } VideoState;
 
-void show_help(void);
+static void show_help(void);
 static int audio_write_get_buf_size(VideoState *is);
 
 /* options specified by the user */
@@ -1645,7 +1644,7 @@ static int audio_write_get_buf_size(VideoState *is)
 
 
 /* prepare a new audio buffer */
-void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
+static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
 {
     VideoState *is = opaque;
     int audio_size, len1;
@@ -2390,7 +2389,7 @@ static void opt_frame_pix_fmt(const char *arg)
     frame_pix_fmt = avcodec_get_pix_fmt(arg);
 }
 
-static void opt_sync(const char *arg)
+static int opt_sync(const char *opt, const char *arg)
 {
     if (!strcmp(arg, "audio"))
         av_sync_type = AV_SYNC_AUDIO_MASTER;
@@ -2399,9 +2398,10 @@ static void opt_sync(const char *arg)
     else if (!strcmp(arg, "ext"))
         av_sync_type = AV_SYNC_EXTERNAL_CLOCK;
     else {
-        show_help();
+        fprintf(stderr, "Unknown value for %s: %s\n", opt, arg);
         exit(1);
     }
+    return 0;
 }
 
 static int opt_seek(const char *opt, const char *arg)
@@ -2432,14 +2432,11 @@ static int opt_thread_count(const char *opt, const char *arg)
     return 0;
 }
 
-static void opt_show_help(void)
-{
-    show_help();
-    exit(0);
-}
-
-const OptionDef options[] = {
-    { "h", 0, {(void*)opt_show_help}, "show help" },
+static const OptionDef options[] = {
+    { "h", OPT_EXIT, {(void*)show_help}, "show help" },
+    { "version", OPT_EXIT, {(void*)show_version}, "show version" },
+    { "L", OPT_EXIT, {(void*)show_license}, "show license" },
+    { "formats", OPT_EXIT, {(void*)show_formats}, "show available formats, codecs, protocols, ..." },
     { "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" },
     { "y", HAS_ARG | OPT_FUNC2, {(void*)opt_height}, "force displayed height", "height" },
     { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
@@ -2467,12 +2464,12 @@ const OptionDef options[] = {
     { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&idct}, "set idct algo",  "algo" },
     { "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_resilience}, "set error detection threshold (0-4)",  "threshold" },
     { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options",  "bit_mask" },
-    { "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
+    { "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
     { "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
     { NULL, },
 };
 
-void show_help(void)
+static void show_help(void)
 {
     printf("usage: ffplay [options] input_file\n"
            "Simple media player\n");
@@ -2495,7 +2492,7 @@ void show_help(void)
            );
 }
 
-void opt_input_file(const char *filename)
+static void opt_input_file(const char *filename)
 {
     if (!strcmp(filename, "-"))
         filename = "pipe:";
@@ -2512,7 +2509,7 @@ int main(int argc, char **argv)
     avdevice_register_all();
     av_register_all();
 
-    show_banner(program_name, program_birth_year);
+    show_banner();
 
     parse_options(argc, argv, options, opt_input_file);