[vlc-commits] demux:mkv: remove useless wrapping

Steve Lhomme git at videolan.org
Wed Jan 24 10:18:27 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 19 11:32:09 2018 +0100| [7e2f3e497a385d9064e5b4927025e7349c677d81] | committer: Jean-Baptiste Kempf

demux:mkv: remove useless wrapping

It's converted to void* anyway

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/dispatcher.hpp             |  3 ---
 modules/demux/mkv/matroska_segment.cpp       |  4 +--
 modules/demux/mkv/matroska_segment_parse.cpp | 37 +++++++++++++---------------
 3 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/modules/demux/mkv/dispatcher.hpp b/modules/demux/mkv/dispatcher.hpp
index 9b4e3e696b..561c62160f 100644
--- a/modules/demux/mkv/dispatcher.hpp
+++ b/modules/demux/mkv/dispatcher.hpp
@@ -94,9 +94,6 @@ namespace {
       typedef      PayloadType_ payload_t;                         \
       typedef     DispatchType_ dispatch_t;                        \
       typedef struct GroupName_ handler_t;                         \
-      static void* Payload (payload_t& data) {                     \
-          return static_cast<void*> (&data);                       \
-      }                                                            \
   };                                                               \
   struct GroupName_ : GroupName_ ## _base
 
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index bd2fd7e7be..526d793eca 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -511,7 +511,7 @@ bool matroska_segment_c::PreloadClusters(uint64 i_cluster_pos)
             if( el == NULL )
                 break;
 
-            ClusterHandler::Dispatcher().send( el, ClusterHandler::Payload( payload ) );
+            ClusterHandler::Dispatcher().send( el, &payload );
         }
     }
 
@@ -1404,7 +1404,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
                 case 1:
                     {
                         EbmlTypeDispatcher const * dispatcher = dispatchers[i_level - 1];
-                        dispatcher->send( el, BlockGetHandler_l1::Payload( payload ) );
+                        dispatcher->send( el, &payload );
                     }
                     break;
 
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 32aee93680..f1bc27810a 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -411,7 +411,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             }
 
             vars.level += 1;
-            dispatcher.iterate( cencs.begin(), cencs.end(), Payload( vars ) );
+            dispatcher.iterate( cencs.begin(), cencs.end(), &vars );
             vars.level -= 1;
         }
         E_CASE( KaxContentEncoding, cenc )
@@ -419,7 +419,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             debug( vars, "Content Encoding" );
 
             vars.level += 1;
-            dispatcher.iterate( cenc.begin(), cenc.end(), Payload( vars ) );
+            dispatcher.iterate( cenc.begin(), cenc.end(), &vars );
             vars.level -= 1;
         }
         E_CASE( KaxContentEncodingOrder, encord )
@@ -442,7 +442,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             vars.tk->i_compression_type = MATROSKA_COMPRESSION_ZLIB;
 
             vars.level += 1;
-            dispatcher.iterate( compr.begin(), compr.end(), Payload( vars ) );
+            dispatcher.iterate( compr.begin(), compr.end(), &vars );
             vars.level -= 1;
         }
         E_CASE( KaxContentCompAlgo, compalg )
@@ -478,7 +478,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             }
 
             vars.level += 1;
-            dispatcher.iterate (tkv.begin (), tkv.end (), Payload( vars ) );
+            dispatcher.iterate (tkv.begin (), tkv.end (), &vars );
             vars.level -= 1;
 
             unsigned int i_crop_top    = vars.track_video_info.i_crop_top;
@@ -516,7 +516,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             debug( vars, "Track Video Projection" ) ;
 
             vars.level += 1;
-            dispatcher.iterate (proj.begin (), proj.end (), Payload( vars ) );
+            dispatcher.iterate (proj.begin (), proj.end (), &vars );
             vars.level -= 1;
         }
         E_CASE( KaxVideoProjectionType, fint )
@@ -642,7 +642,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 msg_Err( vars.p_demuxer, "Video colors elements not allowed for this track" );
             } else {
             vars.level += 1;
-            dispatcher.iterate (colours.begin (), colours.end (), Payload( vars ) );
+            dispatcher.iterate (colours.begin (), colours.end (), &vars );
             vars.level -= 1;
             }
         }
