[vlc-devel] [PATCH v2] Define C++ types in namespaces

Romain Vimont rom1v at videolabs.io
Mon Jun 11 13:58:52 CEST 2018


In order to respect ODR, in C++ code, declare *_sys_t types in a
separate namespace, either unnamed if it's used only in one translation
unit, or named otherwise.

The GUI modules qt and skins2 are left unchanged for now.

See #17078 and #18033
---
Changes since v1:
 - removed "// for ODR" comments
 - rebased on current master

 modules/access/dcp/dcp.cpp                       |  4 ++++
 modules/access/decklink.cpp                      |  7 +++++++
 modules/access/dshow/access.h                    |  4 ++++
 modules/access/dshow/crossbar.cpp                |  4 ++++
 modules/access/dshow/dshow.cpp                   | 10 ++++++++++
 modules/access/dshow/filter.cpp                  |  4 ++++
 modules/access/dshow/filter.h                    |  4 ++++
 modules/access/dshow/vlc_dshow.h                 |  4 ++++
 modules/access/live555.cpp                       |  4 ++++
 modules/audio_filter/spatializer/spatializer.cpp |  9 +++++++++
 modules/demux/mkv/Ebml_parser.cpp                |  3 +++
 modules/demux/mkv/Ebml_parser.hpp                |  4 ++++
 modules/demux/mkv/chapter_command.cpp            |  5 ++++-
 modules/demux/mkv/chapter_command.hpp            |  6 +++---
 modules/demux/mkv/chapters.cpp                   |  3 +++
 modules/demux/mkv/chapters.hpp                   |  4 ++++
 modules/demux/mkv/demux.cpp                      |  3 +++
 modules/demux/mkv/demux.hpp                      |  3 +++
 modules/demux/mkv/matroska_segment.cpp           |  4 ++++
 modules/demux/mkv/matroska_segment.hpp           |  3 +++
 modules/demux/mkv/matroska_segment_parse.cpp     |  4 ++++
 modules/demux/mkv/matroska_segment_seeker.cpp    |  3 +++
 modules/demux/mkv/matroska_segment_seeker.hpp    |  4 ++++
 modules/demux/mkv/mkv.cpp                        |  7 +++++++
 modules/demux/mkv/mkv.hpp                        |  3 +++
 modules/demux/mkv/stream_io_callback.cpp         |  3 +++
 modules/demux/mkv/stream_io_callback.hpp         |  4 ++++
 modules/demux/mkv/util.cpp                       |  4 ++++
 modules/demux/mkv/util.hpp                       |  4 ++++
 modules/demux/mkv/virtual_segment.cpp            |  4 ++++
 modules/demux/mkv/virtual_segment.hpp            |  4 ++++
 modules/demux/sid.cpp                            | 15 +++++++++------
 modules/services_discovery/upnp.cpp              |  4 ++++
 modules/stream_out/chromecast/cast.cpp           |  4 ++++
 modules/video_filter/blend.cpp                   |  8 ++++++++
 modules/video_filter/opencv_example.cpp          |  5 +++++
 modules/video_output/decklink.cpp                |  8 ++++++--
 modules/visualization/projectm.cpp               |  3 +++
 modules/visualization/vsxu.cpp                   |  3 +++
 39 files changed, 174 insertions(+), 12 deletions(-)

diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index a0dc67ad21..ecb1b86965 100644
--- a/modules/access/dcp/dcp.cpp
+++ b/modules/access/dcp/dcp.cpp
@@ -84,6 +84,8 @@ vlc_module_begin()
     set_callbacks( Open, Close )
 vlc_module_end()
 
+namespace {
+
 //! Kind of MXF MEDIA TYPE
 typedef enum MxfMedia_t {
     MXF_UNKNOWN = 0,
@@ -215,6 +217,8 @@ class demux_sys_t
     }
 };
 
