[vlc-devel] [PATCH 3/5] mkv: rename demux_sys_t to demux_mkv
Thomas Guillem
thomas at gllm.fr
Wed Mar 7 17:31:57 CET 2018
ODR related.
---
modules/demux/mkv/chapter_command.hpp | 18 +++++++++---------
modules/demux/mkv/demux.cpp | 26 +++++++++++++-------------
modules/demux/mkv/demux.hpp | 6 +++---
modules/demux/mkv/matroska_segment.cpp | 8 ++++----
modules/demux/mkv/matroska_segment.hpp | 4 ++--
modules/demux/mkv/mkv.cpp | 18 +++++++++---------
modules/demux/mkv/mkv.hpp | 2 ++
modules/demux/mkv/util.cpp | 2 +-
modules/demux/mkv/virtual_segment.cpp | 6 +++---
9 files changed, 46 insertions(+), 44 deletions(-)
diff --git a/modules/demux/mkv/chapter_command.hpp b/modules/demux/mkv/chapter_command.hpp
index f206e35b4b..8c31b5a5a2 100644
--- a/modules/demux/mkv/chapter_command.hpp
+++ b/modules/demux/mkv/chapter_command.hpp
@@ -38,12 +38,12 @@ const binary MATROSKA_DVD_LEVEL_PG = 0x18;
const binary MATROSKA_DVD_LEVEL_PTT = 0x10;
const binary MATROSKA_DVD_LEVEL_CN = 0x08;
-struct demux_sys_t;
+struct demux_mkv;
class chapter_codec_cmds_c
{
public:
- chapter_codec_cmds_c( demux_sys_t & demuxer, int codec_id = -1)
+ chapter_codec_cmds_c( demux_mkv & demuxer, int codec_id = -1)
:p_private_data(NULL)
,i_codec_id( codec_id )
,sys( demuxer )
@@ -78,14 +78,14 @@ protected:
std::vector<KaxChapterProcessData*> leave_cmds;
int i_codec_id;
- demux_sys_t & sys;
+ demux_mkv & sys;
};
class dvd_command_interpretor_c
{
public:
- dvd_command_interpretor_c( demux_sys_t & demuxer )
+ dvd_command_interpretor_c( demux_mkv & demuxer )
:sys( demuxer )
{
memset( p_PRMs, 0, sizeof(p_PRMs) );
@@ -188,7 +188,7 @@ protected:
}
uint16 p_PRMs[256];
- demux_sys_t & sys;
+ demux_mkv & sys;
// DVD command IDs
@@ -250,7 +250,7 @@ protected:
class dvd_chapter_codec_c : public chapter_codec_cmds_c
{
public:
- dvd_chapter_codec_c( demux_sys_t & sys )
+ dvd_chapter_codec_c( demux_mkv & sys )
:chapter_codec_cmds_c( sys, 1 )
{}
@@ -267,7 +267,7 @@ protected:
class matroska_script_interpretor_c
{
public:
- matroska_script_interpretor_c( demux_sys_t & demuxer )
+ matroska_script_interpretor_c( demux_mkv & demuxer )
:sys( demuxer )
{}
@@ -277,14 +277,14 @@ public:
static const std::string CMD_MS_GOTO_AND_PLAY;
protected:
- demux_sys_t & sys;
+ demux_mkv & sys;
};
class matroska_script_codec_c : public chapter_codec_cmds_c
{
public:
- matroska_script_codec_c( demux_sys_t & sys )
+ matroska_script_codec_c( demux_mkv & sys )
:chapter_codec_cmds_c( sys, 0 )
,interpretor( sys )
{}
diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index 5665af76ff..7aff70f29f 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -135,7 +135,7 @@ int event_thread_t::EventInput( vlc_object_t *p_this, char const *,
void event_thread_t::EventThread()
{
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
vlc_object_t *p_vout = NULL;
int canc = vlc_savecancel ();
@@ -428,7 +428,7 @@ void *event_thread_t::EventThread(void *data)
}
-demux_sys_t::~demux_sys_t()
+demux_mkv::~demux_mkv()
{
CleanUi();
size_t i;
@@ -449,7 +449,7 @@ demux_sys_t::~demux_sys_t()
}
-bool demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, matroska_stream_c *p_stream1 )
+bool demux_mkv::AnalyseAllSegmentsFound( demux_t *p_demux, matroska_stream_c *p_stream1 )
{
int i_upper_lvl = 0;
EbmlElement *p_l0;
@@ -554,7 +554,7 @@ bool demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, matroska_stream_c *
return true;
}
-void demux_sys_t::InitUi()
+void demux_mkv::InitUi()
{
msg_Dbg( &demuxer, "Starting the UI Hook" );
@@ -576,7 +576,7 @@ void demux_sys_t::InitUi()
p_ev = new event_thread_t(&demuxer);
}
-void demux_sys_t::CleanUi()
+void demux_mkv::CleanUi()
{
delete p_ev;
p_ev = NULL;
@@ -595,7 +595,7 @@ void demux_sys_t::CleanUi()
msg_Dbg( &demuxer, "Stopping the UI Hook" );
}
-void demux_sys_t::PreloadFamily( const matroska_segment_c & of_segment )
+void demux_mkv::PreloadFamily( const matroska_segment_c & of_segment )
{
for (size_t i=0; i<opened_segments.size(); i++)
{
@@ -604,7 +604,7 @@ void demux_sys_t::PreloadFamily( const matroska_segment_c & of_segment )
}
// preload all the linked segments for all preloaded segments
-bool demux_sys_t::PreloadLinked()
+bool demux_mkv::PreloadLinked()
{
size_t i, j, ij = 0;
virtual_segment_c *p_vseg;
@@ -703,7 +703,7 @@ bool demux_sys_t::PreloadLinked()
return true;
}
-void demux_sys_t::FreeUnused()
+void demux_mkv::FreeUnused()
{
for (std::vector<matroska_stream_c*>::reverse_iterator i = streams.rbegin();
i != streams.rend(); ++i)
@@ -729,7 +729,7 @@ void demux_sys_t::FreeUnused()
}
}
-bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_mk_date )
+bool demux_mkv::PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_mk_date )
{
if ( p_current_vsegment != &new_vsegment )
{
@@ -758,7 +758,7 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_m
return true;
}
-void demux_sys_t::JumpTo( virtual_segment_c & vsegment, virtual_chapter_c & vchapter )
+void demux_mkv::JumpTo( virtual_segment_c & vsegment, virtual_chapter_c & vchapter )
{
if ( !vchapter.p_chapter || !vchapter.p_chapter->Enter( true ) )
{
@@ -767,7 +767,7 @@ void demux_sys_t::JumpTo( virtual_segment_c & vsegment, virtual_chapter_c & vcha
}
}
-matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid ) const
+matroska_segment_c *demux_mkv::FindSegment( const EbmlBinary & uid ) const
{
for (size_t i=0; i<opened_segments.size(); i++)
{
@@ -777,7 +777,7 @@ matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid ) const
return NULL;
}
-virtual_chapter_c *demux_sys_t::BrowseCodecPrivate( unsigned int codec_id,
+virtual_chapter_c *demux_mkv::BrowseCodecPrivate( unsigned int codec_id,
bool (*match)(const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size ),
const void *p_cookie,
size_t i_cookie_size,
@@ -796,7 +796,7 @@ virtual_chapter_c *demux_sys_t::BrowseCodecPrivate( unsigned int codec_id,
return p_result;
}
-virtual_chapter_c *demux_sys_t::FindChapter( int64_t i_find_uid, virtual_segment_c * & p_vsegment_found )
+virtual_chapter_c *demux_mkv::FindChapter( int64_t i_find_uid, virtual_segment_c * & p_vsegment_found )
{
virtual_chapter_c *p_result = NULL;
for (size_t i=0; i<used_vsegments.size(); i++)
diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index c9cfe557c9..f51dc7c9d2 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -326,10 +326,10 @@ private:
};
-struct demux_sys_t
+struct demux_mkv
{
public:
- demux_sys_t( demux_t & demux )
+ demux_mkv( demux_t & demux )
:demuxer(demux)
,b_seekable(false)
,b_fastseekable(false)
@@ -350,7 +350,7 @@ public:
vlc_mutex_init( &lock_demuxer );
}
- virtual ~demux_sys_t();
+ virtual ~demux_mkv();
/* current data */
demux_t & demuxer;
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index eb97a1a91a..e01204f7fd 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -32,7 +32,7 @@
#include <new>
#include <iterator>
-matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estream, KaxSegment *p_seg )
+matroska_segment_c::matroska_segment_c( demux_mkv & demuxer, EbmlStream & estream, KaxSegment *p_seg )
:segment(p_seg)
,es(estream)
,i_timescale(MKVD_TIMECODESCALE)
@@ -275,7 +275,7 @@ bool matroska_segment_c::ParseSimpleTags( SimpleTag* pout_simple, KaxTagSimple *
{
matroska_segment_c * const obj;
EbmlParser * const ep;
- demux_sys_t & sys;
+ demux_mkv & sys;
SimpleTag & out;
int target_type;
} payload = { this, &ep, sys, *pout_simple, 50 };
@@ -357,7 +357,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
{
matroska_segment_c * const obj;
EbmlParser * const ep;
- demux_sys_t & sys;
+ demux_mkv & sys;
int target_type;
} payload = { this, &ep, sys, 50 };
MKV_SWITCH_CREATE( EbmlTypeDispatcher, KaxTagsHandler, TagsHandlerPayload )
@@ -371,7 +371,7 @@ void matroska_segment_c::LoadTags( KaxTags *tags )
{
matroska_segment_c * const obj;
EbmlParser * const ep;
- demux_sys_t & sys;
+ demux_mkv & sys;
Tag & tag;
int target_type;
} payload = { vars.obj, vars.ep, vars.sys, tag, 50 };
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index 39320bda3b..7be6c318a1 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -80,7 +80,7 @@ public:
typedef std::map<mkv_track_t::track_id_t, std::unique_ptr<mkv_track_t>> tracks_map_t;
typedef std::vector<Tag> tags_t;
- matroska_segment_c( demux_sys_t &, EbmlStream &, KaxSegment * );
+ matroska_segment_c( demux_mkv &, EbmlStream &, KaxSegment * );
virtual ~matroska_segment_c();
KaxSegment *segment;
@@ -131,7 +131,7 @@ public:
std::vector<KaxSegmentFamily*> families;
tags_t tags;
- demux_sys_t & sys;
+ demux_mkv & sys;
EbmlParser ep;
bool b_preloaded;
bool b_ref_external_segments;
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 9f0926a43d..84a7805eae 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -79,8 +79,6 @@ vlc_module_begin ()
add_shortcut( "mka", "mkv" )
vlc_module_end ()
-struct demux_sys_t;
-
static int Demux ( demux_t * );
static int Control( demux_t *, int, va_list );
static int Seek ( demux_t *, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_vchapter, bool b_precise = true );
@@ -91,7 +89,7 @@ static int Seek ( demux_t *, mtime_t i_mk_date, double f_percent, virtual_cha
static int Open( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t*)p_this;
- demux_sys_t *p_sys;
+ demux_mkv *p_sys;
matroska_stream_c *p_stream;
matroska_segment_c *p_segment;
const uint8_t *p_peek;
@@ -106,9 +104,11 @@ static int Open( vlc_object_t * p_this )
p_peek[2] != 0xdf || p_peek[3] != 0xa3 ) return VLC_EGENERIC;
/* Set the demux function */
+ p_sys = new demux_mkv( *p_demux );
+
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
- p_demux->p_sys = p_sys = new demux_sys_t( *p_demux );
+ p_demux->p_sys = reinterpret_cast<demux_sys_t*>(p_sys);
vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
if ( vlc_stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &p_sys->b_fastseekable ) )
@@ -261,7 +261,7 @@ error:
static void Close( vlc_object_t *p_this )
{
demux_t *p_demux = reinterpret_cast<demux_t*>( p_this );
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
virtual_segment_c *p_vsegment = p_sys->p_current_vsegment;
if( p_vsegment )
{
@@ -278,7 +278,7 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static int Control( demux_t *p_demux, int i_query, va_list args )
{
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
int64_t *pi64, i64;
double *pf, f;
int i_skp;
@@ -467,7 +467,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
/* Seek */
static int Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_vchapter, bool b_precise )
{
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
virtual_segment_c *p_vsegment = p_sys->p_current_vsegment;
matroska_segment_c *p_segment = p_vsegment->CurrentSegment();
@@ -508,7 +508,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
mtime_t i_pts, mtime_t i_duration, bool b_key_picture,
bool b_discardable_picture )
{
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
matroska_segment_c *p_segment = p_sys->p_current_vsegment->CurrentSegment();
if( !p_segment ) return;
@@ -696,7 +696,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
*****************************************************************************/
static int Demux( demux_t *p_demux)
{
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
vlc_mutex_locker demux_lock ( &p_sys->lock_demuxer );
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index c4da69c4f8..394df1b511 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -98,6 +98,8 @@
//# define MKV_DEBUG 0
#endif
+struct demux_mkv;
+
#define MATROSKA_COMPRESSION_NONE -1
#define MATROSKA_COMPRESSION_ZLIB 0
#define MATROSKA_COMPRESSION_BLIB 1
diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
index 386cb9b0a0..c6e26b22be 100644
--- a/modules/demux/mkv/util.cpp
+++ b/modules/demux/mkv/util.cpp
@@ -239,7 +239,7 @@ void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, m
void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, mtime_t i_duration )
{
- demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ demux_mkv *p_sys = reinterpret_cast<demux_mkv *>(p_demux->p_sys);
matroska_segment_c *p_segment = p_sys->p_current_vsegment->CurrentSegment();
if( p_tk->fmt.i_cat == AUDIO_ES && p_tk->i_chans_to_reorder )
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index d99e6ca646..e8cad12f9c 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -27,7 +27,7 @@
#include "demux.hpp"
-/* FIXME move this, it's demux_sys_t::FindSegment */
+/* FIXME move this, it's demux_mkv::FindSegment */
matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matroska_segment_c*> & segments )
{
for( size_t i = 0; i < segments.size(); i++ )
@@ -418,7 +418,7 @@ virtual_chapter_c* virtual_edition_c::getChapterbyTimecode( int64_t time )
bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
{
- demux_sys_t & sys = *(demux_sys_t *)demux.p_sys;
+ demux_mkv & sys = *(demux_mkv *)demux.p_sys;
virtual_chapter_c *p_cur_vchapter = NULL;
virtual_edition_c *p_cur_vedition = CurrentEdition();
@@ -511,7 +511,7 @@ bool virtual_chapter_c::EnterAndLeave( virtual_chapter_c *p_leaving_vchapter, bo
bool virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
virtual_chapter_c *p_vchapter, bool b_precise )
{
- demux_sys_t *p_sys = (demux_sys_t *)demuxer.p_sys;
+ demux_mkv *p_sys = (demux_mkv *)demuxer.p_sys;
/* find the actual time for an ordered edition */
--
2.11.0
More information about the vlc-devel
mailing list