[vlc-devel] [PATCH 1/3] core: respect ODR for demux_sys_t

Romain Vimont rom1v at videolabs.io
Sun Apr 22 17:03:36 CEST 2018


See #17078 and #18033
---
 include/vlc_common.h                            |  1 -
 modules/access/alsa.c                           |  4 ++--
 modules/access/bluray.c                         |  4 ++--
 modules/access/cdda.c                           |  4 ++--
 modules/access/dc1394.c                         |  4 ++--
 modules/access/dcp/dcp.cpp                      |  2 ++
 modules/access/decklink.cpp                     |  2 ++
 modules/access/dvdnav.c                         |  4 ++--
 modules/access/dvdread.c                        |  4 ++--
 modules/access/idummy.c                         |  4 ++--
 modules/access/imem.c                           |  2 +-
 modules/access/jack.c                           |  4 ++--
 modules/access/linsys/linsys_hdsdi.c            |  4 ++--
 modules/access/linsys/linsys_sdi.c              |  4 ++--
 modules/access/live555.cpp                      |  3 ++-
 modules/access/oss.c                            |  4 ++--
 modules/access/pulse.c                          |  4 ++--
 modules/access/rdp.c                            |  4 ++--
 modules/access/rtp/rtp.h                        |  4 ++--
 modules/access/screen/screen.h                  |  4 ++--
 modules/access/screen/wayland.c                 |  4 ++--
 modules/access/screen/xcb.c                     |  4 ++--
 modules/access/shm.c                            |  2 ++
 modules/access/timecode.c                       |  4 ++--
 modules/access/v4l2/demux.c                     |  4 ++--
 modules/access/v4l2/radio.c                     |  4 ++--
 modules/access/vnc.c                            |  4 ++--
 modules/access/wasapi.c                         |  4 ++--
 modules/demux/adaptive/adaptive.cpp             |  2 +-
 modules/demux/aiff.c                            |  4 ++--
 modules/demux/asf/asf.c                         |  4 ++--
 modules/demux/au.c                              |  4 ++--
 modules/demux/avformat/demux.c                  |  4 ++--
 modules/demux/avi/avi.c                         |  4 ++--
 modules/demux/caf.c                             |  4 ++--
 modules/demux/cdg.c                             |  4 ++--
 modules/demux/flac.c                            |  4 ++--
 modules/demux/gme.c                             |  4 ++--
 modules/demux/image.c                           |  4 ++--
 modules/demux/mjpeg.c                           |  4 ++--
 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           | 10 +++++-----
 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          |  4 ++++
 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                       |  8 +++++++-
 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/mod.c                             |  4 ++--
 modules/demux/mp4/mp4.c                         |  4 ++--
 modules/demux/mpc.c                             |  4 ++--
 modules/demux/mpeg/es.c                         |  4 ++--
 modules/demux/mpeg/h26x.c                       |  4 ++--
 modules/demux/mpeg/mpgv.c                       |  4 ++--
 modules/demux/mpeg/ps.c                         |  4 ++--
 modules/demux/mpeg/ts_pid.h                     |  2 ++
 modules/demux/nsv.c                             |  4 ++--
 modules/demux/nuv.c                             |  4 ++--
 modules/demux/ogg.h                             |  4 ++--
 modules/demux/playlist/sgimb.c                  |  4 ++--
 modules/demux/pva.c                             |  4 ++--
 modules/demux/rawaud.c                          |  4 ++--
 modules/demux/rawdv.c                           |  4 ++--
 modules/demux/rawvid.c                          |  4 ++--
 modules/demux/real.c                            |  4 ++--
 modules/demux/sid.cpp                           | 17 +++++++++--------
 modules/demux/smf.c                             |  4 ++--
 modules/demux/stl.c                             |  5 +++--
 modules/demux/subtitle.c                        |  4 ++--
 modules/demux/tta.c                             |  4 ++--
 modules/demux/ttml.c                            |  4 ++--
 modules/demux/ty.c                              |  4 ++--
 modules/demux/vc1.c                             |  4 ++--
 modules/demux/vobsub.c                          |  4 ++--
 modules/demux/voc.c                             |  4 ++--
 modules/demux/wav.c                             |  4 ++--
 modules/demux/webvtt.c                          |  4 ++--
 modules/demux/xa.c                              |  4 ++--
 modules/misc/stats.c                            |  4 ++--
 modules/services_discovery/sap.c                |  4 ++--
 .../stream_out/chromecast/chromecast_demux.cpp  |  1 -
 94 files changed, 228 insertions(+), 146 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index c11b76dbb3..5669e1f0d6 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -356,7 +356,6 @@ typedef struct access_sys_t access_sys_t;
 typedef struct stream_t     stream_t;
 typedef struct stream_sys_t stream_sys_t;
 typedef struct stream_t demux_t;
-typedef struct demux_sys_t demux_sys_t;
 typedef struct es_out_t     es_out_t;
 typedef struct es_out_id_t  es_out_id_t;
 typedef struct es_out_sys_t es_out_sys_t;
diff --git a/modules/access/alsa.c b/modules/access/alsa.c
index 1126d97c5d..99cb1dcbd8 100644
--- a/modules/access/alsa.c
+++ b/modules/access/alsa.c
@@ -122,7 +122,7 @@ static void DumpDeviceStatus (vlc_object_t *obj, snd_pcm_t *pcm)
 #define DumpDeviceStatus(o, p) DumpDeviceStatus(VLC_OBJECT(o), p)
 
 
-struct demux_sys_t
+typedef struct
 {
     snd_pcm_t *pcm;
     es_out_id_t *es;
@@ -132,7 +132,7 @@ struct demux_sys_t
     mtime_t caching;
     snd_pcm_uframes_t period_size;
     unsigned rate;
-};
+} demux_sys_t;
 
 static void Poll (snd_pcm_t *pcm, int canc)
 {
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 50ff17d395..2ee3617adf 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -145,7 +145,7 @@ typedef struct bluray_overlay_t
     struct subpicture_updater_sys_t *p_updater;
 } bluray_overlay_t;
 