+} // namespace
+
 /*TODO: basic correlation between SMPTE S428-3/S429-2
  * Real sound is more complex with case of left/right surround, ...
  * and hearing impaired/Narration channels */
diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index eb5369eea2..50f02f9308 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -129,6 +129,8 @@ static int Control(demux_t *, int, va_list);
 
 class DeckLinkCaptureDelegate;
 
+namespace {
+
 struct demux_sys_t
 {
     IDeckLink *card;
@@ -156,6 +158,8 @@ struct demux_sys_t
     bool tenbits;
 };
 
+} // namespace
+
 static const char *GetFieldDominance(BMDFieldDominance dom, uint32_t *flags)
 {
     switch(dom)
@@ -224,6 +228,7 @@ static es_format_t GetModeSettings(demux_t *demux, IDeckLinkDisplayMode *m,
 
     return video_fmt;
 }
+namespace {
 
 class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
 {
@@ -297,6 +302,8 @@ private:
     demux_t *demux_;
 };
 
+} // namespace
+
 HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioFrame)
 {
     demux_sys_t *sys = static_cast<demux_sys_t *>(demux_->p_sys);
diff --git a/modules/access/dshow/access.h b/modules/access/dshow/access.h
index 271657e0af..2914c7d047 100644
--- a/modules/access/dshow/access.h
+++ b/modules/access/dshow/access.h
@@ -35,6 +35,8 @@ using Microsoft::WRL::ComPtr;
 
 typedef struct demux_sys_t demux_sys_t;
 
+namespace dshow {
+
 /****************************************************************************
  * Crossbar stuff
  ****************************************************************************/
@@ -82,3 +84,5 @@ struct access_sys_t
     mtime_t        i_start;
 };
 
+}
+
diff --git a/modules/access/dshow/crossbar.cpp b/modules/access/dshow/crossbar.cpp
index 75e93182b3..7e2a55ad19 100644
--- a/modules/access/dshow/crossbar.cpp
+++ b/modules/access/dshow/crossbar.cpp
@@ -39,6 +39,8 @@
 #include "access.h"
 #include "vlc_dshow.h"
 
+namespace dshow {
+
 // Helper function to associate a crossbar pin name with the type.
 static const char * GetPhysicalPinName(long lType)
 {
@@ -287,3 +289,5 @@ HRESULT FindCrossbarRoutes( vlc_object_t *p_this, access_sys_t *p_sys,
 
     return result;
 }
+
+} // namespace
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 749a97e3f0..0b095742fc 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -57,6 +57,8 @@
 #define INSTANCEDATA_OF_PROPERTY_PTR(x) ((PKSPROPERTY((x))) + 1)
 #define INSTANCEDATA_OF_PROPERTY_SIZE(x) (sizeof((x)) - sizeof(KSPROPERTY))
 
+namespace dshow {
+
 /*****************************************************************************
  * Access: local prototypes
  *****************************************************************************/
@@ -215,6 +217,10 @@ static void AccessClose( vlc_object_t * );
 static int  DemuxOpen  ( vlc_object_t * );
 static void DemuxClose ( vlc_object_t * );
 
+} // namespace
+
+using namespace dshow;
+
 vlc_module_begin ()
     set_shortname( N_("DirectShow") )
     set_description( N_("DirectShow input") )
@@ -302,6 +308,8 @@ vlc_module_begin ()
 
 vlc_module_end ()
 
+namespace dshow {
+
 struct ComContext
 {
     ComContext( int mode )
@@ -2393,3 +2401,5 @@ static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
         }
     }
 }
+
+} // namespace
diff --git a/modules/access/dshow/filter.cpp b/modules/access/dshow/filter.cpp
index 40620b9c64..8bfb848039 100644
--- a/modules/access/dshow/filter.cpp
+++ b/modules/access/dshow/filter.cpp
@@ -45,6 +45,8 @@
 
 #include <new>
 
