Commit 4dfa6658 authored by Jean-Paul Saman's avatar Jean-Paul Saman

mozilla: activex: add cache filling level to event MediaPlayerBuffering

Add cache filling level to the MediaPlayerBuffering event.
parent 837ce238
...@@ -142,6 +142,10 @@ typedef struct libvlc_event_t ...@@ -142,6 +142,10 @@ typedef struct libvlc_event_t
/* media instance */ /* media instance */
struct struct
{
float new_cache;
} media_player_buffering;
struct
{ {
float new_position; float new_position;
} media_player_position_changed; } media_player_position_changed;
......
...@@ -211,7 +211,7 @@ library AXVLC ...@@ -211,7 +211,7 @@ library AXVLC
[id(DISPID_MediaPlayerOpeningEvent), helpstring("Opening media")] [id(DISPID_MediaPlayerOpeningEvent), helpstring("Opening media")]
void MediaPlayerOpening(); void MediaPlayerOpening();
[id(DISPID_MediaPlayerBufferingEvent), helpstring("Buffering media")] [id(DISPID_MediaPlayerBufferingEvent), helpstring("Buffering media")]
void MediaPlayerBuffering(); void MediaPlayerBuffering([in] long cache);
[id(DISPID_MediaPlayerPlayingEvent), helpstring("Media is playing")] [id(DISPID_MediaPlayerPlayingEvent), helpstring("Media is playing")]
void MediaPlayerPlaying(); void MediaPlayerPlaying();
[id(DISPID_MediaPlayerPausedEvent), helpstring("Media is paused")] [id(DISPID_MediaPlayerPausedEvent), helpstring("Media is paused")]
......
...@@ -1021,10 +1021,17 @@ void VLCPlugin::fireOnMediaPlayerOpeningEvent() ...@@ -1021,10 +1021,17 @@ void VLCPlugin::fireOnMediaPlayerOpeningEvent()
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerOpeningEvent, &dispparamsNoArgs); vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerOpeningEvent, &dispparamsNoArgs);
}; };
void VLCPlugin::fireOnMediaPlayerBufferingEvent() void VLCPlugin::fireOnMediaPlayerBufferingEvent(long cache)
{ {
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; DISPPARAMS params;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerBufferingEvent, &dispparamsNoArgs); 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 = cache;
params.rgdispidNamedArgs = NULL;
params.cNamedArgs = 0;
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerBufferingEvent, &params);
}; };
void VLCPlugin::fireOnMediaPlayerPlayingEvent() void VLCPlugin::fireOnMediaPlayerPlayingEvent()
...@@ -1081,7 +1088,7 @@ static void handle_input_state_event(const libvlc_event_t* event, void *param) ...@@ -1081,7 +1088,7 @@ static void handle_input_state_event(const libvlc_event_t* event, void *param)
plugin->fireOnMediaPlayerOpeningEvent(); plugin->fireOnMediaPlayerOpeningEvent();
break; break;
case libvlc_MediaPlayerBuffering: case libvlc_MediaPlayerBuffering:
plugin->fireOnMediaPlayerBufferingEvent(); plugin->fireOnMediaPlayerBufferingEvent(event->u.media_player_buffering.new_cache);
break; break;
case libvlc_MediaPlayerPlaying: case libvlc_MediaPlayerPlaying:
plugin->fireOnMediaPlayerPlayingEvent(); plugin->fireOnMediaPlayerPlayingEvent();
......
...@@ -241,7 +241,7 @@ public: ...@@ -241,7 +241,7 @@ public:
// async events; // async events;
void fireOnMediaPlayerNothingSpecialEvent(); void fireOnMediaPlayerNothingSpecialEvent();
void fireOnMediaPlayerOpeningEvent(); void fireOnMediaPlayerOpeningEvent();
void fireOnMediaPlayerBufferingEvent(); void fireOnMediaPlayerBufferingEvent(long cache);
void fireOnMediaPlayerPlayingEvent(); void fireOnMediaPlayerPlayingEvent();
void fireOnMediaPlayerPausedEvent(); void fireOnMediaPlayerPausedEvent();
void fireOnMediaPlayerForwardEvent(); void fireOnMediaPlayerForwardEvent();
......
...@@ -114,7 +114,7 @@ static vlcplugin_event_t vlcevents[] = { ...@@ -114,7 +114,7 @@ static vlcplugin_event_t vlcevents[] = {
{ "MediaPlayerMediaChanged", libvlc_MediaPlayerMediaChanged, handle_input_event }, { "MediaPlayerMediaChanged", libvlc_MediaPlayerMediaChanged, handle_input_event },
{ "MediaPlayerNothingSpecial", libvlc_MediaPlayerNothingSpecial, handle_input_event }, { "MediaPlayerNothingSpecial", libvlc_MediaPlayerNothingSpecial, handle_input_event },
{ "MediaPlayerOpening", libvlc_MediaPlayerOpening, handle_input_event }, { "MediaPlayerOpening", libvlc_MediaPlayerOpening, handle_input_event },
{ "MediaPlayerBuffering", libvlc_MediaPlayerBuffering, handle_input_event }, { "MediaPlayerBuffering", libvlc_MediaPlayerBuffering, handle_changed_event },
{ "MediaPlayerPlaying", libvlc_MediaPlayerPlaying, handle_input_event }, { "MediaPlayerPlaying", libvlc_MediaPlayerPlaying, handle_input_event },
{ "MediaPlayerPaused", libvlc_MediaPlayerPaused, handle_input_event }, { "MediaPlayerPaused", libvlc_MediaPlayerPaused, handle_input_event },
{ "MediaPlayerStopped", libvlc_MediaPlayerStopped, handle_input_event }, { "MediaPlayerStopped", libvlc_MediaPlayerStopped, handle_input_event },
...@@ -140,7 +140,6 @@ static void handle_input_event(const libvlc_event_t* event, void *param) ...@@ -140,7 +140,6 @@ static void handle_input_event(const libvlc_event_t* event, void *param)
{ {
case libvlc_MediaPlayerNothingSpecial: case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerOpening: case libvlc_MediaPlayerOpening:
case libvlc_MediaPlayerBuffering:
case libvlc_MediaPlayerPlaying: case libvlc_MediaPlayerPlaying:
case libvlc_MediaPlayerPaused: case libvlc_MediaPlayerPaused:
case libvlc_MediaPlayerStopped: case libvlc_MediaPlayerStopped:
...@@ -163,6 +162,9 @@ static void handle_changed_event(const libvlc_event_t* event, void *param) ...@@ -163,6 +162,9 @@ static void handle_changed_event(const libvlc_event_t* event, void *param)
VlcPlugin *plugin = (VlcPlugin*)param; VlcPlugin *plugin = (VlcPlugin*)param;
switch( event->type ) switch( event->type )
{ {
case libvlc_MediaPlayerBuffering:
DOUBLE_TO_NPVARIANT(event->u.media_player_buffering.new_cache, npparam[0]);
break;
case libvlc_MediaPlayerTimeChanged: case libvlc_MediaPlayerTimeChanged:
DOUBLE_TO_NPVARIANT(event->u.media_player_time_changed.new_time, npparam[0]); DOUBLE_TO_NPVARIANT(event->u.media_player_time_changed.new_time, npparam[0]);
break; break;
...@@ -239,7 +241,6 @@ void EventObj::deliver(NPP browser) ...@@ -239,7 +241,6 @@ void EventObj::deliver(NPP browser)
NPVariant result; NPVariant result;
NPVariant *params = iter->params(); NPVariant *params = iter->params();
uint32_t count = iter->count(); uint32_t count = iter->count();
assert( params );
NPObject *listener = j->listener(); NPObject *listener = j->listener();
assert( listener ); assert( listener );
...@@ -257,7 +258,7 @@ void EventObj::deliver(NPP browser) ...@@ -257,7 +258,7 @@ void EventObj::deliver(NPP browser)
NPN_MemFree( (void*)NPVARIANT_TO_OBJECT(params[n]) ); NPN_MemFree( (void*)NPVARIANT_TO_OBJECT(params[n]) );
} }
} }
NPN_MemFree( params ); if (params) NPN_MemFree( params );
} }
} }
} }
......
...@@ -183,6 +183,7 @@ libvlc_media_list_new( libvlc_instance_t * p_inst ) ...@@ -183,6 +183,7 @@ libvlc_media_list_new( libvlc_instance_t * p_inst )
vlc_mutex_init( &p_mlist->refcount_lock ); // FIXME: spinlock? vlc_mutex_init( &p_mlist->refcount_lock ); // FIXME: spinlock?
vlc_array_init( &p_mlist->items ); vlc_array_init( &p_mlist->items );
assert( p_mlist->items.i_count == 0 );
p_mlist->i_refcount = 1; p_mlist->i_refcount = 1;
p_mlist->p_md = NULL; p_mlist->p_md = NULL;
......
...@@ -369,6 +369,13 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd, ...@@ -369,6 +369,13 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
p_mi->input.p_vout = get_vout_thread( p_mi ); p_mi->input.p_vout = get_vout_thread( p_mi );
unlock_input( p_mi ); unlock_input( p_mi );
} }
else if( newval.i_int == INPUT_EVENT_CACHE )
{
event.type = libvlc_MediaPlayerBuffering;
event.u.media_player_buffering.new_cache = (int)(100 *
var_GetFloat( p_input, "cache" ));
libvlc_event_send( p_mi->p_event_manager, &event );
}
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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