[vlc-commits] demux:mkv: respect the hidden flag for chapters/editions
Steve Lhomme
git at videolan.org
Wed Mar 21 15:08:13 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 21 13:17:55 2018 +0100| [f34355afc4cb36a6cd4e6d91b7155cc8c0e7ab44] | committer: Hugo Beauzée-Luyssen
demux:mkv: respect the hidden flag for chapters/editions
By default they should be displayed even if they don't have a fancy name.
Ref https://forum.videolan.org/viewtopic.php?p=470038
(cherry picked from commit f5ac0e57ff31560d212a1e7bed3f7f48feac1197)
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=f34355afc4cb36a6cd4e6d91b7155cc8c0e7ab44
---
modules/demux/mkv/chapters.hpp | 3 +--
modules/demux/mkv/matroska_segment_parse.cpp | 3 +--
modules/demux/mkv/virtual_segment.cpp | 37 +++++++++++++---------------
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/modules/demux/mkv/chapters.hpp b/modules/demux/mkv/chapters.hpp
index d42ee637d2..a069b1fdea 100644
--- a/modules/demux/mkv/chapters.hpp
+++ b/modules/demux/mkv/chapters.hpp
@@ -56,7 +56,7 @@ public:
,p_segment_uid(NULL)
,p_segment_edition_uid(NULL)
,b_display_seekpoint(true)
- ,b_user_display(false)
+ ,b_user_display(true)
,p_parent(NULL)
,b_is_leaving(false)
{}
@@ -102,7 +102,6 @@ public:
std::string GetMainName() const;
bool b_ordered;
bool b_default;
- /* TODO handle hidden chapters */
bool b_hidden;
};
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 5589825f95..132e142ed6 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1379,8 +1379,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
}
E_CASE( KaxEditionFlagHidden, flag_hidden )
{
- VLC_UNUSED( flag_hidden ); // TODO: FIXME: implement
- VLC_UNUSED( vars );
+ vars.p_edition->b_hidden = static_cast<uint8>( flag_hidden ) != 0;
}
E_CASE( EbmlVoid, el )
{
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index e5673d896a..28110682cf 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -591,30 +591,27 @@ virtual_chapter_c * virtual_segment_c::FindChapter( int64_t i_find_uid )
int virtual_chapter_c::PublishChapters( input_title_t & title, int & i_user_chapters, int i_level )
{
- if ( p_chapter && ( !p_chapter->b_display_seekpoint || p_chapter->psz_name == "" ) )
- {
- p_chapter->psz_name = p_chapter->GetCodecName();
- if ( p_chapter->psz_name != "" )
- p_chapter->b_display_seekpoint = true;
- }
-
if ( p_chapter && p_chapter->b_display_seekpoint )
{
- if( p_chapter->b_user_display )
- {
- seekpoint_t *sk = vlc_seekpoint_New();
+ std::string chap_name;
+ if ( p_chapter->b_user_display )
+ chap_name = p_chapter->psz_name;
+ if (chap_name == "")
+ chap_name = p_chapter->GetCodecName();
- sk->i_time_offset = i_mk_virtual_start_time;
- sk->psz_name = strdup( p_chapter->psz_name.c_str() );
+ seekpoint_t *sk = vlc_seekpoint_New();
- /* 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;
+ sk->i_time_offset = i_mk_virtual_start_time;
+ if (chap_name != "")
+ sk->psz_name = strdup( chap_name.c_str() );
- i_user_chapters++;
- }
+ /* 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_seekpoint_num = i_user_chapters;
@@ -630,7 +627,7 @@ int virtual_edition_c::PublishChapters( input_title_t & title, int & i_user_chap
/* HACK for now don't expose edition as a seekpoint if its start time is the same than it's first chapter */
if( vchapters.size() > 0 &&
- vchapters[0]->i_mk_virtual_start_time && p_edition )
+ vchapters[0]->i_mk_virtual_start_time && p_edition && !p_edition->b_hidden )
{
seekpoint_t *sk = vlc_seekpoint_New();
sk->i_time_offset = 0;
More information about the vlc-commits
mailing list