+namespace dshow {
+
 DEFINE_GUID(MEDIASUBTYPE_HDYC ,0x43594448 /* CYDH */ , 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
 DEFINE_GUID(MEDIASUBTYPE_DIVX ,0x58564944 /* XVID */ , 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
 
@@ -1166,3 +1168,5 @@ STDMETHODIMP CaptureEnumMediaTypes::Clone( IEnumMediaTypes **ppEnum )
 
     return NOERROR;
 };
+
+} // namespace
diff --git a/modules/access/dshow/filter.h b/modules/access/dshow/filter.h
index 733f45b7bd..c240c3c3e9 100644
--- a/modules/access/dshow/filter.h
+++ b/modules/access/dshow/filter.h
@@ -28,6 +28,8 @@
 
 #include <deque>
 
+namespace dshow {
+
 struct VLCMediaSample
 {
     ComPtr<IMediaSample> p_sample;
@@ -226,3 +228,5 @@ public:
 private:
     virtual ~CaptureEnumMediaTypes();
 };
+
+} // namespace
diff --git a/modules/access/dshow/vlc_dshow.h b/modules/access/dshow/vlc_dshow.h
index be98882cc7..57c84ade3b 100644
--- a/modules/access/dshow/vlc_dshow.h
+++ b/modules/access/dshow/vlc_dshow.h
@@ -44,6 +44,8 @@
 
 #include <dshow.h>
 
+namespace dshow {
+
 /*****************************************************************************
  * DirectShow GUIDs.
  *****************************************************************************/
@@ -370,5 +372,7 @@ DECLARE_INTERFACE_(IAMTVAudio, IUnknown)
     STDMETHOD(UnRegisterNotificationCallBack) (THIS_ IAMTunerNotification*);
 };
 
+} // namespace
+
 #endif /* __MINGW64_VERSION_MAJOR */
 #endif /* VLC_DSHOW_H */
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 6f8c896292..d1e64ba4c3 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -145,6 +145,8 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
+namespace {
+
 typedef struct
 {
     demux_t         *p_demux;
@@ -261,6 +263,8 @@ public:
     demux_sys_t *p_sys;
 };
 
+} // namespace
+
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int, va_list );
 
diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp
index ebb43da86f..b3397735e3 100644
--- a/modules/audio_filter/spatializer/spatializer.cpp
+++ b/modules/audio_filter/spatializer/spatializer.cpp
@@ -91,12 +91,17 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
+
+namespace {
+
 struct filter_sys_t
 {
     vlc_mutex_t lock;
     revmodel *p_reverbm;
 };
 
+} // namespace
+
 #define DECLARECB(fn) static int fn (vlc_object_t *,char const *, \
                                      vlc_value_t, vlc_value_t, void *)
 DECLARECB( RoomCallback  );
@@ -107,6 +112,8 @@ DECLARECB( WidthCallback );
 
 #undef  DECLARECB
 
