Commit 817653d9 authored by Damien Fouilleul's avatar Damien Fouilleul

- add log APIs to Activex

- cleanup
parent 54ca1c9a
......@@ -36,6 +36,10 @@ library AXVLC
interface IVLCControl;
interface IVLCAudio;
interface IVLCInput;
interface IVLCLog;
interface IVLCMessage;
interface IVLCMessageIterator;
interface IVLCMessages;
interface IVLCPlaylist;
interface IVLCVideo;
interface IVLCControl2;
......@@ -192,9 +196,9 @@ library AXVLC
HRESULT mute([in] VARIANT_BOOL muted);
[propget, helpstring("Returns/sets audio volume as a percent value.")]
HRESULT volume([out, retval] int* volume);
HRESULT volume([out, retval] long* volume);
[propput, helpstring("Returns/sets audio volume as a percent value.")]
HRESULT volume([in] int volume);
HRESULT volume([in] long volume);
[helpstring("Mute/unmute audio playback.")]
HRESULT toggleMute();
......@@ -215,9 +219,9 @@ library AXVLC
HRESULT length([out, retval] double* length);
[propget, helpstring("Returns/sets playback position in current clip. Position is ranging from 0.0 to 1.0.")]
HRESULT position([out, retval] float* position);
HRESULT position([out, retval] double* position);
[propput, helpstring("Returns/sets playback position in the current clip. Position ranging from 0.0 to 1.0.")]
HRESULT position([in] float position);
HRESULT position([in] double position);
[propget, helpstring("Returns/sets playback time in current clip, in milliseconds.")]
HRESULT time([out, retval] double* time);
......@@ -225,20 +229,112 @@ library AXVLC
HRESULT time([in] double time);
[propget, helpstring("Returns current playback state.")]
HRESULT state([out, retval] int* state);
HRESULT state([out, retval] long* state);
[propget, helpstring("Returns/sets current playback rate, normal rate is 1.0 ")]
HRESULT rate([out, retval] float* rate);
HRESULT rate([out, retval] double* rate);
[propput, helpstring("Returns/sets current playback rate, normal rate is 1.0.")]
HRESULT rate([in] float rate);
HRESULT rate([in] double rate);
[propget, helpstring("Returns current playback frames per seconds if available.")]
HRESULT fps([out, retval] float* fps);
HRESULT fps([out, retval] double* fps);
[propget, helpstring("Returns whether current playback displays video.")]
HRESULT hasVout([out, retval] VARIANT_BOOL* hasVout);
};
[
odl,
uuid(9ED00AFA-7BCD-4FFF-8D48-7DD4DB2C800D),
helpstring("VLC Log Message"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCMessage: IDispatch
{
[id(DISPID_VALUE), propget]
HRESULT _Value([out, retval] VARIANT* message);
[propget, helpstring("Returns message severity.")]
HRESULT severity([out, retval] long* level);
[propget, helpstring("Returns message issuer type.")]
HRESULT type([out, retval] BSTR* type);
[propget, helpstring("Returns message issuer name.")]
HRESULT name([out, retval] BSTR* name);
[propget, helpstring("Returns message header.")]
HRESULT header([out, retval] BSTR* header);
[propget, helpstring("Returns message content.")]
HRESULT message([out, retval] BSTR* message);
};
[
odl,
uuid(15179CD8-CC12-4242-A58E-E412217FF343),
helpstring("VLC Log iterator"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCMessageIterator : IDispatch
{
[propget, helpstring("Returns whether a message is available.")]
HRESULT hasNext([out, retval] VARIANT_BOOL* hasNext);
[helpstring("Returns next message.")]
HRESULT next([out, retval] IVLCMessage** msg);
};
[
odl,
uuid(6C5CE55D-2D6C-4AAD-8299-C62D2371F106),
helpstring("VLC Log APIs"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCMessages : IDispatch
{
[id(DISPID_NEWENUM), propget]
HRESULT _NewEnum([out, retval] IUnknown** _NewEnum);
[helpstring("Clear all messages from log.")]
HRESULT clear();
[propget, helpstring("Returns the number of messages.")]
HRESULT count([out, retval] long* count);
[helpstring("Returns an iterator for messages in log")]
HRESULT iterator([out, retval] IVLCMessageIterator** iter);
};
[
odl,
uuid(8E3BC3D9-62E9-48FB-8A6D-993F9ABC4A0A),
helpstring("VLC Log APIs"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCLog : IDispatch
{
[propget, helpstring("Returns messages in log")]
HRESULT messages([out, retval] IVLCMessages** iter);
[propget, helpstring("Returns/Sets the log versbosity level.")]
HRESULT verbosity([out, retval] long* level);
[propput, helpstring("Returns/Sets the log versbosity level.")]
HRESULT verbosity([in] long level);
};
[
odl,
uuid(54613049-40BF-4035-9E70-0A9312C0188D),
......@@ -251,19 +347,19 @@ library AXVLC
interface IVLCPlaylist : IDispatch
{
[propget, helpstring("Returns number of items in playlist.")]
HRESULT itemCount([out, retval] int* count);
HRESULT itemCount([out, retval] long* count);
[propget, helpstring("Returns whether playback displays video.")]
HRESULT isPlaying([out, retval] VARIANT_BOOL* playing);
[helpstring("Add a playlist item.")]
HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] int* item);
HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] long* item);
[helpstring("Play/Resume the playlist.")]
HRESULT play();
[helpstring("Play item in playlist.")]
HRESULT playItem([in] int item);
HRESULT playItem([in] long item);
[helpstring("Play/Pause current clip.")]
HRESULT togglePause();
......@@ -281,7 +377,7 @@ library AXVLC
HRESULT clear();
[helpstring("remove item from playlist.")]
HRESULT removeItem([in] int item);
HRESULT removeItem([in] long item);
};
[
......@@ -301,10 +397,10 @@ library AXVLC
HRESULT fullscreen([in] VARIANT_BOOL fullscreen);
[propget, helpstring("Returns video original width.")]
HRESULT width([out, retval] int* width);
HRESULT width([out, retval] long* width);
[propget, helpstring("Returns video original height.")]
HRESULT height([out, retval] int* height);
HRESULT height([out, retval] long* height);
[helpstring("toggle fullscreen/windowed state.")]
HRESULT toggleFullscreen();
......@@ -336,9 +432,9 @@ library AXVLC
HRESULT BaseURL([in] BSTR url);
[id(DISPID_StartTime), propget, helpstring("Returns/sets playback start time of URL.")]
HRESULT StartTime([out, retval] int* seconds);
HRESULT StartTime([out, retval] long* seconds);
[id(DISPID_StartTime), propput, helpstring("Returns/sets playback start time of URL.")]
HRESULT StartTime([in] int seconds);
HRESULT StartTime([in] long seconds);
[id(DISPID_MRL), propget, helpstring("Returns/sets the default MRL in playlist")]
HRESULT MRL([out, retval] BSTR* mrl);
......@@ -354,9 +450,9 @@ library AXVLC
HRESULT Visible([in] VARIANT_BOOL visible);
[id(DISPID_Volume), propget, helpstring("Returns/sets default audio volume.")]
HRESULT Volume([out, retval] int* volume);
HRESULT Volume([out, retval] long* volume);
[id(DISPID_Volume), propput, helpstring("Returns/sets default audio volume.")]
HRESULT Volume([in] int volume);
HRESULT Volume([in] long volume);
[propget, helpstring("Returns the audio object.")]
HRESULT audio([out, retval] IVLCAudio** obj);
......@@ -364,6 +460,9 @@ library AXVLC
[propget, helpstring("Returns the audio object.")]
HRESULT input([out, retval] IVLCInput** obj);
[propget, helpstring("Returns the log object.")]
HRESULT log([out, retval] IVLCLog** obj);
[propget, helpstring("Returns the playlist object.")]
HRESULT playlist([out, retval] IVLCPlaylist** obj);
......
No preview for this file type
......@@ -15,6 +15,10 @@ DEFINE_GUID(IID_IVLCControl, 0xc2fa41d0, 0xb113, 0x476e, 0xac,0x8c, 0x9b,0xd1,0x
DEFINE_GUID(DIID_DVLCEvents, 0xdf48072f, 0x5ef8, 0x434e, 0x9b,0x40, 0xe2,0xf3,0xae,0x75,0x9b,0x5f);
DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f,0x3f,0xd9,0xd4);
DEFINE_GUID(IID_IVLCInput, 0x49e0dbd1, 0x9440, 0x466c, 0x9c,0x97, 0x95,0xc6,0x71,0x90,0xc6,0x03);
DEFINE_GUID(IID_IVLCMessage, 0x9ed00afa, 0x7bcd, 0x4fff, 0x8d,0x48, 0x7d,0xd4,0xdb,0x2c,0x80,0x0d);
DEFINE_GUID(IID_IVLCMessageIterator, 0x15179cd8, 0xcc12, 0x4242, 0xa5,0x8e, 0xe4,0x12,0x21,0x7f,0xf3,0x43);
DEFINE_GUID(IID_IVLCMessages, 0x6c5ce55d, 0x2d6c, 0x4aad, 0x82,0x99, 0xc6,0x2d,0x23,0x71,0xf1,0x06);
DEFINE_GUID(IID_IVLCLog, 0x8e3bc3d9, 0x62e9, 0x48fb, 0x8a,0x6d, 0x99,0x3f,0x9a,0xbc,0x4a,0x0a);
DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d);
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);
......
This diff is collapsed.
......@@ -32,6 +32,10 @@ STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
{
if( (riid == IID_IVLCAudio)
|| (riid == IID_IVLCInput)
|| (riid == IID_IVLCLog)
|| (riid == IID_IVLCMessage)
|| (riid == IID_IVLCMessageIterator)
|| (riid == IID_IVLCMessages)
|| (riid == IID_IVLCPlaylist)
|| (riid == IID_IVLCVideo)
|| (riid == IID_IVLCControl2) )
......
......@@ -96,6 +96,16 @@ function monitor()
{
var vlc = document.getElementById("vlc");
var newState = vlc.input.state;
if( vlc.log.messages.count > 0 )
{
var iter = vlc.log.messages.iterator();
while( iter.hasNext )
{
var msg = iter.next();
alert( msg );
}
vlc.log.messages.clear();
}
if( prevState != newState )
{
if( newState == 0 )
......@@ -138,11 +148,13 @@ function monitor()
function doGo(targetURL)
{
var vlc = document.getElementById("vlc");
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
var options = new Array(":vout=directx");
vlc.playlist.clear();
//vlc.playlist.add(targetURL, null, options);
vlc.playlist.add(targetURL);
vlc.playlist.play();
vlc.log.verbosity = 3;
vlc.log.messages.clear();
if( monitorTimerId == 0 )
{
monitor();
......@@ -157,6 +169,7 @@ function doPlayOrPause()
}
else
{
vlc.log.messages.clear();
vlc.playlist.play();
if( monitorTimerId == 0 )
{
......@@ -238,6 +251,7 @@ function onPause()
};
function onStop()
{
vlc.log.verbosity = -1;
if( slider.Enabled )
{
slider.Value = slider.Min;
......
......@@ -845,7 +845,7 @@ STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
const char *versionStr = VLC_Version();
if( NULL != versionStr )
{
*version = BSTRFromCStr(_p_instance->getCodePage(), versionStr);
*version = BSTRFromCStr(CP_UTF8, versionStr);
return NULL == *version ? E_OUTOFMEMORY : NOERROR;
}
......
This diff is collapsed.
......@@ -25,6 +25,8 @@
#include "axvlc_idl.h"
#include <vlc/libvlc.h>
class VLCAudio : public IVLCAudio
{
public:
......@@ -61,8 +63,8 @@ public:
// IVLCAudio methods
STDMETHODIMP get_mute(VARIANT_BOOL*);
STDMETHODIMP put_mute(VARIANT_BOOL);
STDMETHODIMP get_volume(int*);
STDMETHODIMP put_volume(int);
STDMETHODIMP get_volume(long*);
STDMETHODIMP put_volume(long);
STDMETHODIMP toggleMute();
protected:
......@@ -110,14 +112,14 @@ public:
// IVLCInput methods
STDMETHODIMP get_length(double*);
STDMETHODIMP get_position(float*);
STDMETHODIMP put_position(float);
STDMETHODIMP get_position(double*);
STDMETHODIMP put_position(double);
STDMETHODIMP get_time(double*);
STDMETHODIMP put_time(double);
STDMETHODIMP get_state(int*);
STDMETHODIMP get_rate(float*);
STDMETHODIMP put_rate(float);
STDMETHODIMP get_fps(float*);
STDMETHODIMP get_state(long*);
STDMETHODIMP get_rate(double*);
STDMETHODIMP put_rate(double);
STDMETHODIMP get_fps(double*);
STDMETHODIMP get_hasVout(VARIANT_BOOL*);
protected:
......@@ -129,6 +131,242 @@ private:
};
class VLCMessage: public IVLCMessage
{
public:
VLCMessage(VLCPlugin *p_instance, struct libvlc_log_message_t &msg) :
_p_instance(p_instance),
_p_typeinfo(NULL),
_refcount(1),
_msg(msg) {};
virtual ~VLCMessage();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCMessage == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// behaves as a standalone object
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void) { return InterlockedIncrement(&_refcount); };
STDMETHODIMP_(ULONG) Release(void)
{
ULONG refcount = InterlockedDecrement(&_refcount);
if( 0 == refcount )
{
delete this;
return 0;
}
return refcount;
};
// 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*);
// IVLCMessage methods
STDMETHODIMP get__Value(VARIANT *);
STDMETHODIMP get_severity(long *);
STDMETHODIMP get_type(BSTR *);
STDMETHODIMP get_name(BSTR *);
STDMETHODIMP get_header(BSTR *);
STDMETHODIMP get_message(BSTR *);
protected:
HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
LONG _refcount;
struct libvlc_log_message_t _msg;
};
class VLCLog;
class VLCMessageIterator : public IVLCMessageIterator
{
public:
VLCMessageIterator(VLCPlugin *p_instance, VLCLog* p_vlclog);
virtual ~VLCMessageIterator();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCMessageIterator == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// behaves as a standalone object
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void) { return InterlockedIncrement(&_refcount); };
STDMETHODIMP_(ULONG) Release(void)
{
ULONG refcount = InterlockedDecrement(&_refcount);
if( 0 == refcount )
{
delete this;
return 0;
}
return refcount;
};
// 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*);
// IVLCMessageIterator methods
STDMETHODIMP get_hasNext(VARIANT_BOOL*);
STDMETHODIMP next(IVLCMessage**);
protected:
HRESULT loadTypeInfo();
private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
LONG _refcount;
VLCLog* _p_vlclog;
libvlc_log_iterator_t* _p_iter;
};
class VLCMessages : public IVLCMessages
{
public:
VLCMessages(VLCPlugin *p_instance, VLCLog *p_vlclog) :
_p_instance(p_instance),
_p_typeinfo(NULL),
_p_vlclog(p_vlclog) {};
virtual ~VLCMessages();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCMessages == 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*);
// IVLCMessages methods
STDMETHODIMP get__NewEnum(LPUNKNOWN*);
STDMETHODIMP clear();
STDMETHODIMP get_count(long*);
STDMETHODIMP iterator(IVLCMessageIterator**);
protected:
HRESULT loadTypeInfo();
VLCLog* _p_vlclog;
private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
};
class VLCLog : public IVLCLog
{
public:
friend class VLCMessages;
friend class VLCMessageIterator;
VLCLog(VLCPlugin *p_instance) :
_p_instance(p_instance),
_p_typeinfo(NULL),
_p_log(NULL)
{
_p_vlcmessages = new VLCMessages(p_instance, this);
};
virtual ~VLCLog();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCLog == 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*);
// IVLCLog methods
STDMETHODIMP get_messages(IVLCMessages**);
STDMETHODIMP get_verbosity(long *);
STDMETHODIMP put_verbosity(long);
protected:
HRESULT loadTypeInfo();
libvlc_log_t *_p_log;
private:
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
VLCMessages* _p_vlcmessages;
};
class VLCPlaylist : public IVLCPlaylist
{
public:
......@@ -163,17 +401,17 @@ public:
STDMETHODIMP Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
// IVLCPlaylist methods
STDMETHODIMP get_itemCount(int*);
STDMETHODIMP get_itemCount(long*);
STDMETHODIMP get_isPlaying(VARIANT_BOOL*);
STDMETHODIMP add(BSTR, VARIANT, VARIANT, int*);
STDMETHODIMP add(BSTR, VARIANT, VARIANT, long*);
STDMETHODIMP play();
STDMETHODIMP playItem(int);
STDMETHODIMP playItem(long);
STDMETHODIMP togglePause();
STDMETHODIMP stop();
STDMETHODIMP next();
STDMETHODIMP prev();
STDMETHODIMP clear();
STDMETHODIMP removeItem(int);
STDMETHODIMP removeItem(long);
protected:
HRESULT loadTypeInfo();
......@@ -220,8 +458,8 @@ public:
// IVLCVideo methods
STDMETHODIMP get_fullscreen(VARIANT_BOOL*);
STDMETHODIMP put_fullscreen(VARIANT_BOOL);
STDMETHODIMP get_width(int*);
STDMETHODIMP get_height(int*);
STDMETHODIMP get_width(long*);
STDMETHODIMP get_height(long*);
STDMETHODIMP toggleFullscreen();
protected:
......@@ -275,16 +513,17 @@ public:
STDMETHODIMP put_BaseURL(BSTR url);
STDMETHODIMP get_MRL(BSTR *mrl);
STDMETHODIMP put_MRL(BSTR mrl);
STDMETHODIMP get_StartTime(int *seconds);
STDMETHODIMP put_StartTime(int seconds);
STDMETHODIMP get_StartTime(long *seconds);
STDMETHODIMP put_StartTime(long seconds);
STDMETHODIMP get_VersionInfo(BSTR *version);
STDMETHODIMP get_Visible(VARIANT_BOOL *visible);
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP get_Volume(int *volume);
STDMETHODIMP put_Volume(int volume);
STDMETHODIMP get_Volume(long *volume);
STDMETHODIMP put_Volume(long volume);
STDMETHODIMP get_audio(IVLCAudio**);
STDMETHODIMP get_input(IVLCInput**);
STDMETHODIMP get_log(IVLCLog**);
STDMETHODIMP get_playlist(IVLCPlaylist**);
STDMETHODIMP get_video(IVLCVideo**);
......@@ -297,6 +536,7 @@ private:
VLCAudio* _p_vlcaudio;
VLCInput* _p_vlcinput;
VLCLog * _p_vlclog;
VLCPlaylist* _p_vlcplaylist;
VLCVideo* _p_vlcvideo;
};
......
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