[vlc-devel] [PATCH 1/6] mkv: add virtual_chapter_c::ContainsTimestamp() helper method

Jean-Baptiste Kempf jb at videolan.org
Thu Mar 17 16:58:44 CET 2016


All 6 applied.

On 17 Mar, Steve Lhomme wrote :
> ---
>  modules/demux/mkv/virtual_segment.cpp | 14 +++++++++-----
>  modules/demux/mkv/virtual_segment.hpp |  2 ++
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
> index e08cf00..d1c2abd 100644
> --- a/modules/demux/mkv/virtual_segment.cpp
> +++ b/modules/demux/mkv/virtual_segment.cpp
> @@ -379,12 +379,18 @@ virtual_chapter_c * virtual_chapter_c::BrowseCodecPrivate( unsigned int codec_id
>      return NULL;
>  }
>  
> +bool virtual_chapter_c::ContainsTimestamp( int64_t time )
> +{
> +    /*with the current implementation only the last chapter can have a negative virtual_stop_time*/
> +    return ( time >= i_mk_virtual_start_time &&
> +        ( i_mk_virtual_stop_time < 0 || time < i_mk_virtual_stop_time ) );
> +}
> +
>  virtual_chapter_c* virtual_chapter_c::getSubChapterbyTimecode( int64_t time )
>  {
>      for( size_t i = 0; i < sub_vchapters.size(); i++ )
>      {
> -        if( time >= sub_vchapters[i]->i_mk_virtual_start_time &&
> -            ( sub_vchapters[i]->i_mk_virtual_stop_time < 0 || time < sub_vchapters[i]->i_mk_virtual_stop_time ) )
> +        if( sub_vchapters[i]->ContainsTimestamp( time ) )
>              return sub_vchapters[i]->getSubChapterbyTimecode( time );
>      }
>  
> @@ -395,9 +401,7 @@ virtual_chapter_c* virtual_edition_c::getChapterbyTimecode( int64_t time )
>  {
>      for( size_t i = 0; i < vchapters.size(); i++ )
>      {
> -        if( time >= vchapters[i]->i_mk_virtual_start_time &&
> -            ( vchapters[i]->i_mk_virtual_stop_time < 0 || time < vchapters[i]->i_mk_virtual_stop_time ) )
> -            /*with the current implementation only the last chapter can have a negative virtual_stop_time*/
> +        if( vchapters[i]->ContainsTimestamp( time ) )
>              return vchapters[i]->getSubChapterbyTimecode( time );
>      }
>  
> diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
> index 4036d5e..320f4dd 100644
> --- a/modules/demux/mkv/virtual_segment.hpp
> +++ b/modules/demux/mkv/virtual_segment.hpp
> @@ -67,6 +67,8 @@ public:
>          return ( itemA->i_mk_virtual_start_time < itemB->i_mk_virtual_start_time );
>      }
>  
> +    bool ContainsTimestamp( mtime_t i_pts );
> +
>      matroska_segment_c  &segment;
>      chapter_item_c      *p_chapter;
>      mtime_t             i_mk_virtual_start_time;
> -- 
> 2.7.2.windows.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the vlc-devel mailing list