Commit 312523f7 authored by Damien Fouilleul's avatar Damien Fouilleul

- backport from trunk of [17018],[17006],[16944]

parent e9020e56
......@@ -36,6 +36,8 @@ SOURCES_activex = \
dataobject.h \
viewobject.cpp \
viewobject.h \
supporterrorinfo.cpp \
supporterrorinfo.h \
vlccontrol.cpp \
vlccontrol.h \
vlccontrol2.cpp \
......
......@@ -179,7 +179,9 @@ library AXVLC
odl,
uuid(9E0BD17B-2D3C-4656-B94D-03084F3FD9D4),
helpstring("VLC Audio APIs"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCAudio : IDispatch
......@@ -202,7 +204,9 @@ library AXVLC
odl,
uuid(49E0DBD1-9440-466C-9C97-95C67190C603),
helpstring("VLC Input APIs"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCInput : IDispatch
......@@ -239,7 +243,9 @@ library AXVLC
odl,
uuid(54613049-40BF-4035-9E70-0A9312C0188D),
helpstring("VLC Playlist APIs"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCPlaylist : IDispatch
......@@ -282,7 +288,9 @@ library AXVLC
odl,
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),
helpstring("VLC Video APIs"),
hidden,
dual,
nonextensible,
oleautomation
]
interface IVLCVideo : IDispatch
......@@ -297,12 +305,16 @@ library AXVLC
[propget, helpstring("Returns video original height.")]
HRESULT height([out, retval] int* height);
[helpstring("toggle fullscreen/windowed state.")]
HRESULT toggleFullscreen();
};
[
odl,
uuid(2D719729-5333-406C-BF12-8DE787FD65E3),
helpstring("VLC Control"),
hidden,
dual,
oleautomation
]
......
No preview for this file type
......@@ -1448,6 +1448,9 @@ interface IVLCVideo : public IDispatch
virtual HRESULT STDMETHODCALLTYPE get_height(
int* height) = 0;
virtual HRESULT STDMETHODCALLTYPE toggleFullscreen(
) = 0;
};
#else
typedef struct IVLCVideoVtbl {
......@@ -1512,6 +1515,9 @@ typedef struct IVLCVideoVtbl {
IVLCVideo* This,
int* height);
HRESULT (STDMETHODCALLTYPE *toggleFullscreen)(
IVLCVideo* This);
END_INTERFACE
} IVLCVideoVtbl;
interface IVLCVideo {
......@@ -1533,6 +1539,7 @@ interface IVLCVideo {
#define IVLCVideo_put_fullscreen(p,a) (p)->lpVtbl->put_fullscreen(p,a)
#define IVLCVideo_get_width(p,a) (p)->lpVtbl->get_width(p,a)
#define IVLCVideo_get_height(p,a) (p)->lpVtbl->get_height(p,a)
#define IVLCVideo_toggleFullscreen(p) (p)->lpVtbl->toggleFullscreen(p)
#endif
#endif
......@@ -1569,6 +1576,13 @@ void __RPC_STUB IVLCVideo_get_height_Stub(
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_toggleFullscreen_Proxy(
IVLCVideo* This);
void __RPC_STUB IVLCVideo_toggleFullscreen_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
#endif /* __IVLCVideo_INTERFACE_DEFINED__ */
......
......@@ -36,6 +36,7 @@
#include "vlccontrol2.h"
#include "viewobject.h"
#include "dataobject.h"
#include "supporterrorinfo.h"
#include "utils.h"
......@@ -267,6 +268,7 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter) :
vlcViewObject = new VLCViewObject(this);
vlcDataObject = new VLCDataObject(this);
vlcOleObject = new VLCOleObject(this);
vlcSupportErrorInfo = new VLCSupportErrorInfo(this);
// configure controlling IUnknown interface for implemented interfaces
this->pUnkOuter = (NULL != pUnkOuter) ? pUnkOuter : dynamic_cast<LPUNKNOWN>(this);
......@@ -280,6 +282,7 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter) :
VLCPlugin::~VLCPlugin()
{
delete vlcSupportErrorInfo;
delete vlcOleObject;
delete vlcDataObject;
delete vlcViewObject;
......@@ -350,6 +353,8 @@ STDMETHODIMP VLCPlugin::QueryInterface(REFIID riid, void **ppv)
*ppv = reinterpret_cast<LPVOID>(vlcViewObject);
else if( IID_IDataObject == riid )
*ppv = reinterpret_cast<LPVOID>(vlcDataObject);
else if( IID_ISupportErrorInfo == riid )
*ppv = reinterpret_cast<LPVOID>(vlcSupportErrorInfo);
else
{
*ppv = NULL;
......@@ -599,19 +604,6 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
if( _b_autoloop )
ppsz_argv[ppsz_argc++] = "--loop";
// initial volume setting
char volBuffer[16];
ppsz_argv[ppsz_argc++] = "--volume";
if( _b_mute )
{
ppsz_argv[ppsz_argc++] = "0";
}
else
{
snprintf(volBuffer, sizeof(volBuffer), "%d", _i_volume);
ppsz_argv[ppsz_argc++] = volBuffer;
}
if( IsDebuggerPresent() )
{
/*
......@@ -633,6 +625,14 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
return E_FAIL;
}
// initial volume setting
libvlc_audio_set_volume(_p_libvlc, _i_volume, NULL);
if( _b_mute )
{
libvlc_audio_set_mute(_p_libvlc, TRUE, NULL);
}
// initial playlist item
if( SysStringLen(_bstr_mrl) > 0 )
{
char *psz_mrl = NULL;
......@@ -686,6 +686,13 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
return S_OK;
};
void VLCPlugin::setErrorInfo(REFIID riid, const char *description)
{
vlcSupportErrorInfo->setErrorInfo( getClassID() == CLSID_VLCPlugin2 ?
OLESTR("VideoLAN.VLCPlugin.2") : OLESTR("VideoLAN.VLCPlugin.1"),
riid, description );
};
HRESULT VLCPlugin::onAmbientChanged(LPUNKNOWN pContainer, DISPID dispID)
{
VARIANT v;
......
......@@ -187,6 +187,7 @@ public:
inline BOOL isRunning(void) { return NULL != _p_libvlc; };
HRESULT getVLCObject(int *i_vlc);
HRESULT getVLC(libvlc_instance_t** p_vlc);
void setErrorInfo(REFIID riid, const char *description);
// control geometry within container
RECT getPosRect(void) { return _posRect; };
......@@ -240,6 +241,7 @@ private:
class VLCControl2 *vlcControl2;
class VLCViewObject *vlcViewObject;
class VLCDataObject *vlcDataObject;
class VLCSupportErrorInfo *vlcSupportErrorInfo;
// in place activated window (Clipping window)
HWND _inplacewnd;
......
......@@ -120,6 +120,7 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute)
*mute = libvlc_audio_get_mute(p_libvlc, &ex) ? VARIANT_TRUE : VARIANT_FALSE;
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -140,6 +141,7 @@ STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
libvlc_audio_set_mute(p_libvlc, VARIANT_FALSE != mute, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -163,6 +165,7 @@ STDMETHODIMP VLCAudio::get_volume(int* volume)
*volume = libvlc_audio_get_volume(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -183,6 +186,7 @@ STDMETHODIMP VLCAudio::put_volume(int volume)
libvlc_audio_set_volume(p_libvlc, volume, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -203,6 +207,7 @@ STDMETHODIMP VLCAudio::toggleMute()
libvlc_audio_toggle_mute(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -312,6 +317,7 @@ STDMETHODIMP VLCInput::get_length(double* length)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -340,6 +346,7 @@ STDMETHODIMP VLCInput::get_position(float* position)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -365,6 +372,7 @@ STDMETHODIMP VLCInput::put_position(float position)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -393,6 +401,7 @@ STDMETHODIMP VLCInput::get_time(double* time)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -418,6 +427,7 @@ STDMETHODIMP VLCInput::put_time(double time)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -476,6 +486,7 @@ STDMETHODIMP VLCInput::get_rate(float* rate)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -501,6 +512,7 @@ STDMETHODIMP VLCInput::put_rate(float rate)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -529,6 +541,7 @@ STDMETHODIMP VLCInput::get_fps(float* fps)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -557,6 +570,7 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCInput, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -657,6 +671,8 @@ STDMETHODIMP VLCPlaylist::get_itemCount(int* count)
*count = libvlc_playlist_items_count(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -680,6 +696,8 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
*isPlaying = libvlc_playlist_isplaying(p_libvlc, &ex) ? VARIANT_TRUE: VARIANT_FALSE;
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -741,6 +759,8 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, int* item
CoTaskMemFree(psz_name);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -781,6 +801,8 @@ STDMETHODIMP VLCPlaylist::playItem(int item)
libvlc_playlist_play(p_libvlc, item, 0, NULL, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -801,6 +823,8 @@ STDMETHODIMP VLCPlaylist::togglePause()
libvlc_playlist_pause(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -821,6 +845,8 @@ STDMETHODIMP VLCPlaylist::stop()
libvlc_playlist_stop(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -841,6 +867,8 @@ STDMETHODIMP VLCPlaylist::next()
libvlc_playlist_next(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -861,6 +889,8 @@ STDMETHODIMP VLCPlaylist::prev()
libvlc_playlist_prev(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -881,6 +911,8 @@ STDMETHODIMP VLCPlaylist::clear()
libvlc_playlist_clear(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -901,6 +933,8 @@ STDMETHODIMP VLCPlaylist::removeItem(int item)
libvlc_playlist_delete_item(p_libvlc, item, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -1010,6 +1044,7 @@ STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -1035,6 +1070,7 @@ STDMETHODIMP VLCVideo::put_fullscreen(VARIANT_BOOL fullscreen)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -1063,6 +1099,7 @@ STDMETHODIMP VLCVideo::get_width(int* width)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......@@ -1091,6 +1128,33 @@ STDMETHODIMP VLCVideo::get_height(int* height)
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return hr;
};
STDMETHODIMP VLCVideo::toggleFullscreen()
{
libvlc_instance_t* p_libvlc;
HRESULT hr = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) )
{
libvlc_toggle_fullscreen(p_input, &ex);
libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) )
{
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
......
......@@ -222,6 +222,7 @@ public:
STDMETHODIMP put_fullscreen(VARIANT_BOOL);
STDMETHODIMP get_width(int*);
STDMETHODIMP get_height(int*);
STDMETHODIMP toggleFullscreen();
protected:
HRESULT loadTypeInfo();
......
......@@ -556,6 +556,7 @@ const NPUTF8 * const LibvlcPlaylistNPObject::methodNames[] =
{
"add",
"play",
"playItem",
"togglePause",
"stop",
"next",
......@@ -570,6 +571,7 @@ enum LibvlcPlaylistNPObjectMethodIds
{
ID_add,
ID_play,
ID_playItem,
ID_togglepause,
ID_stop,
ID_next,
......@@ -695,6 +697,23 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
}
}
return INVOKERESULT_NO_SUCH_METHOD;
case ID_playItem:
if( (argCount == 1) && isNumberValue(args[0]) )
{
libvlc_playlist_play(p_plugin->getVLC(), numberValue(args[0]), 0, NULL, &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
else
{
VOID_TO_NPVARIANT(result);
return INVOKERESULT_NO_ERROR;
}
}
return INVOKERESULT_NO_SUCH_METHOD;
case ID_togglepause:
if( argCount == 0 )
{
......
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