[xiph-cvs] cvs commit: ogg-tools/oggmerge acinclude.m4 midi.c oggmerge.c vorbis.c

Jack Moffitt jack at xiph.org
Mon Sep 3 19:23:34 PDT 2001



jack        01/09/03 19:23:34

  Modified:    oggmerge acinclude.m4 midi.c oggmerge.c vorbis.c
  Log:
  We really need AM_PATH_VORBIS in acinclude.m4
  
  And uh, let's remove some debugging..
  
  And uh, we need to _cast_ those ints to char, or 0xFF becomes 0xFFFF.
  
  Oh, and it would be nice if we actually wrote out the last ogg pages of
  each stream too :)

Revision  Changes    Path
1.2       +106 -2    ogg-tools/oggmerge/acinclude.m4

Index: acinclude.m4
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggmerge/acinclude.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- acinclude.m4	2001/08/25 22:22:31	1.1
+++ acinclude.m4	2001/09/04 02:23:33	1.2
@@ -12,10 +12,14 @@
 AC_ARG_WITH(ogg-prefix,[  --with-ogg-prefix=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
 AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
 
-  if test x$ogg_prefix != x ; then
+  if test "x$ogg_prefix" != "x"; then
     ogg_args="$ogg_args --prefix=$ogg_prefix"
     OGG_CFLAGS="-I$ogg_prefix/include"
     OGG_LIBS="-L$ogg_prefix/lib"
+  elif test "x$prefix" != "xNONE"; then
+    ogg_args="$ogg_args --prefix=$prefix"
+    OGG_CFLAGS="-I$prefix/include"
+    OGG_LIBS="-L$prefix/lib"
   fi
 
   OGG_LIBS="$OGG_LIBS -logg"
@@ -50,7 +54,7 @@
        LIBS="$ac_save_LIBS"
   fi
 
-  if test "x$no_ogg" = x ; then
+  if test "x$no_ogg" = "x" ; then
      AC_MSG_RESULT(yes)
      ifelse([$1], , :, [$1])     
   else
@@ -88,4 +92,104 @@
   AC_SUBST(OGG_CFLAGS)
   AC_SUBST(OGG_LIBS)
   rm -f conf.oggtest
+])
+# Configure paths for libvorbis
+# Jack Moffitt <jack at icecast.org> 10-21-2000
+# Shamelessly stolen from Owen Taylor and Manish Singh
+
+dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
+dnl
+AC_DEFUN(AM_PATH_VORBIS,
+[dnl 
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(vorbis-prefix,[  --with-vorbis-prefix=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
+AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
+
+  if test "x$vorbis_prefix" != "x" ; then
+    vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
+    VORBIS_CFLAGS="-I$vorbis_prefix/include"
+    VORBIS_LIBDIR="-L$vorbis_prefix/lib"
+  elif test "x$prefix" != "xNONE"; then
+    vorbis_args="$vorbis_args --prefix=$prefix"
+    VORBIS_CFLAGS="-I$prefix/include"
+    VORBIS_LIBDIR="-L$prefix/lib"
+  fi
+
+  VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
+  VORBISFILE_LIBS="-lvorbisfile"
+  VORBISENC_LIBS="-lvorbisenc"
+
+  AC_MSG_CHECKING(for Vorbis)
+  no_vorbis=""
+
+
+  if test "x$enable_vorbistest" = "xyes" ; then
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $VORBIS_CFLAGS"
+    LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
+dnl
+dnl Now check if the installed Vorbis is sufficiently new.
+dnl
+      rm -f conf.vorbistest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vorbis/codec.h>
+
+int main ()
+{
+  system("touch conf.vorbistest");
+  return 0;
+}
+
+],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+  fi
+
+  if test "x$no_vorbis" = "x" ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$1], , :, [$1])     
+  else
+     AC_MSG_RESULT(no)
+     if test -f conf.vorbistest ; then
+       :
+     else
+       echo "*** Could not run Vorbis test program, checking why..."
+       CFLAGS="$CFLAGS $VORBIS_CFLAGS"
+       LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
+       AC_TRY_LINK([
+#include <stdio.h>
+#include <vorbis/codec.h>
+],     [ return 0; ],
+       [ echo "*** The test program compiled, but did not run. This usually means"
+       echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
+       echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
+       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+       echo "*** is required on your system"
+       echo "***"
+       echo "*** If you have an old version installed, it is best to remove it, although"
+       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+       [ echo "*** The test program failed to compile or link. See the file config.log for the"
+       echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
+       echo "*** or that you have moved Vorbis since it was installed." ])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+     VORBIS_CFLAGS=""
+     VORBIS_LIBS=""
+     VORBISFILE_LIBS=""
+     VORBISENC_LIBS=""
+     ifelse([$2], , :, [$2])
+  fi
+  AC_SUBST(VORBIS_CFLAGS)
+  AC_SUBST(VORBIS_LIBS)
+  AC_SUBST(VORBISFILE_LIBS)
+  AC_SUBST(VORBISENC_LIBS)
+  rm -f conf.vorbistest
 ])

