* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+#include <ctype.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+#include <errno.h>
#include <signal.h>
#include <limits.h>
#include "avformat.h"
#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>
#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;
static int sws_flags = SWS_BICUBIC;
-const char **opt_names=NULL;
-int opt_name_count=0;
-AVCodecContext *avctx_opts[CODEC_TYPE_NB];
-AVFormatContext *avformat_opts;
-struct SwsContext *sws_opts;
-static int64_t timer_start = 0;
+static const char **opt_names;
+static int opt_name_count;
+static AVCodecContext *avctx_opts[CODEC_TYPE_NB];
+static AVFormatContext *avformat_opts;
+static struct SwsContext *sws_opts;
+static int64_t timer_start;
static AVBitStreamFilterContext *video_bitstream_filters=NULL;
static AVBitStreamFilterContext *audio_bitstream_filters=NULL;
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;
static void term_exit(void)
{
-#ifndef __MINGW32__
+#ifdef HAVE_TERMIOS_H
tcsetattr (0, TCSANOW, &oldtty);
#endif
}
static void term_init(void)
{
-#ifndef __MINGW32__
+#ifdef HAVE_TERMIOS_H
struct termios tty;
tcgetattr (0, &tty);
/* 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
return n;
}
+#elif defined(HAVE_CONIO_H)
+ if(kbhit())
+ return(getch());
#endif
return -1;
}
pkt->pts);
break;
default:
- av_abort();
+ abort();
}
} else {
AVFrame avframe; //FIXME/XXX remove this
case CODEC_TYPE_SUBTITLE:
break;
default:
- av_abort();
+ abort();
}
} else {
switch(codec->codec_type) {
codec->sample_rate, icodec->sample_rate);
if(!ost->resample){
printf("Can't resample. Aborting.\n");
- av_abort();
+ abort();
}
}
ist->decoding_needed = 1;
fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
exit(1);
}
- if (ENABLE_SWSCALER)
- sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
+ sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
ost->img_resample_ctx = sws_getContext(
icodec->width - (frame_leftBand + frame_rightBand),
icodec->height - (frame_topBand + frame_bottomBand),
ist->decoding_needed = 1;
break;
default:
- av_abort();
+ abort();
break;
}
/* two pass mode */
}
}
-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);
case CODEC_TYPE_UNKNOWN:
break;
default:
- av_abort();
+ abort();
}
}
case CODEC_TYPE_SUBTITLE:
break;
default:
- av_abort();
+ abort();
}
}
}
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) {
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);
}
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;
AVOutputFormat *ofmt;
URLProtocol *up;
AVCodec *p, *p2;
- const char **pp, *last_name;
+ const char *last_name;
printf("File formats:\n");
last_name= "000";
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"
}
if(!o)
o = av_set_string(avformat_opts, opt, arg);
- if(ENABLE_SWSCALER && !o)
+ if(!o)
o = av_set_string(sws_opts, opt, arg);
if(!o){
if(opt[0] == 'a')
{ "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},
"\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(
OPT_EXPERT);
av_opt_show(avctx_opts[0], NULL);
av_opt_show(avformat_opts, NULL);
- if (ENABLE_SWSCALER)
- av_opt_show(sws_opts, NULL);
+ av_opt_show(sws_opts, NULL);
exit(1);
}
avctx_opts[i]= avcodec_alloc_context2(i);
}
avformat_opts = av_alloc_format_context();
- if (ENABLE_SWSCALER)
- sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
+ sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
if (argc <= 1)
show_help();