Commit 8af862b1 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

ActiveX: add events

- MediaPlayerMediaChanged
- MediaPlayerTitleChanged
- MediaPlayerLengthChanged

Ref #11486
parent 4714a75c
......@@ -185,6 +185,9 @@ library AXVLC
const int DISPID_MediaPlayerPositionChangedEvent = 211;
const int DISPID_MediaPlayerSeekableChangedEvent = 212;
const int DISPID_MediaPlayerPausableChangedEvent = 213;
const int DISPID_MediaPlayerMediaChangedEvent = 214;
const int DISPID_MediaPlayerTitleChangedEvent = 215;
const int DISPID_MediaPlayerLengthChangedEvent = 216;
[
uuid(DF48072F-5EF8-434e-9B40-E2F3AE759B5F),
......@@ -231,6 +234,12 @@ library AXVLC
void MediaPlayerSeekableChanged([in] VARIANT_BOOL seekable);
[id(DISPID_MediaPlayerPausableChangedEvent), helpstring("Pause setting changed")]
void MediaPlayerPausableChanged([in] VARIANT_BOOL pausable);
[id(DISPID_MediaPlayerMediaChangedEvent), helpstring("Media changed")]
void MediaPlayerMediaChanged();
[id(DISPID_MediaPlayerTitleChangedEvent), helpstring("Title changed")]
void MediaPlayerTitleChanged([in] int title);
[id(DISPID_MediaPlayerLengthChangedEvent), helpstring("Length changed")]
void MediaPlayerLengthChanged([in] long length);
};
[
......
......@@ -1009,6 +1009,12 @@ void VLCPlugin::fireOnStopEvent(void)
/*
* Async events
*/
void VLCPlugin::fireOnMediaPlayerMediaChangedEvent()
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerMediaChangedEvent, &dispparamsNoArgs);
};
void VLCPlugin::fireOnMediaPlayerNothingSpecialEvent()
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
......@@ -1081,6 +1087,9 @@ static void handle_input_state_event(const libvlc_event_t* event, void *param)
VLCPlugin *plugin = (VLCPlugin*)param;
switch( event->type )
{
case libvlc_MediaPlayerMediaChanged:
plugin->fireOnMediaPlayerMediaChangedEvent();
break;
case libvlc_MediaPlayerNothingSpecial:
plugin->fireOnMediaPlayerNothingSpecialEvent();
break;
......@@ -1192,6 +1201,44 @@ static void handle_pausable_changed_event(const libvlc_event_t* event, void *par
}
#undef B
void VLCPlugin::fireOnMediaPlayerTitleChangedEvent(int title)
{
DISPPARAMS params;
params.cArgs = 1;
params.rgvarg = (VARIANTARG *) CoTaskMemAlloc(sizeof(VARIANTARG) * params.cArgs) ;
memset(params.rgvarg, 0, sizeof(VARIANTARG) * params.cArgs);
params.rgvarg[0].vt = VT_I2;
params.rgvarg[0].iVal = title;
params.rgdispidNamedArgs = NULL;
params.cNamedArgs = 0;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerTitleChangedEvent, &params);
};
static void handle_title_changed_event(const libvlc_event_t* event, void *param)
{
VLCPlugin *plugin = (VLCPlugin*)param;
plugin->fireOnMediaPlayerTitleChangedEvent(event->u.media_player_title_changed.new_title);
}
void VLCPlugin::fireOnMediaPlayerLengthChangedEvent(long length)
{
DISPPARAMS params;
params.cArgs = 1;
params.rgvarg = (VARIANTARG *) CoTaskMemAlloc(sizeof(VARIANTARG) * params.cArgs) ;
memset(params.rgvarg, 0, sizeof(VARIANTARG) * params.cArgs);
params.rgvarg[0].vt = VT_I4;
params.rgvarg[0].lVal = length;
params.rgdispidNamedArgs = NULL;
params.cNamedArgs = 0;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerLengthChangedEvent, &params);
};
static void handle_length_changed_event(const libvlc_event_t* event, void *param)
{
VLCPlugin *plugin = (VLCPlugin*)param;
plugin->fireOnMediaPlayerLengthChangedEvent(event->u.media_player_length_changed.new_length);
}
/* */
void VLCPlugin::set_player_window()
......@@ -1218,7 +1265,7 @@ void VLCPlugin::on_player_action(vlc_player_action_e pa)
}
static vlcplugin_event_t vlcevents[] = {
//{ libvlc_MediaPlayerMediaChanged, handle_input_state_event }, // unused
{ libvlc_MediaPlayerMediaChanged, handle_input_state_event },
{ libvlc_MediaPlayerNothingSpecial, handle_input_state_event },
{ libvlc_MediaPlayerOpening, handle_input_state_event },
{ libvlc_MediaPlayerBuffering, handle_input_state_event },
......@@ -1233,8 +1280,8 @@ static vlcplugin_event_t vlcevents[] = {
{ libvlc_MediaPlayerPositionChanged, handle_position_changed_event },
{ libvlc_MediaPlayerSeekableChanged, handle_seekable_changed_event },
{ libvlc_MediaPlayerPausableChanged, handle_pausable_changed_event },
//{ libvlc_MediaPlayerTitleChanged, handle_input_state_event }, // unused
//{ libvlc_MediaPlayerLengthChanged, handle_input_state_event }, // unused
{ libvlc_MediaPlayerTitleChanged, handle_title_changed_event },
{ libvlc_MediaPlayerLengthChanged, handle_length_changed_event },
};
void VLCPlugin::player_register_events()
......
......@@ -280,6 +280,9 @@ public:
void fireOnMediaPlayerPositionChangedEvent(float position);
void fireOnMediaPlayerSeekableChangedEvent(VARIANT_BOOL seekable);
void fireOnMediaPlayerPausableChangedEvent(VARIANT_BOOL pausable);
void fireOnMediaPlayerMediaChangedEvent();
void fireOnMediaPlayerTitleChangedEvent(int title);
void fireOnMediaPlayerLengthChangedEvent(long length);
// controlling IUnknown interface
LPUNKNOWN pUnkOuter;
......
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