Commit a5922991 authored by JP Dinger's avatar JP Dinger

activex plugin: Bring marquee interface in line with logo.

parent c34b5ca5
...@@ -441,29 +441,46 @@ library AXVLC ...@@ -441,29 +441,46 @@ library AXVLC
{ {
[helpstring("enable Marquee Filter.")] [helpstring("enable Marquee Filter.")]
HRESULT enable(); HRESULT enable();
[helpstring("disable Marquee Filter.")] [helpstring("disable Marquee Filter.")]
HRESULT disable(); HRESULT disable();
[helpstring("set text to Marquee Filter.")] [propget, helpstring("Retrieve marquee text.")]
HRESULT text([in] BSTR text); HRESULT text([out, retval] BSTR* val);
[propput, helpstring("Change marquee text.")]
[helpstring("change text color.")] HRESULT text([in] BSTR val);
HRESULT color ([in] long val);
[helpstring("change text opacity.")] [propget, helpstring("Retrieve text color.")]
HRESULT opacity ([in] long val); HRESULT color([out, retval] LONG* val);
[helpstring("change text position.")] [propput, helpstring("Change text color.")]
HRESULT position ([in] long val); HRESULT color([in] LONG val);
[helpstring("change refresh time.")] [propget, helpstring("Retrieve text opacity.")]
HRESULT refresh ([in] long val); HRESULT opacity([out, retval] LONG* val);
[helpstring("change text size.")] [propput, helpstring("Set text opacity (0=transparent, 255=opaque).")]
HRESULT size ([in] long val); HRESULT opacity([in] LONG val);
[helpstring("change timeout.")] [propget, helpstring("Retrieve text position.")]
HRESULT timeout ([in] long val); HRESULT position([out, retval] BSTR* val);
[helpstring("change text abcissa.")] [propput, helpstring("Text positioning relative to: center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right.")]
HRESULT x ([in] long val); HRESULT position([in] BSTR val);
[helpstring("change text ordinate.")] [propget, helpstring("Retrieve text refresh time.")]
HRESULT y ([in] long val); 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);
}; };
[ [
......
This diff is collapsed.
/*****************************************************************************
* 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
...@@ -761,23 +761,23 @@ function doMarqueeOption(option, value) ...@@ -761,23 +761,23 @@ function doMarqueeOption(option, value)
if( vlc ) if( vlc )
{ {
if (option == 1) if (option == 1)
vlc.video.marquee.color(val); vlc.video.marquee.color = val;
if (option == 2) if (option == 2)
vlc.video.marquee.opacity(val); vlc.video.marquee.opacity = val;
if (option == 3) if (option == 3)
vlc.video.marquee.position(val); vlc.video.marquee.position = value;
if (option == 4) if (option == 4)
vlc.video.marquee.refresh(val); vlc.video.marquee.refresh = val;
if (option == 5) if (option == 5)
vlc.video.marquee.size(val); vlc.video.marquee.size = val;
if (option == 6) if (option == 6)
vlc.video.marquee.text(value); vlc.video.marquee.text = value;
if (option == 7) if (option == 7)
vlc.video.marquee.timeout(val); vlc.video.marquee.timeout = val;
if (option == 8) if (option == 8)
vlc.video.marquee.x(val); vlc.video.marquee.x = val;
if (option == 9) if (option == 9)
vlc.video.marquee.y(val); vlc.video.marquee.y = val;
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "vlccontrol2.h" #include "vlccontrol2.h"
#include "vlccontrol.h" #include "vlccontrol.h"
#include "position.h"
static inline static inline
HRESULT _exception_bridge(VLCPlugin *p,REFIID riid, libvlc_exception_t *ex) HRESULT _exception_bridge(VLCPlugin *p,REFIID riid, libvlc_exception_t *ex)
...@@ -810,19 +811,7 @@ STDMETHODIMP VLCMarquee::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, ...@@ -810,19 +811,7 @@ STDMETHODIMP VLCMarquee::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
return E_NOTIMPL; return E_NOTIMPL;
}; };
STDMETHODIMP VLCMarquee::Invoke(DISPID dispIdMember, REFIID riid, HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val)
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()
{ {
libvlc_media_player_t *p_md; libvlc_media_player_t *p_md;
HRESULT hr = _p_instance->getMD(&p_md); HRESULT hr = _p_instance->getMD(&p_md);
...@@ -830,137 +819,77 @@ STDMETHODIMP VLCMarquee::enable() ...@@ -830,137 +819,77 @@ STDMETHODIMP VLCMarquee::enable()
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_video_set_marquee_int(p_md, idx, val, &ex);
libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Enabled, true, &ex);
hr = exception_bridge(&ex); hr = exception_bridge(&ex);
} }
return hr; return hr;
}; }
STDMETHODIMP VLCMarquee::disable() HRESULT VLCMarquee::do_get_int(unsigned idx, LONG *val)
{ {
libvlc_media_player_t *p_md; if( NULL == val )
HRESULT hr = _p_instance->getMD(&p_md); return E_POINTER;
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;
};
STDMETHODIMP VLCMarquee::color(long val)
{
libvlc_media_player_t *p_md; libvlc_media_player_t *p_md;
HRESULT hr = _p_instance->getMD(&p_md); HRESULT hr = _p_instance->getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
*val = libvlc_video_get_marquee_int(p_md, idx, &ex);
libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Color, val, &ex);
hr = exception_bridge(&ex); hr = exception_bridge(&ex);
} }
return hr; 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; if( SUCCEEDED(loadTypeInfo()) )
HRESULT hr = _p_instance->getMD(&p_md);
if( SUCCEEDED(hr) )
{ {
libvlc_exception_t ex; return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
libvlc_exception_init(&ex); pVarResult, pExcepInfo, puArgErr);
libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Opacity, val, &ex);
hr = exception_bridge(&ex);
} }
return hr; return E_NOTIMPL;
}; };
STDMETHODIMP VLCMarquee::position(long val) STDMETHODIMP VLCMarquee::get_position(BSTR* val)
{ {
libvlc_media_player_t *p_md; if( NULL == val )
HRESULT hr = _p_instance->getMD(&p_md); return E_POINTER;
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_video_set_marquee_option_as_int(p_md, libvlc_marquee_Position, val, &ex); LONG i;
hr = exception_bridge(&ex); HRESULT hr = do_get_int(libvlc_marquee_Position, &i);
}
return hr;
};
STDMETHODIMP VLCMarquee::refresh(long val) if(SUCCEEDED(hr))
{ *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
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_Refresh, val, &ex);
hr = exception_bridge(&ex);
}
return hr; return hr;
}; }
STDMETHODIMP VLCMarquee::size(long val) STDMETHODIMP VLCMarquee::put_position(BSTR val)
{ {
libvlc_media_player_t *p_md; char *n = CStrFromBSTR(CP_UTF8, val);
HRESULT hr = _p_instance->getMD(&p_md); if( !n ) return E_OUTOFMEMORY;
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;
};
STDMETHODIMP VLCMarquee::text(BSTR text) size_t i;
{ HRESULT hr;
libvlc_media_player_t *p_md; if( position_byname( n, i ) )
HRESULT hr = _p_instance->getMD(&p_md); hr = do_put_int(libvlc_marquee_Position,i);
if( SUCCEEDED(hr) ) else
{ hr = E_INVALIDARG;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
char *psz_text = CStrFromBSTR(CP_UTF8, text); CoTaskMemFree(n);
libvlc_video_set_marquee_option_as_string(p_md, libvlc_marquee_Text, psz_text, &ex);
hr = exception_bridge(&ex);
CoTaskMemFree(psz_text);
}
return hr; return hr;
}; }
STDMETHODIMP VLCMarquee::timeout(long val) STDMETHODIMP VLCMarquee::get_text(BSTR *val)
{ {
libvlc_media_player_t *p_md; char *psz;
HRESULT hr = _p_instance->getMD(&p_md); if( NULL == val )
if( SUCCEEDED(hr) ) return E_POINTER;
{
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;
};
STDMETHODIMP VLCMarquee::x(long val)
{
libvlc_media_player_t *p_md; libvlc_media_player_t *p_md;
HRESULT hr = _p_instance->getMD(&p_md); HRESULT hr = _p_instance->getMD(&p_md);
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
...@@ -968,13 +897,16 @@ STDMETHODIMP VLCMarquee::x(long val) ...@@ -968,13 +897,16 @@ STDMETHODIMP VLCMarquee::x(long val)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&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); hr = exception_bridge(&ex);
if(SUCCEEDED(hr))
*val = BSTRFromCStr(CP_UTF8, psz);
} }
return hr; return hr;
}; }
STDMETHODIMP VLCMarquee::y(long val) STDMETHODIMP VLCMarquee::put_text(BSTR val)
{ {
libvlc_media_player_t *p_md; libvlc_media_player_t *p_md;
HRESULT hr = _p_instance->getMD(&p_md); HRESULT hr = _p_instance->getMD(&p_md);
...@@ -983,11 +915,14 @@ STDMETHODIMP VLCMarquee::y(long val) ...@@ -983,11 +915,14 @@ STDMETHODIMP VLCMarquee::y(long val)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&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); hr = exception_bridge(&ex);
CoTaskMemFree(psz_text);
} }
return hr; return hr;
}; }
/****************************************************************************/ /****************************************************************************/
...@@ -2704,6 +2639,7 @@ HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val) ...@@ -2704,6 +2639,7 @@ HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val)
} }
return hr; return hr;
} }
STDMETHODIMP VLCLogo::file(BSTR fname) STDMETHODIMP VLCLogo::file(BSTR fname)
{ {
libvlc_media_player_t *p_md; libvlc_media_player_t *p_md;
...@@ -2724,19 +2660,6 @@ STDMETHODIMP VLCLogo::file(BSTR fname) ...@@ -2724,19 +2660,6 @@ STDMETHODIMP VLCLogo::file(BSTR fname)
return hr; 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) STDMETHODIMP VLCLogo::get_position(BSTR* val)
{ {
if( NULL == val ) if( NULL == val )
...@@ -2746,35 +2669,21 @@ STDMETHODIMP VLCLogo::get_position(BSTR* val) ...@@ -2746,35 +2669,21 @@ STDMETHODIMP VLCLogo::get_position(BSTR* val)
HRESULT hr = do_get_int(libvlc_logo_position, &i); HRESULT hr = do_get_int(libvlc_logo_position, &i);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ *val = BSTRFromCStr(CP_UTF8, position_bynumber(i));
const char *n="undefined";
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; return hr;
} }
STDMETHODIMP VLCLogo::put_position(BSTR val) STDMETHODIMP VLCLogo::put_position(BSTR val)
{ {
char *n = CStrFromBSTR(CP_UTF8, val); char *n = CStrFromBSTR(CP_UTF8, val);
if( !n ) return E_OUTOFMEMORY; if( !n ) return E_OUTOFMEMORY;
HRESULT hr = E_NOTIMPL; size_t i;
HRESULT hr;
const posidx_s *h; if( position_byname( n, i ) )
for( h=posidx; h<posidx+num_posidx; ++h ) hr = do_put_int(libvlc_logo_position,i);
if( !strcasecmp( n, h->n ) ) else
{
hr = do_put_int(libvlc_logo_position,h->i);
break;
}
if( h == posidx+num_posidx )
hr = E_INVALIDARG; hr = E_INVALIDARG;
CoTaskMemFree(n); CoTaskMemFree(n);
......
...@@ -415,26 +415,37 @@ public: ...@@ -415,26 +415,37 @@ public:
STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
// IVLCMarquee methods // IVLCMarquee methods
STDMETHODIMP enable(); STDMETHODIMP enable() { return do_put_int(libvlc_marquee_Enable, true); }
STDMETHODIMP disable(); STDMETHODIMP disable() { return do_put_int(libvlc_marquee_Enable, false); }
STDMETHODIMP text(BSTR);
STDMETHODIMP color(long); STDMETHODIMP get_text(BSTR *);
STDMETHODIMP opacity(long); STDMETHODIMP put_text(BSTR);
STDMETHODIMP position(long); STDMETHODIMP get_position(BSTR *);
STDMETHODIMP refresh(long); STDMETHODIMP put_position(BSTR);
STDMETHODIMP size(long);
STDMETHODIMP timeout(long); #define PROP_INT( a, b ) \
STDMETHODIMP x(long); STDMETHODIMP get_##a(LONG *val) { return do_get_int(b,val); } \
STDMETHODIMP y(long); 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: protected:
HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
HRESULT exception_bridge(libvlc_exception_t *ex); HRESULT exception_bridge(libvlc_exception_t *ex);
private: private:
VLCPlugin* _p_instance; VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo; ITypeInfo* _p_typeinfo;
HRESULT do_put_int(unsigned idx, LONG val);
HRESULT do_get_int(unsigned idx, LONG *val);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment