Bug 677581 - Update libogg to upstream svn r18096. r=kinetik
authorRalph Giles <giles@mozilla.com>
Tue, 11 Oct 2011 13:50:38 +1300
changeset 78530 df9d305be41206fc7c2549bdd105c1f04f39a9d9
parent 78529 b773a00c239b3edb0ce38d34964b162e937ad7c8
child 78531 a98178fd0f47d0af098c64a33f89330d147312fb
push idunknown
push userunknown
push dateunknown
reviewerskinetik
bugs677581
milestone10.0a1
Bug 677581 - Update libogg to upstream svn r18096. r=kinetik This is one revision ahead of the 1.3.0, after some whitespace fixes to the documentation. Since the last update, the major changes are do documentation, the addition of the ogg_stream_*_fill() calls which are important for controlling overhead and latency with newer codecs like theora and opus. The way configure generates config_types.h has also changed, making it more necessary to have platform-specific type definitions in os_types.h. The patch for Solaris support has been updated to support this.
media/libogg/AUTHORS
media/libogg/CHANGES
media/libogg/README
media/libogg/include/ogg/config_types.h
media/libogg/include/ogg/ogg.h
media/libogg/include/ogg/os_types.h
media/libogg/int-types.patch
media/libogg/solaris-types.patch
media/libogg/src/ogg_bitwise.c
media/libogg/src/ogg_framing.c
media/libogg/update.sh
--- a/media/libogg/AUTHORS
+++ b/media/libogg/AUTHORS
@@ -1,4 +1,7 @@
 Monty <monty@xiph.org>
+Greg Maxwell <greg@xiph.org>
+Ralph Giles <giles@xiph.org>
+Cristian Adam <cristian.adam@gmail.com>
+Tim Terriberry <tterribe@xiph.org>
 
 and the rest of the Xiph.Org Foundation.
-
--- a/media/libogg/CHANGES
+++ b/media/libogg/CHANGES
@@ -1,30 +1,58 @@
+Version 1.3.0 (2011 August 4)
+
+* Add ogg_stream_flush_fill() call
+  This produces longer packets on flush, similar to
+  what ogg_stream_pageout_fill() does for single pages.
+* Windows build fixes
+
+Version 1.2.2 (2010 December 07)
+
+* Build fix (types correction) for Mac OS X
+* Update win32 project files to Visual Studio 2008
+* ogg_stream_pageout_fill documentation fix
+
+Version 1.2.1 (2010 November 01)
+
+* Various build updates (see SVN)
+* Add ogg_stream_pageout_fill() to API to allow applications
+  greater explicit flexibility in page sizing.
+* Documentation updates including multiplexing description,
+  terminology and API (incl. ogg_packet_clear(),
+  ogg_stream_pageout_fill())
+* Correct possible buffer overwrite in stream encoding on 32 bit
+  when a single packet exceed 250MB.
+* Correct read-buffer overrun [without side effects] under
+  similar circumstances.
+* Update unit testing to work properly with new page spill
+  heuristic.
+
 Version 1.2.0 (2010 March 25)
 
-* Alter default flushing behavior to span less often and use larger page 
+* Alter default flushing behavior to span less often and use larger page
   sizes when packet sizes are large.
 * Build fixes for additional compilers
 * Documentation updates
 
 Version 1.1.4 (2009 June 24)
 
-* New async error reporting mechanism. Calls made after a fatal error are 
+* New async error reporting mechanism. Calls made after a fatal error are
   now safely handled in the event an error code is ignored
 * Added allocation checks useful to some embedded applications
 * fix possible read past end of buffer when reading 0 bits
 * Updates to API documentation
 * Build fixes
 
 Version 1.1.3 (2005 November 27)
 
  * Correct a bug in the granulepos field of pages where no packet ends
  * New VS2003 and XCode builds, minor fixes to other builds
  * documentation fixes and cleanup
- 
+
 Version 1.1.2 (2004 September 23)
 
  * fix a bug with multipage packet assembly after seek
 
 Version 1.1.1 (2004 September 12)
 
  * various bugfixes
  * important bugfix for 64-bit platforms
@@ -35,15 +63,15 @@ Version 1.1.1 (2004 September 12)
 
 Version 1.1 (2003 November 17)
 
  * big-endian bitpacker routines for Theora
  * various portability fixes
  * improved API documenation
  * RFC 3533 documentation of the format by Silvia Pfeiffer at CSIRO
  * RFC 3534 documentation of the application/ogg mime-type by Linus Walleij
- 
+
 Version 1.0 (2002 July 19)
 
  * First stable release
  * little-endian bitpacker routines for Vorbis
  * basic Ogg bitstream sync and coding support
 
--- a/media/libogg/README
+++ b/media/libogg/README
@@ -1,133 +1,97 @@
 ********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
-* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
+* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2011             *
 * by the Xiph.Org Foundation http://www.xiph.org/                  *
 *                                                                  *
 ********************************************************************
 
-WHAT'S HERE:
+= WHAT'S HERE =
 
-This source distribution includes libogg and nothing else.  Other modules 
-(eg, the modules vorbis, vorbis-tools and vorbis-plugins for the Vorbis 
-codec) contain the codec libraries for use with Ogg bitstreams.
+This source distribution includes libogg and nothing else. Other modules
+(eg, the modules libvorbis, vorbis-tools for the Vorbis music codec,
+libtheora for the Theora video codec) contain the codec libraries for
+use with Ogg bitstreams.
 
 Directory:
 
-./src  		The source for libogg, a BSD-license inplementation of 
+./src  		The source for libogg, a BSD-license inplementation of
 		the public domain Ogg bitstream format
 
-./include       Library API headers and codebooks
+./include       Library API headers
 
-./doc           Ogg specification documents
+./doc           Ogg specification and libogg API documents
 
 ./win32		Win32 projects and build automation
 
-./macosx	MacOS X project and build files
-
-./macos		Classic MacOS 9 projects and build automation
+./macosx	Mac OS X project and build files
 
-./debian        Rules/spec files for building Debian .deb packages
-		(may not be present, depending on your distribution)
-
-WHAT IS OGG?:
+= WHAT IS OGG? =
 
 Ogg project codecs use the Ogg bitstream format to arrange the raw,
 compressed bitstream into a more robust, useful form.  For example,
 the Ogg bitstream makes seeking, time stamping and error recovery
 possible, as well as mixing several sepearate, concurrent media
 streams into a single physical bitstream.
 
-CONTACT:
+= CONTACT =
 
-The Ogg homepage is located at 'http://www.xiph.org/ogg/'.
+The Ogg homepage is located at 'https://www.xiph.org/ogg/'.
 Up to date technical documents, contact information, source code and
 pre-built utilities may be found there.
 
-BUILDING FROM REPOSITORY SOURCE:
-
-A standard svn build should consist of nothing more than:
-
-./autogen.sh
-make 
-
-and as root if desired :
-
-make install
-
-This will install the Ogg libraries (static and shared) into
-/usr/local/lib, includes into /usr/local/include and API manpages
-(once we write some) into /usr/local/man.
-
 BUILDING FROM TARBALL DISTRIBUTIONS:
 
 ./configure
 make
 
 and optionally (as root):
 make install
 
