Commit 6e0f27a8 authored by Steve Lhomme's avatar Steve Lhomme

mkv.cpp: make the DVD command interpretor global to the demuxer, interpret the...

mkv.cpp: make the DVD command interpretor global to the demuxer, interpret the command when a button is clicked
parent 5ee2785c
...@@ -804,15 +804,11 @@ class dvd_chapter_codec_c : public chapter_codec_cmds_c ...@@ -804,15 +804,11 @@ class dvd_chapter_codec_c : public chapter_codec_cmds_c
public: public:
dvd_chapter_codec_c( demux_sys_t & sys ) dvd_chapter_codec_c( demux_sys_t & sys )
:chapter_codec_cmds_c( sys, 1 ) :chapter_codec_cmds_c( sys, 1 )
,interpretor( sys )
{} {}
bool Enter(); bool Enter();
bool Leave(); bool Leave();
std::string GetCodecName( bool f_for_title = false ) const; std::string GetCodecName( bool f_for_title = false ) const;
protected:
dvd_command_interpretor_c interpretor;
}; };
class matroska_script_interpretor_c class matroska_script_interpretor_c
...@@ -1222,6 +1218,7 @@ public: ...@@ -1222,6 +1218,7 @@ public:
,meta(NULL) ,meta(NULL)
,i_current_title(0) ,i_current_title(0)
,p_current_segment(NULL) ,p_current_segment(NULL)
,dvd_interpretor( *this )
,f_duration(-1.0) ,f_duration(-1.0)
,b_ui_hooked(false) ,b_ui_hooked(false)
,p_input(NULL) ,p_input(NULL)
...@@ -1258,6 +1255,8 @@ public: ...@@ -1258,6 +1255,8 @@ public:
std::vector<virtual_segment_c*> used_segments; std::vector<virtual_segment_c*> used_segments;
virtual_segment_c *p_current_segment; virtual_segment_c *p_current_segment;
dvd_command_interpretor_c dvd_interpretor;
/* duration of the stream */ /* duration of the stream */
float f_duration; float f_duration;
...@@ -1807,6 +1806,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts, ...@@ -1807,6 +1806,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
memcpy( &p_sys->pci_packet, &p_block->p_buffer[1], sizeof(pci_t) ); memcpy( &p_sys->pci_packet, &p_block->p_buffer[1], sizeof(pci_t) );
p_sys->SwapButtons(); p_sys->SwapButtons();
vlc_mutex_unlock( &p_sys->p_ev->lock ); vlc_mutex_unlock( &p_sys->p_ev->lock );
block_Release( p_block );
} }
return; return;
} }
...@@ -2422,6 +2422,7 @@ int demux_sys_t::EventThread( vlc_object_t *p_this ) ...@@ -2422,6 +2422,7 @@ int demux_sys_t::EventThread( vlc_object_t *p_this )
if ( best != 0 && best != p_sys->i_curr_button ) if ( best != 0 && best != p_sys->i_curr_button )
{ {
vlc_value_t val; vlc_value_t val;
btni_t *button_ptr = &(pci->hli.btnit[best-1]);
if( var_Get( p_sys->p_input, "highlight-mutex", &val ) == VLC_SUCCESS ) if( var_Get( p_sys->p_input, "highlight-mutex", &val ) == VLC_SUCCESS )
{ {
...@@ -2454,6 +2455,9 @@ int demux_sys_t::EventThread( vlc_object_t *p_this ) ...@@ -2454,6 +2455,9 @@ 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 );
} }
} }
...@@ -5193,7 +5197,7 @@ bool dvd_chapter_codec_c::Enter() ...@@ -5193,7 +5197,7 @@ bool dvd_chapter_codec_c::Enter()
for ( ; i_size > 0; i_size--, p_data += 8 ) for ( ; i_size > 0; i_size--, p_data += 8 )
{ {
msg_Dbg( &sys.demuxer, "Matroska DVD enter command" ); msg_Dbg( &sys.demuxer, "Matroska DVD enter command" );
f_result |= interpretor.Interpret( p_data ); f_result |= sys.dvd_interpretor.Interpret( p_data );
} }
} }
index++; index++;
...@@ -5216,7 +5220,7 @@ bool dvd_chapter_codec_c::Leave() ...@@ -5216,7 +5220,7 @@ bool dvd_chapter_codec_c::Leave()
for ( ; i_size > 0; i_size--, p_data += 8 ) for ( ; i_size > 0; i_size--, p_data += 8 )
{ {
msg_Dbg( &sys.demuxer, "Matroska DVD leave command" ); msg_Dbg( &sys.demuxer, "Matroska DVD leave command" );
f_result |= interpretor.Interpret( p_data ); f_result |= sys.dvd_interpretor.Interpret( p_data );
} }
} }
index++; index++;
......
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