-struct  demux_sys_t
+typedef struct
 {
     BLURAY              *bluray;
 
@@ -200,7 +200,7 @@ struct  demux_sys_t
 
     /* Used to store bluray disc path */
     char                *psz_bd_path;
-};
+} demux_sys_t;
 
 struct subpicture_updater_sys_t
 {
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index 26bd2aa081..266b801d78 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -115,7 +115,7 @@ static vcddev_t *DiscOpen(vlc_object_t *obj, const char *location,
 /* how many blocks Demux() will read in each iteration */
 #define CDDA_BLOCKS_ONCE 20
 
-struct demux_sys_t
+typedef struct
 {
     vcddev_t    *vcddev;                            /* vcd device descriptor */
     es_out_id_t *es;
@@ -124,7 +124,7 @@ struct demux_sys_t
     unsigned start; /**< Track first sector */
     unsigned length; /**< Track total sectors */
     unsigned position; /**< Current offset within track sectors */
-};
+} demux_sys_t;
 
 static int Demux(demux_t *demux)
 {
diff --git a/modules/access/dc1394.c b/modules/access/dc1394.c
index adec9ac313..f3e381f4a4 100644
--- a/modules/access/dc1394.c
+++ b/modules/access/dc1394.c
@@ -54,7 +54,7 @@ vlc_module_begin()
     set_callbacks( Open, Close )
 vlc_module_end()
 
-struct demux_sys_t
+typedef struct
 {
     /* camera info */
     dc1394_t            *p_dccontext;
@@ -77,7 +77,7 @@ struct demux_sys_t
     unsigned int        focus;
     es_out_id_t         *p_es_video;
     dc1394video_frame_t *frame;
-};
+} demux_sys_t;
 
 /*****************************************************************************
  * Local prototypes
diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index 6867c94354..b420143d45 100644
--- a/modules/access/dcp/dcp.cpp
+++ b/modules/access/dcp/dcp.cpp
@@ -120,6 +120,7 @@ struct audioReader_t
     The classes for handling these essence types are defined in AS_DCP.h and are different for each essence type, respectively. The demux_sys_t structure contains members for handling each of these essence types.
 */
 
+namespace { // for ODR
 class demux_sys_t
 {
  public:
@@ -214,6 +215,7 @@ class demux_sys_t
         delete p_dcp;
     }
 };
+} // namespace
 
 /*TODO: basic correlation between SMPTE S428-3/S429-2
  * Real sound is more complex with case of left/right surround, ...
diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index eb5369eea2..6cc74e3e81 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -129,6 +129,7 @@ static int Control(demux_t *, int, va_list);
 
 class DeckLinkCaptureDelegate;
 
+namespace { // for ODR
 struct demux_sys_t
 {
     IDeckLink *card;
@@ -155,6 +156,7 @@ struct demux_sys_t
 
     bool tenbits;
 };
+} // namespace
 
 static const char *GetFieldDominance(BMDFieldDominance dom, uint32_t *flags)
 {
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 1be6762199..0386102772 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -120,7 +120,7 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     dvdnav_t    *dvdnav;
 
@@ -165,7 +165,7 @@ struct demux_sys_t
     mtime_t     i_pgc_length;
     int         i_vobu_index;
     int         i_vobu_flush;
-};
+} demux_sys_t;
 
 static int Control( demux_t *, int, va_list );
 static int Demux( demux_t * );
diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index 44ae8b60df..89ecfc8906 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -92,7 +92,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
-struct demux_sys_t
+typedef struct
 {
     /* DVDRead state */
     dvd_reader_t *p_dvdread;
@@ -145,7 +145,7 @@ struct demux_sys_t
 
     /* SPU */
     uint32_t clut[16];
-};
+} demux_sys_t;
 
 static int Control   ( demux_t *, int, va_list );
 static int Demux     ( demux_t * );
diff --git a/modules/access/idummy.c b/modules/access/idummy.c
index f95e68634f..b0e82166c5 100644
--- a/modules/access/idummy.c
+++ b/modules/access/idummy.c
@@ -60,11 +60,11 @@ static int DemuxHold( demux_t *demux )
     return 1;
 }
 
-struct demux_sys_t
+typedef struct
 {
     mtime_t end;
     mtime_t length;
-};
+} demux_sys_t;
 
 static int DemuxPause( demux_t *demux )
 {
diff --git a/modules/access/imem.c b/modules/access/imem.c
index 008e0ebde2..80b26a41d8 100644
--- a/modules/access/imem.c
+++ b/modules/access/imem.c
@@ -495,7 +495,7 @@ static int OpenDemux(vlc_object_t *object)
     /* */
     demux->pf_control = ControlDemux;
     demux->pf_demux   = Demux;
-    demux->p_sys      = (demux_sys_t*)sys;
+    demux->p_sys      = sys;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/access/jack.c b/modules/access/jack.c
index d986dc14a0..ac166ea7bb 100644
--- a/modules/access/jack.c
+++ b/modules/access/jack.c
@@ -83,7 +83,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
-struct demux_sys_t
+typedef struct
 {
     /* Audio properties */
     vlc_fourcc_t                i_acodec_raw;
@@ -106,7 +106,7 @@ struct demux_sys_t
     char                        *psz_ports;
     char                        **pp_jack_port_table;
     char                        i_match_ports;
-};
+} demux_sys_t;
 
 static int Demux( demux_t * );
 static int Control( demux_t *p_demux, int i_query, va_list args );
diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index 01f195a410..7b0aa17a94 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -121,7 +121,7 @@ typedef struct hdsdi_audio_t
     es_out_id_t *p_es;
 } hdsdi_audio_t;
 
-struct demux_sys_t
+typedef struct
 {
     /* video device reader */
     int          i_vfd;
@@ -157,7 +157,7 @@ struct demux_sys_t
 
     pthread_t thread;
     int evfd;
-};
+} demux_sys_t;
 
 static int Control( demux_t *, int, va_list );
 static void *Demux( void * );
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index c9efc415ea..5921b19af2 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -146,7 +146,7 @@ enum {
     STATE_SYNC,
 };
 
