[vlc-devel] [PATCH] ActiveX: Added "inputSlave" property.

Sergey Radionov rsatom at gmail.com
Sat Apr 21 18:18:25 CEST 2012


---
 activex/axvlc.idl          |    5 +++++
 activex/persistpropbag.cpp |   13 +++++++++++++
 activex/plugin.cpp         |   15 +++++++++++++++
 activex/plugin.h           |   10 ++++++++++
 activex/vlccontrol2.cpp    |   17 +++++++++++++++++
 activex/vlccontrol2.h      |    2 ++
 6 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/activex/axvlc.idl b/activex/axvlc.idl
index 63dba0b..76cc368 100644
--- a/activex/axvlc.idl
+++ b/activex/axvlc.idl
@@ -698,6 +698,11 @@ library AXVLC
 
         [propget, helpstring("Returns the media description object.")]
         HRESULT mediaDescription([out, retval] IVLCMediaDescription** obj);
+
+        [propget]
+        HRESULT inputSlave([out, retval] BSTR* InputSlave);
+        [propput]
+        HRESULT inputSlave([in] BSTR InputSlave);
     };
 
     [
diff --git a/activex/persistpropbag.cpp b/activex/persistpropbag.cpp
index f0f842e..a08800e 100644
--- a/activex/persistpropbag.cpp
+++ b/activex/persistpropbag.cpp
@@ -219,6 +219,13 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr
         VariantClear(&value);
     }
 
+    V_VT(&value) = VT_BSTR;
+    if( S_OK == pPropBag->Read(OLESTR("InputSlave"), &value, pErrorLog) )
+    {
+        _p_instance->setInputSlave(V_BSTR(&value));
+        VariantClear(&value);
+    }
+
     return _p_instance->onLoad();
 };
 
@@ -290,6 +297,12 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt
     pPropBag->Write(OLESTR("FullscreenEnabled"), &value);
     VariantClear(&value);
 
+    V_VT(&value) = VT_BSTR;
+    V_BSTR(&value) = SysAllocStringLen(_p_instance->getInputSlave(),
+                            SysStringLen(_p_instance->getInputSlave()));
+    pPropBag->Write(OLESTR("InputSlave"), &value);
+    VariantClear(&value);
+
     if( fClearDirty )
         _p_instance->setDirty(FALSE);
 
diff --git a/activex/plugin.cpp b/activex/plugin.cpp
index 7db51f7..065e76a 100644
--- a/activex/plugin.cpp
+++ b/activex/plugin.cpp
@@ -303,6 +303,7 @@ VLCPlugin::~VLCPlugin()
 
     SysFreeString(_bstr_mrl);
     SysFreeString(_bstr_baseurl);
+    SysFreeString(_bstr_input_slave);
 
     if( vlc_player::is_open() )
     {
@@ -407,6 +408,7 @@ HRESULT VLCPlugin::onInit(void)
         _i_volume     = 50;
         _i_time       = 0;
         _i_backcolor  = 0;
+        _bstr_input_slave = NULL;
         // set default/preferred size (320x240) pixels in HIMETRIC
         HDC hDC = CreateDevDC(NULL);
         _extent.cx = 320;
@@ -522,7 +524,20 @@ void VLCPlugin::initVLC()
     ppsz_argv[ppsz_argc++] = "--intf=dummy";
     ppsz_argv[ppsz_argc++] = "--no-video-title-show";
 
+
+    char *psz_input_slave = NULL;
+    if( SysStringLen(_bstr_input_slave) > 0 ) {
+        psz_input_slave = CStrFromBSTR(CP_UTF8, _bstr_input_slave);
+        if( psz_input_slave ) {
+            ppsz_argv[ppsz_argc++] = "--input-slave";
+            ppsz_argv[ppsz_argc++] = psz_input_slave;
+        }
+    }
+
     _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv);
+
+    CoTaskMemFree(psz_input_slave);
+
     if( !_p_libvlc )
         return;
 
diff --git a/activex/plugin.h b/activex/plugin.h
index 06fb5c0..4266b97 100644
--- a/activex/plugin.h
+++ b/activex/plugin.h
@@ -114,6 +114,14 @@ public:
     };
     BSTR getMRL(void) { return _bstr_mrl; };
 
+    void setInputSlave(BSTR input_slave)
+    {
+        SysFreeString(_bstr_input_slave);
+        _bstr_input_slave = SysAllocStringLen( input_slave, SysStringLen(input_slave) );
+        setDirty(TRUE);
+    };
+    BSTR getInputSlave(void) { return _bstr_input_slave; };
+
     inline void setAutoPlay(BOOL autoplay)
     {
         set_autoplay(autoplay != FALSE);
@@ -384,6 +392,8 @@ private:
     int  _i_time;
     SIZEL _extent;
     OLE_COLOR _i_backcolor;
+    BSTR _bstr_input_slave;
+
     // indicates whether properties needs persisting
     BOOL _b_dirty;
 };
diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index 2cede90..84cb90e 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -1492,3 +1492,20 @@ STDMETHODIMP VLCControl2::get_mediaDescription(IVLCMediaDescription** obj)
 {
     return object_get<IVLCMediaDescription>(obj, &_p_vlcmedia_desc);
 }
+
+STDMETHODIMP VLCControl2::get_inputSlave(BSTR *InputSlave)
+{
+    if( NULL == InputSlave )
+        return E_POINTER;
+
+    *InputSlave = SysAllocStringLen(_p_instance->getInputSlave(),
+                       SysStringLen(_p_instance->getInputSlave()));
+    return NOERROR;
+};
+
+STDMETHODIMP VLCControl2::put_inputSlave(BSTR InputSlave)
+{
+    _p_instance->setInputSlave(InputSlave);
+
+    return S_OK;
+};
diff --git a/activex/vlccontrol2.h b/activex/vlccontrol2.h
index cf25258..d035094 100644
--- a/activex/vlccontrol2.h
+++ b/activex/vlccontrol2.h
@@ -420,6 +420,8 @@ public:
     STDMETHODIMP get_subtitle(IVLCSubtitle**);
     STDMETHODIMP get_video(IVLCVideo**);
     STDMETHODIMP get_mediaDescription(IVLCMediaDescription**);
+    STDMETHODIMP get_inputSlave(BSTR *InputSlave);
+    STDMETHODIMP put_inputSlave(BSTR InputSlave);
 
 protected:
     HRESULT loadTypeInfo();
-- 
1.7.7.1.msysgit.0




More information about the vlc-devel mailing list