-BUILDING RPMS:
+This will install the Ogg libraries (static and shared) into
+/usr/local/lib, includes into /usr/local/include and API
+documentation into /usr/local/share/doc.
+
+BUILDING FROM REPOSITORY SOURCE:
 
-RPMs may be built by:
+A standard svn build should consist of nothing more than:
 
-make dist
-rpm -ta libogg-<version>.tar.gz
+./autogen.sh
+make
+
+and as root if desired :
+
+make install
 
 BUILDING ON WIN32:
 
-Use the project file in the win32 directory.  It should compile out of the box.
-You can also run one of the batch files from the commandline.
-
-E.g.: build_ogg_dynamic
+Use the project file in the win32 directory. It should compile out of the box.
 
 CROSS COMPILING FROM LINUX TO WIN32:
 
 It is also possible to cross compile from Linux to windows using the MinGW
 cross tools and even to run the test suite under Wine, the Linux/*nix
 windows emulator.
 
 On Debian and Ubuntu systems, these cross compiler tools can be installed
 by doing:
 
     sudo apt-get mingw32 mingw32-binutils mingw32-runtime wine
 
 Once these tools are installed its possible to compile and test by
-executing the following commands:
+executing the following commands, or something similar depending on
+your system:
 
     ./configure --host=i586-mingw32msvc --target=i586-mingw32msvc \
          --build=i586-linux
     make
     make check
 
-The above has been tested with the following versions of the tools on
-Ubuntu's Hardy Heron release:
-
-    mingw32             4.2.1.dfsg-1ubuntu1
-    mingw32-binutils    2.17.50-20070129.1-1
-    mingw32-runtime     3.13-1
-    wine                0.9.59-0ubuntu4
-
-BUILDING ON MACOS 9:
-
-Ogg on MacOS 9 is built using CodeWarrior 5.3.  To build it, first
-open ogg/mac/libogg.mcp, switch to the "Targets" pane, select
-everything, and make the project.  In ogg/mac/Output you will now have
-both debug and final versions of Ogg shared libraries to link your
-projects against.
-
-To build a project using Ogg, add access paths to your CodeWarrior
-project for the ogg/include and ogg/mac/Output folders.  Be sure that
-"interpret DOS and Unix paths" is turned on in your project; it can be
-found in the "access paths" pane in your project settings.  Now simply
-add the shared libraries you need to your project (OggLib at least)
-and #include "ogg/ogg.h" wherever you need to acces Ogg functionality.
-
 (Build instructions for Ogg codecs such as vorbis are similar and may
 be found in those source modules' README files)
 
-$Id: README 14726 2008-04-14 08:40:46Z erikd $
+$Id: README 18096 2011-09-22 23:32:51Z giles $
--- a/media/libogg/include/ogg/config_types.h
+++ b/media/libogg/include/ogg/config_types.h
@@ -1,17 +1,25 @@
 #ifndef __CONFIG_TYPES_H__
 #define __CONFIG_TYPES_H__
 
 /* these are filled in by configure */
-typedef int16_t ogg_int16_t;
-typedef int32_t ogg_int32_t;
-typedef int64_t ogg_int64_t;
+#define INCLUDE_INTTYPES_H 1
+#define INCLUDE_STDINT_H 1
+#define INCLUDE_SYS_TYPES_H 1
 
-#ifdef SOLARIS
-typedef uint16_t ogg_uint16_t;
-typedef uint32_t ogg_uint32_t;
-#else
-typedef u_int16_t ogg_uint16_t;
-typedef u_int32_t ogg_uint32_t;
+#if INCLUDE_INTTYPES_H
+#  include <inttypes.h>
+#endif
+#if INCLUDE_STDINT_H
+#  include <stdint.h>
+#endif
+#if INCLUDE_SYS_TYPES_H
+#  include <sys/types.h>
 #endif
 
+typedef short ogg_int16_t;
+typedef unsigned short ogg_uint16_t;
+typedef int ogg_int32_t;
+typedef unsigned int ogg_uint32_t;
+typedef long ogg_int64_t;
+
 #endif
--- a/media/libogg/include/ogg/ogg.h
+++ b/media/libogg/include/ogg/ogg.h
@@ -6,17 +6,17 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: toplevel libogg include
- last mod: $Id: ogg.h 17098 2010-03-29 05:35:11Z gmaxwell $
+ last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $
 
  ********************************************************************/
 #ifndef _OGG_H
 #define _OGG_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -73,17 +73,17 @@ typedef struct {
                              logical bitstream */
   int     b_o_s;          /* set after we've written the initial page
                              of a logical bitstream */
   long    serialno;
   long    pageno;
   ogg_int64_t  packetno;  /* sequence number for decode; the framing
                              knows where there's a hole in the data,
                              but we need coupling so that the codec
-                             (which is in a seperate abstraction
+                             (which is in a separate abstraction
                              layer) also knows about the gap */
   ogg_int64_t   granulepos;
 
 } ogg_stream_state;
 
 /* ogg_packet is used to encapsulate the data and metadata belonging
    to a single raw Ogg/Vorbis packet *************************************/
 
@@ -93,17 +93,17 @@ typedef struct {
   long  b_o_s;
   long  e_o_s;
 
   ogg_int64_t  granulepos;
 
   ogg_int64_t  packetno;     /* sequence number for decode; the framing
                                 knows where there's a hole in the data,
                                 but we need coupling so that the codec
-                                (which is in a seperate abstraction
+                                (which is in a separate abstraction
                                 layer) also knows about the gap */
 } ogg_packet;
 
 typedef struct {
   unsigned char *data;
   int storage;
   int fill;
   int returned;
@@ -156,16 +156,17 @@ extern unsigned char *oggpackB_get_buffe
 /* Ogg BITSTREAM PRIMITIVES: encoding **************************/
 
 extern int      ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
 extern int      ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
                                    int count, long e_o_s, ogg_int64_t granulepos);
 extern int      ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
 extern int      ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
 extern int      ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
+extern int      ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
 
 /* Ogg BITSTREAM PRIMITIVES: decoding **************************/
 
 extern int      ogg_sync_init(ogg_sync_state *oy);
 extern int      ogg_sync_clear(ogg_sync_state *oy);
 extern int      ogg_sync_reset(ogg_sync_state *oy);
 extern int      ogg_sync_destroy(ogg_sync_state *oy);
 extern int      ogg_sync_check(ogg_sync_state *oy);
--- a/media/libogg/include/ogg/os_types.h
+++ b/media/libogg/include/ogg/os_types.h
@@ -6,17 +6,17 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os_types.h 17287 2010-06-10 13:42:06Z tterribe $
+ last mod: $Id: os_types.h 17712 2010-12-03 17:10:02Z xiphmont $
 
  ********************************************************************/
 #ifndef _OS_TYPES_H
 #define _OS_TYPES_H
 
 /* make it easy on the folks that want to compile the libs with a
    different malloc than stdlib */
 #define _ogg_malloc  malloc
