From: JP Dinger Date: Tue, 19 Jan 2010 16:50:52 +0000 (+0100) Subject: activex plugin: Bring marquee interface in line with logo. X-Git-Tag: 1.1.0-ff~1103 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a5922991f0660be69c2e363b29786c5743dc0586;p=vlc activex plugin: Bring marquee interface in line with logo. --- diff --git a/projects/activex/axvlc.idl b/projects/activex/axvlc.idl index dba31d553c..961afd8ce8 100644 --- a/projects/activex/axvlc.idl +++ b/projects/activex/axvlc.idl @@ -441,29 +441,46 @@ library AXVLC { [helpstring("enable Marquee Filter.")] HRESULT enable(); - [helpstring("disable Marquee Filter.")] HRESULT disable(); - [helpstring("set text to Marquee Filter.")] - HRESULT text([in] BSTR text); - - [helpstring("change text color.")] - HRESULT color ([in] long val); - [helpstring("change text opacity.")] - HRESULT opacity ([in] long val); - [helpstring("change text position.")] - HRESULT position ([in] long val); - [helpstring("change refresh time.")] - HRESULT refresh ([in] long val); - [helpstring("change text size.")] - HRESULT size ([in] long val); - [helpstring("change timeout.")] - HRESULT timeout ([in] long val); - [helpstring("change text abcissa.")] - HRESULT x ([in] long val); - [helpstring("change text ordinate.")] - HRESULT y ([in] long val); + [propget, helpstring("Retrieve marquee text.")] + HRESULT text([out, retval] BSTR* val); + [propput, helpstring("Change marquee text.")] + HRESULT text([in] BSTR val); + + [propget, helpstring("Retrieve text color.")] + HRESULT color([out, retval] LONG* val); + [propput, helpstring("Change text color.")] + HRESULT color([in] LONG val); + [propget, helpstring("Retrieve text opacity.")] + HRESULT opacity([out, retval] LONG* val); + [propput, helpstring("Set text opacity (0=transparent, 255=opaque).")] + HRESULT opacity([in] LONG val); + [propget, helpstring("Retrieve text position.")] + HRESULT position([out, retval] BSTR* val); + [propput, helpstring("Text positioning relative to: center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right.")] + HRESULT position([in] BSTR val); + [propget, helpstring("Retrieve text refresh time.")] + HRESULT refresh([out, retval] LONG* val); + [propput, helpstring("Set text refresh time.")] + HRESULT refresh([in] LONG val); + [propget, helpstring("Retrieve text size.")] + HRESULT size([out, retval] LONG* val); + [propput, helpstring("Set text size.")] + HRESULT size([in] LONG val); + [propget, helpstring("Retrieve timeout.")] + HRESULT timeout([out, retval] LONG* val); + [propput, helpstring("Change timeout.")] + HRESULT timeout([in] LONG val); + [propget, helpstring("Retrieve text abcissa.")] + HRESULT x([out, retval] LONG* val); + [propput, helpstring("Change text abcissa.")] + HRESULT x([in] LONG val); + [propget, helpstring("Retrieve text ordinate.")] + HRESULT y([out, retval] LONG* val); + [propput, helpstring("Change text ordinate.")] + HRESULT y([in] LONG val); }; [ diff --git a/projects/activex/axvlc.tlb b/projects/activex/axvlc.tlb index d8927e42c5..d08ef96c97 100644 Binary files a/projects/activex/axvlc.tlb and b/projects/activex/axvlc.tlb differ diff --git a/projects/activex/axvlc_idl.h b/projects/activex/axvlc_idl.h index abd103c1ea..5a9955105d 100644 --- a/projects/activex/axvlc_idl.h +++ b/projects/activex/axvlc_idl.h @@ -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 index 0000000000..ec1c7f8abd --- /dev/null +++ b/projects/activex/position.h @@ -0,0 +1,54 @@ +/***************************************************************************** + * position.h: Support routines for logo and marquee plugin objects + ***************************************************************************** + * Copyright (C) 2010 M2X BV + * + * Authors: JP Dinger + * + * 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; hi == i ) + return h->n; + return "undefined"; +} + +static inline bool position_byname( const char *n, size_t &i ) +{ + for( const posidx_s *h=posidx; hn ) ) + { i=h->i; return true; } + return false; +} +#endif diff --git a/projects/activex/test.html b/projects/activex/test.html index 9c3c323575..0d5d19cf89 100644 --- a/projects/activex/test.html +++ b/projects/activex/test.html @@ -761,23 +761,23 @@ function doMarqueeOption(option, value) if( vlc ) { if (option == 1) - vlc.video.marquee.color(val); + vlc.video.marquee.color = val; if (option == 2) - vlc.video.marquee.opacity(val); + vlc.video.marquee.opacity = val; if (option == 3) - vlc.video.marquee.position(val); + vlc.video.marquee.position = value; if (option == 4) - vlc.video.marquee.refresh(val); + vlc.video.marquee.refresh = val; if (option == 5) - vlc.video.marquee.size(val); + vlc.video.marquee.size = val; if (option == 6) - vlc.video.marquee.text(value); + vlc.video.marquee.text = value; if (option == 7) - vlc.video.marquee.timeout(val); + vlc.video.marquee.timeout = val; if (option == 8) - vlc.video.marquee.x(val); + vlc.video.marquee.x = val; if (option == 9) - vlc.video.marquee.y(val); + vlc.video.marquee.y = val; } } diff --git a/projects/activex/vlccontrol2.cpp b/projects/activex/vlccontrol2.cpp index f4d639e400..d540542c20 100644 --- a/projects/activex/vlccontrol2.cpp +++ b/projects/activex/vlccontrol2.cpp @@ -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; hi ) - { - 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; hn ) ) - { - 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); diff --git a/projects/activex/vlccontrol2.h b/projects/activex/vlccontrol2.h index 30ad2cdbff..1898982045 100644 --- a/projects/activex/vlccontrol2.h +++ b/projects/activex/vlccontrol2.h @@ -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); };