-struct demux_sys_t
+typedef struct
 {
     /* device reader */
     int              i_fd;
@@ -186,7 +186,7 @@ struct demux_sys_t
     es_out_id_t      *p_es_video;
     sdi_audio_t      p_audios[MAX_AUDIOS];
     es_out_id_t      *p_es_telx;
-};
+} demux_sys_t;
 
 static int Control( demux_t *, int, va_list );
 static int DemuxControl( demux_t *, int, va_list );
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index cdc3741f35..1164c376bd 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -194,6 +194,7 @@ class RTSPClientVlc;
 #define CAP_SUBSESSION_PAUSE    (1 << 3)
 #define CAPS_DEFAULT            CAP_RATE_CONTROL
 
+namespace { // for ODR
 struct demux_sys_t
 {
     char            *p_sdp;    /* XXX mallocated */
@@ -242,7 +243,7 @@ struct demux_sys_t
 
     float            f_seek_request;/* In case we receive a seek request while paused*/
 };
-
+} // namespace
 
 class RTSPClientVlc : public RTSPClient
 {
diff --git a/modules/access/oss.c b/modules/access/oss.c
index aa03f6e4aa..44b8b17c17 100644
--- a/modules/access/oss.c
+++ b/modules/access/oss.c
@@ -108,7 +108,7 @@ struct buffer_t
     size_t  length;
 };
 
-struct demux_sys_t
+typedef struct
 {
     const char *psz_device;  /* OSS device from MRL */
 
@@ -122,7 +122,7 @@ struct demux_sys_t
     es_out_id_t *p_es;
 
     int64_t i_next_demux_date; /* Used to handle oss:// as input-slave properly */
-};
+} demux_sys_t;
 
 static int FindMainDevice( demux_t *p_demux )
 {
diff --git a/modules/access/pulse.c b/modules/access/pulse.c
index a5808ae387..f3ec93a498 100644
--- a/modules/access/pulse.c
+++ b/modules/access/pulse.c
@@ -50,7 +50,7 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
 vlc_module_end ()
 
-struct demux_sys_t
+typedef struct
 {
     pa_stream *stream; /**< PulseAudio playback stream object */
     pa_context *context; /**< PulseAudio connection context */
@@ -60,7 +60,7 @@ struct demux_sys_t
     bool discontinuity; /**< The next block will not follow the last one */
     unsigned framesize; /**< Byte size of a sample */
     mtime_t caching; /**< Caching value */
-};
+} demux_sys_t;
 
 /* Stream helpers */
 static void stream_state_cb(pa_stream *s, void *userdata)
diff --git a/modules/access/rdp.c b/modules/access/rdp.c
index 8ecceb60a3..7ca36c7a8e 100644
--- a/modules/access/rdp.c
+++ b/modules/access/rdp.c
@@ -103,7 +103,7 @@ vlc_module_end()
 
 #define RDP_MAX_FD 32
 
-struct demux_sys_t
+typedef struct
 {
     vlc_thread_t thread;
     freerdp *p_instance;
@@ -121,7 +121,7 @@ struct demux_sys_t
     int i_port;
     /* cancelability */
     int i_cancel_state;
-};
+} demux_sys_t;
 
 /* context */
 
diff --git a/modules/access/rtp/rtp.h b/modules/access/rtp/rtp.h
index ccb176617d..50f3f50e49 100644
--- a/modules/access/rtp/rtp.h
+++ b/modules/access/rtp/rtp.h
@@ -62,7 +62,7 @@ void *rtp_dgram_thread (void *data);
 void *rtp_stream_thread (void *data);
 
 /* Global data */
-struct demux_sys_t
+typedef struct
 {
     rtp_session_t *session;
     struct vlc_demux_chained_t *chained_demux;
@@ -79,5 +79,5 @@ struct demux_sys_t
     uint8_t       max_src; /**< Max simultaneous RTP sources */
     bool          thread_ready;
     bool          autodetect; /**< Payload type autodetection pending */
-};
+} demux_sys_t;
 
diff --git a/modules/access/screen/screen.h b/modules/access/screen/screen.h
index cd5fe3b191..e0713d2d04 100644
--- a/modules/access/screen/screen.h
+++ b/modules/access/screen/screen.h
@@ -39,7 +39,7 @@
 
 typedef struct screen_data_t screen_data_t;
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t fmt;
     es_out_id_t *es;
@@ -73,7 +73,7 @@ struct demux_sys_t
 #endif
 
     screen_data_t *p_data;
-};
+} demux_sys_t;
 
 int      screen_InitCapture ( demux_t * );
 int      screen_CloseCapture( demux_t * );
diff --git a/modules/access/screen/wayland.c b/modules/access/screen/wayland.c
index c0505fbc52..7ba84443f8 100644
--- a/modules/access/screen/wayland.c
+++ b/modules/access/screen/wayland.c
@@ -41,7 +41,7 @@
 #include <vlc_fs.h>
 #include <vlc_plugin.h>
 
-struct demux_sys_t
+typedef struct
 {
     struct wl_display *display;
     struct wl_output *output;
@@ -62,7 +62,7 @@ struct demux_sys_t
     mtime_t start;
 
     vlc_thread_t thread;
-};
+} demux_sys_t;
 
 static bool DisplayError(vlc_object_t *obj, struct wl_display *display)
 {
diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c
index 1d7b16325f..47203d8d31 100644
--- a/modules/access/screen/xcb.c
+++ b/modules/access/screen/xcb.c
@@ -101,7 +101,7 @@ static int Control (demux_t *, int, va_list);
 static es_out_id_t *InitES (demux_t *, uint_fast16_t, uint_fast16_t,
                             uint_fast8_t, uint8_t *);
 
-struct demux_sys_t
+typedef struct
 {
     /* All owned by timer thread while timer is armed: */
     xcb_connection_t *conn; /**< XCB connection */
@@ -118,7 +118,7 @@ struct demux_sys_t
     uint16_t          cur_w, cur_h; /**< Actual capture pixel dimensions */
     /* Timer does not use this, only input thread: */
     vlc_timer_t       timer;
-};
+} demux_sys_t;
 
 /** Checks MIT-SHM shared memory support */
 static bool CheckSHM (xcb_connection_t *conn)
diff --git a/modules/access/shm.c b/modules/access/shm.c
index 740fc67098..1d19266204 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -110,6 +110,8 @@ vlc_module_begin ()
     add_shortcut ("shm")
 vlc_module_end ()
 
