[xiph-cvs] cvs commit: vorbis-tools/oggenc platform.c Makefile.am oe_unix.c oe_win32.c
Michael Smith
msmith at xiph.org
Wed Nov 29 22:33:37 PST 2000
msmith 00/11/29 22:33:37
Modified: oggenc Makefile.am
Added: oggenc platform.c
Removed: oggenc oe_unix.c oe_win32.c
Log:
Move the platform support stuff into a single file. Add OS/2 support.
Revision Changes Path
1.7 +2 -2 vorbis-tools/oggenc/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile.am 2000/11/18 04:30:02 1.6
+++ Makefile.am 2000/11/30 06:33:36 1.7
@@ -9,8 +9,8 @@
INCLUDES = @OGG_CFLAGS@ @VORBIS_CFLAGS@
oggenc_LDFLAGS = @OGG_LIBS@ @VORBIS_LIBS@ @VORBISENC_LIBS@
-oggenc_SOURCES = oggenc.c audio.c encode.c oe_unix.c getopt.c getopt1.c\
- oe_win32.c\
+oggenc_SOURCES = oggenc.c audio.c encode.c getopt.c getopt1.c\
+ platform.c\
audio.h encode.h platform.h getopt.h
EXTRA_DIST = oggenc.dsp build_oggenc.bat
1.1 vorbis-tools/oggenc/platform.c
Index: platform.c
===================================================================
/* OggEnc
**
** This program is distributed under the GNU General Public License, version 2.
** A copy of this license is included with this source.
**
** Copyright 2000, Michael Smith <msmith at labyrinth.net.au>
**
** Portions from Vorbize, (c) Kenneth Arnold <kcarnold at yahoo.com>
** and libvorbis examples, (c) Monty <monty at xiph.org>
**/
/* Platform support routines - win32, OS/2, unix */
#include "platform.h"
#include "encode.h"
#include <stdlib.h>
#if defined(_WIN32) || defined(__EMX__)
#include <fcntl.h>
#include <io.h>
#include <time.h>
#endif
#ifdef _WIN32
/* This doesn't seem to exist on windows */
char *rindex(char *s, int c)
{
char *ret = NULL;
while(*s)
{
if(*s == (char)c)
ret=s;
s++;
}
return ret;
}
void setbinmode(FILE *f)
{
_setmode( _fileno(f), _O_BINARY );
}
#endif /* win32 */
#ifdef __EMX__
void setbinmode(FILE *f)
{
_fsetmode( f, "b");
}
#endif
#if defined(_WIN32) || defined(__EMX__)
void *timer_start(void)
{
time_t *start = malloc(sizeof(time_t));
time(start);
return (void *)start;
}
double timer_time(void *timer)
{
time_t now = time(NULL);
time_t start = *((time_t *)timer);
return (double)(now-start);
}
void timer_clear(void *timer)
{
free((time_t *)timer);
}
#else /* unix. Or at least win32 */
#include <sys/time.h>
#include <unistd.h>
void *timer_start(void)
{
struct timeval *start = malloc(sizeof(struct timeval));
gettimeofday(start, NULL);
return (void *)start;
}
double timer_time(void *timer)
{
struct timeval now;
struct timeval start = *((struct timeval *)timer);
gettimeofday(&now, NULL);
return (double)now.tv_sec - (double)start.tv_sec +
((double)now.tv_usec - (double)start.tv_usec)/1000000.0;
}
void timer_clear(void *timer)
{
free((time_t *)timer);
}
#endif
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list