@@ -63,21 +63,31 @@
    typedef SInt16 ogg_int16_t;
    typedef UInt16 ogg_uint16_t;
    typedef SInt32 ogg_int32_t;
    typedef UInt32 ogg_uint32_t;
    typedef SInt64 ogg_int64_t;
 
 #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
 
-#  include <sys/types.h>
+#  include <inttypes.h>
    typedef int16_t ogg_int16_t;
-   typedef u_int16_t ogg_uint16_t;
+   typedef uint16_t ogg_uint16_t;
    typedef int32_t ogg_int32_t;
-   typedef u_int32_t ogg_uint32_t;
+   typedef uint32_t ogg_uint32_t;
+   typedef int64_t ogg_int64_t;
+
+#elif defined(__sun__)
+
+   /* Solaris and derivatives */
+#  include <inttypes.h>
+   typedef int16_t ogg_int16_t;
+   typedef uint16_t ogg_uint16_t;
+   typedef int32_t ogg_int32_t;
+   typedef uint32_t ogg_uint32_t;
    typedef int64_t ogg_int64_t;
 
 #elif defined(__HAIKU__)
 
   /* Haiku */
 #  include <sys/types.h>
    typedef short ogg_int16_t;
    typedef unsigned short ogg_uint16_t;
@@ -85,19 +95,19 @@
    typedef unsigned int ogg_uint32_t;
    typedef long long ogg_int64_t;
 
 #elif defined(__BEOS__)
 
    /* Be */
 #  include <inttypes.h>
    typedef int16_t ogg_int16_t;
-   typedef u_int16_t ogg_uint16_t;
+   typedef uint16_t ogg_uint16_t;
    typedef int32_t ogg_int32_t;
-   typedef u_int32_t ogg_uint32_t;
+   typedef uint32_t ogg_uint32_t;
    typedef int64_t ogg_int64_t;
 
 #elif defined (__EMX__)
 
    /* OS/2 GCC */
    typedef short ogg_int16_t;
    typedef unsigned short ogg_uint16_t;
    typedef int ogg_int32_t;
@@ -135,14 +145,13 @@
    typedef signed short ogg_int16_t;
    typedef unsigned short ogg_uint16_t;
    typedef signed int ogg_int32_t;
    typedef unsigned int ogg_uint32_t;
    typedef long long int ogg_int64_t;
 
 #else
 
-#  include <sys/types.h>
 #  include <ogg/config_types.h>
 
 #endif
 
 #endif  /* _OS_TYPES_H */
deleted file mode 100644
--- a/media/libogg/int-types.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- include/ogg/config_types.h.old	2008-11-10 15:24:49.465597010 +0800
-+++ include/ogg/config_types.h	2008-11-10 15:25:19.249016710 +0800
-@@ -3,9 +3,15 @@
- 
- /* these are filled in by configure */
- typedef int16_t ogg_int16_t;
--typedef u_int16_t ogg_uint16_t;
- typedef int32_t ogg_int32_t;
--typedef u_int32_t ogg_uint32_t;
- typedef int64_t ogg_int64_t;
- 
-+#ifdef SOLARIS
-+typedef uint16_t ogg_uint16_t;
-+typedef uint32_t ogg_uint32_t;
-+#else
-+typedef u_int16_t ogg_uint16_t;
-+typedef u_int32_t ogg_uint32_t;
-+#endif
-+
- #endif
new file mode 100644
--- /dev/null
+++ b/media/libogg/solaris-types.patch
@@ -0,0 +1,22 @@
+Index: include/ogg/os_types.h
+===================================================================
+--- include/ogg/os_types.h      (revision 18100)
++++ include/ogg/os_types.h      (working copy)
+@@ -75,6 +75,16 @@
+    typedef uint32_t ogg_uint32_t;
+    typedef int64_t ogg_int64_t;
+ 
++#elif defined(__sun__)
++
++   /* Solaris and derivatives */
++#  include <inttypes.h>
++   typedef int16_t ogg_int16_t;
++   typedef uint16_t ogg_uint16_t;
++   typedef int32_t ogg_int32_t;
++   typedef uint32_t ogg_uint32_t;
++   typedef int64_t ogg_int64_t;
++
+ #elif defined(__HAIKU__)
+ 
+   /* Haiku */
+
--- a/media/libogg/src/ogg_bitwise.c
+++ b/media/libogg/src/ogg_bitwise.c
@@ -6,17 +6,17 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: packing variable sized words into an octet stream
-  last mod: $Id: bitwise.c 17287 2010-06-10 13:42:06Z tterribe $
+  last mod: $Id: bitwise.c 18051 2011-08-04 17:56:39Z giles $
 
  ********************************************************************/
 
 /* We're 'LSb' endian; if we write a word but read individual bits,
    then we'll read the lsb first */
 
 #include <string.h>
 #include <stdlib.h>
@@ -88,21 +88,21 @@ void oggpack_write(oggpack_buffer *b,uns
     if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err;
     ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
     if(!ret) goto err;
     b->buffer=ret;
     b->storage+=BUFFER_INCREMENT;
     b->ptr=b->buffer+b->endbyte;
   }
 
-  value&=mask[bits]; 
+  value&=mask[bits];
   bits+=b->endbit;
 
