/*****************************************************************************
* plugin.h: ActiveX control for VLC
*****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005-2010 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
+ * Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <olectl.h>
#include <vlc/vlc.h>
-#include <vlc/libvlc.h>
extern "C" const GUID CLSID_VLCPlugin;
extern "C" const GUID CLSID_VLCPlugin2;
if( NULL != _p_pict )
_p_pict->Release();
if( NULL != pict )
- _p_pict->AddRef();
+ pict->AddRef();
_p_pict = pict;
};
inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
inline BOOL isRunning(void) { return NULL != _p_libvlc; };
- HRESULT getVLCObject(int *i_vlc);
- HRESULT getVLC(libvlc_instance_t** p_vlc);
+
+ HRESULT getVLC(libvlc_instance_t** pp_libvlc)
+ {
+ if( !isRunning() )
+ initVLC();
+ *pp_libvlc = _p_libvlc;
+ return _p_libvlc ? S_OK : E_FAIL;
+ }
+ HRESULT getMD(libvlc_media_player_t **pp_md)
+ {
+ *pp_md = _p_mplayer;
+ return _p_mplayer ? S_OK : E_FAIL;
+ }
+
void setErrorInfo(REFIID riid, const char *description);
// control geometry within container
void fireOnPauseEvent(void);
void fireOnStopEvent(void);
+ // async events;
+ void fireOnMediaPlayerNothingSpecialEvent();
+ void fireOnMediaPlayerOpeningEvent();
+ void fireOnMediaPlayerBufferingEvent(long cache);
+ void fireOnMediaPlayerPlayingEvent();
+ void fireOnMediaPlayerPausedEvent();
+ void fireOnMediaPlayerForwardEvent();
+ void fireOnMediaPlayerBackwardEvent();
+ void fireOnMediaPlayerEncounteredErrorEvent();
+ void fireOnMediaPlayerEndReachedEvent();
+ void fireOnMediaPlayerStoppedEvent();
+
+ void fireOnMediaPlayerTimeChangedEvent(long time);
+ void fireOnMediaPlayerPositionChangedEvent(long position);
+ void fireOnMediaPlayerSeekableChangedEvent(VARIANT_BOOL seekable);
+ void fireOnMediaPlayerPausableChangedEvent(VARIANT_BOOL pausable);
+
// controlling IUnknown interface
LPUNKNOWN pUnkOuter;
+ /*
+ ** libvlc interface
+ */
+ bool isPlaying()
+ {
+ return _p_mplayer && libvlc_media_player_is_playing(_p_mplayer);
+ }
+ int playlist_get_current_index() { return _i_midx; }
+ int playlist_add_extended_untrusted(const char *, int, const char **);
+ void playlist_delete_item(int idx)
+ {
+ if( _p_mlist )
+ {
+ libvlc_media_list_lock(_p_mlist);
+ libvlc_media_list_remove_index(_p_mlist,idx);
+ libvlc_media_list_unlock(_p_mlist);
+ }
+ }
+ void playlist_clear()
+ {
+ if( !_p_libvlc )
+ return;
+ if( _p_mlist )
+ libvlc_media_list_release(_p_mlist);
+ _p_mlist = libvlc_media_list_new(_p_libvlc);
+ }
+ int playlist_count()
+ {
+ int r = 0;
+ if( !_p_mlist )
+ return 0;
+ libvlc_media_list_lock(_p_mlist);
+ r = libvlc_media_list_count(_p_mlist);
+ libvlc_media_list_unlock(_p_mlist);
+ return r;
+ }
+ void playlist_pause()
+ {
+ if( isPlaying() )
+ libvlc_media_player_pause(_p_mplayer);
+ }
+ void playlist_play()
+ {
+ if( _p_mplayer || playlist_select(0) )
+ libvlc_media_player_play(_p_mplayer);
+ }
+ void playlist_play_item(int idx)
+ {
+ if( playlist_select(idx) )
+ libvlc_media_player_play(_p_mplayer);
+ }
+ void playlist_stop()
+ {
+ if( _p_mplayer )
+ libvlc_media_player_stop(_p_mplayer);
+ }
+ void playlist_next()
+ {
+ if( playlist_select( _i_midx+1 ) )
+ libvlc_media_player_play(_p_mplayer);
+ }
+ void playlist_prev()
+ {
+ if( playlist_select( _i_midx-1 ) )
+ libvlc_media_player_play(_p_mplayer);
+ }
+
protected:
virtual ~VLCPlugin();
private:
+ void initVLC();
+ bool playlist_select(int i);
+ void set_player_window();
+ void player_register_events();
+ void player_unregister_events();
//implemented interfaces
class VLCOleObject *vlcOleObject;
VLCPluginClass* _p_class;
ULONG _i_ref;
- libvlc_instance_t* _p_libvlc;
+ libvlc_instance_t *_p_libvlc;
+ libvlc_media_list_t *_p_mlist;
+ libvlc_media_player_t *_p_mplayer;
+ int _i_midx;
+
UINT _i_codepage;
BOOL _b_usermode;
RECT _posRect;