Commit aab757fa authored by Steve Lhomme's avatar Steve Lhomme

mkv.cpp: process the LinkPGCN DVD command correctly

parent 6e0f27a8
...@@ -665,7 +665,6 @@ public: ...@@ -665,7 +665,6 @@ public:
bool Interpret( const binary * p_command, size_t i_size = 8 ); bool Interpret( const binary * p_command, size_t i_size = 8 );
protected:
uint16 GetPRM( size_t index ) const uint16 GetPRM( size_t index ) const
{ {
if ( index < 256 ) if ( index < 256 )
...@@ -718,6 +717,7 @@ protected: ...@@ -718,6 +717,7 @@ protected:
return false; return false;
} }
protected:
std::string GetRegTypeName( bool b_value, uint16 value ) const std::string GetRegTypeName( bool b_value, uint16 value ) const
{ {
std::string result; std::string result;
...@@ -797,6 +797,7 @@ protected: ...@@ -797,6 +797,7 @@ protected:
// callbacks when browsing inside CodecPrivate // callbacks when browsing inside CodecPrivate
static bool MatchTitleNumber( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size ); static bool MatchTitleNumber( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
static bool MatchPgcType ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size ); static bool MatchPgcType ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
static bool MatchPgcNumber ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
}; };
class dvd_chapter_codec_c : public chapter_codec_cmds_c class dvd_chapter_codec_c : public chapter_codec_cmds_c
...@@ -2424,6 +2425,11 @@ int demux_sys_t::EventThread( vlc_object_t *p_this ) ...@@ -2424,6 +2425,11 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
vlc_value_t val; vlc_value_t val;
btni_t *button_ptr = &(pci->hli.btnit[best-1]); btni_t *button_ptr = &(pci->hli.btnit[best-1]);
p_sys->dvd_interpretor.SetSPRM( 0x88, best );
// process the button action
if ( !p_sys->dvd_interpretor.Interpret( button_ptr->cmd.bytes, 8 ) )
{
if( var_Get( p_sys->p_input, "highlight-mutex", &val ) == VLC_SUCCESS ) if( var_Get( p_sys->p_input, "highlight-mutex", &val ) == VLC_SUCCESS )
{ {
vlc_mutex_t *p_mutex = (vlc_mutex_t *) val.p_address; vlc_mutex_t *p_mutex = (vlc_mutex_t *) val.p_address;
...@@ -2455,9 +2461,7 @@ int demux_sys_t::EventThread( vlc_object_t *p_this ) ...@@ -2455,9 +2461,7 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
p_sys->i_curr_button = best; p_sys->i_curr_button = best;
msg_Dbg( &p_sys->demuxer, "Selected button %d", best ); msg_Dbg( &p_sys->demuxer, "Selected button %d", best );
} }
}
// process the button action
p_sys->dvd_interpretor.Interpret( button_ptr->cmd.bytes, 8 );
} }
} }
...@@ -5406,7 +5410,21 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si ...@@ -5406,7 +5410,21 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
uint16 i_pgcn = (p_command[6] << 8) + p_command[7]; uint16 i_pgcn = (p_command[6] << 8) + p_command[7];
msg_Dbg( &sys.demuxer, "Link PGCN(%d)", i_pgcn ); msg_Dbg( &sys.demuxer, "Link PGCN(%d)", i_pgcn );
// TODO p_chapter = sys.BrowseCodecPrivate( 1, MatchPgcNumber, &i_pgcn, 1, p_segment );
if ( p_chapter != NULL )
{
// if the segment is not part of the current segment, select the new one
if ( p_segment != sys.p_current_segment )
{
sys.PreparePlayback( p_segment );
}
p_chapter->Enter( true );
// jump to the location in the found segment
p_segment->Seek( sys.demuxer, p_chapter->i_user_start_time, -1, p_chapter );
f_result = true;
}
break; break;
} }
case CMD_DVD_LINKCN: case CMD_DVD_LINKCN:
...@@ -5468,6 +5486,20 @@ bool dvd_command_interpretor_c::MatchPgcType( const chapter_codec_cmds_c &data, ...@@ -5468,6 +5486,20 @@ bool dvd_command_interpretor_c::MatchPgcType( const chapter_codec_cmds_c &data,
return (i_pgc_type == i_pgc); return (i_pgc_type == i_pgc);
} }
bool dvd_command_interpretor_c::MatchPgcNumber( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size )
{
if ( i_cookie_size != 1 || data.m_private_data.GetSize() < 7 )
return false;
if ( data.m_private_data.GetBuffer()[0] != MATROSKA_DVD_LEVEL_PGC )
return false;
uint16 *i_pgc_n = (uint16 *)p_cookie;
uint16 i_pgc_num = (data.m_private_data.GetBuffer()[1] << 8) + data.m_private_data.GetBuffer()[2];
return (i_pgc_num == *i_pgc_n);
}
bool matroska_script_codec_c::Enter() bool matroska_script_codec_c::Enter()
{ {
bool f_result = false; bool f_result = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment