[vlc-devel] [PATCH 11/34] mkv: removed manual memory management from mkv_track_t
Filip Roséen
filip at videolabs.io
Fri May 6 19:08:50 CEST 2016
Minor transformation from being a plain-old-data entity to a "proper"
C++ class where manual memory management has been removed and replaced
with std::string, as well as removal of unused members.
---
modules/demux/mkv/matroska_segment_parse.cpp | 4 +-
modules/demux/mkv/mkv.hpp | 84 +++++++++++++---------------
2 files changed, 42 insertions(+), 46 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 4591a01..4916310 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -379,8 +379,8 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
}
E_CASE( KaxCodecName, cname )
{
- vars.tk->psz_codec_name = ToUTF8( UTFstring( cname ) );
- debug( vars, "Track Codec Name=%s", vars.tk->psz_codec_name ) ;
+ vars.tk->str_codec_name = static_cast<UTFstring const&>( cname ).GetUTF8();
+ debug( vars, "Track Codec Name=%s", vars.tk->str_codec_name.c_str() ) ;
}
//AttachmentLink
E_CASE( KaxCodecDecodeAll, cdall ) // UNUSED
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index c55a83a..64a5dff 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -178,63 +178,59 @@ public:
virtual int32_t Init() { return 0; }
};
-struct mkv_track_t
+class mkv_track_t
{
- bool b_default;
- bool b_enabled;
- bool b_forced;
- unsigned int i_number;
+ public:
+ typedef unsigned int track_id_t;
- unsigned int i_extra_data;
- uint8_t *p_extra_data;
+ bool b_default;
+ bool b_enabled;
+ bool b_forced;
+ track_id_t i_number;
- char *psz_codec;
- bool b_dts_only;
- bool b_pts_only;
+ unsigned int i_extra_data;
+ uint8_t *p_extra_data;
- bool b_no_duration;
- uint64_t i_default_duration;
- float f_timecodescale;
- mtime_t i_last_dts;
+ char *psz_codec;
+ bool b_dts_only;
+ bool b_pts_only;
- /* video */
- es_format_t fmt;
- float f_fps;
- es_out_id_t *p_es;
+ bool b_no_duration;
+ uint64_t i_default_duration;
+ float f_timecodescale;
+ mtime_t i_last_dts;
+ uint64_t i_skip_until_fpos;
- /* audio */
- unsigned int i_original_rate;
- uint8_t i_chans_to_reorder; /* do we need channel reordering */
- uint8_t pi_chan_table[AOUT_CHAN_MAX];
+ /* video */
+ es_format_t fmt;
+ float f_fps;
+ es_out_id_t *p_es;
+ /* audio */
+ unsigned int i_original_rate;
+ uint8_t i_chans_to_reorder; /* do we need channel reordering */
+ uint8_t pi_chan_table[AOUT_CHAN_MAX];
- /* Private track paramters */
- PrivateTrackData *p_sys;
- bool b_inited;
- /* data to be send first */
- int i_data_init;
- uint8_t *p_data_init;
+ /* Private track paramters */
+ PrivateTrackData *p_sys;
- /* hack : it's for seek */
- bool b_search_keyframe;
- bool b_silent;
+ bool b_inited;
+ /* data to be send first */
+ int i_data_init;
+ uint8_t *p_data_init;
- /* informative */
- const char *psz_codec_name;
- const char *psz_codec_settings;
- const char *psz_codec_info_url;
- const char *psz_codec_download_url;
+ /* informative */
+ std::string str_codec_name;
- /* encryption/compression */
- int i_compression_type;
- uint32_t i_encoding_scope;
- KaxContentCompSettings *p_compression_data;
-
- /* Matroska 4 new elements used by Opus */
- mtime_t i_seek_preroll;
- mtime_t i_codec_delay;
+ /* encryption/compression */
+ int i_compression_type;
+ uint32_t i_encoding_scope;
+ KaxContentCompSettings *p_compression_data;
+ /* Matroska 4 new elements used by Opus */
+ mtime_t i_seek_preroll;
+ mtime_t i_codec_delay;
};
struct mkv_index_t
--
2.8.2
More information about the vlc-devel
mailing list