From b9188c548e14fd9f1ec3dcc2e43ebf99ae8e4799 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 18 Nov 2010 13:10:57 +0100 Subject: [PATCH] MKV: Use new vlc_delete_all to clear containers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Duraffort --- modules/demux/mkv/chapters.cpp | 26 ++++++++------------------ modules/demux/mkv/matroska_segment.cpp | 25 +++++-------------------- 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/modules/demux/mkv/chapters.cpp b/modules/demux/mkv/chapters.cpp index 5b44e0d692..1e8025bbbf 100644 --- a/modules/demux/mkv/chapters.cpp +++ b/modules/demux/mkv/chapters.cpp @@ -28,18 +28,8 @@ chapter_item_c::~chapter_item_c() { - std::vector::iterator index = codecs.begin(); - while ( index != codecs.end() ) - { - delete (*index); - ++index; - } - std::vector::iterator index_ = sub_chapters.begin(); - while ( index_ != sub_chapters.end() ) - { - delete (*index_); - ++index_; - } + vlc_delete_all( codecs ); + vlc_delete_all( sub_chapters ); } int chapter_item_c::PublishChapters( input_title_t & title, int & i_user_chapters, int i_level ) @@ -93,7 +83,7 @@ chapter_item_c *chapter_item_c::BrowseCodecPrivate( unsigned int codec_id, return this; ++index; } - + // sub-chapters chapter_item_c *p_result = NULL; std::vector::const_iterator index2 = sub_chapters.begin(); @@ -104,7 +94,7 @@ chapter_item_c *chapter_item_c::BrowseCodecPrivate( unsigned int codec_id, return p_result; ++index2; } - + return p_result; } @@ -183,7 +173,7 @@ int16 chapter_item_c::GetTitleNumber( ) const int64_t chapter_item_c::RefreshChapters( bool b_ordered, int64_t i_prev_user_time ) { int64_t i_user_time = i_prev_user_time; - + // first the sub-chapters, and then ourself std::vector::iterator index = sub_chapters.begin(); while ( index != sub_chapters.end() ) @@ -245,7 +235,7 @@ chapter_item_c *chapter_item_c::FindTimecode( mtime_t i_user_timecode, const cha psz_result = (*index)->FindTimecode( i_user_timecode, p_current, b_found ); ++index; } - + if ( psz_result == NULL ) psz_result = this; } @@ -379,14 +369,14 @@ void chapter_edition_c::RefreshChapters( ) mtime_t chapter_edition_c::Duration() const { mtime_t i_result = 0; - + if ( sub_chapters.size() ) { std::vector::const_iterator index = sub_chapters.end(); --index; i_result = (*index)->i_user_end_time; } - + return i_result; } diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp index a91aeda161..2856b9347e 100644 --- a/modules/demux/mkv/matroska_segment.cpp +++ b/modules/demux/mkv/matroska_segment.cpp @@ -66,24 +66,9 @@ matroska_segment_c::~matroska_segment_c() delete p_prev_segment_uid; delete p_next_segment_uid; - std::vector::iterator index = stored_editions.begin(); - while ( index != stored_editions.end() ) - { - delete (*index); - ++index; - } - std::vector::iterator indext = translations.begin(); - while ( indext != translations.end() ) - { - delete (*indext); - ++indext; - } - std::vector::iterator indexf = families.begin(); - while ( indexf != families.end() ) - { - delete (*indexf); - ++indexf; - } + vlc_delete_all( stored_editions ); + vlc_delete_all( translations ); + vlc_delete_all( families ); } @@ -890,7 +875,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time ) p[8] == 'R' && p[9] == 'V' && (p[10] == '3' || p[10] == '4') && p[11] == '0' ) { - p_tk->fmt.video.i_frame_rate = + p_tk->fmt.video.i_frame_rate = p[22] << 24 | p[23] << 16 | p[24] << 8 | p[25] << 0; p_tk->fmt.video.i_frame_rate_base = 65536; } @@ -1091,7 +1076,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time ) p_fmt->i_codec = VLC_CODEC_TTA; if( p_tk->i_extra_data > 0 ) { - fill_extra_data( p_tk, 0 ); + fill_extra_data( p_tk, 0 ); } else { -- 2.11.4.GIT