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

Francois Cartegnie git at videolan.org
Fri Oct 11 13:52:36 CEST 2013


vlc/vlc-2.1 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 11 12:25:41 2013 +0200| [bcf689bcf5186f2c4c2ba64c67c1c41710a5b09b] | committer: Jean-Baptiste Kempf

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

(cherry picked from commit 407651b13cdd23027b53f56ed9aea6e0c5132e9d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 c07394f..967438d 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -742,13 +742,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;
@@ -2057,6 +2062,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 cc3e54c..4b525ff 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