+typedef struct demux_sys_t demux_sys_t;
+
 static int Control (demux_t *, int, va_list);
 static void DemuxFile (void *);
 static void CloseFile (demux_sys_t *);
diff --git a/modules/access/timecode.c b/modules/access/timecode.c
index 97787468df..a319b75d2c 100644
--- a/modules/access/timecode.c
+++ b/modules/access/timecode.c
@@ -51,12 +51,12 @@ vlc_module_begin ()
         change_safe ()
 vlc_module_end ()
 
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *es;
     date_t date;
     mtime_t next_time;
-};
+} demux_sys_t;
 
 static int DemuxOnce (demux_t *demux, bool master)
 {
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index c30b16373f..99ec83f624 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -42,7 +42,7 @@
 
 #include "v4l2.h"
 
-struct demux_sys_t
+typedef struct
 {
     int fd;
     vlc_thread_t thread;
@@ -62,7 +62,7 @@ struct demux_sys_t
 #ifdef ZVBI_COMPILED
     vlc_v4l2_vbi_t *vbi;
 #endif
-};
+} demux_sys_t;
 
 static void *UserPtrThread (void *);
 static void *MmapThread (void *);
diff --git a/modules/access/v4l2/radio.c b/modules/access/v4l2/radio.c
index c91ee2a512..bc458f71b9 100644
--- a/modules/access/v4l2/radio.c
+++ b/modules/access/v4l2/radio.c
@@ -30,12 +30,12 @@
 
 #include "v4l2.h"
 
-struct demux_sys_t
+typedef struct
 {
     int fd;
     vlc_v4l2_ctrl_t *controls;
     mtime_t start;
-};
+} demux_sys_t;
 
 static int RadioControl (demux_t *demux, int query, va_list args)
 {
diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index 8f3ed54f20..7716071b1f 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -109,7 +109,7 @@ vlc_module_begin()
     set_callbacks( Open, Close )
 vlc_module_end()
 
-struct demux_sys_t
+typedef struct
 {
     vlc_thread_t thread;
     int i_cancel_state;
@@ -123,7 +123,7 @@ struct demux_sys_t
     mtime_t i_starttime;
 
     es_out_id_t *es;
-};
+} demux_sys_t;
 
 static void *DemuxThread( void *p_data );
 
diff --git a/modules/access/wasapi.c b/modules/access/wasapi.c
index 58ee86c959..0aa6cb6d52 100644
--- a/modules/access/wasapi.c
+++ b/modules/access/wasapi.c
@@ -267,7 +267,7 @@ static es_out_id_t *CreateES(demux_t *demux, IAudioClient *client, bool loop,
     return es_out_Add(demux->out, &fmt);
 }
 
-struct demux_sys_t
+typedef struct
 {
     IAudioClient *client;
     es_out_id_t *es;
@@ -281,7 +281,7 @@ struct demux_sys_t
         HANDLE thread;
         HANDLE ready;
     };
-};
+} demux_sys_t;
 
 static unsigned __stdcall Thread(void *data)
 {
diff --git a/modules/demux/adaptive/adaptive.cpp b/modules/demux/adaptive/adaptive.cpp
index 3cab4dd13b..0c40d55b28 100644
--- a/modules/demux/adaptive/adaptive.cpp
+++ b/modules/demux/adaptive/adaptive.cpp
@@ -239,7 +239,7 @@ static int Open(vlc_object_t *p_obj)
         return VLC_EGENERIC;
     }
 
-    p_demux->p_sys         = reinterpret_cast<demux_sys_t *>(p_manager);
+    p_demux->p_sys         = p_manager;
     p_demux->pf_demux      = p_manager->demux_callback;
     p_demux->pf_control    = p_manager->control_callback;
 
diff --git a/modules/demux/aiff.c b/modules/demux/aiff.c
index aa460b77c8..d23b5e150a 100644
--- a/modules/demux/aiff.c
+++ b/modules/demux/aiff.c
@@ -57,7 +57,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t  fmt;
     es_out_id_t *es;
@@ -74,7 +74,7 @@ struct demux_sys_t
     int         i_ssnd_fsize;
 
     int64_t     i_time;
-};
+} demux_sys_t;
 
 static int Demux  ( demux_t *p_demux );
 static int Control( demux_t *p_demux, int i_query, va_list args );
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index d17fb5e2db..db8809acb8 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -107,7 +107,7 @@ typedef struct
 
 } asf_track_t;
 
-struct demux_sys_t
+typedef struct
 {
     mtime_t             i_time;     /* s */
     mtime_t             i_sendtime;
@@ -136,7 +136,7 @@ struct demux_sys_t
     asf_packet_sys_t    packet_sys;
 
     vlc_meta_t          *meta;
-};
+} demux_sys_t;
 
 static int      DemuxInit( demux_t * );
 static void     DemuxEnd( demux_t * );
diff --git a/modules/demux/au.c b/modules/demux/au.c
index 0cda4bf73e..938921707f 100644
--- a/modules/demux/au.c
+++ b/modules/demux/au.c
@@ -81,7 +81,7 @@ enum AuCat_e
     AU_CAT_ADPCM    = 2
 };
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t     fmt;
     es_out_id_t     *es;
@@ -92,7 +92,7 @@ struct demux_sys_t
     mtime_t         i_frame_length;
 
     uint32_t        i_header_size;
-};
+} demux_sys_t;
 
 static int Demux( demux_t * );
 static int Control ( demux_t *, int i_query, va_list args );
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 04dbb810f6..756962c525 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -61,7 +61,7 @@ struct avformat_track_s
 /*****************************************************************************
  * demux_sys_t: demux descriptor
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     AVInputFormat  *fmt;
     AVFormatContext *ic;
@@ -80,7 +80,7 @@ struct demux_sys_t
     input_title_t *p_title;
     int i_seekpoint;
     unsigned i_update;
-};
+} demux_sys_t;
 
 #define AVFORMAT_IOBUFFER_SIZE 32768  /* FIXME */
 
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 575bc96826..23cc585c0d 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -168,7 +168,7 @@ typedef struct
 
 } avi_track_t;
 
