[vlc-commits] demux:mkv: don't display the edition as a seekpoint if it has no name
Steve Lhomme
git at videolan.org
Wed Mar 21 15:08:14 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 21 13:55:21 2018 +0100| [bf38a561728b2c7497eff6cea306aca02529222e] | committer: Hugo Beauzée-Luyssen
demux:mkv: don't display the edition as a seekpoint if it has no name
There are chapters for that.
(cherry picked from commit 22425bd29729a8e9cd6ee834bf58c7a8eca1b0ad)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=bf38a561728b2c7497eff6cea306aca02529222e
---
modules/demux/mkv/virtual_segment.cpp | 29 ++++++++++++++++-------------
modules/demux/mkv/virtual_segment.hpp | 2 +-
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 28110682cf..b5958d4754 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -589,7 +589,7 @@ virtual_chapter_c * virtual_segment_c::FindChapter( int64_t i_find_uid )
return NULL;
}
-int virtual_chapter_c::PublishChapters( input_title_t & title, int & i_user_chapters, int i_level )
+int virtual_chapter_c::PublishChapters( input_title_t & title, int & i_user_chapters, int i_level, bool allow_no_name )
{
if ( p_chapter && p_chapter->b_display_seekpoint )
{
@@ -599,24 +599,27 @@ int virtual_chapter_c::PublishChapters( input_title_t & title, int & i_user_chap
if (chap_name == "")
chap_name = p_chapter->GetCodecName();
- seekpoint_t *sk = vlc_seekpoint_New();
+ if (allow_no_name || chap_name != "")
+ {
+ seekpoint_t *sk = vlc_seekpoint_New();
- sk->i_time_offset = i_mk_virtual_start_time;
- if (chap_name != "")
- sk->psz_name = strdup( chap_name.c_str() );
+ sk->i_time_offset = i_mk_virtual_start_time;
+ if (chap_name != "")
+ sk->psz_name = strdup( chap_name.c_str() );
- /* A start time of '0' is ok. A missing ChapterTime element is ok, too, because '0' is its default value. */
- title.i_seekpoint++;
- title.seekpoint = (seekpoint_t**)xrealloc( title.seekpoint,
- title.i_seekpoint * sizeof( seekpoint_t* ) );
- title.seekpoint[title.i_seekpoint-1] = sk;
+ /* A start time of '0' is ok. A missing ChapterTime element is ok, too, because '0' is its default value. */
+ title.i_seekpoint++;
+ title.seekpoint = (seekpoint_t**)xrealloc( title.seekpoint,
+ title.i_seekpoint * sizeof( seekpoint_t* ) );
+ title.seekpoint[title.i_seekpoint-1] = sk;
- i_user_chapters++;
+ i_user_chapters++;
+ }
}
i_seekpoint_num = i_user_chapters;
for( size_t i = 0; i < sub_vchapters.size(); i++ )
- sub_vchapters[i]->PublishChapters( title, i_user_chapters, i_level + 1 );
+ sub_vchapters[i]->PublishChapters( title, i_user_chapters, i_level + 1, true );
return i_user_chapters;
}
@@ -645,7 +648,7 @@ int virtual_edition_c::PublishChapters( input_title_t & title, int & i_user_chap
// if( chapters.size() > 1 )
for( size_t i = 0; i < vchapters.size(); i++ )
- vchapters[i]->PublishChapters( title, i_user_chapters, i_level );
+ vchapters[i]->PublishChapters( title, i_user_chapters, i_level, false );
return i_user_chapters;
}
diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
index cd9dd2ae06..53d297f2cb 100644
--- a/modules/demux/mkv/virtual_segment.hpp
+++ b/modules/demux/mkv/virtual_segment.hpp
@@ -52,7 +52,7 @@ public:
bool Leave( );
bool EnterAndLeave( virtual_chapter_c *p_leaving_vchapter, bool b_enter = true );
virtual_chapter_c * FindChapter( int64_t i_find_uid );
- int PublishChapters( input_title_t & title, int & i_user_chapters, int i_level );
+ int PublishChapters( input_title_t & title, int & i_user_chapters, int i_level, bool allow_no_name );
virtual_chapter_c * BrowseCodecPrivate( unsigned int codec_id,
bool (*match)( const chapter_codec_cmds_c &data,
More information about the vlc-commits
mailing list