+namespace {
+
 struct callback_s {
   const char *psz_name;
   int (*fp_callback)(vlc_object_t *,const char *,
@@ -114,6 +121,8 @@ struct callback_s {
   void (revmodel::* fp_set)(float);
 };
 
+} // namespace
+
 static const callback_s callbacks[] = {
     { "spatializer-roomsize", RoomCallback,  &revmodel::setroomsize },
     { "spatializer-width",    WidthCallback, &revmodel::setwidth },
diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index eb7315c6ae..1776494fb4 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -26,6 +26,8 @@
 #include "Ebml_parser.hpp"
 #include "stream_io_callback.hpp"
 
+namespace mkv {
+
 /*****************************************************************************
  * Ebml Stream parser
  *****************************************************************************/
@@ -344,3 +346,4 @@ bool EbmlParser::IsTopPresent( EbmlElement *el ) const
     return false;
 }
 
+} // namespace
diff --git a/modules/demux/mkv/Ebml_parser.hpp b/modules/demux/mkv/Ebml_parser.hpp
index 6e427faf18..fea21e5382 100644
--- a/modules/demux/mkv/Ebml_parser.hpp
+++ b/modules/demux/mkv/Ebml_parser.hpp
@@ -27,6 +27,8 @@
 
 #include "mkv.hpp"
 
+namespace mkv {
+
 /*****************************************************************************
  * Ebml Stream parser
  *****************************************************************************/
@@ -66,4 +68,6 @@ class EbmlParser
     bool         mb_dummy;
 };
 
+} // namespace
+
 #endif
diff --git a/modules/demux/mkv/chapter_command.cpp b/modules/demux/mkv/chapter_command.cpp
index cff2d56f9c..47479f554e 100644
--- a/modules/demux/mkv/chapter_command.cpp
+++ b/modules/demux/mkv/chapter_command.cpp
@@ -23,8 +23,11 @@
  *****************************************************************************/
 
 #include "chapter_command.hpp"
+#include "demux.hpp"
 #include <algorithm>
 
+namespace mkv {
+
 void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command )
 {
     uint32 codec_time = uint32(-1);
@@ -766,4 +769,4 @@ bool matroska_script_codec_c::Leave()
     return f_result;
 }
 
-
+} // namespace
diff --git a/modules/demux/mkv/chapter_command.hpp b/modules/demux/mkv/chapter_command.hpp
index f206e35b4b..3411824180 100644
--- a/modules/demux/mkv/chapter_command.hpp
+++ b/modules/demux/mkv/chapter_command.hpp
@@ -27,6 +27,8 @@
 
 #include "mkv.hpp"
 
+namespace mkv {
+
 const int MATROSKA_CHAPTER_CODEC_NATIVE  = 0x00;
 const int MATROSKA_CHAPTER_CODEC_DVD     = 0x01;
 
@@ -244,9 +246,6 @@ protected:
     static bool MatchCellNumber   ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
 };
 
-
-#include "demux.hpp"
-
 class dvd_chapter_codec_c : public chapter_codec_cmds_c
 {
 public:
@@ -296,5 +295,6 @@ protected:
     matroska_script_interpretor_c interpretor;
 };
 
+} // namespace
 
 #endif
diff --git a/modules/demux/mkv/chapters.cpp b/modules/demux/mkv/chapters.cpp
index 1242908941..7922975b35 100644
--- a/modules/demux/mkv/chapters.cpp
+++ b/modules/demux/mkv/chapters.cpp
@@ -29,6 +29,8 @@
 #include <functional>
 #include <algorithm>
 
+namespace mkv {
+
 chapter_item_c::~chapter_item_c()
 {
     delete p_segment_uid;
@@ -233,3 +235,4 @@ std::string chapter_edition_c::GetMainName() const
     return "";
 }
 
+} // namespace
diff --git a/modules/demux/mkv/chapters.hpp b/modules/demux/mkv/chapters.hpp
index ee4c186912..de87886321 100644
--- a/modules/demux/mkv/chapters.hpp
+++ b/modules/demux/mkv/chapters.hpp
@@ -29,6 +29,8 @@
 
 #include "mkv.hpp"
 
+namespace mkv {
+
 class chapter_translation_c
 {
 public:
@@ -105,4 +107,6 @@ public:
     bool                        b_hidden;
 };
 
+} // namespace
+
 #endif
diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index 014e0b108e..cd95a7d055 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -29,6 +29,8 @@
 
 #include <vlc_actions.h>
 
+namespace mkv {
+
 event_thread_t::event_thread_t(demux_t *p_demux) : p_demux(p_demux)
 {
     vlc_mutex_init( &lock );
@@ -811,3 +813,4 @@ virtual_chapter_c *demux_sys_t::FindChapter( int64_t i_find_uid, virtual_segment
     return p_result;
 }
 
+} // namespace
diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index c9cfe557c9..e968908c30 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -30,6 +30,8 @@
 #include "chapter_command.hpp"
 #include "virtual_segment.hpp"
 
+namespace mkv {
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 #undef ATTRIBUTE_PACKED
 #undef PRAGMA_PACK_BEGIN
@@ -407,5 +409,6 @@ public:
     event_thread_t *p_ev;
 };
 
+} // namespace
 
 #endif
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 457fdbc641..7fefe6cda1 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -32,6 +32,8 @@
 #include <new>
 #include <iterator>
 
