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
{
[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);
};
[
......
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)
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;
}
}
......
......@@ -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);
......
......@@ -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);
};
......
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