-  b->ptr[0]|=value<<b->endbit;  
-  
+  b->ptr[0]|=value<<b->endbit;
+
   if(bits>=8){
     b->ptr[1]=(unsigned char)(value>>(8-b->endbit));
     if(bits>=16){
       b->ptr[2]=(unsigned char)(value>>(16-b->endbit));
       if(bits>=24){
         b->ptr[3]=(unsigned char)(value>>(24-b->endbit));
         if(bits>=32){
           if(b->endbit)
@@ -131,21 +131,21 @@ void oggpackB_write(oggpack_buffer *b,un
     if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err;
     ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
     if(!ret) goto err;
     b->buffer=ret;
     b->storage+=BUFFER_INCREMENT;
     b->ptr=b->buffer+b->endbyte;
   }
 
-  value=(value&mask[bits])<<(32-bits); 
+  value=(value&mask[bits])<<(32-bits);
   bits+=b->endbit;
 
-  b->ptr[0]|=value>>(24+b->endbit);  
-  
+  b->ptr[0]|=value>>(24+b->endbit);
+
   if(bits>=8){
     b->ptr[1]=(unsigned char)(value>>(16+b->endbit));
     if(bits>=16){
       b->ptr[2]=(unsigned char)(value>>(8+b->endbit));
       if(bits>=24){
         b->ptr[3]=(unsigned char)(value>>(b->endbit));
         if(bits>=32){
           if(b->endbit)
@@ -188,17 +188,17 @@ static void oggpack_writecopy_helper(ogg
 
   long bytes=bits/8;
   bits-=bytes*8;
 
   if(b->endbit){
     int i;
     /* unaligned copy.  Do it the hard way. */
     for(i=0;i<bytes;i++)
-      w(b,(unsigned long)(ptr[i]),8);    
+      w(b,(unsigned long)(ptr[i]),8);
   }else{
     /* aligned block copy */
     if(b->endbyte+bytes+1>=b->storage){
       void *ret;
       if(!b->ptr) goto err;
       if(b->endbyte+bytes+BUFFER_INCREMENT>b->storage) goto err;
       b->storage=b->endbyte+bytes+BUFFER_INCREMENT;
       ret=_ogg_realloc(b->buffer,b->storage);
@@ -210,19 +210,19 @@ static void oggpack_writecopy_helper(ogg
     memmove(b->ptr,source,bytes);
     b->ptr+=bytes;
     b->endbyte+=bytes;
     *b->ptr=0;
 
   }
   if(bits){
     if(msb)
-      w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);    
+      w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);
     else
-      w(b,(unsigned long)(ptr[bytes]),bits);    
+      w(b,(unsigned long)(ptr[bytes]),bits);
   }
   return;
  err:
   oggpack_writeclear(b);
 }
 
 void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){
   oggpack_writecopy_helper(b,source,bits,oggpack_write,0);
@@ -276,21 +276,21 @@ long oggpack_look(oggpack_buffer *b,int 
     if(b->endbyte > b->storage-((bits+7)>>3)) return -1;
     /* special case to avoid reading b->ptr[0], which might be past the end of
         the buffer; also skips some useless accounting */
     else if(!bits)return(0L);
   }
 
   ret=b->ptr[0]>>b->endbit;
   if(bits>8){
-    ret|=b->ptr[1]<<(8-b->endbit);  
+    ret|=b->ptr[1]<<(8-b->endbit);
     if(bits>16){
-      ret|=b->ptr[2]<<(16-b->endbit);  
+      ret|=b->ptr[2]<<(16-b->endbit);
       if(bits>24){
-        ret|=b->ptr[3]<<(24-b->endbit);  
+        ret|=b->ptr[3]<<(24-b->endbit);
         if(bits>32 && b->endbit)
           ret|=b->ptr[4]<<(32-b->endbit);
       }
     }
   }
   return(m&ret);
 }
 
@@ -307,21 +307,21 @@ long oggpackB_look(oggpack_buffer *b,int
     if(b->endbyte > b->storage-((bits+7)>>3)) return -1;
     /* special case to avoid reading b->ptr[0], which might be past the end of
         the buffer; also skips some useless accounting */
     else if(!bits)return(0L);
   }
 
   ret=b->ptr[0]<<(24+b->endbit);
   if(bits>8){
-    ret|=b->ptr[1]<<(16+b->endbit);  
+    ret|=b->ptr[1]<<(16+b->endbit);
     if(bits>16){
-      ret|=b->ptr[2]<<(8+b->endbit);  
+      ret|=b->ptr[2]<<(8+b->endbit);
       if(bits>24){
-        ret|=b->ptr[3]<<(b->endbit);  
+        ret|=b->ptr[3]<<(b->endbit);
         if(bits>32 && b->endbit)
           ret|=b->ptr[4]>>(8-b->endbit);
       }
     }
   }
   return ((ret&0xffffffff)>>(m>>1))>>((m+1)>>1);
 }
 
@@ -381,21 +381,21 @@ long oggpack_read(oggpack_buffer *b,int 
     if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
     /* special case to avoid reading b->ptr[0], which might be past the end of
         the buffer; also skips some useless accounting */
     else if(!bits)return(0L);
   }
 
   ret=b->ptr[0]>>b->endbit;
   if(bits>8){
-    ret|=b->ptr[1]<<(8-b->endbit);  
+    ret|=b->ptr[1]<<(8-b->endbit);
     if(bits>16){
-      ret|=b->ptr[2]<<(16-b->endbit);  
+      ret|=b->ptr[2]<<(16-b->endbit);
       if(bits>24){
-        ret|=b->ptr[3]<<(24-b->endbit);  
+        ret|=b->ptr[3]<<(24-b->endbit);
         if(bits>32 && b->endbit){
           ret|=b->ptr[4]<<(32-b->endbit);
         }
       }
     }
   }
   ret&=m;
   b->ptr+=bits/8;
@@ -424,21 +424,21 @@ long oggpackB_read(oggpack_buffer *b,int
     if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
     /* special case to avoid reading b->ptr[0], which might be past the end of
         the buffer; also skips some useless accounting */
     else if(!bits)return(0L);
   }
 
   ret=b->ptr[0]<<(24+b->endbit);
   if(bits>8){
-    ret|=b->ptr[1]<<(16+b->endbit);  
+    ret|=b->ptr[1]<<(16+b->endbit);
     if(bits>16){
-      ret|=b->ptr[2]<<(8+b->endbit);  
+      ret|=b->ptr[2]<<(8+b->endbit);
       if(bits>24){
-        ret|=b->ptr[3]<<(b->endbit);  
+        ret|=b->ptr[3]<<(b->endbit);
         if(bits>32 && b->endbit)
           ret|=b->ptr[4]>>(8-b->endbit);
       }
     }
   }
   ret=((ret&0xffffffffUL)>>(m>>1))>>((m+1)>>1);
 
   b->ptr+=bits/8;
@@ -506,17 +506,17 @@ long oggpack_bits(oggpack_buffer *b){
 
 long oggpackB_bytes(oggpack_buffer *b){
   return oggpack_bytes(b);
 }
 
 long oggpackB_bits(oggpack_buffer *b){
   return oggpack_bits(b);
 }
-  
+
 unsigned char *oggpack_get_buffer(oggpack_buffer *b){
   return(b->buffer);
 }
 
 unsigned char *oggpackB_get_buffer(oggpack_buffer *b){
   return oggpack_get_buffer(b);
 }
 
@@ -529,17 +529,17 @@ unsigned char *oggpackB_get_buffer(oggpa
 static int ilog(unsigned int v){
   int ret=0;
   while(v){
     ret++;
     v>>=1;
   }
   return(ret);
 }
-      
+
 oggpack_buffer o;
 oggpack_buffer r;
 
 void report(char *in){
   fprintf(stderr,"%s",in);
   exit(1);
 }
 
@@ -576,17 +576,17 @@ void cliptest(unsigned long *b,int vals,
     }
   }
   if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
 }
 
 void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){
   long bytes,i;
   unsigned char *buffer;
-  
+
   oggpackB_reset(&o);
   for(i=0;i<vals;i++)
     oggpackB_write(&o,b[i],bits?bits:ilog(b[i]));
   buffer=oggpackB_get_buffer(&o);
   bytes=oggpackB_bytes(&o);
   if(bytes!=compsize)report("wrong number of bytes!\n");
   for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
     for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
@@ -846,12 +846,12 @@ int main(void){
     fprintf(stderr,"failed; read past end without -1.\n");
       exit(1);
   }
   oggpackB_writeclear(&o);
   fprintf(stderr,"ok.\n\n");
 
 
   return(0);
-}  
+}
 #endif  /* _V_SELFTEST */
 
 #undef BUFFER_INCREMENT
--- a/media/libogg/src/ogg_framing.c
+++ b/media/libogg/src/ogg_framing.c
@@ -7,17 +7,17 @@
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: code raw packets into framed OggSquish stream and
            decode Ogg streams back into raw packets
- last mod: $Id: framing.c 17269 2010-06-04 05:39:45Z xiphmont $
+ last mod: $Id: framing.c 18052 2011-08-04 17:57:02Z giles $
 
  note: The CRC code is directly derived from public domain code by
  Ross Williams (ross@guest.adelaide.edu.au).  See docs/framing.html
  for details.
 
  ********************************************************************/
 
 #include <stdlib.h>
@@ -56,41 +56,41 @@ ogg_int64_t ogg_page_granulepos(const og
 }
 
 int ogg_page_serialno(const ogg_page *og){
   return(og->header[14] |
          (og->header[15]<<8) |
          (og->header[16]<<16) |
          (og->header[17]<<24));
 }
- 
+
 long ogg_page_pageno(const ogg_page *og){
   return(og->header[18] |
          (og->header[19]<<8) |
          (og->header[20]<<16) |
          (og->header[21]<<24));
 }
 
 
 
 /* returns the number of packets that are completed on this page (if
    the leading packet is begun on a previous page, but ends on this
    page, it's counted */
 
 /* NOTE:
-If a page consists of a packet begun on a previous page, and a new
-packet begun (but not completed) on this page, the return will be:
-  ogg_page_packets(page)   ==1, 
-  ogg_page_continued(page) !=0
+   If a page consists of a packet begun on a previous page, and a new
+   packet begun (but not completed) on this page, the return will be:
+     ogg_page_packets(page)   ==1,
+     ogg_page_continued(page) !=0
 
-If a page happens to be a single packet that was begun on a
-previous page, and spans to the next page (in the case of a three or
-more page packet), the return will be: 
-  ogg_page_packets(page)   ==0, 
-  ogg_page_continued(page) !=0
+   If a page happens to be a single packet that was begun on a
+   previous page, and spans to the next page (in the case of a three or
+   more page packet), the return will be:
+     ogg_page_packets(page)   ==0,
+     ogg_page_continued(page) !=0
 */
 
 int ogg_page_packets(const ogg_page *og){
   int i,n=og->header[26],count=0;
   for(i=0;i<n;i++)
     if(og->header[27+i]<255)count++;
   return(count);
 }
@@ -200,43 +200,43 @@ int ogg_stream_init(ogg_stream_state *os
       return -1;
     }
 
     os->serialno=serialno;
 
     return(0);
   }
   return(-1);
-} 
+}
 
 /* async/delayed error detection for the ogg_stream_state */
 int ogg_stream_check(ogg_stream_state *os){
   if(!os || !os->body_data) return -1;
   return 0;
 }
 
 /* _clear does not free os, only the non-flat storage within */
 int ogg_stream_clear(ogg_stream_state *os){
   if(os){
     if(os->body_data)_ogg_free(os->body_data);
     if(os->lacing_vals)_ogg_free(os->lacing_vals);
     if(os->granule_vals)_ogg_free(os->granule_vals);
 
-    memset(os,0,sizeof(*os));    
+    memset(os,0,sizeof(*os));
   }
   return(0);
-} 
+}
 
 int ogg_stream_destroy(ogg_stream_state *os){
   if(os){
     ogg_stream_clear(os);
     _ogg_free(os);
   }
   return(0);
-} 
+}
 
 /* Helpers for ogg_stream_encode; this keeps the structure and
    what's happening fairly clear */
 
 static int _os_body_expand(ogg_stream_state *os,int needed){
   if(os->body_storage<=os->body_fill+needed){
     void *ret;
     ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)*
@@ -270,65 +270,65 @@ static int _os_lacing_expand(ogg_stream_
     os->granule_vals=ret;
     os->lacing_storage+=(needed+32);
   }
   return 0;
 }
 
 /* checksum the page */
 /* Direct table CRC; note that this will be faster in the future if we
-   perform the checksum silmultaneously with other copies */
+   perform the checksum simultaneously with other copies */
 
 void ogg_page_checksum_set(ogg_page *og){
   if(og){
     ogg_uint32_t crc_reg=0;
     int i;
 
     /* safety; needed for API behavior, but not framing code */
     og->header[22]=0;
     og->header[23]=0;
     og->header[24]=0;
     og->header[25]=0;
-    
+
     for(i=0;i<og->header_len;i++)
       crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
     for(i=0;i<og->body_len;i++)
       crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
-    
+
     og->header[22]=(unsigned char)(crc_reg&0xff);
     og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
     og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
     og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
   }
 }
 
 /* submit data to the internal buffer of the framing engine */
 int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
                        long e_o_s, ogg_int64_t granulepos){
 
   int bytes = 0, lacing_vals, i;
 
   if(ogg_stream_check(os)) return -1;
   if(!iov) return 0;
- 
+
   for (i = 0; i < count; ++i) bytes += (int)iov[i].iov_len;
   lacing_vals=bytes/255+1;
 
   if(os->body_returned){
     /* advance packet data according to the body_returned pointer. We
        had to keep it around to return a pointer into the buffer last
        call */
-    
+
     os->body_fill-=os->body_returned;
     if(os->body_fill)
       memmove(os->body_data,os->body_data+os->body_returned,
               os->body_fill);
     os->body_returned=0;
   }
- 
+
   /* make sure we have the buffer storage */
   if(_os_body_expand(os,bytes) || _os_lacing_expand(os,lacing_vals))
     return -1;
 
   /* Copy in the submitted packet.  Yes, the copy is a waste; this is
      the liability of overly clean abstraction for the time being.  It
      will actually be fairly easy to eliminate the extra copy in the
      future */
@@ -402,17 +402,17 @@ static int ogg_stream_flush_i(ogg_stream
           are large.
        These are not necessary behaviors, just 'always better than naive flushing'
        without requiring an application to explicitly request a specific optimized
        behavior. We'll want an explicit behavior setup pathway eventually as well. */
 
     int packets_done=0;
     int packet_just_done=0;
     for(vals=0;vals<maxvals;vals++){
-      if(acc>nfill && packet_just_done>=8){
+      if(acc>nfill && packet_just_done>=4){
         force=1;
         break;
       }
       acc+=os->lacing_vals[vals]&0x0ff;
       if((os->lacing_vals[vals]&0xff)<255){
         granule_pos=os->granule_vals[vals];
         packet_just_done=++packets_done;
       }else
@@ -462,43 +462,43 @@ static int ogg_stream_flush_i(ogg_stream
                                      plausible uses */
   {
     long pageno=os->pageno++;
     for(i=18;i<22;i++){
       os->header[i]=(unsigned char)(pageno&0xff);
       pageno>>=8;
     }
   }
-  
+
   /* zero for computation; filled in later */
   os->header[22]=0;
   os->header[23]=0;
   os->header[24]=0;
   os->header[25]=0;
-  
+
   /* segment table */
   os->header[26]=(unsigned char)(vals&0xff);
   for(i=0;i<vals;i++)
     bytes+=os->header[i+27]=(unsigned char)(os->lacing_vals[i]&0xff);
-  
+
   /* set pointers in the ogg_page struct */
   og->header=os->header;
   og->header_len=os->header_fill=vals+27;
   og->body=os->body_data+os->body_returned;
   og->body_len=bytes;
-  
+
   /* advance the lacing data and set the body_returned pointer */
-  
+
   os->lacing_fill-=vals;
   memmove(os->lacing_vals,os->lacing_vals+vals,os->lacing_fill*sizeof(*os->lacing_vals));
   memmove(os->granule_vals,os->granule_vals+vals,os->lacing_fill*sizeof(*os->granule_vals));
   os->body_returned+=bytes;
-  
+
   /* calculate the checksum */
-  
+
   ogg_page_checksum_set(og);
 
   /* done */
   return(1);
 }
 
 /* This will flush remaining packets into a page (returning nonzero),
    even if there is not enough data to trigger a flush normally
@@ -507,41 +507,49 @@ static int ogg_stream_flush_i(ogg_stream
    try to flush a normal sized page like ogg_stream_pageout; a call to
    ogg_stream_flush does not guarantee that all packets have flushed.
    Only a return value of 0 from ogg_stream_flush indicates all packet
    data is flushed into pages.
 
    since ogg_stream_flush will flush the last page in a stream even if
    it's undersized, you almost certainly want to use ogg_stream_pageout
    (and *not* ogg_stream_flush) unless you specifically need to flush
-   an page regardless of size in the middle of a stream. */
+   a page regardless of size in the middle of a stream. */
 
 int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
   return ogg_stream_flush_i(os,og,1,4096);
 }
 
+/* Like the above, but an argument is provided to adjust the nominal
+   page size for applications which are smart enough to provide their
+   own delay based flushing */
+
+int ogg_stream_flush_fill(ogg_stream_state *os,ogg_page *og, int nfill){
+  return ogg_stream_flush_i(os,og,1,nfill);
+}
+
 /* This constructs pages from buffered packet segments.  The pointers
 returned are to static buffers; do not free. The returned buffers are
 good only until the next call (using the same ogg_stream_state) */
 
 int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){
   int force=0;
   if(ogg_stream_check(os)) return 0;
 
   if((os->e_o_s&&os->lacing_fill) ||          /* 'were done, now flush' case */
      (os->lacing_fill&&!os->b_o_s))           /* 'initial header page' case */
     force=1;
 
   return(ogg_stream_flush_i(os,og,force,4096));
 }
 
-/* Like the above, but an argument is provided to adjust the nominal 
+/* Like the above, but an argument is provided to adjust the nominal
 page size for applications which are smart enough to provide their
 own delay based flushing */
-   
+
 int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill){
   int force=0;
   if(ogg_stream_check(os)) return 0;
 
   if((os->e_o_s&&os->lacing_fill) ||          /* 'were done, now flush' case */
      (os->lacing_fill&&!os->b_o_s))           /* 'initial header page' case */
     force=1;
 
@@ -640,73 +648,73 @@ int ogg_sync_wrote(ogg_sync_state *oy, l
 
 /* sync the stream.  This is meant to be useful for finding page
    boundaries.
 
    return values for this:
   -n) skipped n bytes
    0) page not ready; more data (no bytes skipped)
    n) page synced at current location; page length n bytes
-   
+
 */
 
 long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
   unsigned char *page=oy->data+oy->returned;
   unsigned char *next;
   long bytes=oy->fill-oy->returned;
 
   if(ogg_sync_check(oy))return 0;
-  
+
   if(oy->headerbytes==0){
     int headerbytes,i;
     if(bytes<27)return(0); /* not enough for a header */
-    
+
     /* verify capture pattern */
     if(memcmp(page,"OggS",4))goto sync_fail;
-    
+
     headerbytes=page[26]+27;
     if(bytes<headerbytes)return(0); /* not enough for header + seg table */
-    
+
     /* count up body length in the segment table */
-    
+
     for(i=0;i<page[26];i++)
       oy->bodybytes+=page[27+i];
     oy->headerbytes=headerbytes;
   }
-  
+
   if(oy->bodybytes+oy->headerbytes>bytes)return(0);
-  
+
   /* The whole test page is buffered.  Verify the checksum */
   {
     /* Grab the checksum bytes, set the header field to zero */
     char chksum[4];
     ogg_page log;
-    
+
     memcpy(chksum,page+22,4);
     memset(page+22,0,4);
-    
+
     /* set up a temp page struct and recompute the checksum */
     log.header=page;
     log.header_len=oy->headerbytes;
     log.body=page+oy->headerbytes;
     log.body_len=oy->bodybytes;
     ogg_page_checksum_set(&log);
-    
+
     /* Compare */
     if(memcmp(chksum,page+22,4)){
       /* D'oh.  Mismatch! Corrupt page (or miscapture and not a page
          at all) */
       /* replace the computed checksum with the one actually read in */
       memcpy(page+22,chksum,4);
-      
+
       /* Bad checksum. Lose sync */
       goto sync_fail;
     }
   }
-  
+
   /* yes, have a whole page all ready to go */
   {
     unsigned char *page=oy->data+oy->returned;
     long bytes;
 
     if(og){
       og->header=page;
       og->header_len=oy->headerbytes;
@@ -715,33 +723,33 @@ long ogg_sync_pageseek(ogg_sync_state *o
     }
 
     oy->unsynced=0;
     oy->returned+=(bytes=oy->headerbytes+oy->bodybytes);
     oy->headerbytes=0;
     oy->bodybytes=0;
     return(bytes);
   }
-  
+
  sync_fail:
-  
+
   oy->headerbytes=0;
   oy->bodybytes=0;
-  
+
   /* search for possible capture */
   next=memchr(page+1,'O',bytes-1);
   if(!next)
     next=oy->data+oy->fill;
 
   oy->returned=(int)(next-oy->data);
   return((long)-(next-page));
 }
 
 /* sync the stream and get a page.  Keep trying until we find a page.
-   Supress 'sync errors' after reporting the first.
+   Suppress 'sync errors' after reporting the first.
 
    return values:
    -1) recapture (hole in data)
     0) need more data
     1) page returned
 
    Returns pointers into buffered data; invalidated by next call to
    _stream, _clear, _init, or _buffer */
@@ -759,17 +767,17 @@ int ogg_sync_pageout(ogg_sync_state *oy,
     if(ret>0){
       /* have a page */
       return(1);
     }
     if(ret==0){
       /* need more data */
       return(0);
     }
-    
+
     /* head did not start a synced page... skipped some bytes */
     if(!oy->unsynced){
       oy->unsynced=1;
       return(-1);
     }
 
     /* loop. keep looking */
 
@@ -788,17 +796,17 @@ int ogg_stream_pagein(ogg_stream_state *
   int version=ogg_page_version(og);
   int continued=ogg_page_continued(og);
   int bos=ogg_page_bos(og);
   int eos=ogg_page_eos(og);
   ogg_int64_t granulepos=ogg_page_granulepos(og);
   int serialno=ogg_page_serialno(og);
   long pageno=ogg_page_pageno(og);
   int segments=header[26];
-  
+
   if(ogg_stream_check(os)) return -1;
 
   /* clean up 'returned data' */
   {
     long lr=os->lacing_returned;
     long br=os->body_returned;
 
     /* body data */
@@ -843,57 +851,57 @@ int ogg_stream_pagein(ogg_stream_state *
       os->lacing_vals[os->lacing_fill++]=0x400;
       os->lacing_packet++;
     }
   }
 
   /* are we a 'continued packet' page?  If so, we may need to skip
      some segments */
   if(continued){
-    if(os->lacing_fill<1 || 
+    if(os->lacing_fill<1 ||
        os->lacing_vals[os->lacing_fill-1]==0x400){
       bos=0;
       for(;segptr<segments;segptr++){
         int val=header[27+segptr];
         body+=val;
         bodysize-=val;
         if(val<255){
           segptr++;
           break;
         }
       }
     }
   }
-  
+
   if(bodysize){
     if(_os_body_expand(os,bodysize)) return -1;
     memcpy(os->body_data+os->body_fill,body,bodysize);
     os->body_fill+=bodysize;
   }
 
   {
     int saved=-1;
     while(segptr<segments){
       int val=header[27+segptr];
       os->lacing_vals[os->lacing_fill]=val;
       os->granule_vals[os->lacing_fill]=-1;
-      
+
       if(bos){
         os->lacing_vals[os->lacing_fill]|=0x100;
         bos=0;
       }
-      
+
       if(val<255)saved=os->lacing_fill;
-      
+
       os->lacing_fill++;
       segptr++;
-      
+
       if(val<255)os->lacing_packet=os->lacing_fill;
     }
-  
+
     /* set the granulepos on the last granuleval of the last full packet */
     if(saved!=-1){
       os->granule_vals[saved]=granulepos;
     }
 
   }
 
   if(eos){
@@ -1246,29 +1254,28 @@ const int head3_4[] = {0x4f,0x67,0x67,0x
 const int head1_4b[] = {0x4f,0x67,0x67,0x53,0,0x02,
                         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                         0x01,0x02,0x03,0x04,0,0,0,0,
                         0xff,0x7b,0x23,0x17,
                         1,
                         0};
 
 const int head2_4b[] = {0x4f,0x67,0x67,0x53,0,0x00,
-                        0x07,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
+                        0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
                         0x01,0x02,0x03,0x04,1,0,0,0,
-                        0xe6,0x54,0xfe,0x7d,
-                        27,
+                        0xce,0x8f,0x17,0x1a,
+                        23,
                         255,255,255,255,255,255,255,255,
-                        255,255,255,255,255,255,255,255,
-                        255,10,255,4,255,0,0,0,0,0,0};
+                        255,255,255,255,255,255,255,255,255,10,255,4,255,0,0};
 
 
 const int head3_4b[] = {0x4f,0x67,0x67,0x53,0,0x04,
-                        0x07,0x24,0x00,0x00,0x00,0x00,0x00,0x00,
+                        0x07,0x14,0x00,0x00,0x00,0x00,0x00,0x00,
                         0x01,0x02,0x03,0x04,2,0,0,0,
-                        0x77,0x62,0xe0,0x12,
+                        0x9b,0xb2,0x50,0xa1,
                         1,
                         0};
 
 /* page with the 255 segment limit */
 const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
                        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                        0x01,0x02,0x03,0x04,0,0,0,0,
                        0xff,0x7b,0x23,0x17,
@@ -1489,33 +1496,33 @@ void test_pack(const int *pl, const int 
     depacket+=pl[packets];
 
   for(packets=0;;packets++)if(pl[packets]==-1)break;
 
   for(i=0;i<packets;i++){
     /* construct a test packet */
     ogg_packet op;
     int len=pl[i];
-    
+
     op.packet=data+inptr;
     op.bytes=len;
     op.e_o_s=(pl[i+1]<0?1:0);
     op.granulepos=granule_pos;
 
     granule_pos+=1024;
 
     for(j=0;j<len;j++)data[inptr++]=i+j;
 
     /* submit the test packet */
     ogg_stream_packetin(&os_en,&op);
 
     /* retrieve any finished pages */
     {
       ogg_page og;
-      
+
       while(ogg_stream_pageout(&os_en,&og)){
         /* We have a page.  Check it carefully */
 
         fprintf(stderr,"%ld, ",pageno);
 
         if(headers[pageno]==NULL){
           fprintf(stderr,"coded too many pages!\n");
           exit(1);
@@ -1554,31 +1561,31 @@ void test_pack(const int *pl, const int 
 
           ogg_sync_wrote(&oy,next-buf);
 
           while(1){
             int ret=ogg_sync_pageout(&oy,&og_de);
             if(ret==0)break;
             if(ret<0)continue;
             /* got a page.  Happy happy.  Verify that it's good. */
-            
+
             fprintf(stderr,"(%d), ",pageout);
 
             check_page(data+deptr,headers[pageout],&og_de);
             deptr+=og_de.body_len;
             pageout++;
 
             /* submit it to deconstitution */
             ogg_stream_pagein(&os_de,&og_de);
 
             /* packets out? */
             while(ogg_stream_packetpeek(&os_de,&op_de2)>0){
               ogg_stream_packetpeek(&os_de,NULL);
               ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
-              
+
               /* verify peek and out match */
               if(memcmp(&op_de,&op_de2,sizeof(op_de))){
                 fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
                         depacket);
                 exit(1);
               }
 
               /* verify the packet! */
@@ -1594,17 +1601,17 @@ void test_pack(const int *pl, const int 
                 exit(1);
               }
               if(bosflag && op_de.b_o_s){
                 fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
                 exit(1);
               }
               bosflag=1;
               depacket+=op_de.bytes;
-              
+
               /* check eos flag */
               if(eosflag){
                 fprintf(stderr,"Multiple decoded packets with eos flag!\n");
                 exit(1);
               }
 
               if(op_de.e_o_s)eosflag=1;
 
@@ -1698,17 +1705,17 @@ int main(void){
     const int *headret[]={head1_4,head2_4,head3_4,NULL};
 
     fprintf(stderr,"testing single packet page span... ");
     test_pack(packets,headret,0,0,0);
   }
 
   {
     /* spill expand packet test */
-    const int packets[]={0,4345,259,255,0,0,0,0,0,0,-1};
+    const int packets[]={0,4345,259,255,0,0,-1};
     const int *headret[]={head1_4b,head2_4b,head3_4b,NULL};
 
     fprintf(stderr,"testing page spill expansion... ");
     test_pack(packets,headret,0,0,0);
   }
 
   /* page with the 255 segment limit */
   {
@@ -1741,64 +1748,64 @@ int main(void){
                    10,10,10,10,10,10,10,10,
                    10,10,10,10,10,10,10,10,
                    10,10,10,10,10,10,10,10,
                    10,10,10,10,10,10,10,10,
                    10,10,10,10,10,10,10,10,
                    10,10,10,10,10,10,10,10,
                    10,10,10,10,10,10,10,50,-1};
     const int *headret[]={head1_5,head2_5,head3_5,NULL};
-    
+
     fprintf(stderr,"testing max packet segments... ");
     test_pack(packets,headret,0,0,0);
   }
 
   {
     /* packet that overspans over an entire page */
     const int packets[]={0,100,130049,259,255,-1};
     const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
-    
+
     fprintf(stderr,"testing very large packets... ");
     test_pack(packets,headret,0,0,0);
   }
 
   {
     /* test for the libogg 1.1.1 resync in large continuation bug
        found by Josh Coalson)  */
     const int packets[]={0,100,130049,259,255,-1};
     const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
-    
+
     fprintf(stderr,"testing continuation resync in very large packets... ");
     test_pack(packets,headret,100,2,3);
   }
 
   {
     /* term only page.  why not? */
     const int packets[]={0,100,64770,-1};
     const int *headret[]={head1_7,head2_7,head3_7,NULL};
-    
+
     fprintf(stderr,"testing zero data page (1 nil packet)... ");
     test_pack(packets,headret,0,0,0);
   }
 
 
 
   {
     /* build a bunch of pages for testing */
     unsigned char *data=_ogg_malloc(1024*1024);
-    int pl[]={0, 0,0,0,0,1,1,98,4079, 0,0,0,0,1,1,2954,2057, 0,0,0,0,76,34,912,0,234,1000,1000, 1000,300,-1};
+    int pl[]={0, 1,1,98,4079, 1,1,2954,2057, 76,34,912,0,234,1000,1000, 1000,300,-1};
     int inptr=0,i,j;
     ogg_page og[5];
-    
+
     ogg_stream_reset(&os_en);
 
     for(i=0;pl[i]!=-1;i++){
       ogg_packet op;
       int len=pl[i];
-      
+
       op.packet=data+inptr;
       op.bytes=len;
       op.e_o_s=(pl[i+1]<0?1:0);
       op.granulepos=(i+1)*1000;
 
       for(j=0;j<len;j++)data[inptr++]=i+j;
       ogg_stream_packetin(&os_en,&op);
     }
@@ -1836,51 +1843,35 @@ int main(void){
       ogg_sync_pageout(&oy,&temp);
       ogg_stream_pagein(&os_de,&temp);
       ogg_sync_pageout(&oy,&temp);
       /* skip */
       ogg_sync_pageout(&oy,&temp);
       ogg_stream_pagein(&os_de,&temp);
 
       /* do we get the expected results/packets? */
-      
+
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,0,0,0);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,1,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,2,-1);
+      checkpacket(&test,1,1,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,3,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,4,-1);
+      checkpacket(&test,1,2,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,1,5,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,1,6,-1);
+      checkpacket(&test,98,3,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,98,7,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,4079,8,9000);
+      checkpacket(&test,4079,4,5000);
       if(ogg_stream_packetout(&os_de,&test)!=-1){
         fprintf(stderr,"Error: loss of page did not return error\n");
         exit(1);
       }
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,17,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,18,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,19,-1);
+      checkpacket(&test,76,9,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,20,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,76,21,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,34,22,-1);
+      checkpacket(&test,34,10,-1);
       fprintf(stderr,"ok.\n");
     }
 
     /* Test lost pages on pagein/packetout: rollback with continuation */
     {
       ogg_page temp;
       ogg_packet test;
 
@@ -1907,53 +1898,37 @@ int main(void){
       ogg_sync_pageout(&oy,&temp);
       ogg_stream_pagein(&os_de,&temp);
 
       /* do we get the expected results/packets? */
 
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,0,0,0);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,1,-1);
+      checkpacket(&test,1,1,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,2,-1);
+      checkpacket(&test,1,2,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,3,-1);
+      checkpacket(&test,98,3,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,4,-1);
+      checkpacket(&test,4079,4,5000);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,1,5,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,1,6,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,98,7,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,4079,8,9000);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,9,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,10,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,11,-1);
+      checkpacket(&test,2954,7,-1);
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,0,12,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,1,13,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,1,14,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,2954,15,-1);
-      if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,2057,16,17000);
+      checkpacket(&test,2057,8,9000);
       if(ogg_stream_packetout(&os_de,&test)!=-1){
         fprintf(stderr,"Error: loss of page did not return error\n");
         exit(1);
       }
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
-      checkpacket(&test,300,29,30000);
+      checkpacket(&test,300,17,18000);
       fprintf(stderr,"ok.\n");
     }
 
     /* the rest only test sync */
     {
       ogg_page og_de;
       /* Test fractional page inputs: incomplete capture */
       fprintf(stderr,"Testing sync on partial inputs... ");
@@ -2019,23 +1994,23 @@ int main(void){
       ogg_sync_wrote(&oy,og[1].header_len-20);
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
              og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
 
       fprintf(stderr,"ok.\n");
     }
-    
+
     /* Test recapture: garbage + page */
     {
       ogg_page og_de;
       fprintf(stderr,"Testing search for capture... ");
-      ogg_sync_reset(&oy); 
-      
+      ogg_sync_reset(&oy);
+
       /* 'garbage' */
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
              og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
              og[1].header_len);
       ogg_sync_wrote(&oy,og[1].header_len);
@@ -2061,17 +2036,17 @@ int main(void){
 
       fprintf(stderr,"ok.\n");
     }
 
     /* Test recapture: page + garbage + page */
     {
       ogg_page og_de;
       fprintf(stderr,"Testing recapture... ");
-      ogg_sync_reset(&oy); 
+      ogg_sync_reset(&oy);
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
              og[1].header_len);
       ogg_sync_wrote(&oy,og[1].header_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
              og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
@@ -2105,18 +2080,14 @@ int main(void){
     }
 
     /* Free page data that was previously copied */
     {
       for(i=0;i<5;i++){
         free_page(&og[i]);
       }
     }
-  }    
+  }
 
   return(0);
 }
 
 #endif
-
-
-
-
--- a/media/libogg/update.sh
+++ b/media/libogg/update.sh
@@ -6,9 +6,9 @@ cp $1/include/ogg/config_types.h ./inclu
 cp $1/include/ogg/ogg.h ./include/ogg/ogg.h
 cp $1/include/ogg/os_types.h ./include/ogg/os_types.h
 cp $1/CHANGES ./CHANGES
 cp $1/COPYING ./COPYING
 cp $1/README ./README
 cp $1/src/bitwise.c ./src/ogg_bitwise.c
 cp $1/src/framing.c ./src/ogg_framing.c
 cp $1/AUTHORS ./AUTHORS
-patch -p0 < int-types.patch
+patch -p0 < solaris-types.patch