[vlc-commits] demux: ogg: correctly handle speex headers (fix #1197)

Francois Cartegnie git at videolan.org
Fri Oct 11 12:33:01 CEST 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 11 12:25:41 2013 +0200| [407651b13cdd23027b53f56ed9aea6e0c5132e9d] | committer: Francois Cartegnie

demux: ogg: correctly handle speex headers (fix #1197)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=407651b13cdd23027b53f56ed9aea6e0c5132e9d
---

 modules/demux/ogg.c |   11 ++++++++++-
 modules/demux/ogg.h |    1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index d6ced62..2b440b0 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -760,13 +760,18 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         switch( p_stream->fmt.i_codec )
         {
         case VLC_CODEC_VORBIS:
-        case VLC_CODEC_SPEEX:
         case VLC_CODEC_THEORA:
             if( p_stream->i_packets_backup == 3 )
                 p_stream->b_force_backup = false;
             b_xiph = true;
             break;
 
+        case VLC_CODEC_SPEEX:
+            if( p_stream->i_packets_backup == 2 + p_stream->i_extra_headers_packets )
+                p_stream->b_force_backup = false;
+            b_xiph = true;
+            break;
+
         case VLC_CODEC_OPUS:
             if( p_stream->i_packets_backup == 2 )
                 p_stream->b_force_backup = false;
@@ -2098,6 +2103,10 @@ static void Ogg_ReadSpeexHeader( logical_stream_t *p_stream,
     p_stream->fmt.audio.i_channels = oggpack_read( &opb, 32 );
     fill_channels_info(&p_stream->fmt.audio);
     p_stream->fmt.i_bitrate = oggpack_read( &opb, 32 );
+    oggpack_adv( &opb, 32 ); /* frame_size */
+    oggpack_adv( &opb, 32 ); /* vbr */
+    oggpack_adv( &opb, 32 ); /* frames_per_packet */
+    p_stream->i_extra_headers_packets = oggpack_read( &opb, 32 ); /* extra_headers */
 }
 
 static void Ogg_ReadOpusHeader( demux_t *p_demux,
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index 606282c..dc086c9 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -44,6 +44,7 @@ typedef struct logical_stream_s
      * them to the decoder. */
     bool             b_force_backup;
     int              i_packets_backup;
+    int32_t          i_extra_headers_packets;
     void             *p_headers;
     int              i_headers;
     ogg_int64_t      i_previous_granulepos;



More information about the vlc-commits mailing list