]> git.sesse.net Git - vlc/commitdiff
activex plugin: Bring marquee interface in line with logo.
authorJP Dinger <jpd@m2x.nl>
Tue, 19 Jan 2010 16:50:52 +0000 (17:50 +0100)
committerJP Dinger <jpd@m2x.nl>
Tue, 19 Jan 2010 16:53:20 +0000 (17:53 +0100)
projects/activex/axvlc.idl
projects/activex/axvlc.tlb
projects/activex/axvlc_idl.h
projects/activex/position.h [new file with mode: 0644]
projects/activex/test.html
projects/activex/vlccontrol2.cpp
projects/activex/vlccontrol2.h

index dba31d553ce15f7be7f30291e048c48f0fdab8e1..961afd8ce8462b055707c799b02e7b02208a1e32 100644 (file)
@@ -441,29 +441,46 @@ library AXVLC
     {\r
         [helpstring("enable Marquee Filter.")]\r
         HRESULT enable();\r
-\r
         [helpstring("disable Marquee Filter.")]\r
         HRESULT disable();\r
 \r
-        [helpstring("set text to Marquee Filter.")]\r
-        HRESULT text([in] BSTR text);\r
-\r
-        [helpstring("change text color.")]\r
-        HRESULT color ([in] long val);\r
-        [helpstring("change  text opacity.")]\r
-        HRESULT opacity ([in] long val);\r
-        [helpstring("change text position.")]\r
-        HRESULT position ([in] long val);\r
-        [helpstring("change refresh time.")]\r
-        HRESULT refresh ([in] long val);\r
-        [helpstring("change text size.")]\r
-        HRESULT size ([in] long val);\r
-        [helpstring("change timeout.")]\r
-        HRESULT timeout ([in] long val);\r
-        [helpstring("change text abcissa.")]\r
-        HRESULT x ([in] long val);\r
-        [helpstring("change text ordinate.")]\r
-        HRESULT y ([in] long val);\r
+        [propget, helpstring("Retrieve marquee text.")]\r
+        HRESULT text([out, retval] BSTR* val);\r
+        [propput, helpstring("Change marquee text.")]\r
+        HRESULT text([in] BSTR val);\r
+\r
+        [propget, helpstring("Retrieve text color.")]\r
+        HRESULT color([out, retval] LONG* val);\r
+        [propput, helpstring("Change text color.")]\r
+        HRESULT color([in] LONG val);\r
+        [propget, helpstring("Retrieve text opacity.")]\r
+        HRESULT opacity([out, retval] LONG* val);\r
+        [propput, helpstring("Set text opacity (0=transparent, 255=opaque).")]\r
+        HRESULT opacity([in] LONG val);\r
+        [propget, helpstring("Retrieve text position.")]\r
+        HRESULT position([out, retval] BSTR* val);\r
+        [propput, helpstring("Text positioning relative to: center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right.")]\r
+        HRESULT position([in] BSTR val);\r
+        [propget, helpstring("Retrieve text refresh time.")]\r
+        HRESULT refresh([out, retval] LONG* val);\r
+        [propput, helpstring("Set text refresh time.")]\r
+        HRESULT refresh([in] LONG val);\r
+        [propget, helpstring("Retrieve text size.")]\r
+        HRESULT size([out, retval] LONG* val);\r
+        [propput, helpstring("Set text size.")]\r
+        HRESULT size([in] LONG val);\r
+        [propget, helpstring("Retrieve timeout.")]\r
+        HRESULT timeout([out, retval] LONG* val);\r
+        [propput, helpstring("Change timeout.")]\r
+        HRESULT timeout([in] LONG val);\r
+        [propget, helpstring("Retrieve text abcissa.")]\r
+        HRESULT x([out, retval] LONG* val);\r
+        [propput, helpstring("Change text abcissa.")]\r
+        HRESULT x([in] LONG val);\r
+        [propget, helpstring("Retrieve text ordinate.")]\r
+        HRESULT y([out, retval] LONG* val);\r
+        [propput, helpstring("Change text ordinate.")]\r
+        HRESULT y([in] LONG val);\r
     };\r
 \r
     [\r
index d8927e42c53636ba4b055edc204782e7c96b1aa7..d08ef96c9745b5dbf053704bd013397cdb1cd664 100644 (file)
Binary files a/projects/activex/axvlc.tlb and b/projects/activex/axvlc.tlb differ
index abd103c1eae7698268ae2fb869eb29813f9d6e3b..5a9955105dbecc2284e1178073757e25d452d114 100644 (file)
@@ -2528,31 +2528,58 @@ interface IVLCMarquee : public IDispatch
     virtual HRESULT STDMETHODCALLTYPE disable(
         ) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE text(
-        BSTR text) = 0;
+    virtual HRESULT STDMETHODCALLTYPE get_text(
+        BSTR *val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE color(
-        LONG val) = 0;
+    virtual HRESULT STDMETHODCALLTYPE put_text(
+        BSTR val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE get_color(
+        LONG *val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE opacity(
+    virtual HRESULT STDMETHODCALLTYPE put_color(
         LONG val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE position(
+    virtual HRESULT STDMETHODCALLTYPE get_opacity(
+        LONG *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_opacity(
         LONG val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE refresh(
+    virtual HRESULT STDMETHODCALLTYPE get_position(
+        BSTR *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_position(
+        BSTR val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE get_refresh(
+        LONG *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_refresh(
         LONG val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE size(
+    virtual HRESULT STDMETHODCALLTYPE get_size(
+        LONG *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_size(
         LONG val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE timeout(
+    virtual HRESULT STDMETHODCALLTYPE get_timeout(
+        LONG *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_timeout(
         LONG val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE x(
+    virtual HRESULT STDMETHODCALLTYPE get_x(
+        LONG *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_x(
         LONG val) = 0;
 
-    virtual HRESULT STDMETHODCALLTYPE y(
+    virtual HRESULT STDMETHODCALLTYPE get_y(
+        LONG *val) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE put_y(
         LONG val) = 0;
 
 };
@@ -2609,39 +2636,75 @@ typedef struct IVLCMarqueeVtbl {
     HRESULT (STDMETHODCALLTYPE *disable)(
         IVLCMarquee* This);
 
-    HRESULT (STDMETHODCALLTYPE *text)(
+    HRESULT (STDMETHODCALLTYPE *get_text)(
         IVLCMarquee* This,
-        BSTR text);
+        BSTR *val);
 
-    HRESULT (STDMETHODCALLTYPE *color)(
+    HRESULT (STDMETHODCALLTYPE *put_text)(
         IVLCMarquee* This,
-        LONG val);
+        BSTR val);
+
+    HRESULT (STDMETHODCALLTYPE *get_color)(
+        IVLCMarquee* This,
+        LONG *val);
 
-    HRESULT (STDMETHODCALLTYPE *opacity)(
+    HRESULT (STDMETHODCALLTYPE *put_color)(
         IVLCMarquee* This,
         LONG val);
 
-    HRESULT (STDMETHODCALLTYPE *position)(
+    HRESULT (STDMETHODCALLTYPE *get_opacity)(
+        IVLCMarquee* This,
+        LONG *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_opacity)(
         IVLCMarquee* This,
         LONG val);
 
-    HRESULT (STDMETHODCALLTYPE *refresh)(
+    HRESULT (STDMETHODCALLTYPE *get_position)(
+        IVLCMarquee* This,
+        BSTR *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_position)(
+        IVLCMarquee* This,
+        BSTR val);
+
+    HRESULT (STDMETHODCALLTYPE *get_refresh)(
+        IVLCMarquee* This,
+        LONG *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_refresh)(
         IVLCMarquee* This,
         LONG val);
 
-    HRESULT (STDMETHODCALLTYPE *size)(
+    HRESULT (STDMETHODCALLTYPE *get_size)(
+        IVLCMarquee* This,
+        LONG *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_size)(
         IVLCMarquee* This,
         LONG val);
 
-    HRESULT (STDMETHODCALLTYPE *timeout)(
+    HRESULT (STDMETHODCALLTYPE *get_timeout)(
+        IVLCMarquee* This,
+        LONG *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_timeout)(
         IVLCMarquee* This,
         LONG val);
 
-    HRESULT (STDMETHODCALLTYPE *x)(
+    HRESULT (STDMETHODCALLTYPE *get_x)(
+        IVLCMarquee* This,
+        LONG *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_x)(
         IVLCMarquee* This,
         LONG val);
 
-    HRESULT (STDMETHODCALLTYPE *y)(
+    HRESULT (STDMETHODCALLTYPE *get_y)(
+        IVLCMarquee* This,
+        LONG *val);
+
+    HRESULT (STDMETHODCALLTYPE *put_y)(
         IVLCMarquee* This,
         LONG val);
 
@@ -2664,15 +2727,24 @@ interface IVLCMarquee {
 /*** IVLCMarquee methods ***/
 #define IVLCMarquee_enable(This) (This)->lpVtbl->enable(This)
 #define IVLCMarquee_disable(This) (This)->lpVtbl->disable(This)
-#define IVLCMarquee_text(This,text) (This)->lpVtbl->text(This,text)
-#define IVLCMarquee_color(This,val) (This)->lpVtbl->color(This,val)
-#define IVLCMarquee_opacity(This,val) (This)->lpVtbl->opacity(This,val)
-#define IVLCMarquee_position(This,val) (This)->lpVtbl->position(This,val)
-#define IVLCMarquee_refresh(This,val) (This)->lpVtbl->refresh(This,val)
-#define IVLCMarquee_size(This,val) (This)->lpVtbl->size(This,val)
-#define IVLCMarquee_timeout(This,val) (This)->lpVtbl->timeout(This,val)
-#define IVLCMarquee_x(This,val) (This)->lpVtbl->x(This,val)
-#define IVLCMarquee_y(This,val) (This)->lpVtbl->y(This,val)
+#define IVLCMarquee_get_text(This,val) (This)->lpVtbl->get_text(This,val)
+#define IVLCMarquee_put_text(This,val) (This)->lpVtbl->put_text(This,val)
+#define IVLCMarquee_get_color(This,val) (This)->lpVtbl->get_color(This,val)
+#define IVLCMarquee_put_color(This,val) (This)->lpVtbl->put_color(This,val)
+#define IVLCMarquee_get_opacity(This,val) (This)->lpVtbl->get_opacity(This,val)
+#define IVLCMarquee_put_opacity(This,val) (This)->lpVtbl->put_opacity(This,val)
+#define IVLCMarquee_get_position(This,val) (This)->lpVtbl->get_position(This,val)
+#define IVLCMarquee_put_position(This,val) (This)->lpVtbl->put_position(This,val)
+#define IVLCMarquee_get_refresh(This,val) (This)->lpVtbl->get_refresh(This,val)
+#define IVLCMarquee_put_refresh(This,val) (This)->lpVtbl->put_refresh(This,val)
+#define IVLCMarquee_get_size(This,val) (This)->lpVtbl->get_size(This,val)
+#define IVLCMarquee_put_size(This,val) (This)->lpVtbl->put_size(This,val)
+#define IVLCMarquee_get_timeout(This,val) (This)->lpVtbl->get_timeout(This,val)
+#define IVLCMarquee_put_timeout(This,val) (This)->lpVtbl->put_timeout(This,val)
+#define IVLCMarquee_get_x(This,val) (This)->lpVtbl->get_x(This,val)
+#define IVLCMarquee_put_x(This,val) (This)->lpVtbl->put_x(This,val)
+#define IVLCMarquee_get_y(This,val) (This)->lpVtbl->get_y(This,val)
+#define IVLCMarquee_put_y(This,val) (This)->lpVtbl->put_y(This,val)
 #endif
 
 #endif
@@ -2691,74 +2763,146 @@ void __RPC_STUB IVLCMarquee_disable_Stub(
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_text_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_text_Proxy(
     IVLCMarquee* This,
-    BSTR text);
-void __RPC_STUB IVLCMarquee_text_Stub(
+    BSTR *val);
+void __RPC_STUB IVLCMarquee_get_text_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_color_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_text_Proxy(
     IVLCMarquee* This,
-    LONG val);
-void __RPC_STUB IVLCMarquee_color_Stub(
+    BSTR val);
+void __RPC_STUB IVLCMarquee_put_text_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_opacity_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_color_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_color_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_color_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_opacity_Stub(
+void __RPC_STUB IVLCMarquee_put_color_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_position_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_opacity_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_opacity_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_opacity_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_position_Stub(
+void __RPC_STUB IVLCMarquee_put_opacity_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_position_Proxy(
+    IVLCMarquee* This,
+    BSTR *val);
+void __RPC_STUB IVLCMarquee_get_position_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_position_Proxy(
+    IVLCMarquee* This,
+    BSTR val);
+void __RPC_STUB IVLCMarquee_put_position_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_refresh_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_refresh_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_refresh_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_refresh_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_refresh_Stub(
+void __RPC_STUB IVLCMarquee_put_refresh_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_size_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_size_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_size_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_size_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_size_Stub(
+void __RPC_STUB IVLCMarquee_put_size_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_timeout_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_timeout_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_timeout_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_timeout_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_timeout_Stub(
+void __RPC_STUB IVLCMarquee_put_timeout_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_x_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_x_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_x_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_x_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_x_Stub(
+void __RPC_STUB IVLCMarquee_put_x_Stub(
+    IRpcStubBuffer* This,
+    IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCMarquee_get_y_Proxy(
+    IVLCMarquee* This,
+    LONG *val);
+void __RPC_STUB IVLCMarquee_get_y_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
     DWORD* pdwStubPhase);
-HRESULT STDMETHODCALLTYPE IVLCMarquee_y_Proxy(
+HRESULT STDMETHODCALLTYPE IVLCMarquee_put_y_Proxy(
     IVLCMarquee* This,
     LONG val);
-void __RPC_STUB IVLCMarquee_y_Stub(
+void __RPC_STUB IVLCMarquee_put_y_Stub(
     IRpcStubBuffer* This,
     IRpcChannelBuffer* pRpcChannelBuffer,
     PRPC_MESSAGE pRpcMessage,
diff --git a/projects/activex/position.h b/projects/activex/position.h
new file mode 100644 (file)
index 0000000..ec1c7f8
--- /dev/null
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * position.h: Support routines for logo and marquee plugin objects
+ *****************************************************************************
+ * Copyright (C) 2010 M2X BV
+ *
+ * Authors: JP Dinger <jpd (at) videolan (dot) 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifndef POSITION_H
+#define POSITION_H
+
+struct posidx_s { const char *n; size_t i; };
+static const posidx_s posidx[] = {
+    { "center",        0 },
+    { "left",          1 },
+    { "right",         2 },
+    { "top",           4 },
+    { "bottom",        8 },
+    { "top-left",      5 },
+    { "top-right",     6 },
+    { "bottom-left",   9 },
+    { "bottom-right", 10 },
+};
+enum { num_posidx = sizeof(posidx)/sizeof(*posidx) };
+
+static inline const char *position_bynumber( size_t i )
+{
+    for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
+        if( h->i == i )
+            return h->n;
+    return "undefined";
+}
+
+static inline bool position_byname( const char *n, size_t &i )
+{
+    for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
+        if( !strcasecmp( n, h->n ) )
+            { i=h->i; return true; }
+    return false;
+}
+#endif
index 9c3c3235755adc250523fdf764274b243e98d20d..0d5d19cf89886a0b84c80d773d6bd3fcfe3e9d0a 100644 (file)
@@ -761,23 +761,23 @@ function doMarqueeOption(option, value)
     if( vlc )\r
     {\r
         if (option == 1)\r
-            vlc.video.marquee.color(val);\r
+            vlc.video.marquee.color = val;\r
         if (option == 2)\r
-            vlc.video.marquee.opacity(val);\r
+            vlc.video.marquee.opacity = val;\r
         if (option == 3)\r
-            vlc.video.marquee.position(val);\r
+            vlc.video.marquee.position = value;\r
         if (option == 4)\r
-            vlc.video.marquee.refresh(val);\r
+            vlc.video.marquee.refresh = val;\r
         if (option == 5)\r
-            vlc.video.marquee.size(val);\r
+            vlc.video.marquee.size = val;\r
         if (option == 6)\r
-            vlc.video.marquee.text(value);\r
+            vlc.video.marquee.text = value;\r
         if (option == 7)\r
-            vlc.video.marquee.timeout(val);\r
+            vlc.video.marquee.timeout = val;\r
         if (option == 8)\r
-            vlc.video.marquee.x(val);\r
+            vlc.video.marquee.x = val;\r
         if (option == 9)\r
-            vlc.video.marquee.y(val);\r
+            vlc.video.marquee.y = val;\r
     }\r
 }\r
 
index f4d639e400925d52c69e6c3ca34b5ebedc84e29b..d540542c201fcb725b39584ee322c6a317d6a64b 100644 (file)
@@ -32,6 +32,7 @@
 #include "vlccontrol2.h"
 #include "vlccontrol.h"
 
+#include "position.h"
 
 static inline
 HRESULT _exception_bridge(VLCPlugin *p,REFIID riid, libvlc_exception_t *ex)
@@ -810,19 +811,7 @@ STDMETHODIMP VLCMarquee::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
     return E_NOTIMPL;
 };
 
-STDMETHODIMP VLCMarquee::Invoke(DISPID dispIdMember, REFIID riid,
-        LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
-        VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
-    if( SUCCEEDED(loadTypeInfo()) )
-    {
-        return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
-                pVarResult, pExcepInfo, puArgErr);
-    }
-    return E_NOTIMPL;
-};
-
-STDMETHODIMP VLCMarquee::enable()
+HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val)
 {
     libvlc_media_player_t *p_md;
     HRESULT hr = _p_instance->getMD(&p_md);
@@ -830,137 +819,77 @@ STDMETHODIMP VLCMarquee::enable()
     {
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
-
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Enabled, true, &ex);
+        libvlc_video_set_marquee_int(p_md, idx, val, &ex);
         hr = exception_bridge(&ex);
     }
     return hr;
-};
+}
 
-STDMETHODIMP VLCMarquee::disable()
+HRESULT VLCMarquee::do_get_int(unsigned idx, LONG *val)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Enabled, false, &ex);
-        hr = exception_bridge(&ex);
-    }
-    return hr;
-};
+    if( NULL == val )
+        return E_POINTER;
 
-STDMETHODIMP VLCMarquee::color(long val)
-{
     libvlc_media_player_t *p_md;
     HRESULT hr = _p_instance->getMD(&p_md);
     if( SUCCEEDED(hr) )
     {
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
-
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Color, val, &ex);
+        *val = libvlc_video_get_marquee_int(p_md, idx, &ex);
         hr = exception_bridge(&ex);
     }
     return hr;
-};
+}
 
-STDMETHODIMP VLCMarquee::opacity(long val)
+STDMETHODIMP VLCMarquee::Invoke(DISPID dispIdMember, REFIID riid,
+        LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
+        VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
+    if( SUCCEEDED(loadTypeInfo()) )
     {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Opacity, val, &ex);
-        hr = exception_bridge(&ex);
+        return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
+                pVarResult, pExcepInfo, puArgErr);
     }
-    return hr;
+    return E_NOTIMPL;
 };
 
-STDMETHODIMP VLCMarquee::position(long val)
+STDMETHODIMP VLCMarquee::get_position(BSTR* val)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
+    if( NULL == val )
+        return E_POINTER;
 
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Position, val, &ex);
-        hr = exception_bridge(&ex);
-    }
-    return hr;
-};
+    LONG i;
+    HRESULT hr = do_get_int(libvlc_marquee_Position, &i);
 
-STDMETHODIMP VLCMarquee::refresh(long val)
-{
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
+    if(SUCCEEDED(hr))
+        *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
 
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Refresh, val, &ex);
-        hr = exception_bridge(&ex);
-    }
     return hr;
-};
+}
 
-STDMETHODIMP VLCMarquee::size(long val)
+STDMETHODIMP VLCMarquee::put_position(BSTR val)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Size, val, &ex);
-        hr = exception_bridge(&ex);
-    }
-    return hr;
-};
+    char *n = CStrFromBSTR(CP_UTF8, val);
+    if( !n ) return E_OUTOFMEMORY;
 
-STDMETHODIMP VLCMarquee::text(BSTR text)
-{
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
+    size_t i;
+    HRESULT hr;
+    if( position_byname( n, i ) )
+        hr = do_put_int(libvlc_marquee_Position,i);
+    else
+        hr = E_INVALIDARG;
 
-        char *psz_text = CStrFromBSTR(CP_UTF8, text);
-        libvlc_video_set_marquee_option_as_string(p_md, libvlc_marquee_Text, psz_text, &ex);
-        hr = exception_bridge(&ex);
-        CoTaskMemFree(psz_text);
-    }
+    CoTaskMemFree(n);
     return hr;
-};
+}
 
-STDMETHODIMP VLCMarquee::timeout(long val)
+STDMETHODIMP VLCMarquee::get_text(BSTR *val)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = _p_instance->getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_exception_t ex;
-        libvlc_exception_init(&ex);
-
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Timeout, val, &ex);
-        hr = exception_bridge(&ex);
-    }
-    return hr;
-};
+    char *psz;
+    if( NULL == val )
+        return E_POINTER;
 
-STDMETHODIMP VLCMarquee::x(long val)
-{
     libvlc_media_player_t *p_md;
     HRESULT hr = _p_instance->getMD(&p_md);
     if( SUCCEEDED(hr) )
@@ -968,13 +897,16 @@ STDMETHODIMP VLCMarquee::x(long val)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
 
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_X, val, &ex);
+        psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text, &ex);
+
         hr = exception_bridge(&ex);
+        if(SUCCEEDED(hr))
+            *val = BSTRFromCStr(CP_UTF8, psz);
     }
     return hr;
-};
+}
 
-STDMETHODIMP VLCMarquee::y(long val)
+STDMETHODIMP VLCMarquee::put_text(BSTR val)
 {
     libvlc_media_player_t *p_md;
     HRESULT hr = _p_instance->getMD(&p_md);
@@ -983,11 +915,14 @@ STDMETHODIMP VLCMarquee::y(long val)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
 
-        libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Y, val, &ex);
+        char *psz_text = CStrFromBSTR(CP_UTF8, val);
+        libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text,
+                                        psz_text, &ex);
         hr = exception_bridge(&ex);
+        CoTaskMemFree(psz_text);
     }
     return hr;
-};
+}
 
 /****************************************************************************/
 
@@ -2704,6 +2639,7 @@ HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val)
     }
     return hr;
 }
+
 STDMETHODIMP VLCLogo::file(BSTR fname)
 {
     libvlc_media_player_t *p_md;
@@ -2724,19 +2660,6 @@ STDMETHODIMP VLCLogo::file(BSTR fname)
     return hr;
 }
 
-struct posidx_s { const char *n; size_t i; };
-static const posidx_s posidx[] = {
-    { "center",        0 },
-    { "left",          1 },
-    { "right",         2 },
-    { "top",           4 },
-    { "bottom",        8 },
-    { "top-left",      5 },
-    { "top-right",     6 },
-    { "bottom-left",   9 },
-    { "bottom-right", 10 },
-};
-enum { num_posidx = sizeof(posidx)/sizeof(*posidx) };
 STDMETHODIMP VLCLogo::get_position(BSTR* val)
 {
     if( NULL == val )
@@ -2746,35 +2669,21 @@ STDMETHODIMP VLCLogo::get_position(BSTR* val)
     HRESULT hr = do_get_int(libvlc_logo_position, &i);
 
     if(SUCCEEDED(hr))
-    {
-        const char *n="undefined";
+        *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
 
-        for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
-            if( i == h->i )
-            {
-                n=h->n;
-                break;
-            }
-        *val = BSTRFromCStr(CP_UTF8, n);
-    }
     return hr;
 }
+
 STDMETHODIMP VLCLogo::put_position(BSTR val)
 {
     char *n = CStrFromBSTR(CP_UTF8, val);
     if( !n ) return E_OUTOFMEMORY;
 
-    HRESULT hr = E_NOTIMPL;
-
-    const posidx_s *h;
-    for( h=posidx; h<posidx+num_posidx; ++h )
-        if( !strcasecmp( n, h->n ) )
-        {
-            hr = do_put_int(libvlc_logo_position,h->i);
-            break;
-        }
-
-    if( h == posidx+num_posidx )
+    size_t i;
+    HRESULT hr;
+    if( position_byname( n, i ) )
+        hr = do_put_int(libvlc_logo_position,i);
+    else
         hr = E_INVALIDARG;
 
     CoTaskMemFree(n);
index 30ad2cdbffa732085d5afcbca98fbcafddf6cd64..1898982045a6eb0314d92248d4b9ec78430bc3d1 100644 (file)
@@ -415,26 +415,37 @@ public:
     STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
 
     // IVLCMarquee methods
-    STDMETHODIMP enable();
-    STDMETHODIMP disable();
-    STDMETHODIMP text(BSTR);
-    STDMETHODIMP color(long);
-    STDMETHODIMP opacity(long);
-    STDMETHODIMP position(long);
-    STDMETHODIMP refresh(long);
-    STDMETHODIMP size(long);
-    STDMETHODIMP timeout(long);
-    STDMETHODIMP x(long);
-    STDMETHODIMP y(long);
+    STDMETHODIMP enable()  { return do_put_int(libvlc_marquee_Enable, true); }
+    STDMETHODIMP disable() { return do_put_int(libvlc_marquee_Enable, false); }
+
+    STDMETHODIMP get_text(BSTR *);
+    STDMETHODIMP put_text(BSTR);
+    STDMETHODIMP get_position(BSTR *);
+    STDMETHODIMP put_position(BSTR);
+
+#define PROP_INT( a, b ) \
+        STDMETHODIMP get_##a(LONG *val) { return do_get_int(b,val); } \
+        STDMETHODIMP put_##a(LONG val)  { return do_put_int(b,val); }
+
+    PROP_INT( color,    libvlc_marquee_Color )
+    PROP_INT( opacity,  libvlc_marquee_Opacity )
+    PROP_INT( refresh,  libvlc_marquee_Refresh )
+    PROP_INT( size,     libvlc_marquee_Size )
+    PROP_INT( timeout,  libvlc_marquee_Timeout )
+    PROP_INT( x,        libvlc_marquee_X )
+    PROP_INT( y,        libvlc_marquee_Y )
+
+#undef  PROP_INT
 
 protected:
     HRESULT loadTypeInfo();
     HRESULT exception_bridge(libvlc_exception_t *ex);
-
 private:
     VLCPlugin*      _p_instance;
     ITypeInfo*      _p_typeinfo;
 
+    HRESULT do_put_int(unsigned idx, LONG val);
+    HRESULT do_get_int(unsigned idx, LONG *val);
 };