[vlc-devel] [PATCH 4/4] Define C++ types in namespaces
Romain Vimont
rom1v at videolabs.io
Fri Apr 27 22:05:03 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
---
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 | 5 ++++-
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 | 3 +++
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, 173 insertions(+), 13 deletions(-)
diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index a0dc67ad21..dcfa3ef186 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 { // for ODR
+
//! 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..98c4016a59 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 { // for ODR
+
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 { // for ODR
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 da18701ad2..13bb38df4f 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 2cfd388c9d..d6fe01ea39 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -145,6 +145,8 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
+namespace { // for ODR
+
typedef struct
{
demux_t *p_demux;
@@ -242,7 +244,6 @@ struct demux_sys_t
float f_seek_request;/* In case we receive a seek request while paused*/
};
-
class RTSPClientVlc : public RTSPClient
{
public:
@@ -261,6 +262,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..2d237737ad 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 { // for ODR
+
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 { // for ODR
+
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 4a9325bf23..ab7ea128b7 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
*****************************************************************************/
@@ -351,3 +353,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 ba0ac712fe..82929d64bc 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
*****************************************************************************/
@@ -77,4 +79,6 @@ public:
}
};
+} // 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 a069b1fdea..45850ba4ec 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 fc6cab349e..63aa35326d 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 );
@@ -812,3 +814,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 009e1fc3d2..b0d202347b 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)
@@ -1411,3 +1413,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 752bf58bb4..615e420ee6 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 )
@@ -2099,3 +2101,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 b1dc644f77..c0eca03520 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -41,9 +41,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" ) )
@@ -79,6 +82,8 @@ vlc_module_begin ()
add_shortcut( "mka", "mkv" )
vlc_module_end ()
+namespace mkv {
+
struct demux_sys_t;
static int Demux ( demux_t * );
@@ -900,3 +905,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 c4da69c4f8..fa09c33b87 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -98,6 +98,8 @@
//# define MKV_DEBUG 0
#endif
+namespace mkv {
+
#define MATROSKA_COMPRESSION_NONE -1
#define MATROSKA_COMPRESSION_ZLIB 0
#define MATROSKA_COMPRESSION_BLIB 1
@@ -236,5 +238,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 6a50745f13..bd1923e769 100644
--- a/modules/demux/mkv/stream_io_callback.cpp
+++ b/modules/demux/mkv/stream_io_callback.cpp
@@ -27,6 +27,8 @@
#include "matroska_segment.hpp"
#include "demux.hpp"
+namespace mkv {
+
/*****************************************************************************
* Stream managment
*****************************************************************************/
@@ -116,3 +118,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 d2c72a4214..e7bc68cff2 100644
--- a/modules/demux/mkv/stream_io_callback.hpp
+++ b/modules/demux/mkv/stream_io_callback.hpp
@@ -23,6 +23,8 @@
*****************************************************************************/
#include "mkv.hpp"
+namespace mkv {
+
/*****************************************************************************
* Stream managment
*****************************************************************************/
@@ -52,3 +54,4 @@ class vlc_stream_io_callback: public IOCallback
uint64 toRead ( void );
};
+} // namespace
diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
index 3b25e00aee..00a87e31a3 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 adf8ea8e18..1da166434f 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 930789b931..b03fed906b 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 { // for ODR
+
+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 45caf6edbf..63b27130e4 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 { // for ODR
+
/*
* 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..12114dca16 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 { // for ODR
+
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..d804f678a4 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 { // for ODR
+
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 { // for ODR
+
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..a2fa684e96 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 { // for ODR
+
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 5f52446347..3c6f5d784d 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 { // for ODR
+
/* 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..e3b5536129 100644
--- a/modules/visualization/projectm.cpp
+++ b/modules/visualization/projectm.cpp
@@ -132,6 +132,8 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
+namespace { // for ODR
+
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..be40395601 100644
--- a/modules/visualization/vsxu.cpp
+++ b/modules/visualization/vsxu.cpp
@@ -73,6 +73,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
+namespace { // for ODR
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.0
More information about the vlc-devel
mailing list