+namespace mkv {
+
 matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estream, KaxSegment *p_seg )
     :segment(p_seg)
     ,es(estream)
@@ -1423,3 +1425,5 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
         }
     }
 }
+
+} // namespace
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index dd3ac52723..d3626e42aa 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -37,6 +37,8 @@
 
 #include "Ebml_parser.hpp"
 
+namespace mkv {
+
 class EbmlParser;
 
 class chapter_edition_c;
@@ -177,5 +179,6 @@ private:
     friend SegmentSeeker;
 };
 
+} // namespace
 
 #endif
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index add75d84bd..ce9fc75a90 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -41,6 +41,8 @@ extern "C" {
 #include <stdexcept>
 #include <limits>
 
+namespace mkv {
+
 /* GetFourCC helper */
 #define GetFOURCC( p )  __GetFOURCC( (uint8_t*)p )
 static vlc_fourcc_t __GetFOURCC( uint8_t *p )
@@ -2094,3 +2096,5 @@ bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
 
     return true;
 }
+
+} // namespace
diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index 8feecb902f..37835c6de3 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -49,6 +49,8 @@ namespace {
     template<class It> It next_( It it ) { return ++it; }
 }
 
+namespace mkv {
+
 SegmentSeeker::cluster_positions_t::iterator
 SegmentSeeker::add_cluster_position( fptr_t fpos )
 {
@@ -521,3 +523,4 @@ SegmentSeeker::mkv_jump_to( matroska_segment_c& ms, fptr_t fpos )
         ms.es.I_O().setFilePointer( fpos );
 }
 
+} // namespace
diff --git a/modules/demux/mkv/matroska_segment_seeker.hpp b/modules/demux/mkv/matroska_segment_seeker.hpp
index e2e1579354..963d7f4c65 100644
--- a/modules/demux/mkv/matroska_segment_seeker.hpp
+++ b/modules/demux/mkv/matroska_segment_seeker.hpp
@@ -31,6 +31,8 @@
 #include <map>
 #include <limits>
 
+namespace mkv {
+
 class matroska_segment_c;
 
 class SegmentSeeker
@@ -125,4 +127,6 @@ class SegmentSeeker
         cluster_map_t       _clusters;
 };
 
+} // namespace
+
 #endif /* include-guard */
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index f5ed6ba97d..8249f649eb 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -39,9 +39,12 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+namespace mkv {
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
+} // namespace
 
+using namespace mkv;
 vlc_module_begin ()
     set_shortname( "Matroska" )
     set_description( N_("Matroska stream demuxer" ) )
@@ -77,6 +80,8 @@ vlc_module_begin ()
     add_shortcut( "mka", "mkv" )
 vlc_module_end ()
 
+namespace mkv {
+
 struct demux_sys_t;
 
 static int  Demux  ( demux_t * );
@@ -898,3 +903,5 @@ bool matroska_stream_c::isUsed() const
     }
     return false;
 }
+
+} // namespace
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 90be75902f..c3e74bfbda 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -96,6 +96,8 @@
 //# define MKV_DEBUG 0
 #endif
 
+namespace mkv {
+
 #define MATROSKA_COMPRESSION_NONE  -1
 #define MATROSKA_COMPRESSION_ZLIB   0
 #define MATROSKA_COMPRESSION_BLIB   1
@@ -231,5 +233,6 @@ class mkv_track_t
         mtime_t i_codec_delay;
 };
 
+} // namespace
 
 #endif /* _MKV_HPP_ */