@@ -747,7 +747,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 msg_Err( vars.p_demuxer, "Video metadata elements not allowed for this track" );
             } else {
             vars.level += 1;
-            dispatcher.iterate (mastering.begin (), mastering.end (), Payload( vars ) );
+            dispatcher.iterate (mastering.begin (), mastering.end (), &vars );
             vars.level -= 1;
             }
         }
@@ -808,7 +808,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 msg_Err( vars.p_demuxer, "Audio elements not allowed for this track" );
             } else {
             vars.level += 1;
-            dispatcher.iterate( tka.begin(), tka.end(), Payload( vars ));
+            dispatcher.iterate( tka.begin(), tka.end(), &vars );
             vars.level -= 1;
             }
         }
@@ -844,7 +844,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
     };
 
-    MetaDataHandlers::Dispatcher().iterate ( m->begin(), m->end(), MetaDataHandlers::Payload( metadata_payload ) );
+    MetaDataHandlers::Dispatcher().iterate ( m->begin(), m->end(), &metadata_payload );
 
     if( p_track->i_number == 0 )
     {
@@ -929,8 +929,7 @@ void matroska_segment_c::ParseTracks( KaxTracks *tracks )
         }
     };
 
-    TrackHandlers::Dispatcher().iterate(
-      tracks->begin(), tracks->end(), TrackHandlers::Payload( payload ) );
+    TrackHandlers::Dispatcher().iterate( tracks->begin(), tracks->end(), &payload );
 }
 
 /*****************************************************************************
@@ -1085,7 +1084,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
                 chapter_translation_c *p_translate = new chapter_translation_c();
 
                 TranslationHandler::Dispatcher().iterate(
-                    trans.begin(), trans.end(), TranslationHandler::Payload( p_translate )
+                    trans.begin(), trans.end(), &p_translate
                 );
 
                 vars.obj->translations.push_back( p_translate );
@@ -1105,7 +1104,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
         }
     };
 
-    InfoHandlers::Dispatcher().iterate( m->begin(), m->end(), InfoHandlers::Payload( captures ) );
+    InfoHandlers::Dispatcher().iterate( m->begin(), m->end(), &captures );
 
     if( i_duration != -1 )
         i_duration = mtime_t( static_cast<double>( i_duration * i_timescale ) / 10e5 );
@@ -1186,7 +1185,7 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
             debug( vars, "ChapterDisplay" );
 
             vars.level += 1;
-            dispatcher.iterate( chapter_display.begin(), chapter_display.end(), Payload( vars ) );
+            dispatcher.iterate( chapter_display.begin(), chapter_display.end(), &vars );
             vars.level -= 1;
         }
         E_CASE( KaxChapterString, name )
@@ -1259,7 +1258,7 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
         }
     };
 
-    ChapterAtomHandlers::Dispatcher().iterate( ca->begin(), ca->end(), ChapterAtomHandlers::Payload( payload ) );
+    ChapterAtomHandlers::Dispatcher().iterate( ca->begin(), ca->end(), &payload );
 }
 
 /*****************************************************************************
@@ -1394,7 +1393,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
                     msg_Dbg( vars.p_demuxer, "|   |   |   + Unknown (%s)", typeid(el).name() );
                 }
             };
-            KaxEditionHandler::Dispatcher().iterate( entry.begin(), entry.end(), KaxEditionHandler::Payload( data ) );
+            KaxEditionHandler::Dispatcher().iterate( entry.begin(), entry.end(), &data );
 
             data.obj->stored_editions.push_back( data.p_edition );
         }
@@ -1408,7 +1407,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
         }
     };
 
-    KaxChapterHandler::Dispatcher().iterate( chapters->begin(), chapters->end(), KaxChapterHandler::Payload( *this ) );
+    KaxChapterHandler::Dispatcher().iterate( chapters->begin(), chapters->end(), this );
 }
 
 bool matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_time, ScopeMode read_fully )
@@ -2062,9 +2061,7 @@ bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
     };
 
     try {
-        TrackCodecHandlers::Dispatcher().send( p_tk->codec.c_str(),
-          TrackCodecHandlers::Payload( captures )
-        );
+        TrackCodecHandlers::Dispatcher().send( p_tk->codec.c_str(), &captures );
     }
     catch (std::exception const& e)
     {



More information about the vlc-commits mailing list