-struct demux_sys_t
+typedef struct
 {
     mtime_t i_time;
     mtime_t i_length;
@@ -195,7 +195,7 @@ struct demux_sys_t
 
     unsigned int       i_attachment;
     input_attachment_t **attachment;
-};
+} demux_sys_t;
 
 #define __EVEN(x) (((x) & 1) ? (x) + 1 : (x))
 
diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index 8273efcca2..5c70667b51 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -79,7 +79,7 @@ typedef struct packet_table_t
     uint64_t i_descriptions_start;
 } packet_table_t;
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t  fmt;
     es_out_id_t *es;
@@ -90,7 +90,7 @@ struct demux_sys_t
 
     frame_span_t position;
     packet_table_t packet_table;
-};
+} demux_sys_t;
 
 /*
  We use this value to indicate that the data section extends until the end of the file.
diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c
index 5f958bee68..afd57224eb 100644
--- a/modules/demux/cdg.c
+++ b/modules/demux/cdg.c
@@ -54,13 +54,13 @@ vlc_module_end ()
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int i_query, va_list args );
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t     fmt;
     es_out_id_t     *p_es;
 
     date_t          pts;
-};
+} demux_sys_t;
 
 #define CDG_FRAME_SIZE (96)
 #define CDG_FRAME_RATE (75)
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 559bede0ae..c5900c26ed 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -70,7 +70,7 @@ typedef struct
     uint64_t i_byte_offset;
 } flac_seekpoint_t;
 
-struct demux_sys_t
+typedef struct
 {
     bool  b_start;
     int   i_next_block_flags;
@@ -102,7 +102,7 @@ struct demux_sys_t
     input_attachment_t **attachments;
     int                i_cover_idx;
     int                i_cover_score;
-};
+} demux_sys_t;
 
 #define FLAC_PACKET_SIZE 16384
 #define FLAC_MAX_PREROLL      (CLOCK_FREQ * 4)
diff --git a/modules/demux/gme.c b/modules/demux/gme.c
index 6154ed9581..e0d8788da3 100644
--- a/modules/demux/gme.c
+++ b/modules/demux/gme.c
@@ -49,7 +49,7 @@ vlc_module_end ()
 
 #define RATE 48000
 
-struct demux_sys_t
+typedef struct
 {
     Music_Emu   *emu;
     unsigned     track_id;
@@ -60,7 +60,7 @@ struct demux_sys_t
     input_title_t **titlev;
     unsigned        titlec;
     bool            title_changed;
-};
+} demux_sys_t;
 
 
 static int Demux (demux_t *);
diff --git a/modules/demux/image.c b/modules/demux/image.c
index 7b7604156f..4ea027b9d1 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -98,7 +98,7 @@ vlc_module_end()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     block_t     *data;
     es_out_id_t *es;
@@ -107,7 +107,7 @@ struct demux_sys_t
     mtime_t     pts_origin;
     mtime_t     pts_next;
     date_t        pts;
-};
+} demux_sys_t;
 
 static block_t *Load(demux_t *demux)
 {
diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 2d7dde7c3c..cb7096356e 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -65,7 +65,7 @@ static int MimeDemux( demux_t * );
 static int MjpgDemux( demux_t * );
 static int Control( demux_t *, int i_query, va_list args );
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t     fmt;
     es_out_id_t     *p_es;
@@ -79,7 +79,7 @@ struct demux_sys_t
     const uint8_t   *p_peek;
     int             i_data_peeked;
     int             i_level;
-};
+} demux_sys_t;
 
 /*****************************************************************************
  * Peek: Helper function to peek data with incremental size.
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..9fcaa5a12c 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;
 
@@ -85,7 +87,7 @@ protected:
 class dvd_command_interpretor_c
 {
 public:
-    dvd_command_interpretor_c( demux_sys_t & demuxer )
+    dvd_command_interpretor_c( mkv::demux_sys_t & demuxer )
     :sys( demuxer )
     {
         memset( p_PRMs, 0, sizeof(p_PRMs) );
@@ -188,7 +190,7 @@ protected:
     }
 
     uint16       p_PRMs[256];
-    demux_sys_t  & sys;
+    mkv::demux_sys_t  & sys;
 
     // DVD command IDs
 
@@ -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 39320bda3b..d3626e42aa 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -25,6 +25,7 @@
 #ifndef VLC_MKV_MATROSKA_SEGMENT_HPP_
 #define VLC_MKV_MATROSKA_SEGMENT_HPP_
 
+#include "demux.hpp"
 #include "mkv.hpp"
 #include "matroska_segment_seeker.hpp"
 #include <vector>
@@ -36,6 +37,8 @@
 
 #include "Ebml_parser.hpp"
 
+namespace mkv {
+
 class EbmlParser;
 
 class chapter_edition_c;
@@ -176,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..031e51d928 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -41,14 +41,16 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+namespace mkv {
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
+} // namespace
 
 vlc_module_begin ()
     set_shortname( "Matroska" )
     set_description( N_("Matroska stream demuxer" ) )
     set_capability( "demux", 50 )
-    set_callbacks( Open, Close )
+    set_callbacks( mkv::Open, mkv::Close )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
 
@@ -79,6 +81,8 @@ vlc_module_begin ()
     add_shortcut( "mka", "mkv" )
 vlc_module_end ()
 
+namespace mkv {
+
 struct demux_sys_t;
 
 static int  Demux  ( demux_t * );
@@ -900,3 +904,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/mod.c b/modules/demux/mod.c
index eb513aba3d..bf3b4138e3 100644
--- a/modules/demux/mod.c
+++ b/modules/demux/mod.c
@@ -109,7 +109,7 @@ vlc_module_end ()
  *****************************************************************************/
 static vlc_mutex_t libmodplug_lock = VLC_STATIC_MUTEX;
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t  fmt;
     es_out_id_t *es;
@@ -120,7 +120,7 @@ struct demux_sys_t
     int         i_data;
     uint8_t     *p_data;
     ModPlugFile *f;