diff --git a/modules/demux/mkv/stream_io_callback.cpp b/modules/demux/mkv/stream_io_callback.cpp
index 32e5692afb..dfa52c2efe 100644
--- a/modules/demux/mkv/stream_io_callback.cpp
+++ b/modules/demux/mkv/stream_io_callback.cpp
@@ -24,6 +24,8 @@
 
 #include "stream_io_callback.hpp"
 
+namespace mkv {
+
 /*****************************************************************************
  * Stream managment
  *****************************************************************************/
@@ -113,3 +115,4 @@ uint64 vlc_stream_io_callback::toRead( void )
     return static_cast<uint64>( i_size - vlc_stream_Tell( s ) );
 }
 
+} // namespace
diff --git a/modules/demux/mkv/stream_io_callback.hpp b/modules/demux/mkv/stream_io_callback.hpp
index d0621c5cf3..bbea5d6f07 100644
--- a/modules/demux/mkv/stream_io_callback.hpp
+++ b/modules/demux/mkv/stream_io_callback.hpp
@@ -35,6 +35,8 @@
 
 using namespace LIBEBML_NAMESPACE;
 
+namespace mkv {
+
 /*****************************************************************************
  * Stream managment
  *****************************************************************************/
@@ -64,4 +66,6 @@ class vlc_stream_io_callback: public IOCallback
     uint64           toRead          ( void );
 };
 
+} // namespace
+
 #endif
diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
index b6a5bed820..c86ee3b772 100644
--- a/modules/demux/mkv/util.cpp
+++ b/modules/demux/mkv/util.cpp
@@ -25,6 +25,8 @@
 #include "util.hpp"
 #include "demux.hpp"
 
+namespace mkv {
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -425,3 +427,5 @@ void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ... )
     MkvTree_va( demuxer, i_level, psz_format, args );
     va_end( args );
 }
+
+} // namespace
diff --git a/modules/demux/mkv/util.hpp b/modules/demux/mkv/util.hpp
index 780acaaf60..224ce0d9d9 100644
--- a/modules/demux/mkv/util.hpp
+++ b/modules/demux/mkv/util.hpp
@@ -25,6 +25,8 @@
 
 #include "mkv.hpp"
 
+namespace mkv {
+
 #ifdef HAVE_ZLIB_H
 int32_t zlib_decompress_extra( demux_t * p_demux, mkv_track_t & tk );
 block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
@@ -94,3 +96,5 @@ block_t * packetize_wavpack( const mkv_track_t &, uint8_t *, size_t);
 /* helper functions to print the mkv parse tree */
 void MkvTree_va( demux_t& demuxer, int i_level, const char* fmt, va_list args);
 void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ... );
+
+} // namespace
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index c9987bb3e8..a5dc7142b2 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -27,6 +27,8 @@
 
 #include "demux.hpp"
 
+namespace mkv {
+
 /* FIXME move this, it's demux_sys_t::FindSegment */
 matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matroska_segment_c*> & segments )
 {
@@ -754,3 +756,5 @@ void virtual_segment_c::KeepTrackSelection( matroska_segment_c & old, matroska_s
         }
     }
 }
+
+} // namespace
diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
index 53d297f2cb..1035381fa5 100644
--- a/modules/demux/mkv/virtual_segment.hpp
+++ b/modules/demux/mkv/virtual_segment.hpp
@@ -31,6 +31,8 @@
 #include "matroska_segment.hpp"
 #include "chapters.hpp"
 
+namespace mkv {
+
 /* virtual classes don't own anything but virtual elements so they shouldn't have to delete anything */
 
 class virtual_chapter_c
@@ -165,4 +167,6 @@ private:
     void KeepTrackSelection( matroska_segment_c & old, matroska_segment_c & next );
 };
 
+} // namespace
+
 #endif
