Commit 3ef49160 authored by Damien Fouilleul's avatar Damien Fouilleul

- ActiveX: support for libvlc and common scripting APIS, widl has replaced...

- ActiveX: support for libvlc and common scripting APIS, widl has replaced midl as default IDL compiler
parent c3a1a371
......@@ -38,6 +38,8 @@ SOURCES_activex = \
viewobject.h \
vlccontrol.cpp \
vlccontrol.h \
vlccontrol2.cpp \
vlccontrol2.h \
plugin.cpp \
plugin.h \
axvlc_idl.c \
......@@ -100,10 +102,20 @@ axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
if HAS_WIDL_COMPILER
axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
$(WIDL) -I$(WINE_SDK_PATH)/include -tuh -T axvlc.tlb -U axvlc_idl.c -H axvlc_idl.h axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
clean-tlb:
endif
endif
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
......@@ -125,14 +137,13 @@ endif
clean-stamp:
rm -f stamp-pic
stamp-pic: FORCE
@for dep in "" `$(VLC_CONFIG) --target builtin`; do \
if test "$${dep}" -nt "$(LIBRARIES_activex)"; then \
rm -f $@; \
break; \
fi; \
done
@if test ! -f $@; then printf "" > $@; fi
if BUILD_SHARED
stamp-pic:
else
stamp-pic: $(shell $(VLC_CONFIG) --target builtin)
endif
@touch $@
###############################################################################
# Clean rules
......@@ -142,7 +153,6 @@ clean-local: clean-stamp clean-tlb
rm -f axvlc$(LIBEXT)
###############################################################################
# Force rule
# Force rules
###############################################################################
FORCE:
/*****************************************************************************
* axvlc.idl: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
......@@ -23,19 +23,23 @@
//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 "oaidl.idl";
[
uuid(DF2BBE39-40A8-433b-A279-073F48DA94B6),
version(1.0),
helpstring("VideoLAN VLC ActiveX Plugin"),
helpstring("VideoLAN VLC ActiveX Plugin")
]
library AXVLC
{
importlib("stdole2.tlb");
// Forward declare all types defined in this typelib
interface IVLCControl;
interface IVLCPlaylist;
interface ILibVLCControl;
dispinterface DVLCEvents;
importlib("stdole2.tlb");
enum VLCPlaylistMode
{
VLCPlayListInsert = 1,
......@@ -64,7 +68,7 @@ library AXVLC
[
odl,
uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1),
helpstring("VLC Control"),
helpstring("VLC Control (deprecated)"),
dual,
hidden,
oleautomation
......@@ -166,14 +170,173 @@ library AXVLC
void stop();
};
[
odl,
uuid(9E0BD17B-2D3C-4656-B94D-03084F3FD9D4),
helpstring("VLC Audio APIs"),
dual,
oleautomation
]
interface IVLCAudio : IDispatch
{
[propget, helpstring("Returns/sets the audio mute state.")]
HRESULT mute([out, retval] VARIANT_BOOL* muted);
[propput, helpstring("Returns/sets the audio mute state.")]
HRESULT mute([in] VARIANT_BOOL muted);
[propget, helpstring("Returns/sets audio volume as a percent value.")]
HRESULT volume([out, retval] int* volume);
[propput, helpstring("Returns/sets audio volume as a percent value.")]
HRESULT volume([in] int volume);
[helpstring("Mute/unmute audio playback.")]
HRESULT toggleMute();
};
[
odl,
uuid(49E0DBD1-9440-466C-9C97-95C67190C603),
helpstring("VLC Input APIs"),
dual,
oleautomation
]
interface IVLCInput : IDispatch
{
[propget, helpstring("Returns the clip length, in milliseconds.")]
HRESULT length([out, retval] __int64* 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);
[propput, helpstring("Returns/sets playback position in the current clip. Position ranging from 0.0 to 1.0.")]
HRESULT position([in] float position);
[propget, helpstring("Returns/sets playback time in current clip, in milliseconds.")]
HRESULT time([out, retval] __int64* time);
[propput, helpstring("Returns/sets playback time in the current clip, in milliseconds.")]
HRESULT time([in] __int64 time);
[propget, helpstring("Returns current playback state.")]
HRESULT state([out, retval] int* state);
[propget, helpstring("Returns/sets current playback rate, normal rate is 1.0 ")]
HRESULT rate([out, retval] float* rate);
[propput, helpstring("Returns/sets current playback rate, normal rate is 1.0.")]
HRESULT rate([in] float rate);
[propget, helpstring("Returns current playback frames per seconds if available.")]
HRESULT fps([out, retval] float* fps);
[propget, helpstring("Returns whether current playback displays video.")]
HRESULT hasVout([out, retval] VARIANT_BOOL* hasVout);
};
[
odl,
uuid(54613049-40BF-4035-9E70-0A9312C0188D),
helpstring("VLC Playlist APIs"),
dual,
oleautomation
]
interface IVLCPlaylist : IDispatch
{
[propget, helpstring("Returns number of items in playlist.")]
HRESULT itemCount([out, retval] int* 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] BSTR name, [in, optional] VARIANT options, [out, retval] int* item);
[helpstring("Play/Resume the playlist.")]
HRESULT play();
[helpstring("Play item in playlist.")]
HRESULT playItem([in] int item);
[helpstring("Play/Pause current clip.")]
HRESULT togglePause();
[helpstring("Stop current clip.")]
HRESULT stop();
[helpstring("Advance to next item in playlist.")]
HRESULT next();
[helpstring("Advance to previous item in playlist.")]
HRESULT prev();
[helpstring("Remove all items from playlist.")]
HRESULT clear();
[helpstring("remove item from playlist.")]
HRESULT removeItem([in] int item);
};
[
odl,
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),
helpstring("VLC Video APIs"),
dual,
oleautomation
]
interface IVLCVideo : IDispatch
{
[propget, helpstring("Returns/sets the fullscreen state.")]
HRESULT fullscreen([out, retval] VARIANT_BOOL* fullscreen);
[propput, helpstring("Returns/sets the fullscreen state.")]
HRESULT fullscreen([in] VARIANT_BOOL fullscreen);
[propget, helpstring("Returns video original width.")]
HRESULT width([out, retval] int* width);
[propget, helpstring("Returns video original height.")]
HRESULT height([out, retval] int* height);
};
[
odl,
uuid(2D719729-5333-406C-BF12-8DE787FD65E3),
helpstring("VLC Control"),
dual,
oleautomation
]
interface IVLCControl2 : IDispatch
{
[propget, helpstring("Returns the audio object.")]
HRESULT audio([out, retval] IVLCAudio** obj);
[propget, helpstring("Returns the audio object.")]
HRESULT input([out, retval] IVLCInput** obj);
[propget, helpstring("Returns the playlist object.")]
HRESULT playlist([out, retval] IVLCPlaylist** obj);
[propget, helpstring("Returns the audio object.")]
HRESULT video([out, retval] IVLCVideo** obj);
};
[
uuid(E23FE9C6-778E-49D4-B537-38FCDE4887D8),
helpstring("VLC control"),
helpstring("VLC control (deprecated)"),
control
]
coclass VLCPlugin
{
[default] interface IVLCControl;
interface IVLCControl2;
[default, source] dispinterface DVLCEvents;
};
[
uuid(9BE31822-FDAD-461B-AD51-BE1D1C159921),
helpstring("VLC control"),
control
]
coclass VLCPlugin2
{
[default] interface IVLCControl2;
interface IVLCControl;
[default, source] dispinterface DVLCEvents;
};
};
No preview for this file type
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/*** Autogenerated by WIDL 0.9.20 from axvlc.idl - Do not edit ***/
/* link this file in with the server and any clients */
#include <rpc.h>
#include <rpcndr.h>
#define INITGUID
#include <guiddef.h>
/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Apr 02 19:22:45 2006
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
extern "C" {
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID LIBID_AXVLC = {0xDF2BBE39,0x40A8,0x433b,{0xA2,0x79,0x07,0x3F,0x48,0xDA,0x94,0xB6}};
const IID IID_IVLCControl = {0xC2FA41D0,0xB113,0x476e,{0xAC,0x8C,0x9B,0xD1,0x49,0x99,0xC1,0xC1}};
const IID DIID_DVLCEvents = {0xDF48072F,0x5EF8,0x434e,{0x9B,0x40,0xE2,0xF3,0xAE,0x75,0x9B,0x5F}};
const CLSID CLSID_VLCPlugin = {0xE23FE9C6,0x778E,0x49D4,{0xB5,0x37,0x38,0xFC,0xDE,0x48,0x87,0xD8}};
DEFINE_GUID(LIBID_AXVLC, 0xdf2bbe39, 0x40a8, 0x433b, 0xa2,0x79, 0x07,0x3f,0x48,0xda,0x94,0xb6);
DEFINE_GUID(IID_IVLCControl, 0xc2fa41d0, 0xb113, 0x476e, 0xac,0x8c, 0x9b,0xd1,0x49,0x99,0xc1,0xc1);
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_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);
DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8);
DEFINE_GUID(CLSID_VLCPlugin2, 0x9be31822, 0xfdad, 0x461b, 0xad,0x51, 0xbe,0x1d,0x1c,0x15,0x99,0x21);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
/*****************************************************************************
* guiddef.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* 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 __GUIDDEF_H__
#define __GUIDDEF_H__
/*
** Widl generated code requires guiddef.h,
** which is not available under MinGW
*/
#undef GUID_EXT
#define GUID_EXT
#include <initguid.h>
#endif
This diff is collapsed.
/*****************************************************************************
* plugin.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
......@@ -100,9 +100,10 @@ static LRESULT CALLBACK VLCVideoClassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam
}
};
VLCPluginClass::VLCPluginClass(LONG *p_class_ref, HINSTANCE hInstance) :
VLCPluginClass::VLCPluginClass(LONG *p_class_ref, HINSTANCE hInstance, REFCLSID rclsid) :
_p_class_ref(p_class_ref),
_hinstance(hInstance),
_classid(rclsid),
_inplace_picture(NULL)
{
WNDCLASS wClass;
......@@ -248,9 +249,9 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter) :
_videownd(NULL),
_p_class(p_class),
_i_ref(1UL),
_p_libvlc(NULL),
_i_codepage(CP_ACP),
_b_usermode(TRUE),
_i_vlc(0)
_b_usermode(TRUE)
{
p_class->AddRef();
......@@ -339,6 +340,8 @@ STDMETHODIMP VLCPlugin::QueryInterface(REFIID riid, void **ppv)
*ppv = reinterpret_cast<LPVOID>(vlcControl);
else if( IID_IVLCControl == riid )
*ppv = reinterpret_cast<LPVOID>(vlcControl);
else if( IID_IVLCControl2 == riid )
*ppv = reinterpret_cast<LPVOID>(vlcControl2);
else if( IID_IViewObject == riid )
*ppv = reinterpret_cast<LPVOID>(vlcViewObject);
else if( IID_IViewObject2 == riid )
......@@ -465,7 +468,7 @@ static void getViewportCoords(LPRECT lprPosRect, LPRECT lprClipRect)
HRESULT VLCPlugin::onInit(void)
{
if( 0 == _i_vlc )
if( NULL == _p_libvlc )
{
// initialize persistable properties
_bstr_mrl = NULL;
......@@ -540,21 +543,29 @@ HRESULT VLCPlugin::onLoad(void)
return S_OK;
};
HRESULT VLCPlugin::getVLCObject(int *i_vlc)
HRESULT VLCPlugin::getVLCObject(int* i_vlc)
{
if( ! isRunning() )
libvlc_instance_t *p_libvlc;
HRESULT result = getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
_i_vlc = VLC_Create();
if( _i_vlc < 0 )
*i_vlc = libvlc_get_vlc_id(p_libvlc);
}
else
{
_i_vlc = 0;
return E_FAIL;
*i_vlc = 0;
}
return result;
}
HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
{
if( ! isRunning() )
{
/*
** default initialization options
*/
char *ppsz_argv[10] = { "vlc", };
char *ppsz_argv[32] = { "vlc" };
int ppsz_argc = 1;
HKEY h_key;
......@@ -575,17 +586,38 @@ HRESULT VLCPlugin::getVLCObject(int *i_vlc)
RegCloseKey( h_key );
}
#if 0
ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc";
#if 1
//ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc";
ppsz_argv[0] = "C:\\cygwin\\home\\damienf\\vlc-trunk\\vlc";
#endif
// make sure plugin isn't affected with VLC single instance mode
ppsz_argv[ppsz_argc++] = "--no-one-instance";
/* common settings */
ppsz_argv[ppsz_argc++] = "-vv";
ppsz_argv[ppsz_argc++] = "--no-stats";
ppsz_argv[ppsz_argc++] = "--no-media-library";
ppsz_argv[ppsz_argc++] = "--intf";
ppsz_argv[ppsz_argc++] = "dummy";
// loop mode is a configuration option only
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() )
{
/*
......@@ -600,36 +632,31 @@ HRESULT VLCPlugin::getVLCObject(int *i_vlc)
ppsz_argv[ppsz_argc++] = "--win9x-cv-method=1";
}
if( VLC_Init(_i_vlc, ppsz_argc, ppsz_argv) )
_p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, NULL);
if( NULL == _p_libvlc )
{
VLC_Destroy(_i_vlc);
_i_vlc = 0;
*pp_libvlc = NULL;
return E_FAIL;
}
VLC_VolumeSet(_i_vlc, _i_volume);
if( _b_mute )
VLC_VolumeMute(_i_vlc);
char *psz_mrl = CStrFromBSTR(CP_UTF8, _bstr_mrl);
if( NULL != psz_mrl )
{
char timeBuffer[32];
const char *options[1];
int cOptions = 0;
int i_options = 0;
char timeBuffer[32];
if( _i_time )
{
snprintf(timeBuffer, sizeof(timeBuffer), ":start-time=%d", _i_time);
options[cOptions++] = timeBuffer;
options[i_options++] = timeBuffer;
}
// add default target to playlist
VLC_AddTarget(_i_vlc, psz_mrl, options, cOptions, PLAYLIST_APPEND, PLAYLIST_END);
libvlc_playlist_add_extended(_p_libvlc, psz_mrl, NULL, i_options, options, NULL);
CoTaskMemFree(psz_mrl);
}
}
*i_vlc = _i_vlc;
*pp_libvlc = _p_libvlc;
return S_OK;
};
......@@ -721,13 +748,12 @@ HRESULT VLCPlugin::onClose(DWORD dwSaveOption)
}
if( isRunning() )
{
int i_vlc = _i_vlc;
libvlc_instance_t* p_libvlc = _p_libvlc;
_i_vlc = 0;
_p_libvlc = NULL;
vlcDataObject->onClose();
VLC_CleanUp(i_vlc);
VLC_Destroy(i_vlc);
libvlc_destroy(p_libvlc);
}
return S_OK;
};
......@@ -806,26 +832,24 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
if( _b_usermode )
{
/* will run vlc if not done already */
int i_vlc;
HRESULT result = getVLCObject(&i_vlc);
libvlc_instance_t* p_libvlc;
HRESULT result = getVLC(&p_libvlc);
if( FAILED(result) )
return result;
/* set internal video width and height */
vlc_value_t val;
val.i_int = posRect.right-posRect.left;
VLC_VariableSet(i_vlc, "conf::width", val);
val.i_int = posRect.bottom-posRect.top;
VLC_VariableSet(i_vlc, "conf::height", val);
libvlc_video_set_size(p_libvlc,
posRect.right-posRect.left,
posRect.bottom-posRect.top,
NULL );
/* set internal video parent window */
/* horrible cast there */
val.i_int = reinterpret_cast<int>(_videownd);
VLC_VariableSet(i_vlc, "drawable", val);
libvlc_video_set_parent(p_libvlc,
reinterpret_cast<libvlc_drawable_t>(_videownd), NULL);
if( _b_autoplay & (VLC_PlaylistNumberOfItems(i_vlc) > 0) )
if( _b_autoplay & (libvlc_playlist_items_count(p_libvlc, NULL) > 0) )
{
VLC_Play(i_vlc);
libvlc_playlist_play(p_libvlc, 0, 0, NULL, NULL);
fireOnPlayEvent();
}
}
......@@ -840,7 +864,7 @@ HRESULT VLCPlugin::onInPlaceDeactivate(void)
{
if( isRunning() )
{
VLC_Stop(_i_vlc);
libvlc_playlist_stop(_p_libvlc, NULL);
fireOnStopEvent();
}
......@@ -880,7 +904,7 @@ void VLCPlugin::setVolume(int volume)
_i_volume = volume;
if( isRunning() )
{
VLC_VolumeSet(_i_vlc, _i_volume);
libvlc_audio_set_volume(_p_libvlc, _i_volume, NULL);
}
setDirty(TRUE);
}
......@@ -896,7 +920,12 @@ void VLCPlugin::setTime(int seconds)
_i_time = seconds;
if( isRunning() )
{
VLC_TimeSet(_i_vlc, seconds, VLC_FALSE);
libvlc_input_t *p_input = libvlc_playlist_get_input(_p_libvlc, NULL);
if( NULL != p_input )
{
libvlc_input_set_time(p_input, _i_time, NULL);
libvlc_input_free(p_input);
}
}
setDirty(TRUE);
}
......@@ -1065,11 +1094,13 @@ void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
SWP_NOOWNERZORDER );
//RedrawWindow(_videownd, &posRect, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
vlc_value_t val;
val.i_int = posRect.right-posRect.left;
VLC_VariableSet(_i_vlc, "conf::width", val);
val.i_int = posRect.bottom-posRect.top;
VLC_VariableSet(_i_vlc, "conf::height", val);
if( isRunning() )
{
libvlc_video_set_size(_p_libvlc,
posRect.right-posRect.left,
posRect.bottom-posRect.top,
NULL );
}
};
void VLCPlugin::freezeEvents(BOOL freeze)
......
......@@ -26,9 +26,10 @@
#include <ole2.h>
#include <olectl.h>
#include <vlc/vlc.h>
#include <vlc/libvlc.h>
extern const GUID CLSID_VLCPlugin;
extern const GUID CLSID_VLCPlugin2;
extern const GUID LIBID_AXVLC;
extern const GUID DIID_DVLCEvents;
......@@ -37,7 +38,7 @@ class VLCPluginClass : public IClassFactory
public:
VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
VLCPluginClass(LONG *p_class_ref, HINSTANCE hInstance, REFCLSID rclsid);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
......@@ -48,6 +49,8 @@ public:
STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv);
STDMETHODIMP LockServer(BOOL fLock);
REFCLSID getClassID(void) { return (REFCLSID)_classid; };
LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
LPCSTR getVideoWndClassName(void) const { return TEXT("VLC Plugin Video"); };
HINSTANCE getHInstance(void) const { return _hinstance; };
......@@ -62,6 +65,7 @@ private:
LPLONG _p_class_ref;
HINSTANCE _hinstance;
CLSID _classid;
ATOM _inplace_wndclass_atom;
ATOM _video_wndclass_atom;
LPPICTURE _inplace_picture;
......@@ -81,7 +85,7 @@ public:
/* custom methods */
HRESULT getTypeLib(LCID lcid, ITypeLib **pTL) { return LoadRegTypeLib(LIBID_AXVLC, 1, 0, lcid, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFCLSID getClassID(void) { return _p_class->getClassID(); };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
/*
......@@ -165,9 +169,9 @@ public:
inline BOOL isDirty(void) { return _b_dirty; };
inline void setDirty(BOOL dirty) { _b_dirty = dirty; };
inline BOOL isRunning(void) { return 0 != _i_vlc; };
inline BOOL isRunning(void) { return NULL != _p_libvlc; };
HRESULT getVLCObject(int *i_vlc);
HRESULT getVLC(libvlc_instance_t** p_vlc);
// control geometry within container
RECT getPosRect(void) { return _posRect; };
......@@ -218,6 +222,7 @@ private:
class VLCConnectionPointContainer *vlcConnectionPointContainer;
class VLCObjectSafety *vlcObjectSafety;
class VLCControl *vlcControl;
class VLCControl2 *vlcControl2;
class VLCViewObject *vlcViewObject;
class VLCDataObject *vlcDataObject;
......@@ -226,12 +231,12 @@ private:
// video window (Drawing window)
HWND _videownd;
VLCPluginClass *_p_class;
VLCPluginClass* _p_class;
ULONG _i_ref;
libvlc_instance_t* _p_libvlc;
UINT _i_codepage;
BOOL _b_usermode;
int _i_vlc;
RECT _posRect;
// persistable properties
......
......@@ -70,6 +70,28 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
return NULL;
};
char *CStrFromGUID(REFGUID clsid)
{
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
#ifdef OLE2ANSI
return (LPCSTR)oleStr;
#else
char *pct_CLSID = NULL;
size_t len = WideCharToMultiByte(CP_ACP, 0, oleStr, -1, NULL, 0, NULL, NULL);
if( len > 0 )
{
pct_CLSID = (char *)CoTaskMemAlloc(len);
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len, NULL, NULL);
}
CoTaskMemFree(oleStr);
return pct_CLSID;
#endif
};
/*
** properties
*/
......
......@@ -31,6 +31,8 @@
extern char *CStrFromBSTR(UINT codePage, BSTR bstr);
extern BSTR BSTRFromCStr(UINT codePage, LPCSTR s);
extern char *CStrFromGUID(REFGUID clsid);
// properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
......
......@@ -529,7 +529,7 @@ STDMETHODIMP VLCControl::getVariable( BSTR name, VARIANT *value)
return hr;
};
static void freeTargetOptions(char **cOptions, int cOptionCount)
void VLCControl::FreeTargetOptions(char **cOptions, int cOptionCount)
{
// clean up
if( NULL != cOptions )
......@@ -546,7 +546,7 @@ static void freeTargetOptions(char **cOptions, int cOptionCount)
}
};
static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
HRESULT VLCControl::CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
{
HRESULT hr = E_INVALIDARG;
if( VT_ERROR == V_VT(options) )
......@@ -621,7 +621,7 @@ static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOpti
if( FAILED(hr) )
{
// free already processed elements
freeTargetOptions(*cOptions, *cOptionCount);
FreeTargetOptions(*cOptions, *cOptionCount);
}
}
else
......@@ -715,7 +715,7 @@ static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOpti
if( FAILED(hr) )
{
// free already processed elements
freeTargetOptions(*cOptions, *cOptionCount);
FreeTargetOptions(*cOptions, *cOptionCount);
}
}
else
......@@ -750,7 +750,7 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM
int cOptionsCount;
char **cOptions;
if( FAILED(createTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
if( FAILED(CreateTargetOptions(CP_UTF8, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG;
if( VLC_SUCCESS <= VLC_AddTarget(i_vlc, cUri, (const char **)cOptions, cOptionsCount, mode, position) )
......@@ -766,7 +766,7 @@ STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistM
_p_instance->fireOnStopEvent();
}
freeTargetOptions(cOptions, cOptionsCount);
FreeTargetOptions(cOptions, cOptionsCount);
CoTaskMemFree(cUri);
}
return hr;
......
......@@ -23,7 +23,6 @@
#ifndef _VLCCONTROL_H_
#define _VLCCONTROL_H_
#include <oaidl.h>
#include "axvlc_idl.h"
class VLCControl : public IVLCControl
......@@ -94,6 +93,9 @@ public:
STDMETHODIMP get_AutoPlay(VARIANT_BOOL *autoplay);
STDMETHODIMP put_AutoPlay(VARIANT_BOOL autoplay);
static HRESULT CreateTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount);
static void FreeTargetOptions(char **cOptions, int cOptionCount);
private:
HRESULT getTypeInfo();
......
This diff is collapsed.
/*****************************************************************************
* vlccontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* 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 _VLCCONTROL2_H_
#define _VLCCONTROL2_H_
#include "axvlc_idl.h"
class VLCAudio : public IVLCAudio
{
public:
VLCAudio(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCAudio();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCAudio == 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*);
// IVLCAudio methods
STDMETHODIMP get_mute(VARIANT_BOOL*);
STDMETHODIMP put_mute(VARIANT_BOOL);
STDMETHODIMP get_volume(int*);
STDMETHODIMP put_volume(int);
STDMETHODIMP toggleMute();
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
class VLCInput : public IVLCInput
{
public:
VLCInput(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCInput();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCInput == 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*);
// IVLCInput methods
STDMETHODIMP get_length(__int64*);
STDMETHODIMP get_position(float*);
STDMETHODIMP put_position(float);
STDMETHODIMP get_time(__int64*);
STDMETHODIMP put_time(__int64);
STDMETHODIMP get_state(int*);
STDMETHODIMP get_rate(float*);
STDMETHODIMP put_rate(float);
STDMETHODIMP get_fps(float*);
STDMETHODIMP get_hasVout(VARIANT_BOOL*);
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
class VLCPlaylist : public IVLCPlaylist
{
public:
VLCPlaylist(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCPlaylist();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCPlaylist == 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*);
// IVLCPlaylist methods
STDMETHODIMP get_itemCount(int*);
STDMETHODIMP get_isPlaying(VARIANT_BOOL*);
STDMETHODIMP add(BSTR, BSTR, VARIANT, int*);
STDMETHODIMP play();
STDMETHODIMP playItem(int);
STDMETHODIMP togglePause();
STDMETHODIMP stop();
STDMETHODIMP next();
STDMETHODIMP prev();
STDMETHODIMP clear();
STDMETHODIMP removeItem(int);
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
class VLCVideo : public IVLCVideo
{
public:
VLCVideo(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCVideo();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCVideo == 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*);
// IVLCVideo methods
STDMETHODIMP get_fullscreen(VARIANT_BOOL*);
STDMETHODIMP put_fullscreen(VARIANT_BOOL);
STDMETHODIMP get_width(int*);
STDMETHODIMP get_height(int*);
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
class VLCControl2 : public IVLCControl2
{
public:
VLCControl2(VLCPlugin *p_instance);
virtual ~VLCControl2();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDispatch == riid)
|| (IID_IVLCControl2 == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
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*);
// IVLCControl2 methods
STDMETHODIMP get_audio(IVLCAudio**);
STDMETHODIMP get_input(IVLCInput**);
STDMETHODIMP get_playlist(IVLCPlaylist**);
STDMETHODIMP get_video(IVLCVideo**);
private:
HRESULT getTypeInfo();
VLCPlugin* _p_instance;
ITypeInfo* _p_typeinfo;
VLCAudio* _p_vlcaudio;
VLCInput* _p_vlcinput;
VLCPlaylist* _p_vlcplaylist;
VLCVideo* _p_vlcvideo;
};
#endif
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