[vorbis-dev] Ports

Brian Havard brianh at kheldar.apana.org.au
Fri Dec 15 03:52:02 PST 2000



On Thu, 14 Dec 2000 10:06:39 +1100, Michael Smith wrote:

>>I've done a port for OS/2 using Watcom C++, including a simple command line
>>player based on vorbisfile_example.c, which can be downloaded from 
>>http://silk.apana.org.au/utils.html
>>It'd be nice if my changes could be commited to CVS, should I just post
>>patches here?
>
>Yes, unless they're huge (I would assume they're not).

You would assume rightly. There's some minor patches & a handful of
makefiles (I've called them watcom.mak). I'll start with the patches. BTW,
Watcom C++ is cross-platform so can also be used to target Win32 or even
DOS, probably with little if any modification.

>I believe someone
>else ported it to OS/2 a while ago - and sent me a patch for oggenc
>support. I don't know whether oggenc actually works with OS/2 though, since
>I don't have a system to test it on.

Yeah, I noticed that there's a couple of entries in platform.c #ifdef'ed
__EMX__ (EMX is an OS/2 port of gcc).

For the vorbis module:

Index: lib/os.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/os.h,v
retrieving revision 1.17
diff -u -r1.17 os.h
--- lib/os.h	2000/12/13 18:12:34	1.17
+++ lib/os.h	2000/12/15 09:49:16
@@ -29,7 +29,7 @@
 #endif
 
 #ifndef __GNUC__
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__WATCOMC__)
 #  include <malloc.h>
 #  define rint(x)   (floor((x)+0.5)) 
 #endif
@@ -116,7 +116,7 @@
 
 typedef int vorbis_fpu_control;
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__WATCOMC__)
 
 static __inline int vorbis_ftoi(double f){
         int i;
===== CUT HERE ====================================================

And this for vorbis-tools:

Index: oggenc/audio.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/audio.c,v
retrieving revision 1.5
diff -u -r1.5 audio.c
--- oggenc/audio.c	2000/11/30 06:04:45	1.5
+++ oggenc/audio.c	2000/12/15 10:05:00
@@ -13,6 +13,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#ifdef __WATCOMC__
+#include <malloc.h> /* for alloca() */
+#endif
 #include <sys/types.h>
 #include "audio.h"
 
Index: oggenc/oggenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/oggenc.c,v
retrieving revision 1.8
diff -u -r1.8 oggenc.c
--- oggenc/oggenc.c	2000/11/30 06:04:45	1.8
+++ oggenc/oggenc.c	2000/12/15 10:05:03
@@ -90,6 +90,7 @@
         /* We randomly pick a serial number. This is then incremented for each file */
         srand(time(NULL));
         nextserial = rand();
+	lower_priority();
 
         for(i = 0; i < numfiles; i++)
         {
Index: oggenc/platform.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/platform.c,v
retrieving revision 1.1
diff -u -r1.1 platform.c
--- oggenc/platform.c	2000/11/30 06:33:36	1.1
+++ oggenc/platform.c	2000/12/15 10:05:03
@@ -15,13 +15,19 @@
 #include "platform.h"
 #include "encode.h"
 #include <stdlib.h>
-#if defined(_WIN32) || defined(__EMX__)
+#if defined(_WIN32) || defined(__EMX__) || defined(__WATCOMC__)
 #include <fcntl.h>
 #include <io.h>
 #include <time.h>
 #endif
 
-#ifdef _WIN32
+#ifdef __OS2__
+#define INCL_DOS
+#define INCL_NOPMAPI
+#include <os2.h>
+#endif
+
+#if defined(_WIN32) || defined(__WATCOMC__)
 /* This doesn't seem to exist on windows */
 char *rindex(char *s, int c)
 {
@@ -35,7 +41,9 @@
         }
         return ret;
 }
+#endif
 
+#ifdef _WIN32
 void setbinmode(FILE *f)
 {
         _setmode( _fileno(f), _O_BINARY );
@@ -49,8 +57,14 @@
 }
 #endif
 
+#ifdef __WATCOMC__
+void setbinmode(FILE *f)
+{
+	setmode( fileno(f), O_BINARY );
+}
+#endif
 
-#if defined(_WIN32) || defined(__EMX__)
+#if defined(_WIN32) || defined(__EMX__) || defined(__WATCOMC__)
 void *timer_start(void)
 {
         time_t *start = malloc(sizeof(time_t));
@@ -102,3 +116,9 @@
 #endif
 
 
+void lower_priority()
+{
+#ifdef __OS2__
+	DosSetPriority( PRTYS_PROCESS, PRTYC_IDLETIME, 16, 0 );
+#endif
+}
Index: oggenc/platform.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/platform.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 platform.h
--- oggenc/platform.h	2000/09/07 00:57:47	1.1.1.1
+++ oggenc/platform.h	2000/12/15 10:05:03
@@ -3,7 +3,7 @@
 
 #include <stdio.h>
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__OS2__)
 
 char *rindex(char *s, int c);
 void setbinmode(FILE *);
@@ -13,6 +13,8 @@
 #define setbinmode(x) 
 
 #endif
+
+void lower_priority();
 
 #endif /* __PLATFORM_H */
 
===== CUT HERE ====================================================

Is that ok so far? I've also got some patches for encoder/decoder examples but
they're not that important and will apparently send me to hell :)


-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh at kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------

--- >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 'vorbis-dev-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 Vorbis-dev mailing list