-};
+} demux_sys_t;
 
 static int Demux  ( demux_t *p_demux );
 static int Control( demux_t *p_demux, int i_query, va_list args );
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index f1adc2de30..4b7cd8f244 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -88,7 +88,7 @@ static int   DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;}
 static int   DemuxFrag( demux_t * );
 static int   Control ( demux_t *, int, va_list );
 
-struct demux_sys_t
+typedef struct
 {
     MP4_Box_t    *p_root;      /* container for the whole file */
 
@@ -141,7 +141,7 @@ struct demux_sys_t
     } hacks;
 
     mp4_fragments_index_t *p_fragsindex;
-};
+} demux_sys_t;
 
 #define DEMUX_INCREMENT (CLOCK_FREQ / 4) /* How far the pcr will go, each round */
 #define DEMUX_TRACK_MAX_PRELOAD (CLOCK_FREQ * 15) /* maximum preloading, to deal with interleaving */
diff --git a/modules/demux/mpc.c b/modules/demux/mpc.c
index 1635b8874f..df6259cc47 100644
--- a/modules/demux/mpc.c
+++ b/modules/demux/mpc.c
@@ -73,7 +73,7 @@ vlc_module_end ()
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int, va_list );
 
-struct demux_sys_t
+typedef struct
 {
     /* */
     es_out_id_t   *p_es;
@@ -89,7 +89,7 @@ struct demux_sys_t
 
     /* */
     int64_t        i_position;
-};
+} demux_sys_t;
 
 #ifndef HAVE_MPC_MPCDEC_H
 static mpc_int32_t ReaderRead( void *p_private, void *dst, mpc_int32_t i_size );
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 4710a2894a..829fbf126d 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -119,7 +119,7 @@ typedef struct
     sync_table_ctx_t current;
 } sync_table_t;
 
-struct demux_sys_t
+typedef struct
 {
     codec_t codec;
     vlc_fourcc_t i_original;
@@ -161,7 +161,7 @@ struct demux_sys_t
     float rgf_replay_peak[AUDIO_REPLAY_GAIN_MAX];
 
     sync_table_t mllt;
-};
+} demux_sys_t;
 
 static int MpgaProbe( demux_t *p_demux, int64_t *pi_offset );
 static int MpgaInit( demux_t *p_demux );
diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index 3072551a5b..6c1c45951c 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -73,7 +73,7 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *p_es;
 
@@ -82,7 +82,7 @@ struct demux_sys_t
     unsigned    frame_rate_den;
 
     decoder_t *p_packetizer;
-};
+} demux_sys_t;
 
 static int Demux( demux_t * );
 static int Control( demux_t *, int, va_list );
diff --git a/modules/demux/mpeg/mpgv.c b/modules/demux/mpeg/mpgv.c
index 47be270dbe..3fc7ee724b 100644
--- a/modules/demux/mpeg/mpgv.c
+++ b/modules/demux/mpeg/mpgv.c
@@ -52,14 +52,14 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     bool  b_start;
 
     es_out_id_t *p_es;
 
     decoder_t *p_packetizer;
-};
+} demux_sys_t;
 
 static int Demux( demux_t * );
 static int Control( demux_t *, int, va_list );
diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index e4ad557993..fc8b305556 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -82,7 +82,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
-struct demux_sys_t
+typedef struct
 {
     ps_psm_t    psm;
     ps_track_t  tk[PS_TK_COUNT];
@@ -114,7 +114,7 @@ struct demux_sys_t
     int         current_title;
     int         current_seekpoint;
     unsigned    updates;
-};
+} demux_sys_t;
 
 static int Demux  ( demux_t *p_demux );
 static int Control( demux_t *p_demux, int i_query, va_list args );
diff --git a/modules/demux/mpeg/ts_pid.h b/modules/demux/mpeg/ts_pid.h
index c61256ae09..d727adf2e3 100644
--- a/modules/demux/mpeg/ts_pid.h
+++ b/modules/demux/mpeg/ts_pid.h
@@ -26,6 +26,8 @@
 
 #include "ts_streams.h"
 
+typedef struct demux_sys_t demux_sys_t;
+
 typedef enum
 {
     TYPE_FREE = 0,
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index ebb9097d20..a3d61de398 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -58,7 +58,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t  fmt_audio;
     es_out_id_t *p_audio;
@@ -74,7 +74,7 @@ struct demux_sys_t
     int64_t     i_pcr_inc;
 
     bool b_start_record;
-};
+} demux_sys_t;
 
 static int Demux  ( demux_t *p_demux );
 static int Control( demux_t *p_demux, int i_query, va_list args );
diff --git a/modules/demux/nuv.c b/modules/demux/nuv.c
index 40f7b4b60a..a14f91a91f 100644
--- a/modules/demux/nuv.c
+++ b/modules/demux/nuv.c
@@ -170,7 +170,7 @@ typedef struct
 
 } extended_header_t;
 
-struct demux_sys_t
+typedef struct
 {
     header_t          hdr;
     extended_header_t exh;
@@ -192,7 +192,7 @@ struct demux_sys_t
     int64_t i_total_length;
     /* first frame position (used for calculating size without seektable) */
     int i_first_frame_offset;
-};
+} demux_sys_t;
 
 static int HeaderLoad( demux_t *, header_t *h );
 static int FrameHeaderLoad( demux_t *, frame_header_t *h );
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index bed61065a2..4b7d6d256c 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -169,7 +169,7 @@ struct ogg_skeleton_t
     int64_t        i_indexlastnum;
 };
 
-struct demux_sys_t
+typedef struct
 {
     ogg_sync_state oy;        /* sync and verify incoming physical bitstream */
 
@@ -236,7 +236,7 @@ struct demux_sys_t
 
     bool b_slave;
 
-};
+} demux_sys_t;
 
 
 unsigned const char * Read7BitsVariableLE( unsigned const char *,
diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c
index af4b3fe832..4153f41944 100644
--- a/modules/demux/playlist/sgimb.c
+++ b/modules/demux/playlist/sgimb.c
@@ -111,7 +111,7 @@
  *****************************************************************************/
 #define MAX_LINE 1024
 
-struct demux_sys_t
+typedef struct
 {
     char        *psz_uri;       /* Stream= or sgiQTFileBegin rtsp link */
     char        *psz_server;    /* sgiNameServerHost= */
@@ -127,7 +127,7 @@ struct demux_sys_t
     int         i_sid;          /* sgiSid= */
     bool  b_concert;      /* DeliveryService=cds */
     bool  b_rtsp_kasenna; /* kasenna style RTSP */
-};
+} demux_sys_t;
 
 static int ReadDir( stream_t *, input_item_node_t * );
 
