Ogg Vorbis / Speex Plugin * Contents - Platform independent source codes -- sqOgg.c : Core functions for the codec -- OggPlugin.h : Common header -- OggPlugin.c : (glue code genareted by OggPlugin.cs) - Changesets -- OggPlugin.cs : a plugin class (tested on Squeak3.8-6665full) -- OggCodec.cs : Basic codec classes (tested on OLPC-1229, Squeak3.8-6665full) -- Morphic-OggCodec.cs : etoys support (tested on OLPC-1229) - test/ : tests - acinclude.m4 : configure setting file for unix - macosx/ : xcode files for Mac OSX * Changesets OggPlugin.cs is * Test Test directory includes some programs which allows you to test this library without Squeak. You need to prepare sample sound raw data files and helper software (sox) before trying to these tests. cd test; make test - test/badpointer.c : test error recovering - test/buftest.c : test result buffer - test/dump.c : show internal structure of ogg container - test/packet.c : test writing and reading ogg packet - test/vdecode.c : Ogg vorbis encoder - test/vencode.c : Ogg vorbis decoder - test/sdecode.c : Ogg speex encoder - test/sencode.c : Ogg speex decoder - test/play.sh : A wrapper to play raw sound for test Prerequired files - sample.wav : see test/Makefile * To do - Speex only supports mono channel. - other container like RTP * How to Build as an external plugin This plugin is tested with - libogg-1.1.3 - libvorbis-1.1.2 - speex-1.0.5 ** Build on Linux (using shared library) - Install libogg, libvorbis, and libspeex (with header files). - Add "OggPlugin" to platforms/unix/src/plugins.ext $ mkdir platforms/unix/plugins/OggPlugin/ $ mkdir platforms/Cross/plugins/OggPlugin/ $ cp acinclude.m4 platforms/unix/plugins/OggPlugin/ $ cp sqOgg.c OggPlugin.h OggPlugin.c platforms/Cross/plugins/OggPlugin/ $ cd platforms/unix/bld $ make -C ../config/ # rebuild configure script $ ../config/configure $ make OggPlugin.la ** Build on Windows (using static library, assume with cygwin) (I use Cygwin bash shell.) 1-1 : Build Ogg Vorbis library with build tool (mingw gcc 2.95.2). $ export PATH=/cygdrive/c/gnutools/bin:$PATH $ tar xzvf libogg-1.1.3.tar.gz $ cd libogg-1.1.3 $ ./configure ac_cv_sizeof_short=2 ac_cv_sizeof_int=4 $ make $ /bin/cp src/.libs/libogg.a /cygdrive/c/gnutools/lib/ $ /bin/cp -r include/ogg /cygdrive/c/gnutools/include $ cd .. $ tar xzvf libvorbis-1.1.2.tar.gz $ cd libvorbis-1.1.2 $ ./configure $ make ### It causes an error, but the library would be made. $ /bin/cp lib/.libs/*.a /cygdrive/c/gnutools/lib/ $ /bin/cp -r include/vorbis/ /cygdrive/c/gnutools/include/ build speex as libvorbis 1-2: Test if Ogg Vorbis is installed correctly. $ cd examples $ gcc -o encoder_example encoder_example.c -lvorbis -lvorbisenc -logg $ ./encoder_example.exe < /cygdrive/c/WINDOWS/Media/tada.wav > tada.ogg 2: Building OggPlugin - cd to Squeak VM win32 platform directory. $ mkdir plugins/OggPlugin (copy OggPlugin.c OggPlugin.h sqOgg.c to OggPlugin/) (add -lvorbis -logg -lvorbisenc -lspeex to Makefile.ming32 like;) makedll: $(LIBOBJ) $(DLLTOOL) \ --output-def $(OBJDIR)/$(LIB).def \ --output-exp $(OBJDIR)/$(LIB).exp \ --output-lib $(OBJDIR)/$(LIB).lib \ $(LIBOBJ) $(DLLWRAP) -mwindows \ -def $(OBJDIR)/$(LIB).def \ -o $(OBJDIR)/$(LIB).dll \ $(LIBS) \ $(OBJDIR)/$(LIB).exp \ $(LIBOBJ) -lvorbis -logg -lvorbisenc -lspeex strip --strip-all $(OBJDIR)/$(LIB).dll -$(RM) -f $(LIBOBJ) $(LIB).lib $(LIB).exp $(LIB).def $ make OggPlugin.dll -f Makefile.mingw32 ** Build on Mac OSX (using static library, with Xcode) (NOTE: This is unfinished trial to make universal plugin.) 1: Build libraries as universal bin (assumes ~/src is current dir) $ cd libogg-1.1.3/ $ ./configure $ make CFLAGS="-arch i386" $ mv src/.libs/libogg.a libogg.i386.a $ make clean $ make CFLAGS="-arch ppc" $ mv src/.libs/libogg.a libogg.ppc.a $ mkdir lib $ lipo -create libogg.i386.a libogg.ppc.a -output lib/libogg.a $ cd ../libvorbis-1.1.2 $ ./configure --with-ogg=$HOME/src/libogg-1.1.3 --disable-shared $ make CFLAGS="-arch i386" $ mv lib/.libs/libvorbis.a libvorbis.i386.a $ mv lib/.libs/libvorbisenc.a libvorbisenc.i386.a $ make clean $ make CFLAGS="-arch ppc" $ mv lib/.libs/libvorbis.a libvorbis.ppc.a $ mv lib/.libs/libvorbisenc.a libvorbisenc.ppc.a $ lipo -create libvorbis.i386.a libvorbis.ppc.a -output libvorbis.a $ lipo -create libvorbisenc.i386.a libvorbisenc.ppc.a -output libvorbisenc.a $ cd ../speex-1.0.5/ $ ./configure --disable-shared $ make CFLAGS="-arch i386" $ mv libspeex/.libs/libspeex.a libspeex.i386.a $ make CFLAGS="-arch ppc" $ mv libspeex/.libs/libspeex.a libspeex.ppc.a $ lipo -create libspeex.i386.a libspeex.ppc.a -output libspeex.a 2: Build OggPlugin.bundle (assumes vm source is ~/squeak-svn) - Start Xcode - File - New Project - Carbon Bundle -- Project Name: OggPlugin - Project - Add to project -- add OggPlugin.c, sqOgg.c - Project - Edit Project Settings - Build -- Archtechtures : ppc i386 -- Header Search Paths : add /Developer/Headers/FlatCarbon ~/squeak-svn/platforms/Mac\ OS/vm/ ~/squeak-svn/platforms/Mac\ OS/vm/Developer ~/squeak-svn/platforms/Cross/vm ~/src/libogg-1.1.3/include ~/src/libvorbis-1.1.2/include ~/src/speex-1.0.5/include -- Library Search Paths : add ~/src/libogg-1.1.3/lib ~/src/libvorbis-1.1.2 ~/src/speex-1.0.5 -- Other Linker Flags : -logg -lvorbis -lvorbisenc -lspeex -- check 'Force Package Info Generation' - remove main.c Or, just use macosx/OggPlugin.xcodeproj.