[vlc-commits] ogg: prepare for void *p_sys

Rémi Denis-Courmont git at videolan.org
Sun Dec 3 16:57:56 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec  3 17:05:50 2017 +0200| [4c422d897c1dc748b5b41326dbcc36fc506e798e] | committer: Rémi Denis-Courmont

ogg: prepare for void *p_sys

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

 modules/demux/ogg.c     | 44 ++++++++++++++++++++++++++------------------
 modules/demux/oggseek.c |  3 ++-
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 30a74196f0..ed658ebcdc 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1201,6 +1201,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
                               logical_stream_t *p_stream,
                               ogg_packet *p_oggpacket )
 {
+    demux_sys_t *p_sys = p_demux->p_sys;
     block_t *p_block;
     bool b_selected;
     int i_header_len = 0;
@@ -1394,7 +1395,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         {
             if( p_stream->i_skip_frames >= p_block->i_nb_samples )
             {
-                if( p_demux->p_sys->i_nzpcr_offset == 0 ) /* not on chained streams */
+                if( p_sys->i_nzpcr_offset == 0 ) /* not on chained streams */
                     p_block->i_flags |= BLOCK_FLAG_PREROLL;
                 p_stream->i_skip_frames -= p_block->i_nb_samples;
                 p_block->i_nb_samples = 0;
@@ -1407,7 +1408,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         }
         else
         {
-            if( p_demux->p_sys->i_nzpcr_offset == 0 ) /* not on chained streams */
+            if( p_sys->i_nzpcr_offset == 0 ) /* not on chained streams */
                 p_block->i_flags |= BLOCK_FLAG_PREROLL;
             p_stream->i_skip_frames--;
         }
@@ -2291,6 +2292,8 @@ static void Ogg_CleanSpecificData( logical_stream_t *p_stream )
  */
 static void Ogg_LogicalStreamDelete( demux_t *p_demux, logical_stream_t *p_stream )
 {
+    demux_sys_t *p_sys = p_demux->p_sys;
+
     if( p_stream->p_es )
         es_out_Del( p_demux->out, p_stream->p_es );
 
@@ -2309,8 +2312,8 @@ static void Ogg_LogicalStreamDelete( demux_t *p_demux, logical_stream_t *p_strea
 
     Ogg_FreeSkeleton( p_stream->p_skel );
     p_stream->p_skel = NULL;
-    if ( p_demux->p_sys->p_skelstream == p_stream )
-        p_demux->p_sys->p_skelstream = NULL;
+    if( p_sys->p_skelstream == p_stream )
+        p_sys->p_skelstream = NULL;
 
     /* Shouldn't happen */
     if ( unlikely( p_stream->p_preparse_block ) )
@@ -3114,29 +3117,32 @@ static void Ogg_ReadAnnodexHeader( demux_t *p_demux,
 static void Ogg_ReadSkeletonHeader( demux_t *p_demux, logical_stream_t *p_stream,
                                     ogg_packet *p_oggpacket )
 {
-    p_demux->p_sys->p_skelstream = p_stream;
+    demux_sys_t *p_sys = p_demux->p_sys;
+
+    p_sys->p_skelstream = p_stream;
     /* There can be only 1 skeleton for streams */
-    p_demux->p_sys->skeleton.major = GetWLE( &p_oggpacket->packet[8] );
-    p_demux->p_sys->skeleton.minor = GetWLE( &p_oggpacket->packet[10] );
+    p_sys->skeleton.major = GetWLE( &p_oggpacket->packet[8] );
+    p_sys->skeleton.minor = GetWLE( &p_oggpacket->packet[10] );
     if ( asprintf( & p_stream->fmt.psz_description,
-                        "OGG Skeleton version %" PRIu16 ".%" PRIu16,
-                        p_demux->p_sys->skeleton.major,
-                        p_demux->p_sys->skeleton.minor ) < 0 )
+                   "OGG Skeleton version %" PRIu16 ".%" PRIu16,
+                   p_sys->skeleton.major, p_sys->skeleton.minor ) < 0 )
         p_stream->fmt.psz_description = NULL;
 }
 
 static void Ogg_ReadSkeletonBones( demux_t *p_demux, ogg_packet *p_oggpacket )
 {
-    if ( p_demux->p_sys->skeleton.major < 3 || p_oggpacket->bytes < 52 ) return;
+    demux_sys_t *p_sys = p_demux->p_sys;
+
+    if ( p_sys->skeleton.major < 3 || p_oggpacket->bytes < 52 ) return;
 
     /* Find the matching stream for this skeleton data */
     ogg_int32_t i_serialno = GetDWLE( &p_oggpacket->packet[12] );
     logical_stream_t *p_target_stream = NULL;
-    for ( int i=0; i< p_demux->p_sys->i_streams; i++ )
+    for ( int i=0; i< p_sys->i_streams; i++ )
     {
-        if ( p_demux->p_sys->pp_stream[i]->i_serial_no == i_serialno )
+        if ( p_sys->pp_stream[i]->i_serial_no == i_serialno )
         {
-            p_target_stream = p_demux->p_sys->pp_stream[i];
+            p_target_stream = p_sys->pp_stream[i];
             break;
         }
     }
@@ -3196,18 +3202,20 @@ unsigned const char * Read7BitsVariableLE( unsigned const char *p_begin,
 
 static void Ogg_ReadSkeletonIndex( demux_t *p_demux, ogg_packet *p_oggpacket )
 {
-    if ( p_demux->p_sys->skeleton.major < 4
+    demux_sys_t *p_sys = p_demux->p_sys;
+
+    if( p_sys->skeleton.major < 4
          || p_oggpacket->bytes < 44 /* Need at least 1 index value (42+1+1) */
     ) return;
 
     /* Find the matching stream for this skeleton data */
     int32_t i_serialno = GetDWLE( &p_oggpacket->packet[6] );
     logical_stream_t *p_stream = NULL;
-    for ( int i=0; i< p_demux->p_sys->i_streams; i++ )
+    for ( int i=0; i< p_sys->i_streams; i++ )
     {
-        if ( p_demux->p_sys->pp_stream[i]->i_serial_no == i_serialno )
+        if( p_sys->pp_stream[i]->i_serial_no == i_serialno )
         {
-            p_stream = p_demux->p_sys->pp_stream[i];
+            p_stream = p_sys->pp_stream[i];
             break;
         }
     }
diff --git a/modules/demux/oggseek.c b/modules/demux/oggseek.c
index dec482f8fd..ecb4c01087 100644
--- a/modules/demux/oggseek.c
+++ b/modules/demux/oggseek.c
@@ -947,6 +947,7 @@ int Oggseek_BlindSeektoAbsoluteTime( demux_t *p_demux, logical_stream_t *p_strea
 int Oggseek_BlindSeektoPosition( demux_t *p_demux, logical_stream_t *p_stream,
                                  double f, bool b_canfastseek )
 {
+    demux_sys_t *p_sys = p_demux->p_sys;
     OggDebug( msg_Dbg( p_demux, "=================== Seeking To Blind Pos" ) );
     int64_t i_size = stream_Size( p_demux->s );
     int64_t i_granule;
@@ -967,7 +968,7 @@ int Oggseek_BlindSeektoPosition( demux_t *p_demux, logical_stream_t *p_stream,
          * final seek time */
         i_pagepos = OggBackwardSeekToFrame( p_demux,
                 __MAX ( i_size - MAX_PAGE_SIZE, p_stream->i_data_start ),
-                __MIN ( i_size + MAX_PAGE_SIZE, p_demux->p_sys->i_total_length ),
+                __MIN ( i_size + MAX_PAGE_SIZE, p_sys->i_total_length ),
                 p_stream, i_granule );
     }
     else



More information about the vlc-commits mailing list