diff --git a/modules/demux/pva.c b/modules/demux/pva.c
index 8eb52924f4..2089f90ab8 100644
--- a/modules/demux/pva.c
+++ b/modules/demux/pva.c
@@ -52,7 +52,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *p_video;
     es_out_id_t *p_audio;
@@ -66,7 +66,7 @@ struct demux_sys_t
     block_t     *p_es;  /* video */
 
     int64_t     b_pcr_audio;
-};
+} demux_sys_t;
 
 static int  Demux   ( demux_t *p_demux );
 static int  Control ( demux_t *p_demux, int i_query, va_list args );
diff --git a/modules/demux/rawaud.c b/modules/demux/rawaud.c
index 375bdb1244..a5b36b2428 100644
--- a/modules/demux/rawaud.c
+++ b/modules/demux/rawaud.c
@@ -80,7 +80,7 @@ vlc_module_end();
 /*****************************************************************************
  * Definitions of structures used by this plugin
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *p_es;
     es_format_t  fmt;
@@ -88,7 +88,7 @@ struct demux_sys_t
     unsigned int i_frame_samples;
     unsigned int i_seek_step;
     date_t       pts;
-};
+} demux_sys_t;
 
 
 /*****************************************************************************
diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c
index c081982f69..25f1141828 100644
--- a/modules/demux/rawdv.c
+++ b/modules/demux/rawdv.c
@@ -93,7 +93,7 @@ typedef struct {
     int8_t ap3;
 } dv_header_t;
 
-struct demux_sys_t
+typedef struct
 {
     int    frame_size;
 
@@ -110,7 +110,7 @@ struct demux_sys_t
     /* program clock reference (in units of 90kHz) */
     mtime_t i_pcr;
     bool b_hurry_up;
-};
+} demux_sys_t;
 
 /*****************************************************************************
  * Local prototypes
diff --git a/modules/demux/rawvid.c b/modules/demux/rawvid.c
index 08882e2e18..9cb45651c8 100644
--- a/modules/demux/rawvid.c
+++ b/modules/demux/rawvid.c
@@ -79,7 +79,7 @@ vlc_module_end ()
 /*****************************************************************************
  * Definitions of structures used by this plugin
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     int    frame_size;
 
@@ -89,7 +89,7 @@ struct demux_sys_t
     date_t pcr;
 
     bool b_y4m;
-};
+} demux_sys_t;
 
 /*****************************************************************************
  * Local prototypes
diff --git a/modules/demux/real.c b/modules/demux/real.c
index 9cf2bbda13..7b810cae10 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -117,7 +117,7 @@ typedef struct
     uint32_t i_frame_index;
 } real_index_t;
 
-struct demux_sys_t
+typedef struct
 {
     int64_t  i_data_offset;
     int64_t  i_data_size;
@@ -145,7 +145,7 @@ struct demux_sys_t
     int64_t     i_index_offset;
     bool        b_seek;
     real_index_t *p_index;
-};
+} demux_sys_t;
 
 static const unsigned char i_subpacket_size_sipr[4] = { 29, 19, 37, 20 };
 
diff --git a/modules/demux/sid.cpp b/modules/demux/sid.cpp
index f9362d0a5c..be33f35288 100644
--- a/modules/demux/sid.cpp
+++ b/modules/demux/sid.cpp
@@ -57,7 +57,8 @@ 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;
@@ -73,7 +74,7 @@ struct demux_sid
     int last_title;
     bool title_changed;
 };
-
+} // namespace
 
 static int Demux (demux_t *);
 static int Control (demux_t *, int, va_list);
@@ -81,7 +82,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 +125,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;
 
@@ -177,7 +178,7 @@ static int Open (vlc_object_t *obj)
     /* Callbacks */
     demux->pf_demux = Demux;
     demux->pf_control = Control;
-    demux->p_sys = reinterpret_cast<demux_sys_t*>(sys);
+    demux->p_sys = sys;
 
     return VLC_SUCCESS;
 
@@ -194,7 +195,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 +205,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 +236,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/demux/smf.c b/modules/demux/smf.c
index cc977fc35e..35fa8833a4 100644
--- a/modules/demux/smf.c
+++ b/modules/demux/smf.c
@@ -91,7 +91,7 @@ static int ReadDeltaTime (stream_t *s, mtrk_t *track)
     return 0;
 }
 
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *es;
     date_t       pts; /*< Play timestamp */
@@ -104,7 +104,7 @@ struct demux_sys_t
 
     unsigned     trackc; /*< Number of tracks */
     mtrk_t       trackv[]; /*< Track states */
-};
+} demux_sys_t;
 
 /**
  * Non-MIDI Meta events handler
diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index 18b07e9d66..d53b750d02 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -58,7 +58,8 @@ typedef struct {
     size_t  count;
 } stl_entry_t;
 
-struct demux_sys_t {
+typedef struct
+{
     size_t      count;
     stl_entry_t *index;
 
@@ -68,7 +69,7 @@ struct demux_sys_t {
     int64_t     next_date;
     bool        b_slave;
     bool        b_first_time;
-};
+} demux_sys_t;
 
 static size_t ParseInteger(uint8_t *data, size_t size)
 {
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 35f6e81ec2..f9a10d963a 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -166,7 +166,7 @@ typedef struct
 
 } subs_properties_t;
 
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *es;
     bool        b_slave;
@@ -187,7 +187,7 @@ struct demux_sys_t
     subs_properties_t props;
 
     block_t * (*pf_convert)( const subtitle_t * );
-};
+} demux_sys_t;
 
 static int  ParseMicroDvd   ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
 static int  ParseSubRip     ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
diff --git a/modules/demux/tta.c b/modules/demux/tta.c
index 83878b3543..7853180581 100644
--- a/modules/demux/tta.c
+++ b/modules/demux/tta.c
@@ -60,7 +60,7 @@ vlc_module_end ()
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int, va_list );
 
-struct demux_sys_t
+typedef struct
 {
     /* */
     es_out_id_t *p_es;