1.2       +3 -11     ogg-tools/oggmerge/midi.c

Index: midi.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggmerge/midi.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- midi.c	2001/09/03 23:27:01	1.1
+++ midi.c	2001/09/04 02:23:33	1.2
@@ -251,7 +251,7 @@
         if (databuf->pos == databuf->size)
                 midistate->data = databuf->next;
 
-	return value;
+	return value & 0xFF;
 }
 
 static int64_t _get_long(midi_state_t *midistate)
@@ -263,8 +263,7 @@
         value = ((_get_byte(midistate) & 0xFF) << 24) | ((_get_byte(midistate) & 0xFF) << 16) | 
                 ((_get_byte(midistate) & 0xFF) << 8) | (_get_byte(midistate) & 0xFF);
 
-//	if (_little_endian()) return _swap_long(value);
-	return value;
+	return value & 0xFFFFFFFF;
 }
 
 static long _get_short(midi_state_t *midistate)
@@ -275,8 +274,7 @@
 
         value = ((_get_byte(midistate) & 0xFF) << 8) | (_get_byte(midistate) & 0xFF);
 
-//	if (_little_endian()) return _swap_short(value);
-	return value;
+	return value & 0xFFFF;
 }
 
 static ogg_page *_copy_ogg_page(ogg_page *og)
@@ -460,7 +458,6 @@
                                 break;
                         }
                         
-			printf("_process_data(): parsing header\n");
                         // parse the header, make a packet, and stuff
                         // into the stream
                         buf = _get_data(midistate, 4);
@@ -488,11 +485,6 @@
                                 ticks = (rawtime & 0x7FFF);
                         }
                 
-			if (smtpe)
-				printf("SMTPE timebase of %d frames and %d ticks per frame\n", frames, ticks);
-			else
-				printf("Timebase of %d ticks per quarternote\n", ticks);
-
                         // grab second chunk header
                         buf = _get_data(midistate, 4);
                         if (buf == NULL || memcmp(buf, "MTrk", 4) != 0) {

1.4       +5 -1      ogg-tools/oggmerge/oggmerge.c

Index: oggmerge.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggmerge/oggmerge.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- oggmerge.c	2001/09/03 23:46:29	1.3
+++ oggmerge.c	2001/09/04 02:23:33	1.4
@@ -251,7 +251,11 @@
                 file = params.input;
                 while (file) {
                         if (file->page == NULL) {
-				while (!feof(file->fp) && file->status == EMOREDATA  && (file->page = file->page_out(&file->state)) == NULL) {
+				while ((file->page = file->page_out(&file->state)) == NULL && file->status == EMOREDATA) {
+					if (feof(file->fp)) {
+						file->status = 0;
+						break;
+					}
                                         bytes = fread(buf, 1, BUFSIZE, file->fp);
                                         file->status = file->data_in(&file->state, buf, bytes);
                                         if (file->status < 0 && file->status != EMOREDATA) {

1.2       +0 -1      ogg-tools/oggmerge/vorbis.c

Index: vorbis.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/oggmerge/vorbis.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vorbis.c	2001/09/03 23:27:01	1.1
+++ vorbis.c	2001/09/04 02:23:33	1.2
@@ -146,7 +146,6 @@
         
         if (vstate->samplerate == 0) return 0;
         
-	printf("making timestamp from granulepos = %lld and samplerate = %d\n", granulepos, vstate->samplerate);
         stamp = (double)granulepos * (double)1000000 / (double)vstate->samplerate;
         
         return stamp;

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