[vlc-devel] [PATCH 1/2] mkv: only jump on known chapters from chapter commands

Steve Lhomme robux4 at gmail.com
Thu Mar 17 17:00:38 CET 2016


On Thu, Mar 17, 2016 at 3:34 PM, Denis Charmet <typx at dinauz.org> wrote:
> On 2016-03-17 15:11, Steve Lhomme wrote:
>>
>> ---
>>  modules/demux/mkv/chapter_command.cpp | 14 +++++++-------
>>  modules/demux/mkv/demux.cpp           | 12 ++++--------
>>  modules/demux/mkv/demux.hpp           |  2 +-
>>  3 files changed, 12 insertions(+), 16 deletions(-)
>>
>> diff --git a/modules/demux/mkv/chapter_command.cpp
>> b/modules/demux/mkv/chapter_command.cpp
>> index 966c339..ab49ad5 100644
>> --- a/modules/demux/mkv/chapter_command.cpp
>> +++ b/modules/demux/mkv/chapter_command.cpp
>> @@ -308,9 +308,9 @@ bool dvd_command_interpretor_c::Interpret( const
>> binary * p_command, size_t i_si
>>
>>              // find in the ChapProcessPrivate matching this Title level
>>              p_vchapter = sys.BrowseCodecPrivate( 1,
>> MatchTitleNumber, &i_title, sizeof(i_title), p_vsegment );
>> -            if ( p_vsegment != NULL )
>> +            if ( p_vsegment != NULL && p_vchapter != NULL )
>>              {
>> -                sys.JumpTo( *p_vsegment, p_vchapter );
>> +                sys.JumpTo( *p_vsegment, *p_vchapter );
>>                  f_result = true;
>>              }
>>
>> @@ -351,9 +351,9 @@ bool dvd_command_interpretor_c::Interpret( const
>> binary * p_command, size_t i_si
>>                          break;
>>                      }
>>                      p_vchapter = sys.BrowseCodecPrivate( 1,
>> MatchPgcType, &p_type, 1, p_vsegment );
>> -                    if ( p_vsegment != NULL )
>> +                    if ( p_vsegment != NULL && p_vchapter != NULL )
>>                      {
>> -                        sys.JumpTo( *p_vsegment, p_vchapter );
>> +                        sys.JumpTo( *p_vsegment, *p_vchapter );
>>                          f_result = true;
>>                      }
>>                  break;
>> @@ -410,7 +410,7 @@ bool dvd_command_interpretor_c::Interpret( const
>> binary * p_command, size_t i_si
>>                          p_vchapter = p_vsegment->BrowseCodecPrivate(
>> 1, MatchPgcType, &p_type, 1 );
>>                          if ( p_vchapter != NULL )
>>                          {
>> -                            sys.JumpTo( *p_vsegment, p_vchapter );
>> +                            sys.JumpTo( *p_vsegment, *p_vchapter );
>>                              f_result = true;
>>                          }
>>                      }
>> @@ -454,7 +454,7 @@ bool dvd_command_interpretor_c::Interpret( const
>> binary * p_command, size_t i_si
>>                              p_vchapter =
>> p_vsegment->BrowseCodecPrivate( 1, MatchPgcType, &p_type, 1 );
>>                              if ( p_vchapter != NULL )
>>                              {
>> -                                sys.JumpTo( *p_vsegment, p_vchapter );
>> +                                sys.JumpTo( *p_vsegment, *p_vchapter );
>>                                  f_result = true;
>>                              }
>>                          }
>> @@ -496,7 +496,7 @@ bool dvd_command_interpretor_c::Interpret( const
>> binary * p_command, size_t i_si
>>                              p_vchapter =
>> p_vchapter->BrowseCodecPrivate( 1, MatchChapterNumber, &i_ptt,
>> sizeof(i_ptt) );
>>                              if ( p_vchapter != NULL )
>>                              {
>> -                                sys.JumpTo( *p_vsegment, p_vchapter );
>> +                                sys.JumpTo( *p_vsegment, *p_vchapter );
>>                                  f_result = true;
>>                              }
>>                          }
>> diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
>> index 110508e..ac50dd4 100644
>> --- a/modules/demux/mkv/demux.cpp
>> +++ b/modules/demux/mkv/demux.cpp
>> @@ -804,7 +804,7 @@ bool demux_sys_t::PreparePlayback(
>> virtual_segment_c *p_new_vsegment )
>>      return true;
>>  }
>>
>> -void demux_sys_t::JumpTo( virtual_segment_c & vsegment,
>> virtual_chapter_c * p_vchapter )
>> +void demux_sys_t::JumpTo( virtual_segment_c & vsegment,
>> virtual_chapter_c & vchapter )
>>  {
>>      // if the segment is not part of the current segment, select the new
>> one
>>      if ( &vsegment != p_current_vsegment )
>> @@ -812,15 +812,11 @@ void demux_sys_t::JumpTo( virtual_segment_c &
>> vsegment, virtual_chapter_c * p_vc
>>          PreparePlayback( &vsegment );
>>      }
>>
>> -    if ( p_vchapter )
>> +    if ( !vchapter.p_chapter || !vchapter.p_chapter->Enter( true ) )
>>      {
>> -        if ( !p_vchapter->p_chapter || !p_vchapter->p_chapter->Enter(
>> true ) )
>> -        {
>> -            // jump to the location in the found segment
>> -            vsegment.Seek( demuxer,
>> p_vchapter->i_mk_virtual_start_time, p_vchapter, -1 );
>> -        }
>> +        // jump to the location in the found segment
>> +        vsegment.Seek( demuxer, vchapter.i_mk_virtual_start_time,
>> &vchapter, -1 );
>
>
> When you force a Seek from the demux and not from Control, you should call
> ES_OUT_RESET_PCR to flush your buffers.

Not sure what you mean by that. JumpTo() is only done during a Demux() call.

Looking at the mkv demuxer there's only one place where
ES_OUT_RESET_PCR is done. When there is a discontinuity during a
chapter change in an ordered chapter or the segment changes. I suppose
I should add the same RESET_PCR when I know there's a discontinuity.
I'll do that in a different patch.

>>      }
>> -
>>  }
>>
>>  matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid )
>> const
>> diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
>> index 44e8bd4..519e85b 100644
>> --- a/modules/demux/mkv/demux.hpp
>> +++ b/modules/demux/mkv/demux.hpp
>> @@ -385,7 +385,7 @@ public:
>>      void FreeUnused();
>>      bool PreparePlayback( virtual_segment_c *p_new_vsegment );
>>      matroska_stream_c *AnalyseAllSegmentsFound( demux_t *p_demux,
>> EbmlStream *p_estream, bool b_initial = false );
>> -    void JumpTo( virtual_segment_c & p_vsegment, virtual_chapter_c *
>> p_vchapter );
>> +    void JumpTo( virtual_segment_c & vsegment, virtual_chapter_c &
>> vchapter );
>>
>>      void InitUi();
>>      void CleanUi();
>
>
> Regards,
> --
> Denis Charmet - TypX
> Le mauvais esprit est un art de vivre
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list