@@ -75,7 +75,7 @@ struct demux_sys_t
     /* */
     vlc_meta_t     *p_meta;
     int64_t        i_start;
-};
+} demux_sys_t;
 
 /*****************************************************************************
  * Open: initializes ES structures
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 88dbff268c..ace89eb2be 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -41,7 +41,7 @@
 
 //#define TTML_DEMUX_DEBUG
 
-struct demux_sys_t
+typedef struct
 {
     xml_t*          p_xml;
     xml_reader_t*   p_reader;
@@ -65,7 +65,7 @@ struct demux_sys_t
         size_t   i_count;
         size_t   i_current;
     } times;
-};
+} demux_sys_t;
 
 static char *tt_genTiming( tt_time_t t )
 {
diff --git a/modules/demux/ty.c b/modules/demux/ty.c
index b08217564e..fc963ce345 100644
--- a/modules/demux/ty.c
+++ b/modules/demux/ty.c
@@ -212,7 +212,7 @@ typedef struct
 
 } xds_t;
 
-struct demux_sys_t
+typedef struct
 {
   es_out_id_t *p_video;               /* ptr to video codec */
   es_out_id_t *p_audio;               /* holds either ac3 or mpeg codec ptr */
@@ -254,7 +254,7 @@ struct demux_sys_t
   ty_seq_table_t  *seq_table;         /* table of SEQ entries from mstr chk */
   bool      eof;
   bool      b_first_chunk;
-};
+} demux_sys_t;
 
 static int get_chunk_header(demux_t *);
 static mtime_t get_pts( const uint8_t *buf );
diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c
index 41d2366921..08be4ebf38 100644
--- a/modules/demux/vc1.c
+++ b/modules/demux/vc1.c
@@ -57,14 +57,14 @@ vlc_module_end ()
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-struct demux_sys_t
+typedef struct
 {
     mtime_t     i_dts;
     es_out_id_t *p_es;
 
     float       f_fps;
     decoder_t *p_packetizer;
-};
+} demux_sys_t;
 
 static int Demux( demux_t * );
 static int Control( demux_t *, int, va_list );
diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index 3f1257633d..22d1ae2fb8 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -87,7 +87,7 @@ typedef struct
     int64_t     i_delay;
 } vobsub_track_t;
 
-struct demux_sys_t
+typedef struct
 {
     int64_t        i_next_demux_date;
     int64_t        i_length;
@@ -103,7 +103,7 @@ struct demux_sys_t
     int            i_original_frame_height;
     bool           b_palette;
     uint32_t       palette[16];
-};
+} demux_sys_t;
 
 
 static int Demux( demux_t * );
diff --git a/modules/demux/voc.c b/modules/demux/voc.c
index 33e6ecf958..839b18c094 100644
--- a/modules/demux/voc.c
+++ b/modules/demux/voc.c
@@ -53,7 +53,7 @@ vlc_module_end ()
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int i_query, va_list args );
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t     fmt;
     es_out_id_t     *p_es;
@@ -66,7 +66,7 @@ struct demux_sys_t
     unsigned        i_silence_countdown;
 
     date_t          pts;
-};
+} demux_sys_t;
 
 static const char ct_header[] = "Creative Voice File\x1a";
 
diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index ab94767f06..5c4083c2fd 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -62,7 +62,7 @@ vlc_module_end ()
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int i_query, va_list args );
 
-struct demux_sys_t
+typedef struct
 {
     es_format_t     fmt;
     es_out_id_t     *p_es;
@@ -78,7 +78,7 @@ struct demux_sys_t
     uint32_t i_channel_mask;
     uint8_t i_chans_to_reorder;            /* do we need channel reordering */
     uint8_t pi_chan_table[AOUT_CHAN_MAX];
-};
+} demux_sys_t;
 
 static int ChunkFind( demux_t *, const char *, unsigned int * );
 
diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index bbb822722a..85311b2494 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -42,7 +42,7 @@ struct index_entry_s
     unsigned active;
 };
 
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t *es;
     bool         b_slave;
@@ -72,7 +72,7 @@ struct demux_sys_t
     } index;
 
     webvtt_text_parser_t *p_streamparser;
-};
+} demux_sys_t;
 
 #define WEBVTT_PREALLOC 64
 
diff --git a/modules/demux/xa.c b/modules/demux/xa.c
index c55632e3b1..6d1f86f376 100644
--- a/modules/demux/xa.c
+++ b/modules/demux/xa.c
@@ -54,7 +54,7 @@ vlc_module_end ()
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int i_query, va_list args );
 
-struct demux_sys_t
+typedef struct
 {
     es_out_id_t     *p_es;
 
@@ -64,7 +64,7 @@ struct demux_sys_t
     unsigned int    i_bitrate;
 
     date_t          pts;
-};
+} demux_sys_t;
 
 typedef struct xa_header_t
 {
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index 4d02a307d9..703910fd56 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -133,13 +133,13 @@ static int OpenEncoder ( vlc_object_t *p_this )
 #endif
 
 /*** Demuxer ***/
-struct demux_sys_t
+typedef struct
 {
     es_format_t     fmt;
     es_out_id_t     *p_es;
 
     date_t          pts;
-};
+} demux_sys_t;
 
 static int Demux( demux_t *p_demux )
 {
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 2726086af4..ae7c1d7a01 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -230,10 +230,10 @@ struct services_discovery_sys_t
     int i_timeout;
 };
 
-struct demux_sys_t
+typedef struct
 {
     sdp_t *p_sdp;
-};
+} demux_sys_t;
 
 /*****************************************************************************
  * Local prototypes
diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index bcd379f330..a5b30eb8c4 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -493,7 +493,6 @@ int Open(vlc_object_t *p_this)
         return VLC_ENOMEM;
 
     p_demux->p_sys = p_sys;
-    p_demux->p_sys = reinterpret_cast<demux_sys_t*>(p_sys);
     p_demux->pf_demux = Demux;
     p_demux->pf_control = Control;
 
-- 
2.17.0



More information about the vlc-devel mailing list