[xiph-cvs] cvs commit: libshout/win32 libshout.dsp libshout.dsw

Ed oddsock at xiph.org
Thu Jan 29 16:08:02 PST 2004



oddsock     04/01/29 19:08:02

  Modified:    src      mp3.c shout.c vorbis.c
               .        timing.c
  Added:       include  os.h
               win32    libshout.dsp libshout.dsw
  Log:
  added win32 support to libshout
  
  - new MSVC6 project files
  - os.h with WIN32 specific typedefs
  - fixed some casting issues which were causing precision errors on win32
  - apparently select doesn't work with microsecond granularity so we will use Sleep() which does.

Revision  Changes    Path
1.1                  libshout/include/os.h

Index: os.h
===================================================================
#ifdef _WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef __int32 int32_t;
typedef int  ssize_t;
#endif

<p><p>1.14      +2 -2      libshout/src/mp3.c

Index: mp3.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/mp3.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- mp3.c	13 Jul 2003 16:31:20 -0000	1.13
+++ mp3.c	30 Jan 2004 00:08:01 -0000	1.14
@@ -134,7 +134,7 @@
         if (mp3_data->frame_left > 0) {
                 /* is the rest of the frame here? */
                 if (mp3_data->frame_left <= len) {
-			self->senttime += ((double)mp3_data->frame_samples / (double)mp3_data->frame_samplerate * 1000000);
+			self->senttime += (int64_t)((double)mp3_data->frame_samples / (double)mp3_data->frame_samplerate * 1000000);
                         mp3_data->frames++;
                         pos += mp3_data->frame_left;
                         mp3_data->frame_left = 0;
@@ -187,7 +187,7 @@
 
                         /* do we have a complete frame in this buffer? */
                         if (len - pos >= mh.framesize) {
-				self->senttime += ((double)mp3_data->frame_samples / (double)mp3_data->frame_samplerate * 1000000);
+				self->senttime += (int64_t)((double)mp3_data->frame_samples / (double)mp3_data->frame_samplerate * 1000000);
                                 mp3_data->frames++;
                                 pos += mh.framesize;
                         } else {

<p><p>1.49      +4 -3      libshout/src/shout.c

Index: shout.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- shout.c	13 Jul 2003 16:31:20 -0000	1.48
+++ shout.c	30 Jan 2004 00:08:01 -0000	1.49
@@ -255,14 +255,15 @@
         if (self->senttime == 0)
                 return;
 
-	sleep = ((double)self->senttime / 1000) - (timing_get_time() - self->starttime);
-
+	sleep = self->senttime / 1000 - (timing_get_time() - self->starttime);
         if (sleep > 0)
                 timing_sleep((uint64_t)sleep);
+		
 }
 
 int shout_delay(shout_t *self)
 {
+
         if (!self)
                 return 0;
 
@@ -270,7 +271,7 @@
                 return 0;
 
         /* Is this cast to double needed? */
-	return (double)self->senttime / 1000 - (timing_get_time() - self->starttime);
+	return self->senttime / 1000 - (timing_get_time() - self->starttime);
 }
   
 shout_metadata_t *shout_metadata_new(void)

<p><p>1.11      +3 -4      libshout/src/vorbis.c

Index: vorbis.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/vorbis.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- vorbis.c	13 Jul 2003 16:31:20 -0000	1.10
+++ vorbis.c	30 Jan 2004 00:08:01 -0000	1.11
@@ -91,7 +91,7 @@
         char *buffer;
         ogg_page og;
         ogg_packet op;
-	int samples;
+	uint64_t samples;
 
         buffer = ogg_sync_buffer(&vorbis_data->oy, len);
         memcpy(buffer, data, len);
@@ -139,9 +139,8 @@
                         size = blocksize(vorbis_data, &op);
                         samples += size;
                 }
-
-		self->senttime += ((double)samples * 1000000) / 
-			((double)vorbis_data->samplerate);
+		self->senttime += (samples *  1000000) / 
+			(vorbis_data->samplerate);
 
                 ret = sock_write_bytes(self->socket, og.header, og.header_len);
                 if (ret != og.header_len)

<p><p>1.15      +5 -1      timing/timing.c

Index: timing.c
===================================================================
RCS file: /usr/local/cvsroot/timing/timing.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- timing.c	29 Jan 2004 01:02:12 -0000	1.14
+++ timing.c	30 Jan 2004 00:08:02 -0000	1.15
@@ -70,5 +70,9 @@
      * says so.  The solaris manpage also says this is a legal
      * value.  If you think differerntly, please provide references.
      */
-    select(0, NULL, NULL, NULL, &sleeper);
+#ifdef WIN32
+	Sleep(sleeptime);
+#else
+    select(1, NULL, NULL, NULL, &sleeper);
+#endif
 }

