]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
revert my accidental previous commit
[ffmpeg] / ffmpeg.c
index 6905f2c2b815f8bdd9b35955f5019584688515a5..ac52d7a2bb037e6221b093b0416fc617cecba52c 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
 #include "fifo.h"
 #include "avstring.h"
 
-#ifdef __MINGW32__
-#include <conio.h>
-#else
+#if !defined(HAVE_GETRUSAGE) && defined(HAVE_GETPROCESSTIMES)
+#include <windows.h>
+#endif
+
+#if defined(HAVE_TERMIOS_H)
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <termios.h>
 #include <sys/resource.h>
-#endif
-#ifdef CONFIG_OS2
-#include <sys/types.h>
-#include <sys/select.h>
-#include <stdlib.h>
+#elif defined(HAVE_CONIO_H)
+#include <conio.h>
 #endif
 #undef time //needed because HAVE_AV_CONFIG_H is defined on top
 #include <time.h>
@@ -127,7 +126,6 @@ static int video_rc_qmod_freq=0;
 #endif
 static char *video_rc_override_string=NULL;
 static char *video_rc_eq="tex^qComp";
-static int me_method = ME_EPZS;
 static int video_disable = 0;
 static int video_discard = 0;
 static int video_codec_id = CODEC_ID_NONE;
@@ -283,7 +281,7 @@ typedef struct AVInputFile {
     int nb_streams;       /* nb streams we are aware of */
 } AVInputFile;
 
-#ifndef __MINGW32__
+#ifdef HAVE_TERMIOS_H
 
 /* init terminal so that we can grab keys */
 static struct termios oldtty;
@@ -291,7 +289,7 @@ static struct termios oldtty;
 
 static void term_exit(void)
 {
-#ifndef __MINGW32__
+#ifdef HAVE_TERMIOS_H
     tcsetattr (0, TCSANOW, &oldtty);
 #endif
 }
@@ -307,7 +305,7 @@ sigterm_handler(int sig)
 
 static void term_init(void)
 {
-#ifndef __MINGW32__
+#ifdef HAVE_TERMIOS_H
     struct termios tty;
 
     tcgetattr (0, &tty);
@@ -340,10 +338,7 @@ static void term_init(void)
 /* read a key without blocking */
 static int read_key(void)
 {
-#ifdef __MINGW32__
-    if(kbhit())
-        return(getch());
-#else
+#if defined(HAVE_TERMIOS_H)
     int n = 1;
     unsigned char ch;
 #ifndef CONFIG_BEOS_NETSERVER
@@ -363,6 +358,9 @@ static int read_key(void)
 
         return n;
     }
+#elif defined(HAVE_CONIO_H)
+    if(kbhit())
+        return(getch());
 #endif
     return -1;
 }
@@ -2417,35 +2415,6 @@ static void add_frame_hooker(const char *arg)
     }
 }
 
-const char *motion_str[] = {
-    "zero",
-    "full",
-    "log",
-    "phods",
-    "epzs",
-    "x1",
-    "hex",
-    "umh",
-    "iter",
-    NULL,
-};
-
-static void opt_motion_estimation(const char *arg)
-{
-    const char **p;
-    p = motion_str;
-    for(;;) {
-        if (!*p) {
-            fprintf(stderr, "Unknown motion estimation method '%s'\n", arg);
-            exit(1);
-        }
-        if (!strcmp(*p, arg))
-            break;
-        p++;
-    }
-    me_method = (p - motion_str) + 1;
-}
-
 static void opt_video_codec(const char *arg)
 {
     opt_codec(&video_stream_copy, &video_codec_id, CODEC_TYPE_VIDEO, arg);
@@ -2839,8 +2808,6 @@ static void new_video_stream(AVFormatContext *oc)
         if (do_psnr)
             video_enc->flags|= CODEC_FLAG_PSNR;
 
-        video_enc->me_method = me_method;
-
         /* two pass mode */
         if (do_pass) {
             if (do_pass == 1) {
@@ -3005,7 +2972,7 @@ static void opt_output_file(const char *filename)
     if (!file_oformat) {
         file_oformat = guess_format(NULL, filename, NULL);
         if (!file_oformat) {
-            fprintf(stderr, "Unable for find a suitable output format for '%s'\n",
+            fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
                     filename);
             exit(1);
         }
@@ -3142,20 +3109,23 @@ static void opt_pass(const char *pass_str)
     do_pass = pass;
 }
 
-#if defined(__MINGW32__) || defined(CONFIG_OS2)
-static int64_t getutime(void)
-{
-  return av_gettime();
-}
-#else
 static int64_t getutime(void)
 {
+#ifdef HAVE_GETRUSAGE
     struct rusage rusage;
 
     getrusage(RUSAGE_SELF, &rusage);
     return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
-}
+#elif defined(HAVE_GETPROCESSTIMES)
+    HANDLE proc;
+    FILETIME c, e, k, u;
+    proc = GetCurrentProcess();
+    GetProcessTimes(proc, &c, &e, &k, &u);
+    return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
+#else
+  return av_gettime();
 #endif
+}
 
 #if defined(CONFIG_FFM_DEMUXER) || defined(CONFIG_FFM_MUXER)
 extern int ffm_nopts;
@@ -3167,7 +3137,7 @@ static void show_formats(void)
     AVOutputFormat *ofmt;
     URLProtocol *up;
     AVCodec *p, *p2;
-    const char **pp, *last_name;
+    const char *last_name;
 
     printf("File formats:\n");
     last_name= "000";
@@ -3268,19 +3238,7 @@ static void show_formats(void)
     printf("\n");
 
     printf("Frame size, frame rate abbreviations:\n ntsc pal qntsc qpal sntsc spal film ntsc-film sqcif qcif cif 4cif\n");
-    printf("Motion estimation methods:\n");
-    pp = motion_str;
-    while (*pp) {
-        printf(" %s", *pp);
-        if ((pp - motion_str + 1) == ME_ZERO)
-            printf("(fastest)");
-        else if ((pp - motion_str + 1) == ME_FULL)
-            printf("(slowest)");
-        else if ((pp - motion_str + 1) == ME_EPZS)
-            printf("(default)");
-        pp++;
-    }
-    printf("\n\n");
+    printf("\n");
     printf(
 "Note, the names of encoders and decoders do not always match, so there are\n"
 "several cases where the above table shows encoder only or decoder only entries\n"
@@ -3633,8 +3591,6 @@ const OptionDef options[] = {
     { "rc_eq", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_eq}, "set rate control equation", "equation" },
     { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
     { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
-    { "me", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_motion_estimation}, "set motion estimation method",
-      "method" },
     { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold",  "" },
     { "strict", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_strict}, "how strictly to follow the standards", "strictness" },
     { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},
@@ -3720,7 +3676,7 @@ static void show_license(void)
     "\n"
     "You should have received a copy of the GNU General Public License\n"
     "along with FFmpeg; if not, write to the Free Software\n"
-    "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n"
+    "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
     );
 #else
     printf(