[vlc-commits] demux: ogg: fix regressions with the es_format mess

Francois Cartegnie git at videolan.org
Fri Jul 28 10:00:21 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 27 22:02:21 2017 +0200| [59133450fd56ab23285797b56acd5d2e4ffc677c] | committer: Francois Cartegnie

demux: ogg: fix regressions with the es_format mess

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

 modules/demux/ogg.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 1516283eb3..3ca3ac0dd1 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -500,6 +500,7 @@ static int Demux( demux_t * p_demux )
                         oggpacket.bytes >= 7 &&
                         ! memcmp( oggpacket.packet, "\x01vorbis", 7 ) )
                 {
+                    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_VORBIS );
                     Ogg_ReadVorbisHeader( p_stream, &oggpacket );
                     p_stream->i_secondary_header_packets = 0;
                 }
@@ -1571,6 +1572,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 if( oggpacket.bytes >= 7 &&
                     ! memcmp( oggpacket.packet, "\x01vorbis", 7 ) )
                 {
+                    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_VORBIS);
                     if ( Ogg_ReadVorbisHeader( p_stream, &oggpacket ) )
                         msg_Dbg( p_demux, "found vorbis header" );
                     else
@@ -1585,6 +1587,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 else if( oggpacket.bytes >= 5 &&
                     ! memcmp( oggpacket.packet, "Speex", 5 ) )
                 {
+                    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_SPEEX );
                     if ( Ogg_ReadSpeexHeader( p_stream, &oggpacket ) )
                         msg_Dbg( p_demux, "found speex header, channels: %i, "
                                 "rate: %i,  bitrate: %i, frames: %i group %i",
@@ -1604,6 +1607,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 else if( oggpacket.bytes >= 8 &&
                     ! memcmp( oggpacket.packet, "OpusHead", 8 ) )
                 {
+                    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_OPUS );
                     Ogg_ReadOpusHeader( p_stream, &oggpacket );
                     msg_Dbg( p_demux, "found opus header, channels: %i, "
                              "pre-skip: %i",
@@ -1656,6 +1660,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 else if( oggpacket.bytes >= 7 &&
                          ! memcmp( oggpacket.packet, "\x80theora", 7 ) )
                 {
+                    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_THEORA );
                     if ( Ogg_ReadTheoraHeader( p_stream, &oggpacket ) )
                         msg_Dbg( p_demux,
                                  "found theora header, bitrate: %i, rate: %f",
@@ -1672,6 +1677,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 else if( oggpacket.bytes >= 6 &&
                          ! memcmp( oggpacket.packet, "\x80""daala", 6 ) )
                 {
+                    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_DAALA );
                     if ( Ogg_ReadDaalaHeader( p_stream, &oggpacket ) )
                         msg_Dbg( p_demux,
                                  "found daala header, bitrate: %i, rate: %f",
@@ -1690,6 +1696,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                          ( oggpacket.bytes >= 9 &&
                            ! memcmp( oggpacket.packet, "KW-DIRAC\x00", 9 ) ) )
                 {
+                    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_DIRAC );
                     if( Ogg_ReadDiracHeader( p_stream, &oggpacket ) )
                         msg_Dbg( p_demux, "found dirac header" );
                     else
@@ -1723,6 +1730,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 else if( oggpacket.bytes >= 26 &&
                          ! memcmp( oggpacket.packet, "OVP80", 5 ) )
                 {
+                    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_VP8 );
                     if ( Ogg_ReadVP8Header( p_demux, p_stream, &oggpacket ) )
                         msg_Dbg( p_demux, "found VP8 header "
                              "fps: %f, width:%i; height:%i",
@@ -1756,6 +1764,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 else if( oggpacket.bytes >= 8 &&
                     ! memcmp( &oggpacket.packet[1], "kate\0\0\0", 7 ) )
                 {
+                    es_format_Change( &p_stream->fmt, SPU_ES, VLC_CODEC_KATE );
                     if ( Ogg_ReadKateHeader( p_stream, &oggpacket ) )
                         msg_Dbg( p_demux, "found kate header" );
                     else
@@ -2564,8 +2573,6 @@ static bool Ogg_ReadTheoraHeader( logical_stream_t *p_stream,
     int i_subminor;
     int i_version;
 
-    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_THEORA );
-
     /* Signal that we want to keep a backup of the theora
      * stream headers. They will be used when switching between
      * audio streams. */
@@ -2634,8 +2641,6 @@ static bool Ogg_ReadDaalaHeader( logical_stream_t *p_stream,
     uint8_t i_subminor;
     int i_version;
 
-    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_DAALA );
-
     /* Signal that we want to keep a backup of the daala
      * stream headers. They will be used when switching between
      * audio streams. */
@@ -2689,8 +2694,6 @@ static bool Ogg_ReadVorbisHeader( logical_stream_t *p_stream,
 {
     oggpack_buffer opb;
 
-    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_VORBIS );
-
     /* Signal that we want to keep a backup of the vorbis
      * stream headers. They will be used when switching between
      * audio streams. */
@@ -2750,8 +2753,6 @@ static bool Ogg_ReadSpeexHeader( logical_stream_t *p_stream,
 {
     oggpack_buffer opb;
 
-    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_SPEEX );
-
     /* Signal that we want to keep a backup of the speex
      * stream headers. They will be used when switching between
      * audio streams. */
@@ -2783,8 +2784,6 @@ static void Ogg_ReadOpusHeader( logical_stream_t *p_stream,
 {
     oggpack_buffer opb;
 
-    es_format_Change( &p_stream->fmt, AUDIO_ES, VLC_CODEC_OPUS );
-
     /* Signal that we want to keep a backup of the opus
      * stream headers. They will be used when switching between
      * audio streams. */
@@ -2855,8 +2854,6 @@ static bool Ogg_ReadKateHeader( logical_stream_t *p_stream,
     int n;
     char *psz_desc;
 
-    es_format_Change( &p_stream->fmt, SPU_ES, VLC_CODEC_KATE );
-
     /* Signal that we want to keep a backup of the kate
      * stream headers. They will be used when switching between
      * kate streams. */
@@ -2921,7 +2918,6 @@ static bool Ogg_ReadVP8Header( demux_t *p_demux, logical_stream_t *p_stream,
         /* Mapping version */
         if ( p_oggpacket->packet[6] != 0x01 || p_oggpacket->packet[7] != 0x00 )
             return false;
-        es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_VP8 );
         p_stream->i_granule_shift = 32;
         p_stream->fmt.video.i_width = GetWBE( &p_oggpacket->packet[8] );
         p_stream->fmt.video.i_height = GetWBE( &p_oggpacket->packet[10] );
@@ -2949,6 +2945,9 @@ static bool Ogg_ReadVP8Header( demux_t *p_demux, logical_stream_t *p_stream,
 static void Ogg_ApplyContentType( logical_stream_t *p_stream, const char* psz_value,
                                   bool *b_force_backup, bool *b_packet_out )
 {
+    if( p_stream->fmt.i_cat != UNKNOWN_ES )
+        return;
+
     if( !strncmp(psz_value, "audio/x-wav", 11) )
     {
         /* n.b. WAVs are unsupported right now */
@@ -3404,9 +3403,6 @@ static bool Ogg_ReadDiracHeader( logical_stream_t *p_stream,
     p_stream->f_rate = (float) u_n / u_d;
     if ( p_stream->f_rate == 0 ) return false;
 
-    /* probably is an ogg dirac es */
-    es_format_Change( &p_stream->fmt, VIDEO_ES, VLC_CODEC_DIRAC );
-
     return true;
 }
 



More information about the vlc-commits mailing list