Commit 348fa4ad authored by Michel Lespinasse's avatar Michel Lespinasse
Browse files

added support for timing on win32 (using ftime instead of gettimeofday)

parent 53e367b2
......@@ -93,7 +93,7 @@ dnl Checks for libraries.
dnl Checks for header files.
INCLUDES='-I$(top_srcdir)/include -I$(top_builddir)/include'
AC_SUBST([INCLUDES])
AC_CHECK_HEADERS([sys/time.h io.h])
AC_CHECK_HEADERS([sys/time.h sys/timeb.h io.h])
AC_CHECK_GENERATE_INTTYPES([include])
dnl Checks for typedefs, structures, and compiler characteristics.
......@@ -105,7 +105,7 @@ AC_TYPE_SIZE_T
AC_C_BIGENDIAN
dnl Checks for library functions.
AC_CHECK_FUNCS([memalign gettimeofday])
AC_CHECK_FUNCS([memalign gettimeofday ftime])
AC_TYPE_SIGNAL
builtin([include],[libmpeg2/configure.incl])
......
CFLAGS = @MPEG2DEC_CFLAGS@
bin_PROGRAMS = mpeg2dec extract_mpeg2
mpeg2dec_SOURCES = mpeg2dec.c getopt.c
mpeg2dec_SOURCES = mpeg2dec.c getopt.c gettimeofday.c
mpeg2dec_LDADD = $(top_builddir)/libmpeg2/libmpeg2.la \
$(top_builddir)/libvo/libvo.a @LIBVO_LIBS@ \
libcpuaccel.la
......@@ -13,4 +13,4 @@ libcpuaccel_la_LDFLAGS = -no-undefined
man_MANS = mpeg2dec.1 extract_mpeg2.1
EXTRA_DIST = configure.incl getopt.h $(man_MANS)
EXTRA_DIST = configure.incl getopt.h gettimeofday.h $(man_MANS)
/*
* gettimeofday.c
* Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "gettimeofday.h"
#ifdef CUSTOM_GETTIMEOFDAY
#include <sys/timeb.h>
void gettimeofday (struct timeval * tp, void * dummy)
{
struct timeb tm;
ftime (&tm);
tp->tv_sec = tm.time;
tp->tv_usec = tm.millitm * 1000;
}
#endif
/*
* gettimeofday.h
* Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
#include <sys/time.h>
#elif defined(HAVE_SYS_TIMEB_H) && defined(HAVE_FTIME)
#define HAVE_GETTIMEOFDAY 1
#define CUSTOM_GETTIMEOFDAY 1
struct timeval {
long tv_sec;
long tv_usec;
};
void gettimeofday (struct timeval * tp, void * dummy);
#else
#undef HAVE_GETTIMEOFDAY
#endif
......@@ -27,21 +27,19 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <getopt.h>
#ifdef HAVE_IO_H
#include <fcntl.h>
#include <io.h>
#endif
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
#include <sys/time.h>
#include <signal.h>
#endif
#include <inttypes.h>
#include "mpeg2.h"
#include "video_out.h"
#include "convert.h"
#include "mm_accel.h"
#include "gettimeofday.h"
#define BUFFER_SIZE 4096
static uint8_t buffer[BUFFER_SIZE];
......@@ -53,7 +51,7 @@ static mpeg2dec_t * mpeg2dec;
static vo_open_t * output_open = NULL;
static vo_instance_t * output;
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
#ifdef HAVE_GETTIMEOFDAY
static void print_fps (int final);
......@@ -116,7 +114,7 @@ static void print_fps (int final)
last_count = frame_counter;
}
#else /* !HAVE_SYS_TIME_H || !HAVE_GETTIMEOFDAY */
#else /* !HAVE_GETTIMEOFDAY */
static void print_fps (int final)
{
......
......@@ -18,6 +18,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
......@@ -48,6 +51,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
......@@ -94,7 +100,7 @@
#define PACKAGE_VERSION ""
/* Define as the return type of signal handlers (`int' or `void'). */
/* #undef RETSIGTYPE */
#define RETSIGTYPE void
/* The size of a `char', as computed by sizeof. */
#define SIZEOF_CHAR 1
......
......@@ -93,6 +93,10 @@ SOURCE=..\src\getopt.c
# End Source File
# Begin Source File
SOURCE=..\src\gettimeofday.c
# End Source File
# Begin Source File
SOURCE=..\src\mpeg2dec.c
# End Source File
# End Group
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment