Commit e79db6b8 authored by JP Dinger's avatar JP Dinger Committed by Jean-Baptiste Kempf

Update activex plugin and test page for new logo interface.

parent 1df0dd79
......@@ -2,6 +2,7 @@
* axvlc.idl: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* Copyright (C) 2010 M2X BV
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
......@@ -21,8 +22,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
//comments terminated by [t] are by tonsofpcs, regarding the string review. April 02, 2006. [t]
//Possibly change all instances of "the current playlist" to "the playlist" and "current playlist" to "the playlist" [t]
// comments terminated by [t] are by tonsofpcs, regarding the string
// review. April 02, 2006. [t]
// Possibly change all instances of "the current playlist" to "the
// playlist" and "current playlist" to "the playlist" [t]
import "ocidl.idl";
......@@ -129,13 +132,13 @@ library AXVLC
HRESULT setVariable([in] BSTR name, [in] VARIANT value);
[helpstring("Returns the value of a VLC variable.")]
HRESULT getVariable([in] BSTR name, [out, retval] VARIANT *value);
[helpstring("Add an item to the playlist.")]
/*
** use VARIANT rather than a SAFEARRAY as argument type
** for compatibility with some scripting language (JScript)
*/
[helpstring("Add an item to the playlist.")]
HRESULT addTarget([in] BSTR uri, [in] VARIANT options, [in] enum VLCPlaylistMode mode, [in] int position);
[propget, helpstring("Returns index of current item in playlist.")]
HRESULT PlaylistIndex([out, retval] int* index);
......@@ -463,6 +466,54 @@ library AXVLC
HRESULT y ([in] long val);
};
[
odl,
uuid(8a4a20c2-93f3-44e8-8644-beb2e3487e84),
helpstring("VLC Logo Filter"),
dual,
oleautomation
]
interface IVLCLogo : IDispatch
{
[helpstring("Enable the logo filter.")]
HRESULT enable();
[helpstring("Disable the logo filter.")]
HRESULT disable();
[helpstring("specify input file[[,delay],alpha].")]
HRESULT file([in] BSTR fname);
[propget, helpstring("")]
HRESULT delay([out, retval] long* val);
[propput, helpstring("Set delay-to-next-picture in miliseconds.")]
HRESULT delay([in] long val);
[propget, helpstring("")]
HRESULT repeat([out, retval] long* val);
[propput, helpstring("Repeat: -1 continuous (default), 0 no repeat, ....")]
HRESULT repeat([in] long val);
[propget, helpstring("Returns the `global' alpha value.")]
HRESULT opacity([out, retval] long* val);
[propput, helpstring("Alpha value: 0 opaque to 255 fully transparent")]
HRESULT opacity([in] long val);
[propget, helpstring("Retrieve picture position.")]
HRESULT position([out, retval] BSTR* val);
[propput, helpstring("Picture positioning relative to: center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right.")]
HRESULT position([in] BSTR val);
[propget, helpstring("Picture x offset.")]
HRESULT x([out, retval] long* val);
[propput, helpstring("Picture x offset.")]
HRESULT x([in] long val);
[propget, helpstring("Picture y offset.")]
HRESULT y([out, retval] long* val);
[propput, helpstring("Picture y offset.")]
HRESULT y([in] long val);
};
[
odl,
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),
......@@ -520,6 +571,9 @@ library AXVLC
[propget, helpstring("Returns the marquee object.")]
HRESULT marquee([out, retval] IVLCMarquee** obj);
[propget, helpstring("Returns the logo object.")]
HRESULT logo([out, retval] IVLCLogo** obj);
};
[
......
/*** Autogenerated by WIDL 1.0 from axvlc.idl - Do not edit ***/
/*** Autogenerated by WIDL 1.1.23 from axvlc.idl - Do not edit ***/
#include <rpc.h>
#include <rpcndr.h>
......@@ -22,6 +22,7 @@ DEFINE_GUID(IID_IVLCPlaylistItems, 0xfd37fe32, 0x82bc, 0x4a25, 0xb0,0x56, 0x31,0
DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d);
DEFINE_GUID(IID_IVLCSubtitle, 0x465e787a, 0x0556, 0x452f, 0x94,0x77, 0x95,0x4e,0x4a,0x94,0x00,0x03);
DEFINE_GUID(IID_IVLCMarquee, 0x8d076ad6, 0x9b6f, 0x4150, 0xa0,0xfd, 0x5d,0x7e,0x8c,0x8c,0xb0,0x2c);
DEFINE_GUID(IID_IVLCLogo, 0x8a4a20c2, 0x93f3, 0x44e8, 0x86,0x44, 0xbe,0xb2,0xe3,0x48,0x7e,0x84);
DEFINE_GUID(IID_IVLCVideo, 0x0aaedf0b, 0xd333, 0x4b27, 0xa0,0xc6, 0xbb,0xf3,0x14,0x13,0xa4,0x2e);
DEFINE_GUID(IID_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3);
DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8);
......
This diff is collapsed.
......@@ -235,14 +235,12 @@ Insert Slider widget
<INPUT size=4 value="" id="logoIntValue">
<SELECT readonly onClick="doLogoOption(this.value,document.getElementById('logoIntValue').value);">
<OPTION value=1>File</OPTION>
<OPTION value=2>Transparency</OPTION>
<OPTION value=3>Position</OPTION>
<OPTION value=2>Position</OPTION>
<OPTION value=3>Opacity</OPTION>
<OPTION value=4>Repeat</OPTION>
<OPTION value=5>Delay</OPTION>
<OPTION value=6>X</OPTION>
<OPTION value=7>Y</OPTION>
<OPTION value=8>Width</OPTION>
<OPTION value=9>Height</OPTION>
</SELECT>
</TD>
</TR>
......@@ -786,27 +784,23 @@ function doMarqueeOption(option, value)
function doLogoOption(option, value)
{
var vlc = getVLC("vlc");
val = parseInt(value);
if( vlc )
{
if (option == 1)
vlc.video.logo.file(val);
vlc.video.logo.file(value);
if (option == 2)
vlc.video.logo.transparency(val);
vlc.video.logo.position = value;
val = parseInt(value);
if (option == 3)
vlc.video.logo.position(val);
vlc.video.logo.opacity = val;
if (option == 4)
vlc.video.logo.repeat(val);
vlc.video.logo.repeat = val;
if (option == 5)
vlc.video.logo.delay(val);
vlc.video.logo.delay = val;
if (option == 6)
vlc.video.logo.x(val);
vlc.video.logo.x = val;
if (option == 7)
vlc.video.logo.y(val);
if (option == 8)
vlc.video.logo.width(val);
if (option == 9)
vlc.video.logo.height(val);
vlc.video.logo.y = val;
}
}
......
......@@ -2,6 +2,7 @@
* vlccontrol2.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* Copyright (C) 2010 M2X BV
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
......@@ -21,17 +22,16 @@
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "vlccontrol2.h"
#include "vlccontrol.h"
#include "utils.h"
#include <stdio.h>
#include <shlwapi.h>
#include <wininet.h>
#include <tchar.h>
#include "utils.h"
#include "plugin.h"
#include "vlccontrol2.h"
#include "vlccontrol.h"
static inline
HRESULT _exception_bridge(VLCPlugin *p,REFIID riid, libvlc_exception_t *ex)
......@@ -55,6 +55,7 @@ EMIT_EXCEPTION_BRIDGE( VLCMarquee )
EMIT_EXCEPTION_BRIDGE( VLCMessageIterator )
EMIT_EXCEPTION_BRIDGE( VLCMessages )
EMIT_EXCEPTION_BRIDGE( VLCLog )
EMIT_EXCEPTION_BRIDGE( VLCLogo )
EMIT_EXCEPTION_BRIDGE( VLCPlaylistItems )
EMIT_EXCEPTION_BRIDGE( VLCPlaylist )
EMIT_EXCEPTION_BRIDGE( VLCVideo )
......@@ -335,7 +336,7 @@ STDMETHODIMP VLCAudio::toggleMute()
return hr;
};
/*******************************************************************************/
/****************************************************************************/
VLCInput::~VLCInput()
{
......@@ -594,7 +595,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
return hr;
};
/*******************************************************************************/
/****************************************************************************/
VLCLog::~VLCLog()
{
......@@ -742,7 +743,7 @@ STDMETHODIMP VLCLog::put_verbosity(long verbosity)
return hr;
};
/*******************************************************************************/
/****************************************************************************/
VLCMarquee::~VLCMarquee()
{
......@@ -988,7 +989,7 @@ STDMETHODIMP VLCMarquee::y(long val)
return hr;
};
/*******************************************************************************/
/****************************************************************************/
/* STL forward iterator used by VLCEnumIterator class to implement IEnumVARIANT */
......@@ -1196,7 +1197,7 @@ STDMETHODIMP VLCMessages::iterator(IVLCMessageIterator** iter)
return *iter ? S_OK : E_OUTOFMEMORY;
};
/*******************************************************************************/
/****************************************************************************/
VLCMessageIterator::VLCMessageIterator(VLCPlugin *p_instance, VLCLog* p_vlclog ) :
_p_instance(p_instance),
......@@ -1333,7 +1334,7 @@ STDMETHODIMP VLCMessageIterator::next(IVLCMessage** message)
return hr;
};
/*******************************************************************************/
/****************************************************************************/
VLCMessage::~VLCMessage()
{
......@@ -1493,7 +1494,7 @@ STDMETHODIMP VLCMessage::get_message(BSTR* message)
return NOERROR;
};
/*******************************************************************************/
/****************************************************************************/
VLCPlaylistItems::~VLCPlaylistItems()
{
......@@ -1608,7 +1609,7 @@ STDMETHODIMP VLCPlaylistItems::remove(long item)
return hr;
};
/*******************************************************************************/
/****************************************************************************/
VLCPlaylist::~VLCPlaylist()
{
......@@ -1902,7 +1903,7 @@ STDMETHODIMP VLCPlaylist::get_items(IVLCPlaylistItems** obj)
return E_OUTOFMEMORY;
};
/*******************************************************************************/
/****************************************************************************/
VLCSubtitle::~VLCSubtitle()
{
......@@ -2085,11 +2086,12 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name)
return hr;
};
/*******************************************************************************/
/****************************************************************************/
VLCVideo::~VLCVideo()
{
delete _p_vlcmarquee;
delete _p_vlclogo;
if( _p_typeinfo )
_p_typeinfo->Release();
};
......@@ -2585,24 +2587,213 @@ STDMETHODIMP VLCVideo::get_marquee(IVLCMarquee** obj)
return E_OUTOFMEMORY;
};
/*******************************************************************************/
STDMETHODIMP VLCVideo::get_logo(IVLCLogo** obj)
{
if( NULL == obj )
return E_POINTER;
*obj = _p_vlclogo;
if( NULL != _p_vlclogo )
{
_p_vlclogo->AddRef();
return NOERROR;
}
return E_OUTOFMEMORY;
}
/****************************************************************************/
HRESULT VLCLogo::loadTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
{
ITypeLib *p_typelib;
hr = _p_instance->getTypeLib(LOCALE_USER_DEFAULT, &p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCLogo, &_p_typeinfo);
if( FAILED(hr) )
{
_p_typeinfo = NULL;
}
p_typelib->Release();
}
}
return hr;
}
STDMETHODIMP VLCLogo::GetTypeInfoCount(UINT* pctInfo)
{
if( NULL == pctInfo )
return E_INVALIDARG;
if( SUCCEEDED(loadTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
return NOERROR;
}
STDMETHODIMP VLCLogo::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
{
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(loadTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
return NOERROR;
}
*ppTInfo = NULL;
return E_NOTIMPL;
}
STDMETHODIMP VLCLogo::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(loadTypeInfo()) )
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
return E_NOTIMPL;
}
STDMETHODIMP VLCLogo::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;
}
HRESULT VLCLogo::do_put_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_logo_int(p_md, idx, val, &ex);
hr = exception_bridge(&ex);
}
return hr;
}
HRESULT VLCLogo::do_get_int(unsigned idx, LONG *val)
{
if( NULL == val )
return E_POINTER;
libvlc_media_player_t *p_md;
HRESULT hr = _p_instance->getMD(&p_md);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
*val = libvlc_video_get_logo_int(p_md, idx, &ex);
hr = exception_bridge(&ex);
}
return hr;
}
STDMETHODIMP VLCLogo::file(BSTR fname)
{
libvlc_media_player_t *p_md;
HRESULT hr = _p_instance->getMD(&p_md);
char *n = CStrFromBSTR(CP_UTF8, fname);
if( !n ) hr = E_OUTOFMEMORY;
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_video_set_logo_string(p_md, libvlc_logo_file, n, &ex);
hr = exception_bridge(&ex);
}
CoTaskMemFree(n);
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 )
return E_POINTER;
LONG i;
HRESULT hr = do_get_int(libvlc_logo_position, &i);
if(SUCCEEDED(hr))
{
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;
}
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 )
hr = E_INVALIDARG;
CoTaskMemFree(n);
return hr;
}
/****************************************************************************/
VLCControl2::VLCControl2(VLCPlugin *p_instance) :
_p_instance(p_instance),
_p_typeinfo(NULL),
_p_vlcaudio(NULL),
_p_vlcinput(NULL),
_p_vlcplaylist(NULL),
_p_vlcsubtitle(NULL),
_p_vlcvideo(NULL)
{
_p_vlcaudio = new VLCAudio(p_instance);
_p_vlcinput = new VLCInput(p_instance);
_p_vlclog = new VLCLog(p_instance);
_p_vlcplaylist = new VLCPlaylist(p_instance);
_p_vlcsubtitle = new VLCSubtitle(p_instance);
_p_vlcvideo = new VLCVideo(p_instance);
};
_p_vlcaudio(new VLCAudio(p_instance)),
_p_vlcinput(new VLCInput(p_instance)),
_p_vlclog(new VLCLog(p_instance)),
_p_vlcplaylist(new VLCPlaylist(p_instance)),
_p_vlcsubtitle(new VLCSubtitle(p_instance)),
_p_vlcvideo(new VLCVideo(p_instance))
{
}
VLCControl2::~VLCControl2()
{
......
......@@ -27,6 +27,7 @@
#include "axvlc_idl.h"
#include <vlc/libvlc.h>
#include <ole2.h>
class VLCAudio : public IVLCAudio
{
......@@ -436,6 +437,73 @@ private:
};
class VLCLogo : public IVLCLogo
{
public:
VLCLogo(VLCPlugin *p): _p_instance(p), _p_typeinfo(NULL) { }
virtual ~VLCLogo() { if( _p_typeinfo ) _p_typeinfo->Release(); }
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCLogo == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// behaves as a standalone object
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); }
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); }
// IDispatch methods
STDMETHODIMP GetTypeInfoCount(UINT*);
STDMETHODIMP GetTypeInfo(UINT, LCID, LPTYPEINFO*);
STDMETHODIMP GetIDsOfNames(REFIID,LPOLESTR*,UINT,LCID,DISPID*);
STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
STDMETHODIMP enable() { return do_put_int(libvlc_logo_enable, true); }
STDMETHODIMP disable() { return do_put_int(libvlc_logo_enable, false); }
STDMETHODIMP file(BSTR fname);
#define PROP_INT( a ) \
STDMETHODIMP get_##a(LONG *val) \
{ return do_get_int(libvlc_logo_##a,val); } \
STDMETHODIMP put_##a(LONG val) \
{ return do_put_int(libvlc_logo_##a,val); }
PROP_INT( delay )
PROP_INT( repeat )
PROP_INT( opacity )
PROP_INT( x )
PROP_INT( y )
#undef PROP_INT
STDMETHODIMP get_position(BSTR* val);
STDMETHODIMP put_position(BSTR val);
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);
};
class VLCPlaylistItems : public IVLCPlaylistItems
{
public:
......@@ -602,10 +670,8 @@ public:
VLCVideo(VLCPlugin *p_instance) :
_p_instance(p_instance),
_p_typeinfo(NULL),
_p_vlcmarquee(NULL)
{
_p_vlcmarquee = new VLCMarquee(p_instance);
};
_p_vlcmarquee(new VLCMarquee(p_instance)),
_p_vlclogo(new VLCLogo(p_instance)) { }
virtual ~VLCVideo();
// IUnknown methods
......@@ -648,6 +714,7 @@ public:
STDMETHODIMP get_teletext(long*);
STDMETHODIMP put_teletext(long);
STDMETHODIMP get_marquee(IVLCMarquee**);
STDMETHODIMP get_logo(IVLCLogo**);
STDMETHODIMP deinterlaceDisable();
STDMETHODIMP deinterlaceEnable(BSTR);
STDMETHODIMP takeSnapshot(LPPICTUREDISP*);
......@@ -662,7 +729,7 @@ private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
VLCMarquee* _p_vlcmarquee;
VLCLogo* _p_vlclogo;
};
class VLCControl2 : public IVLCControl2
......
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