diff --git a/modules/demux/sid.cpp b/modules/demux/sid.cpp
index aa87462e94..ae20bc15c3 100644
--- a/modules/demux/sid.cpp
+++ b/modules/demux/sid.cpp
@@ -57,7 +57,9 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
 vlc_module_end ()
 
-struct demux_sid
+namespace {
+
+struct demux_sys_t
 {
     sidplay2 *player;
     sid2_config_t config;
@@ -74,6 +76,7 @@ struct demux_sid
     bool title_changed;
 };
 
+} // namespace
 
 static int Demux (demux_t *);
 static int Control (demux_t *, int, va_list);
@@ -81,7 +84,7 @@ static int Control (demux_t *, int, va_list);
 static int Open (vlc_object_t *obj)
 {
     demux_t *demux = (demux_t *)obj;
-    demux_sid *sys = NULL;
+    demux_sys_t *sys = NULL;
     es_format_t fmt;
     bool result = false;
     SidTune *tune = NULL;
@@ -124,7 +127,7 @@ static int Open (vlc_object_t *obj)
     if (unlikely(player==NULL))
         goto error;
 
-    sys = reinterpret_cast<demux_sid*>(calloc (1, sizeof(demux_sid)));
+    sys = reinterpret_cast<demux_sys_t *>(calloc(1, sizeof(demux_sys_t)));
     if (unlikely(sys==NULL))
         goto error;
 
@@ -194,7 +197,7 @@ error:
 static void Close (vlc_object_t *obj)
 {
     demux_t *demux = (demux_t *)obj;
-    demux_sid *sys = reinterpret_cast<demux_sid*>(demux->p_sys);
+    demux_sys_t *sys = reinterpret_cast<demux_sys_t *>(demux->p_sys);
 
     delete sys->player;
     delete sys->config.sidEmulation;
@@ -204,7 +207,7 @@ static void Close (vlc_object_t *obj)
 
 static int Demux (demux_t *demux)
 {
-    demux_sid *sys = reinterpret_cast<demux_sid*>(demux->p_sys);
+    demux_sys_t *sys = reinterpret_cast<demux_sys_t *>(demux->p_sys);
 
     block_t *block = block_Alloc( sys->block_size);
     if (unlikely(block==NULL))
@@ -235,7 +238,7 @@ static int Demux (demux_t *demux)
 
 static int Control (demux_t *demux, int query, va_list args)
 {
-    demux_sid *sys = reinterpret_cast<demux_sid*>(demux->p_sys);
+    demux_sys_t *sys = reinterpret_cast<demux_sys_t *>(demux->p_sys);
 
     switch (query)
     {
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 6626cae2f4..90e0d7ba73 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -78,6 +78,8 @@ static const char *const ppsz_readible_satip_channel_lists[] = {
     "Astra 19.2°E", "Astra 28.2°E", "Astra 23.5°E", N_("Master List"), N_("Server List"), N_("Custom List")
 };
 
+namespace {
+
 /*
  * VLC handle
  */
@@ -92,6 +94,8 @@ struct access_sys_t
     UpnpInstanceWrapper* p_upnp;
 };
 
+} // namespace
+
 UpnpInstanceWrapper* UpnpInstanceWrapper::s_instance;
 vlc_mutex_t UpnpInstanceWrapper::s_lock = VLC_STATIC_MUTEX;
 SD::MediaServerList *UpnpInstanceWrapper::p_server_list = NULL;
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 19d68ba893..43a44f41de 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -49,6 +49,8 @@
 #define CC_ENABLE_SPU
 #endif
 
+namespace {
+
 struct sout_access_out_sys_t
 {
     sout_access_out_sys_t(httpd_host_t *httpd_host, intf_sys_t * const intf,
@@ -170,6 +172,8 @@ struct sout_stream_id_sys_t
     bool                  flushed;
 };
 
+} // namespace
+
 #define SOUT_CFG_PREFIX "sout-chromecast-"
 
 static const char DEFAULT_MUXER[] = "avformat{mux=matroska,options={live=1}}";
diff --git a/modules/video_filter/blend.cpp b/modules/video_filter/blend.cpp
index 12f4115c27..3339abe528 100644
--- a/modules/video_filter/blend.cpp
+++ b/modules/video_filter/blend.cpp
@@ -60,6 +60,8 @@ void merge(T *dst, unsigned src, unsigned f)
     *dst = div255((255 - f) * (*dst) + src * f);
 }
 
+namespace {
+
 struct CPixel {
     unsigned i, j, k;
     unsigned a;
@@ -519,6 +521,8 @@ private:
     G g;
 };
 
+} // namespace
+
 template <class TDst, class TSrc, class TConvert>
 void Blend(const CPicture &dst_data, const CPicture &src_data,
            unsigned width, unsigned height, int alpha)
@@ -551,6 +555,8 @@ void Blend(const CPicture &dst_data, const CPicture &src_data,
 typedef void (*blend_function_t)(const CPicture &dst_data, const CPicture &src_data,
                                  unsigned width, unsigned height, int alpha);
 
+namespace {
+
 static const struct {
     vlc_fourcc_t     dst;
     vlc_fourcc_t     src;
@@ -632,6 +638,8 @@ struct filter_sys_t {
     blend_function_t blend;
 };
 
+} // namespace
+
 /**
  * It blends 2 picture together.
  */
diff --git a/modules/video_filter/opencv_example.cpp b/modules/video_filter/opencv_example.cpp
index c3a5fe98a6..1d787858cc 100644
--- a/modules/video_filter/opencv_example.cpp
+++ b/modules/video_filter/opencv_example.cpp
@@ -49,6 +49,9 @@
 /*****************************************************************************
  * filter_sys_t : filter descriptor
  *****************************************************************************/
+
+namespace {
+
 struct filter_sys_t
 {
     CvMemStorage* p_storage;
@@ -57,6 +60,8 @@ struct filter_sys_t
     int i_id;
 };
 
+} // namespace
+
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 821c9a805d..39b471db92 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -177,10 +177,12 @@ static const char * const rgsz_ar_text[] = {
 };
 static_assert(ARRAY_SIZE(rgi_ar_values) == ARRAY_SIZE(rgsz_ar_text), "afd arrays messed up");
 
+namespace {
+
 /* Only one audio output module and one video output module
  * can be used per process.
  * We use a static mutex in audio/video submodules entry points.  */
-typedef struct decklink_sys_t
+struct decklink_sys_t
 {
     /* With LOCK */
     IDeckLinkOutput *p_output;
@@ -217,7 +219,9 @@ typedef struct decklink_sys_t
         int nosignal_delay;
         picture_t *pic_nosignal;
     } video;
-} decklink_sys_t;
+};
+
+} // namespace
 
 /*****************************************************************************
  * Local prototypes.
diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp
index d42cd5a7af..669a5419a7 100644
--- a/modules/visualization/projectm.cpp
+++ b/modules/visualization/projectm.cpp
@@ -132,6 +132,8 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
+namespace {
+
 struct filter_sys_t
 {
     /* */
@@ -151,6 +153,7 @@ struct filter_sys_t
     unsigned i_nb_samples;
 };
 
+} // namespace
 
 static block_t *DoWork( filter_t *, block_t * );
 static void *Thread( void * );
diff --git a/modules/visualization/vsxu.cpp b/modules/visualization/vsxu.cpp
index 8be523e6fa..faa8815102 100644
--- a/modules/visualization/vsxu.cpp
+++ b/modules/visualization/vsxu.cpp
@@ -73,6 +73,7 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
+namespace {
 
 struct filter_sys_t
 {
@@ -92,6 +93,8 @@ struct filter_sys_t
     bool b_quit;
 };
 
+} // namespace
+
 static block_t *DoWork( filter_t *, block_t * );
 static void *Thread( void * );
 
-- 
2.17.1



More information about the vlc-devel mailing list