[vlc-devel] [PATCH] ActiveX, npapi: changed access interface to vlc_player_option as if it was VlcPlugin/VlcPluginBase member.
rsatom at gmail.com
rsatom at gmail.com
Sat Apr 21 17:42:49 CEST 2012
From: Sergey Radionov <RSATom at gmail.com>
---
activex/persistpropbag.cpp | 4 ++--
activex/plugin.h | 7 ++++++-
activex/vlccontrol2.cpp | 4 ++--
npapi/vlcplugin_base.h | 7 ++++++-
npapi/vlcplugin_win.cpp | 2 +-
npapi/vlcshell.cpp | 7 ++++---
6 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/activex/persistpropbag.cpp b/activex/persistpropbag.cpp
index 2e17d5b..f0f842e 100644
--- a/activex/persistpropbag.cpp
+++ b/activex/persistpropbag.cpp
@@ -215,7 +215,7 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("FullscreenEnabled"), &value, pErrorLog) )
{
- _p_instance->set_enable_fs(V_BOOL(&value) != VARIANT_FALSE);
+ _p_instance->get_options().set_enable_fs(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
@@ -286,7 +286,7 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
VariantClear(&value);
V_VT(&value) = VT_BOOL;
- V_BOOL(&value) = _p_instance->get_enable_fs()? VARIANT_TRUE : VARIANT_FALSE;
+ V_BOOL(&value) = _p_instance->get_options().get_enable_fs()? VARIANT_TRUE : VARIANT_FALSE;
pPropBag->Write(OLESTR("FullscreenEnabled"), &value);
VariantClear(&value);
diff --git a/activex/plugin.h b/activex/plugin.h
index bc63428..94883b8 100644
--- a/activex/plugin.h
+++ b/activex/plugin.h
@@ -75,7 +75,7 @@ private:
LPPICTURE _inplace_picture;
};
-struct VLCPlugin : public IUnknown, public vlc_player_options
+struct VLCPlugin : public IUnknown, private vlc_player_options
{
public:
VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter);
@@ -90,6 +90,11 @@ public:
REFCLSID getClassID(void) { return _p_class->getClassID(); };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
+ vlc_player_options& get_options()
+ { return *static_cast<vlc_player_options*>(this); }
+ const vlc_player_options& get_options() const
+ { return *static_cast<const vlc_player_options*>(this); }
+
/*
** persistant properties
*/
diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index fb38a1c..28cb940 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -1476,14 +1476,14 @@ STDMETHODIMP VLCControl2::get_FullscreenEnabled(VARIANT_BOOL* enabled)
if( NULL == enabled )
return E_POINTER;
- *enabled = varbool( _p_instance->get_enable_fs() );
+ *enabled = varbool( _p_instance->get_options().get_enable_fs() );
return S_OK;
}
STDMETHODIMP VLCControl2::put_FullscreenEnabled(VARIANT_BOOL enabled)
{
- _p_instance->set_enable_fs( VARIANT_FALSE != enabled );
+ _p_instance->get_options().set_enable_fs( VARIANT_FALSE != enabled );
return S_OK;
}
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index f169612..56b324e 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -190,7 +190,7 @@ typedef enum vlc_toolbar_clicked_e {
clicked_Unmute
} vlc_toolbar_clicked_t;
-class VlcPluginBase: public vlc_player_options
+class VlcPluginBase: private vlc_player_options
{
protected:
@@ -198,6 +198,11 @@ public:
VlcPluginBase( NPP, NPuint16_t );
virtual ~VlcPluginBase();
+ vlc_player_options& get_options()
+ { return *static_cast<vlc_player_options*>(this); }
+ const vlc_player_options& get_options() const
+ { return *static_cast<const vlc_player_options*>(this); }
+
NPError init(int argc, char* const argn[], char* const argv[]);
libvlc_instance_t* getVLC()
{ return libvlc_instance; };
diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp
index 4866a1c..e0527d8 100644
--- a/npapi/vlcplugin_win.cpp
+++ b/npapi/vlcplugin_win.cpp
@@ -88,7 +88,7 @@ LRESULT CALLBACK VlcPluginWin::NPWndProcR(HWND hWnd, UINT uMsg, WPARAM wParam, L
VlcPluginWin::VlcPluginWin(NPP instance, NPuint16_t mode) :
VlcPluginBase(instance, mode), _NPWndProc(0),
- _WindowsManager(DllGetModule(), _ViewRC, this)
+ _WindowsManager(DllGetModule(), _ViewRC, &get_options())
{
_ViewRC.hDeFullscreenBitmap =
LoadImage(DllGetModule(), MAKEINTRESOURCE(3),
diff --git a/npapi/vlcshell.cpp b/npapi/vlcshell.cpp
index bf5b2d6..6bf2fd7 100644
--- a/npapi/vlcshell.cpp
+++ b/npapi/vlcshell.cpp
@@ -350,7 +350,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
p_plugin->resize_windows();
/* now set plugin state to that requested in parameters */
- p_plugin->set_toolbar_visible( p_plugin->get_show_toolbar() );
+ bool show_toolbar = p_plugin->get_options().get_show_toolbar();
+ p_plugin->set_toolbar_visible( show_toolbar );
/* handle streams properly */
if( !p_plugin->b_stream )
@@ -359,7 +360,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
{
if( p_plugin->playlist_add( p_plugin->psz_target ) != -1 )
{
- if( p_plugin->get_autoplay() )
+ if( p_plugin->get_options().get_autoplay() )
{
p_plugin->playlist_play();
}
@@ -461,7 +462,7 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* )
if( p_plugin->playlist_add( stream->url ) != -1 )
{
- if( p_plugin->get_autoplay() )
+ if( p_plugin->get_options().get_autoplay() )
{
p_plugin->playlist_play();
}
--
1.7.7.1.msysgit.0
More information about the vlc-devel
mailing list