<p><p>1.1                  libshout/win32/libshout.dsp

Index: libshout.dsp
===================================================================
# Microsoft Developer Studio Project File - Name="libshout" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Static Library" 0x0104

CFG=libshout - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE 
!MESSAGE NMAKE /f "libshout.mak".
!MESSAGE 
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE 
!MESSAGE NMAKE /f "libshout.mak" CFG="libshout - Win32 Debug"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "libshout - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libshout - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE 

# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe

!IF  "$(CFG)" == "libshout - Win32 Release"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "_WIN32" /D VERSION=\"2.0.0\" /D LIBSHOUT_MAJOR=2 /D LIBSHOUT_MINOR=0 /D LIBSHOUT_MICRO=0 /D "HAVE_WINSOCK2_H" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo

!ELSEIF  "$(CFG)" == "libshout - Win32 Debug"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WIN32" /D VERSION=\"2.0.0\" /D LIBSHOUT_MAJOR=2 /D LIBSHOUT_MINOR=0 /D LIBSHOUT_MICRO=0 /D "HAVE_WINSOCK2_H" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo

!ENDIF 

# Begin Target

# Name "libshout - Win32 Release"
# Name "libshout - Win32 Debug"
# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File

SOURCE=..\src\avl\avl.c
# End Source File
# Begin Source File

SOURCE=..\src\avl\avl.h
# End Source File
# Begin Source File

SOURCE=..\src\httpp\httpp.c
# End Source File
# Begin Source File

SOURCE=..\src\httpp\httpp.h
# End Source File
# Begin Source File

SOURCE=..\src\mp3.c
# End Source File
# Begin Source File

SOURCE=..\src\net\resolver.c
# End Source File
# Begin Source File

SOURCE=..\src\net\resolver.h
# End Source File
# Begin Source File

SOURCE=..\src\shout.c
# End Source File
# Begin Source File

SOURCE=..\src\shout_private.h
# End Source File
# Begin Source File

SOURCE=..\src\net\sock.c
# End Source File
# Begin Source File

SOURCE=..\src\net\sock.h
# End Source File
# Begin Source File

SOURCE=..\src\thread\thread.c
# End Source File
# Begin Source File

SOURCE=..\src\thread\thread.h
# End Source File
# Begin Source File

SOURCE=..\src\timing\timing.c
# End Source File
# Begin Source File

SOURCE=..\src\timing\timing.h
# End Source File
# Begin Source File

SOURCE=..\src\util.c
# End Source File
# Begin Source File

SOURCE=..\src\util.h
# End Source File
# Begin Source File

SOURCE=..\src\vorbis.c
# End Source File
# End Group
# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File

SOURCE=..\include\os.h
# End Source File
# Begin Source File

SOURCE=..\include\shout\shout.h
# End Source File
# End Group
# End Target
# End Project

<p><p>1.1                  libshout/win32/libshout.dsw

Index: libshout.dsw
===================================================================
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!

###############################################################################

Project: "libshout"=.\libshout.dsp - Package Owner=<4>

Package=<5>
{{{
}}}

Package=<4>
{{{
}}}

###############################################################################

Global:

Package=<5>
{{{
}}}

Package=<3>
{{{
}}}

###############################################################################

<p><p><p>--- >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