Commit d4fea951 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Expose a function to pause unconditionally instead of toggling

See #4805
parent 6a19320e
......@@ -1486,6 +1486,9 @@ interface IVLCPlaylist : public IDispatch
virtual HRESULT STDMETHODCALLTYPE playItem(
long itemId) = 0;
virtual HRESULT STDMETHODCALLTYPE pause(
) = 0;
virtual HRESULT STDMETHODCALLTYPE togglePause(
) = 0;
......@@ -1577,6 +1580,9 @@ typedef struct IVLCPlaylistVtbl {
IVLCPlaylist* This,
long itemId);
HRESULT (STDMETHODCALLTYPE *pause(
IVLCPlaylist* This);
HRESULT (STDMETHODCALLTYPE *togglePause)(
IVLCPlaylist* This);
......@@ -1622,6 +1628,7 @@ interface IVLCPlaylist {
#define IVLCPlaylist_add(This,uri,name,options,itemId) (This)->lpVtbl->add(This,uri,name,options,itemId)
#define IVLCPlaylist_play(This) (This)->lpVtbl->play(This)
#define IVLCPlaylist_playItem(This,itemId) (This)->lpVtbl->playItem(This,itemId)
#define IVLCPlaylist_pause(This) (This)->lpVtbl->pause(This)
#define IVLCPlaylist_togglePause(This) (This)->lpVtbl->togglePause(This)
#define IVLCPlaylist_stop(This) (This)->lpVtbl->stop(This)
#define IVLCPlaylist_next(This) (This)->lpVtbl->next(This)
......@@ -1675,6 +1682,13 @@ void __RPC_STUB IVLCPlaylist_playItem_Stub(
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IVLCPlaylist_pause_Proxy(
IVLCPlaylist* This);
void __RPC_STUB IVLCPlaylist_pause_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IVLCPlaylist_togglePause_Proxy(
IVLCPlaylist* This);
void __RPC_STUB IVLCPlaylist_togglePause_Stub(
......
......@@ -557,12 +557,18 @@ STDMETHODIMP VLCPlaylist::playItem(long item)
return S_OK;
};
STDMETHODIMP VLCPlaylist::togglePause()
STDMETHODIMP VLCPlaylist::pause()
{
Instance()->get_player().pause();
return S_OK;
};
STDMETHODIMP VLCPlaylist::togglePause()
{
Instance()->get_player().togglePause();
return S_OK;
};
STDMETHODIMP VLCPlaylist::stop()
{
Instance()->get_player().stop();
......
......@@ -267,6 +267,7 @@ public:
STDMETHODIMP add(BSTR, VARIANT, VARIANT, long*);
STDMETHODIMP play();
STDMETHODIMP playItem(long);
STDMETHODIMP pause();
STDMETHODIMP togglePause();
STDMETHODIMP stop();
STDMETHODIMP next();
......
......@@ -193,6 +193,14 @@ bool vlc_player::play(unsigned int idx)
}
void vlc_player::pause()
{
if( is_open() ) {
libvlc_media_player_set_pause(_mp, true);
on_player_action(pa_pause);
}
}
void vlc_player::togglePause()
{
if( is_open() ) {
libvlc_media_list_player_pause(_ml_p);
......
......@@ -58,6 +58,7 @@ public:
void play();
bool play(unsigned int idx);
void pause();
void togglePause();
void stop();
bool next();
......
......@@ -876,6 +876,7 @@ const NPUTF8 * const LibvlcPlaylistNPObject::methodNames[] =
"add",
"play",
"playItem",
"pause",
"togglePause",
"stop",
"next",
......@@ -890,6 +891,7 @@ enum LibvlcPlaylistNPObjectMethodIds
ID_playlist_add,
ID_playlist_play,
ID_playlist_playItem,
ID_playlist_pause,
ID_playlist_togglepause,
ID_playlist_stop,
ID_playlist_next,
......@@ -1013,7 +1015,7 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
case ID_playlist_togglepause:
case ID_playlist_pause:
if( argCount == 0 )
{
p_plugin->playlist_pause();
......@@ -1021,6 +1023,14 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
case ID_playlist_togglepause:
if( argCount == 0 )
{
p_plugin->playlist_togglePause();
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_NO_SUCH_METHOD;
case ID_playlist_stop:
if( argCount == 0 )
{
......
......@@ -97,10 +97,6 @@ public:
int b_stream;
char * psz_target;
void playlist_toggle_play_pause()
{
playlist_isplaying() ? playlist_pause() : playlist_play();
}
void playlist_play()
{
get_player().play();
......@@ -125,6 +121,10 @@ public:
{
get_player().pause();
}
void playlist_togglePause()
{
get_player().togglePause();
}
int playlist_isplaying()
{
return get_player().is_playing();
......
......@@ -365,7 +365,7 @@ static gboolean fullscreen_win_keypress_handler(GtkWidget *widget, GdkEventKey *
switch (event->keyval)
{
case GDK_KEY_space:
plugin->playlist_toggle_play_pause();
plugin->playlist_togglePause();
return True;
case GDK_KEY_Escape:
plugin->set_fullscreen(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