Add cache filling level to the MediaPlayerBuffering event.
/* media instance */
struct
+ {
+ float new_cache;
+ } media_player_buffering;
+ struct
{
float new_position;
} media_player_position_changed;
[id(DISPID_MediaPlayerOpeningEvent), helpstring("Opening media")]\r
void MediaPlayerOpening();\r
[id(DISPID_MediaPlayerBufferingEvent), helpstring("Buffering media")]\r
- void MediaPlayerBuffering();\r
+ void MediaPlayerBuffering([in] long cache);\r
[id(DISPID_MediaPlayerPlayingEvent), helpstring("Media is playing")]\r
void MediaPlayerPlaying();\r
[id(DISPID_MediaPlayerPausedEvent), helpstring("Media is paused")]\r
vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerOpeningEvent, &dispparamsNoArgs);
};
-void VLCPlugin::fireOnMediaPlayerBufferingEvent()
+void VLCPlugin::fireOnMediaPlayerBufferingEvent(long cache)
{
- DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
- vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerBufferingEvent, &dispparamsNoArgs);
+ 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 = cache;
+ params.rgdispidNamedArgs = NULL;
+ params.cNamedArgs = 0;
+ vlcConnectionPointContainer->fireEvent(DISPID_MediaPlayerBufferingEvent, ¶ms);
};
void VLCPlugin::fireOnMediaPlayerPlayingEvent()
plugin->fireOnMediaPlayerOpeningEvent();
break;
case libvlc_MediaPlayerBuffering:
- plugin->fireOnMediaPlayerBufferingEvent();
+ plugin->fireOnMediaPlayerBufferingEvent(event->u.media_player_buffering.new_cache);
break;
case libvlc_MediaPlayerPlaying:
plugin->fireOnMediaPlayerPlayingEvent();
// async events;
void fireOnMediaPlayerNothingSpecialEvent();
void fireOnMediaPlayerOpeningEvent();
- void fireOnMediaPlayerBufferingEvent();
+ void fireOnMediaPlayerBufferingEvent(long cache);
void fireOnMediaPlayerPlayingEvent();
void fireOnMediaPlayerPausedEvent();
void fireOnMediaPlayerForwardEvent();
{ "MediaPlayerMediaChanged", libvlc_MediaPlayerMediaChanged, handle_input_event },
{ "MediaPlayerNothingSpecial", libvlc_MediaPlayerNothingSpecial, 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 },
{ "MediaPlayerPaused", libvlc_MediaPlayerPaused, handle_input_event },
{ "MediaPlayerStopped", libvlc_MediaPlayerStopped, handle_input_event },
{
case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerOpening:
- case libvlc_MediaPlayerBuffering:
case libvlc_MediaPlayerPlaying:
case libvlc_MediaPlayerPaused:
case libvlc_MediaPlayerStopped:
VlcPlugin *plugin = (VlcPlugin*)param;
switch( event->type )
{
+ case libvlc_MediaPlayerBuffering:
+ DOUBLE_TO_NPVARIANT(event->u.media_player_buffering.new_cache, npparam[0]);
+ break;
case libvlc_MediaPlayerTimeChanged:
DOUBLE_TO_NPVARIANT(event->u.media_player_time_changed.new_time, npparam[0]);
break;
NPVariant result;
NPVariant *params = iter->params();
uint32_t count = iter->count();
- assert( params );
NPObject *listener = j->listener();
assert( listener );
NPN_MemFree( (void*)NPVARIANT_TO_OBJECT(params[n]) );
}
}
- NPN_MemFree( params );
+ if (params) NPN_MemFree( params );
}
}
}
vlc_mutex_init( &p_mlist->refcount_lock ); // FIXME: spinlock?
vlc_array_init( &p_mlist->items );
+ assert( p_mlist->items.i_count == 0 );
p_mlist->i_refcount = 1;
p_mlist->p_md = NULL;
from_mtime(var_GetTime( p_input, "length" ));
libvlc_event_send( p_mi->p_event_manager, &event );
}
+ 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;
-
}
/**************************************************************************