[vlc-commits] demux: ogg: fix dirac handling

Francois Cartegnie git at videolan.org
Fri Dec 15 16:44:22 CET 2017


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 14 18:53:35 2017 +0100| [f7df27f5174c4e58551436a5e0bd3c1800234d73] | committer: Francois Cartegnie

demux: ogg: fix dirac handling

(cherry picked from commit 824556bd31ca5f501e7362908eed2815b5526800)

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

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

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index b9844a2c19..775e51b69a 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1408,10 +1408,24 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     }
 
     /* Conditional block fixes */
-    if ( p_stream->fmt.i_cat == VIDEO_ES &&
-         Ogg_IsKeyFrame( p_stream, p_oggpacket ) )
+    if ( p_stream->fmt.i_cat == VIDEO_ES )
     {
-         p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+        if( Ogg_IsKeyFrame( p_stream, p_oggpacket ) )
+            p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+
+        if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
+        {
+            ogg_int64_t nzdts = Oggseek_GranuleToAbsTimestamp( p_stream, p_oggpacket->granulepos, false );
+            ogg_int64_t nzpts = Oggseek_GranuleToAbsTimestamp( p_stream, p_oggpacket->granulepos, true );
+            p_block->i_dts = ( nzdts > VLC_TS_INVALID ) ? VLC_TS_0 + nzdts : nzdts;
+            p_block->i_pts = ( nzpts > VLC_TS_INVALID ) ? VLC_TS_0 + nzpts : nzpts;
+            /* granulepos for dirac is possibly broken, this value should be ignored */
+            if( 0 >= p_oggpacket->granulepos )
+            {
+                p_block->i_pts = VLC_TS_INVALID;
+                p_block->i_dts = p_stream->i_pcr;
+            }
+        }
     }
     else if( p_stream->fmt.i_cat == AUDIO_ES )
     {
@@ -1434,19 +1448,6 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     {
         p_block->i_length = 0;
     }
-    else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
-    {
-        ogg_int64_t nzdts = Oggseek_GranuleToAbsTimestamp( p_stream, p_oggpacket->granulepos, false );
-        ogg_int64_t nzpts = Oggseek_GranuleToAbsTimestamp( p_stream, p_oggpacket->granulepos, true );
-        p_block->i_dts = ( nzdts > VLC_TS_INVALID ) ? VLC_TS_0 + nzdts : nzdts;
-        p_block->i_pts = ( nzpts > VLC_TS_INVALID ) ? VLC_TS_0 + nzpts : nzpts;
-        /* granulepos for dirac is possibly broken, this value should be ignored */
-        if( 0 >= p_oggpacket->granulepos )
-        {
-            p_block->i_pts = VLC_TS_INVALID;
-            p_block->i_dts = p_stream->i_pcr;
-        }
-    }
 
     if( p_stream->fmt.i_codec != VLC_CODEC_VORBIS &&
         p_stream->fmt.i_codec != VLC_CODEC_SPEEX &&



More information about the vlc-commits mailing list