Commit 03e30a85 authored by Damien Fouilleul's avatar Damien Fouilleul

Initial version of ActiveX plugin for VLC

parent 25f69f55
......@@ -11,7 +11,7 @@ NULL =
# - modules should come before . because vlc needs the builtins
# - . should come before mozilla because the plugin needs libvlc_pic.a
# - po should come before . because VLC.app needs the pofiles
SUBDIRS = intl modules po . mozilla share m4 doc
SUBDIRS = intl modules po . mozilla activex share m4 doc
DIST_SUBDIRS = $(SUBDIRS) src debian ipkg lib
EXTRA_DIST = \
......
###############################################################################
# Building the Activex plugin
###############################################################################
noinst_LIBRARIES = $(noinst_LIBRARIES_activex)
MOSTLYCLEANFILES = $(LIBRARIES_activex)
EXTRA_DIST = $(SOURCES_activex) $(DIST_rsrc)
BUILT_SOURCES = $(BUILT_SOURCES_activex)
SOURCES_activex = \
main.cpp \
utils.cpp \
utils.h \
olecontrol.cpp \
olecontrol.h \
oleinplaceactiveobject.cpp \
oleinplaceactiveobject.h \
oleinplaceobject.cpp \
oleinplaceobject.h \
oleobject.cpp \
oleobject.h \
persistpropbag.cpp \
persistpropbag.h \
persiststorage.cpp \
persiststorage.h \
persiststreaminit.cpp \
persiststreaminit.h \
provideclassinfo.cpp \
provideclassinfo.h \
connectioncontainer.cpp \
connectioncontainer.h \
objectsafety.cpp \
objectsafety.h \
vlccontrol.cpp \
vlccontrol.h \
plugin.cpp \
plugin.h \
axvlc_idl.c \
axvlc_idl.h \
$(NULL)
DIST_rsrc = \
axvlc_rc.rc \
$(NULL)
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
noinst_LIBRARIES_activex = libaxvlc.a
axvlc_DATA = axvlc$(LIBEXT)
axvlcdir = $(libdir)
LDFLAGS_activex = `$(VLC_CONFIG) --libs vlc activex builtin`
libaxvlc_a_SOURCES = $(SOURCES_activex) $(SOURCE_dll)
libaxvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags activex`
libaxvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags activex`
libaxvlc_a_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc)
axvlc$(LIBEXT): $(libaxvlc_a_OBJECTS) \
$(libaxvlc_a_DEPENDENCIES) stamp-pic
$(CXXLINK) $(libaxvlc_a_OBJECTS) $(DATA_axvlc_rc) -Wl,--enable-stdcall-fixup axvlc.def \
$(LIBRARIES_libvlc) -shared $(LDFLAGS_activex)
DATA_axvlc_tlb = $(axvlc_tlb_DATA)
noinst_axvlc_tlb_DATA = axvlc.tlb
noinst_axvlc_tlbdir = $(libdir)
if HAS_MIDL_COMPILER
axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
$(MIDL) -Oicf -error all -env win32 -tlb axvlc.tlb -iid axvlc_idl.c -h axvlc_idl.h axvlc.idl
clean-tlb:
-rm axvlc.tlb axvlc_idl.c axvlc_idl.h
else
clean-tlb:
endif
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
noinst_axvlc_rc_DATA = axvlc_rc.$(OBJEXT)
noinst_axvlc_rcdir = $(libdir)
axvlc_rc.$(OBJEXT): axvlc_rc.rc inplace.bmp $(axvlc_tlb_DATA)
$(WINDRES) -DVERSION=$(VERSION) -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` --include-dir $(srcdir) -i $< -o $@
###############################################################################
# Stamp rules
###############################################################################
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
###############################################################################
# Clean rules
###############################################################################
clean-local: clean-stamp clean-tlb
-rm axvlc$(LIBEXT)
###############################################################################
# Force rule
###############################################################################
FORCE:
== ACTIVEX Control for VLC ==
The VLC ActiveX Control has been primary designed to work with Internet Explorer.
however it may also work with Visual Basic and/or .NET
Please note, that this code does not rely upon MFC/ATL, hence good compatibility
is not guaranteed
== Compiling ==
In order to script the ActiveX Control on Internet Explorer, a type library is required.
This type library is usually generated from an IDL file using Microsoft MIDL compiler.
However, for convenience I have checked in the output of the MIDL compiler in the
repository so that you will only need the MIDL compiler if you change axvlc.idl.
the generated files are as follow:
axvlc_idl.c
axvlc_idl.h
axvlc.tlb
To use the MIDL compiler on cygwin, you will need to set some environment variables
before configuring vlc. If you have a copy of 'Microsoft Visual C++ 6.0' installed,
the following settings are correct:
export PATH=$PATH:"/cygdrive/c/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin":"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/Bin"
export INCLUDE='C:\Program Files\Microsoft Visual Studio\VC98\Include'
export MIDL="midl"
if you are cross-compiling on Linux, you may be able to use 'widl' which is part of
the WINE project (http://www.winehq.com), however I have not tested it.
== Installing ==
The ActiveX control is built as axvlc.dll, which is the only file that needs be
distributed and it may be installed anywhere on the target machine as long as
its path is correct within the registry.
the necessary registry settings are stored in axvlc.reg
in order to use the plugin, you will need to VLC properly installed on your system
otherwise make sure that the plugin path is set in the registry as indicated below
[HKEY_LOCAL_MACHINE\Software\VideoLAN\VLC]
InstallDir="path\\dir\\"
regards,
Damien Fouilleul <Damien dot Fouilleul at laposte dot net>
LIBRARY AXVLC.DLL
EXPORTS
CLSID_VLCPlugin data
DllMain DllMain@12
DllCanUnloadNow DllCanUnloadNow@0
DllGetClassObject DllGetClassObject@12
DllRegisterServer DllRegisterServer@0
DllUnregisterServer DllUnregisterServer@0
/*****************************************************************************
* axvlc.idl: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
[
uuid(DF2BBE39-40A8-433b-A279-073F48DA94B6),
version(1.0),
helpstring("VideoLAN VLC ActiveX Plugin"),
]
library AXVLC
{
importlib("stdole2.tlb");
// Forward declare all types defined in this typelib
interface IVLCControl;
dispinterface DVLCEvents;
enum VLCPlaylistMode {
VLCPlayListInsert = 1,
VLCPlayListReplace = 2,
VLCPlayListAppend = 4,
VLCPlayListGo = 8,
VLCPlayListCheckInsert = 16
};
// playlist target position
const int VLCPlayListEnd = -666;
[
odl,
uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1),
helpstring("VLC Control"),
dual,
hidden,
oleautomation
]
interface IVLCControl : IDispatch {
[id(0), bindable, defaultbind, propget, helpstring("Specifies current target in playlist")]
HRESULT Value([out, retval] VARIANT* pvarValue);
[id(0), bindable, defaultbind, propput, helpstring("Specifies current target in playlist")]
HRESULT Value([in] VARIANT pvarValue);
[propget, bindable, helpstring("Shows or hides plugin.")]
HRESULT Visible([out, retval] VARIANT_BOOL* visible);
[propput, bindable, helpstring("Shows or hides plugin.")]
HRESULT Visible([in] VARIANT_BOOL visible);
[helpstring("Play current target in playlist.")]
HRESULT play();
[helpstring("Pause playback.")]
HRESULT pause();
[helpstring("Stop playback.")]
HRESULT stop();
[propget, helpstring("Specifies whether VLC is playing.")]
HRESULT Playing([out, retval] VARIANT_BOOL* isPlaying);
[propput, helpstring("Specifies whether VLC is playing.")]
HRESULT Playing([in] VARIANT_BOOL isPlaying);
[propget, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]
HRESULT Position([out, retval] float* position);
[propput, helpstring("Specifies playback position within current target in playlist, position is a relative value ranging from 0.0 to 1.0.")]
HRESULT Position([in] float position);
[propget, helpstring("Specifies playback time relative to the start of current target in playlist.")]
HRESULT Time([out, retval] int* seconds);
[propput, helpstring("Specifies playback time relative to the start of current target in playlist.")]
HRESULT Time([in] int seconds);
[helpstring("Advance or backtrack playback time, relative to current time.")]
HRESULT shuttle([in] int seconds);
[helpstring("Switch between normal and fullscreen video.")]
HRESULT fullscreen();
[propget, helpstring("Returns total length in seconds of current target in playlist, may be unknown.")]
HRESULT Length([out, retval] int* seconds);
[helpstring("Increases playback speed, one of 1x, 2x, 4x, 8x.")]
HRESULT playFaster();
[helpstring("Decreases playback speed, one of 1x, 2x, 4x, 8x.")]
HRESULT playSlower();
[propget, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]
HRESULT Volume([out, retval] int* volume);
[propput, helpstring("Specifies playback sound volume, ranges from 0 to 200%.")]
HRESULT Volume([in] int volume);
[helpstring("Mute/unmute playback sound volume.")]
HRESULT toggleMute();
[helpstring("Add a target to the current playlist.")]
/*
** use VARIANT rather than a SAFEARRAY as argument type
** for compatibility with some scripting language (JScript)
*/
HRESULT addTarget([in] BSTR uri, [in] VARIANT options, [in] enum VLCPlaylistMode mode, [in] int position);
[propget, helpstring("Returns index of current target in playlist.")]
HRESULT PlaylistIndex([out, retval] int* index);
[propget, helpstring("Returns number of items in playlist.")]
HRESULT PlaylistCount([out, retval] int* index);
[helpstring("Advance to next item in playlist.")]
HRESULT playlistNext();
[helpstring("Advance to previous item in playlist.")]
HRESULT playlistPrev();
[helpstring("Remove all items from playlist.")]
HRESULT playlistClear();
[propget, helpstring("Returns VLC Version.")]
HRESULT VersionInfo([out, retval] BSTR* version);
};
[
uuid(DF48072F-5EF8-434e-9B40-E2F3AE759B5F),
helpstring("Event interface for VLC control"),
hidden
]
dispinterface DVLCEvents {
properties:
methods:
[id(1), helpstring("Playback in progress")]
void OnPlay();
[id(2), helpstring("Playback has paused")]
void OnPause();
[id(3), helpstring("Playback has stopped")]
void OnStop();
};
[
uuid(E23FE9C6-778E-49D4-B537-38FCDE4887D8),
helpstring("VLC control"),
control
]
coclass VLCPlugin {
[default] interface IVLCControl;
[default, source] dispinterface DVLCEvents;
};
};
REGEDIT4
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin\CLSID]
@="{E23FE9C6-778E-49d4-B537-38FCDE4887D8}"
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin.1]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\VideoLAN.VLCPlugin.1\CLSID]
@="{E23FE9C6-778E-49d4-B537-38FCDE4887D8}"
[HKEY_CLASSES_ROOT\AppID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}]
@="VideoLAN VLC ActiveX Plugin"
"AppID"="{E23FE9C6-778E-49d4-B537-38FCDE4887D8}"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\ProgID]
@="VideoLAN.VLCPlugin.1"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\VersionIndependentProgID]
@="VideoLAN.VLCPlugin"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\InprocServer32]
@="axvlc.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{40FC6ED4-2438-11CF-A3DB-080036F12502}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{40FC6ED5-2438-11CF-A3DB-080036F12502}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Version]
@="1.0"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Control]
@=""
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\Insertable]
@=""
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\MiscStatus]
@="0"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\MiscStatus\1]
@="131473"
[HKEY_CLASSES_ROOT\CLSID\{E23FE9C6-778E-49d4-B537-38FCDE4887D8}\TypeLib]
@="{DF2BBE39-40A8-433b-A279-073F48DA94B6}"
[HKEY_CLASSES_ROOT\TypeLib\{DF2BBE39-40A8-433b-A279-073F48DA94B6}\1.0]
@="VideoLAN VLC ActiveX Plugin"
[HKEY_CLASSES_ROOT\TypeLib\{DF2BBE39-40A8-433b-A279-073F48DA94B6}\1.0\0\win32]
@="axvlc.dll"
[HKEY_CLASSES_ROOT\TypeLib\{DF2BBE39-40A8-433b-A279-073F48DA94B6}\1.0\FLAGS]
@="2"
/*****************************************************************************
* axvlc_idl.c: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef __cplusplus
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}};
#ifdef __cplusplus
}
#endif
/*****************************************************************************
* axvlc_idl.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __axvlc_idl_h__
#define __axvlc_idl_h__
#ifdef __cplusplus
extern "C"{
#endif
/* Forward Declarations */
#ifndef __IVLCControl_FWD_DEFINED__
#define __IVLCControl_FWD_DEFINED__
typedef interface IVLCControl IVLCControl;
#endif /* __IVLCControl_FWD_DEFINED__ */
#ifndef __DVLCEvents_FWD_DEFINED__
#define __DVLCEvents_FWD_DEFINED__
typedef interface DVLCEvents DVLCEvents;
#endif /* __DVLCEvents_FWD_DEFINED__ */
#ifndef __VLCPlugin_FWD_DEFINED__
#define __VLCPlugin_FWD_DEFINED__
#ifdef __cplusplus
typedef class VLCPlugin VLCPlugin;
#else
typedef struct VLCPlugin VLCPlugin;
#endif /* __cplusplus */
#endif /* __VLCPlugin_FWD_DEFINED__ */
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
#ifndef __AXVLC_LIBRARY_DEFINED__
#define __AXVLC_LIBRARY_DEFINED__
/* library AXVLC */
/* [helpstring][version][uuid] */
enum VLCPlaylistMode
{ VLCPlayListInsert = 1,
VLCPlayListReplace = 2,
VLCPlayListAppend = 4,
VLCPlayListGo = 8,
VLCPlayListCheckInsert = 16
};
#define VLCPlayListEnd ( -666 )
EXTERN_C const IID LIBID_AXVLC;
#ifndef __IVLCControl_INTERFACE_DEFINED__
#define __IVLCControl_INTERFACE_DEFINED__
/* interface IVLCControl */
/* [object][oleautomation][hidden][dual][helpstring][uuid] */
EXTERN_C const IID IID_IVLCControl;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("C2FA41D0-B113-476e-AC8C-9BD14999C1C1")
IVLCControl : public IDispatch
{
public:
virtual /* [helpstring][propget][defaultbind][bindable][id] */ HRESULT STDMETHODCALLTYPE get_Value(
/* [retval][out] */ VARIANT __RPC_FAR *pvarValue) = 0;
virtual /* [helpstring][propput][defaultbind][bindable][id] */ HRESULT STDMETHODCALLTYPE put_Value(
/* [in] */ VARIANT pvarValue) = 0;
virtual /* [helpstring][bindable][propget] */ HRESULT STDMETHODCALLTYPE get_Visible(
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *visible) = 0;
virtual /* [helpstring][bindable][propput] */ HRESULT STDMETHODCALLTYPE put_Visible(
/* [in] */ VARIANT_BOOL visible) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE play( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE pause( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE stop( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Playing(
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Playing(
/* [in] */ VARIANT_BOOL isPlaying) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Position(
/* [retval][out] */ float __RPC_FAR *position) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Position(
/* [in] */ float position) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Time(
/* [retval][out] */ int __RPC_FAR *seconds) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Time(
/* [in] */ int seconds) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE shuttle(
/* [in] */ int seconds) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE fullscreen( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Length(
/* [retval][out] */ int __RPC_FAR *seconds) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playFaster( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playSlower( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Volume(
/* [retval][out] */ int __RPC_FAR *volume) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Volume(
/* [in] */ int volume) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE toggleMute( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE addTarget(
/* [in] */ BSTR uri,
/* [in] */ VARIANT options,
/* [in] */ enum VLCPlaylistMode mode,
/* [in] */ int position) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PlaylistIndex(
/* [retval][out] */ int __RPC_FAR *index) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PlaylistCount(
/* [retval][out] */ int __RPC_FAR *index) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playlistNext( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playlistPrev( void) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE playlistClear( void) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_VersionInfo(
/* [retval][out] */ BSTR __RPC_FAR *version) = 0;
};
#else /* C style interface */
typedef struct IVLCControlVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IVLCControl __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IVLCControl __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IVLCControl __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IVLCControl __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IVLCControl __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IVLCControl __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IVLCControl __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [helpstring][propget][defaultbind][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Value )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT __RPC_FAR *pvarValue);
/* [helpstring][propput][defaultbind][bindable][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Value )(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT pvarValue);
/* [helpstring][bindable][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Visible )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *visible);
/* [helpstring][bindable][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Visible )(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL visible);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *play )(
IVLCControl __RPC_FAR * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *pause )(
IVLCControl __RPC_FAR * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *stop )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Playing )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Playing )(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL isPlaying);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Position )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ float __RPC_FAR *position);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Position )(
IVLCControl __RPC_FAR * This,
/* [in] */ float position);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Time )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Time )(
IVLCControl __RPC_FAR * This,
/* [in] */ int seconds);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *shuttle )(
IVLCControl __RPC_FAR * This,
/* [in] */ int seconds);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *fullscreen )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Length )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playFaster )(
IVLCControl __RPC_FAR * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playSlower )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Volume )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *volume);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Volume )(
IVLCControl __RPC_FAR * This,
/* [in] */ int volume);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *toggleMute )(
IVLCControl __RPC_FAR * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *addTarget )(
IVLCControl __RPC_FAR * This,
/* [in] */ BSTR uri,
/* [in] */ VARIANT options,
/* [in] */ enum VLCPlaylistMode mode,
/* [in] */ int position);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_PlaylistIndex )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *index);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_PlaylistCount )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *index);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playlistNext )(
IVLCControl __RPC_FAR * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playlistPrev )(
IVLCControl __RPC_FAR * This);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *playlistClear )(
IVLCControl __RPC_FAR * This);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionInfo )(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *version);
END_INTERFACE
} IVLCControlVtbl;
interface IVLCControl
{
CONST_VTBL struct IVLCControlVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IVLCControl_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IVLCControl_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IVLCControl_Release(This) \
(This)->lpVtbl -> Release(This)
#define IVLCControl_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IVLCControl_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IVLCControl_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IVLCControl_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IVLCControl_get_Value(This,pvarValue) \
(This)->lpVtbl -> get_Value(This,pvarValue)
#define IVLCControl_put_Value(This,pvarValue) \
(This)->lpVtbl -> put_Value(This,pvarValue)
#define IVLCControl_get_Visible(This,visible) \
(This)->lpVtbl -> get_Visible(This,visible)
#define IVLCControl_put_Visible(This,visible) \
(This)->lpVtbl -> put_Visible(This,visible)
#define IVLCControl_play(This) \
(This)->lpVtbl -> play(This)
#define IVLCControl_pause(This) \
(This)->lpVtbl -> pause(This)
#define IVLCControl_stop(This) \
(This)->lpVtbl -> stop(This)
#define IVLCControl_get_Playing(This,isPlaying) \
(This)->lpVtbl -> get_Playing(This,isPlaying)
#define IVLCControl_put_Playing(This,isPlaying) \
(This)->lpVtbl -> put_Playing(This,isPlaying)
#define IVLCControl_get_Position(This,position) \
(This)->lpVtbl -> get_Position(This,position)
#define IVLCControl_put_Position(This,position) \
(This)->lpVtbl -> put_Position(This,position)
#define IVLCControl_get_Time(This,seconds) \
(This)->lpVtbl -> get_Time(This,seconds)
#define IVLCControl_put_Time(This,seconds) \
(This)->lpVtbl -> put_Time(This,seconds)
#define IVLCControl_shuttle(This,seconds) \
(This)->lpVtbl -> shuttle(This,seconds)
#define IVLCControl_fullscreen(This) \
(This)->lpVtbl -> fullscreen(This)
#define IVLCControl_get_Length(This,seconds) \
(This)->lpVtbl -> get_Length(This,seconds)
#define IVLCControl_playFaster(This) \
(This)->lpVtbl -> playFaster(This)
#define IVLCControl_playSlower(This) \
(This)->lpVtbl -> playSlower(This)
#define IVLCControl_get_Volume(This,volume) \
(This)->lpVtbl -> get_Volume(This,volume)
#define IVLCControl_put_Volume(This,volume) \
(This)->lpVtbl -> put_Volume(This,volume)
#define IVLCControl_toggleMute(This) \
(This)->lpVtbl -> toggleMute(This)
#define IVLCControl_addTarget(This,uri,options,mode,position) \
(This)->lpVtbl -> addTarget(This,uri,options,mode,position)
#define IVLCControl_get_PlaylistIndex(This,index) \
(This)->lpVtbl -> get_PlaylistIndex(This,index)
#define IVLCControl_get_PlaylistCount(This,index) \
(This)->lpVtbl -> get_PlaylistCount(This,index)
#define IVLCControl_playlistNext(This) \
(This)->lpVtbl -> playlistNext(This)
#define IVLCControl_playlistPrev(This) \
(This)->lpVtbl -> playlistPrev(This)
#define IVLCControl_playlistClear(This) \
(This)->lpVtbl -> playlistClear(This)
#define IVLCControl_get_VersionInfo(This,version) \
(This)->lpVtbl -> get_VersionInfo(This,version)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][propget][defaultbind][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Value_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT __RPC_FAR *pvarValue);
void __RPC_STUB IVLCControl_get_Value_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput][defaultbind][bindable][id] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Value_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT pvarValue);
void __RPC_STUB IVLCControl_put_Value_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][bindable][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Visible_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *visible);
void __RPC_STUB IVLCControl_get_Visible_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][bindable][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Visible_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL visible);
void __RPC_STUB IVLCControl_put_Visible_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_play_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_play_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_pause_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_pause_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_stop_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_stop_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Playing_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ VARIANT_BOOL __RPC_FAR *isPlaying);
void __RPC_STUB IVLCControl_get_Playing_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Playing_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ VARIANT_BOOL isPlaying);
void __RPC_STUB IVLCControl_put_Playing_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Position_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ float __RPC_FAR *position);
void __RPC_STUB IVLCControl_get_Position_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Position_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ float position);
void __RPC_STUB IVLCControl_put_Position_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Time_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
void __RPC_STUB IVLCControl_get_Time_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Time_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ int seconds);
void __RPC_STUB IVLCControl_put_Time_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_shuttle_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ int seconds);
void __RPC_STUB IVLCControl_shuttle_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_fullscreen_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_fullscreen_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Length_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *seconds);
void __RPC_STUB IVLCControl_get_Length_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_playFaster_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_playFaster_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_playSlower_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_playSlower_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_Volume_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *volume);
void __RPC_STUB IVLCControl_get_Volume_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IVLCControl_put_Volume_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ int volume);
void __RPC_STUB IVLCControl_put_Volume_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_toggleMute_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_toggleMute_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_addTarget_Proxy(
IVLCControl __RPC_FAR * This,
/* [in] */ BSTR uri,
/* [in] */ VARIANT options,
/* [in] */ enum VLCPlaylistMode mode,
/* [in] */ int position);
void __RPC_STUB IVLCControl_addTarget_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_PlaylistIndex_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *index);
void __RPC_STUB IVLCControl_get_PlaylistIndex_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_PlaylistCount_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *index);
void __RPC_STUB IVLCControl_get_PlaylistCount_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_playlistNext_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_playlistNext_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_playlistPrev_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_playlistPrev_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IVLCControl_playlistClear_Proxy(
IVLCControl __RPC_FAR * This);
void __RPC_STUB IVLCControl_playlistClear_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IVLCControl_get_VersionInfo_Proxy(
IVLCControl __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *version);
void __RPC_STUB IVLCControl_get_VersionInfo_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IVLCControl_INTERFACE_DEFINED__ */
#ifndef __DVLCEvents_DISPINTERFACE_DEFINED__
#define __DVLCEvents_DISPINTERFACE_DEFINED__
/* dispinterface DVLCEvents */
/* [hidden][helpstring][uuid] */
EXTERN_C const IID DIID_DVLCEvents;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("DF48072F-5EF8-434e-9B40-E2F3AE759B5F")
DVLCEvents : public IDispatch
{
};
#else /* C style interface */
typedef struct DVLCEventsVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
DVLCEvents __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
DVLCEvents __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
DVLCEvents __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
DVLCEvents __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
DVLCEvents __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
DVLCEvents __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
DVLCEvents __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
END_INTERFACE
} DVLCEventsVtbl;
interface DVLCEvents
{
CONST_VTBL struct DVLCEventsVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define DVLCEvents_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define DVLCEvents_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define DVLCEvents_Release(This) \
(This)->lpVtbl -> Release(This)
#define DVLCEvents_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define DVLCEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define DVLCEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define DVLCEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __DVLCEvents_DISPINTERFACE_DEFINED__ */
EXTERN_C const CLSID CLSID_VLCPlugin;
#ifdef __cplusplus
class DECLSPEC_UUID("E23FE9C6-778E-49D4-B537-38FCDE4887D8")
VLCPlugin;
#endif
#endif /* __AXVLC_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
#ifndef VERSION_NUMBER
#define VERSION_NUMBER 0,0,0,0
#endif
#ifndef VERSION
#define VERSION 0.0.0
#endif
#define STRINGIFY( z ) UGLY_KLUDGE( z )
#define UGLY_KLUDGE( z ) #z
1 VERSIONINFO
FILETYPE 1
FILEOS 4
PRODUCTVERSION VERSION_NUMBER
FILEVERSION VERSION_NUMBER
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "VideoLAN Team"
VALUE "FileVersion", STRINGIFY( VERSION )
VALUE "FileDescription", "VLC media player"
VALUE "LegalCopyright", "(c) 1996-2003 VideoLAN"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
INPLACE-PICT BITMAP DISCARDABLE "inplace.bmp"
1 TYPELIB "axvlc.tlb"
/*****************************************************************************
* connectioncontainer.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "connectioncontainer.h"
#include "utils.h"
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnections : public IEnumConnections
{
public:
VLCEnumConnections(vector<CONNECTDATA> &v) :
e(VLCEnum<CONNECTDATA>(IID_IEnumConnections, v))
{ e.setRetainOperation((VLCEnum<CONNECTDATA>::retainer)&retain); };
VLCEnumConnections(const VLCEnumConnections &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumConnections() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPCONNECTDATA rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMCONNECTIONS *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
};
private:
static void retain(CONNECTDATA cd)
{
cd.pUnk->AddRef();
};
VLCEnum<CONNECTDATA> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP VLCConnectionPoint::GetConnectionInterface(IID *iid)
{
if( NULL == iid )
return E_POINTER;
*iid = _iid;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *ppCPC)
{
if( NULL == ppCPC )
return E_POINTER;
_p_cpc->AddRef();
*ppCPC = _p_cpc;
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
{
if( (NULL == pUnk) || (NULL == pdwCookie) )
return E_POINTER;
CONNECTDATA cd;
pUnk->AddRef();
cd.pUnk = pUnk;
*pdwCookie = cd.dwCookie = _connections.size();
_connections.push_back(cd);
return S_OK;
};
STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
{
if( pdwCookie < _connections.size() )
{
CONNECTDATA cd = _connections[pdwCookie];
if( NULL != cd.pUnk )
{
cd.pUnk->Release();
cd.pUnk = NULL;
return S_OK;
}
}
return CONNECT_E_NOCONNECTION;
};
STDMETHODIMP VLCConnectionPoint::EnumConnections(IEnumConnections **ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONS>(new VLCEnumConnections(_connections));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
void VLCConnectionPoint::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispParams)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IDispatch *pDisp;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp)) )
{
unsigned int puArgErr;
VARIANT vRes;
if( SUCCEEDED(pDisp->Invoke(dispId, IID_NULL, lcid, DISPATCH_METHOD, pDispParams, &vRes, NULL, &puArgErr)) )
{
VariantClear(&vRes);
}
pDisp->Release();
}
}
++iter;
}
};
void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
{
vector<CONNECTDATA>::iterator end = _connections.end();
vector<CONNECTDATA>::iterator iter = _connections.begin();
while( iter != end )
{
CONNECTDATA cd = *iter;
if( NULL != cd.pUnk )
{
IPropertyNotifySink *pPropSink;
if( SUCCEEDED(cd.pUnk->QueryInterface(IID_IPropertyNotifySink, (LPVOID *)&pPropSink)) )
{
pPropSink->OnChanged(dispId);
pPropSink->Release();
}
}
++iter;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
class VLCEnumConnectionPoints : public IEnumConnectionPoints
{
public:
VLCEnumConnectionPoints(vector<LPCONNECTIONPOINT> &v) :
e(VLCEnum<LPCONNECTIONPOINT>(IID_IEnumConnectionPoints, v))
{ e.setRetainOperation((VLCEnum<LPCONNECTIONPOINT>::retainer)&retain); };
VLCEnumConnectionPoints(const VLCEnumConnectionPoints &vlcEnum) : e(vlcEnum.e) {};
virtual ~VLCEnumConnectionPoints() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{ return e.QueryInterface(riid, ppv); };
STDMETHODIMP_(ULONG) AddRef(void)
{ return e.AddRef(); };
STDMETHODIMP_(ULONG) Release(void)
{return e.Release(); };
//IEnumConnectionPoints
STDMETHODIMP Next(ULONG celt, LPCONNECTIONPOINT *rgelt, ULONG *pceltFetched)
{ return e.Next(celt, rgelt, pceltFetched); };
STDMETHODIMP Skip(ULONG celt)
{ return e.Skip(celt);};
STDMETHODIMP Reset(void)
{ return e.Reset();};
STDMETHODIMP Clone(LPENUMCONNECTIONPOINTS *ppenum)
{ if( NULL == ppenum ) return E_POINTER;
*ppenum = dynamic_cast<LPENUMCONNECTIONPOINTS>(new VLCEnumConnectionPoints(*this));
return (NULL != *ppenum) ? S_OK : E_OUTOFMEMORY;
};
private:
static void retain(LPCONNECTIONPOINT cp)
{
cp->AddRef();
};
VLCEnum<LPCONNECTIONPOINT> e;
};
////////////////////////////////////////////////////////////////////////////////////////////////
VLCConnectionPointContainer::VLCConnectionPointContainer(VLCPlugin *p_instance) :
_p_instance(p_instance)
{
_p_events = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
_p_instance->getDispEventID());
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_events));
_p_props = new VLCConnectionPoint(dynamic_cast<LPCONNECTIONPOINTCONTAINER>(this),
IID_IPropertyNotifySink);
_v_cps.push_back(dynamic_cast<LPCONNECTIONPOINT>(_p_props));
};
VLCConnectionPointContainer::~VLCConnectionPointContainer()
{
_v_cps.clear();
delete _p_props;
delete _p_events;
};
STDMETHODIMP VLCConnectionPointContainer::EnumConnectionPoints(LPENUMCONNECTIONPOINTS *ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = dynamic_cast<LPENUMCONNECTIONPOINTS>(new VLCEnumConnectionPoints(_v_cps));
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
STDMETHODIMP VLCConnectionPointContainer::FindConnectionPoint(REFIID riid, IConnectionPoint **ppCP)
{
if( NULL == ppCP )
return E_POINTER;
*ppCP = NULL;
if( IID_IPropertyNotifySink == riid )
{
_p_props->AddRef();
*ppCP = dynamic_cast<LPCONNECTIONPOINT>(_p_props);
}
else if( _p_instance->getDispEventID() == riid )
{
_p_events->AddRef();
*ppCP = dynamic_cast<LPCONNECTIONPOINT>(_p_events);
}
else
return CONNECT_E_NOCONNECTION;
return NOERROR;
};
void VLCConnectionPointContainer::fireEvent(DISPID dispId, LCID lcid, DISPPARAMS* pDispParams)
{
_p_events->fireEvent(dispId,lcid, pDispParams);
};
void VLCConnectionPointContainer::firePropChangedEvent(DISPID dispId)
{
_p_props->firePropChangedEvent(dispId);
};
/*****************************************************************************
* connectioncontainer.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __CONNECTIONCONTAINER_H__
#define __CONNECTIONCONTAINER_H__
#include <ocidl.h>
#include <vector>
using namespace std;
class VLCConnectionPoint : public IConnectionPoint
{
public:
VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
_iid(iid), _p_cpc(p_cpc) {};
virtual ~VLCConnectionPoint() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( (IID_IUnknown == riid)
&& (IID_IConnectionPoint == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
// must be a standalone object
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_cpc->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_cpc->Release(); };
// IConnectionPoint methods
STDMETHODIMP GetConnectionInterface(IID *);
STDMETHODIMP GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *);
STDMETHODIMP Advise(IUnknown *, DWORD *);
STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);
void fireEvent(DISPID dispIdMember, LCID lcid, DISPPARAMS* pDispParams);
void firePropChangedEvent(DISPID dispId);
private:
REFIID _iid;
IConnectionPointContainer *_p_cpc;
vector<CONNECTDATA> _connections;
};
//////////////////////////////////////////////////////////////////////////
class VLCConnectionPointContainer : public IConnectionPointContainer
{
public:
VLCConnectionPointContainer(VLCPlugin *p_instance);
virtual ~VLCConnectionPointContainer();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IConnectionPointContainer == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IConnectionPointContainer methods
STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
void fireEvent(DISPID, LCID, DISPPARAMS*);
void firePropChangedEvent(DISPID dispId);
private:
VLCPlugin *_p_instance;
VLCConnectionPoint *_p_events;
VLCConnectionPoint *_p_props;
vector<LPCONNECTIONPOINT> _v_cps;
};
#endif
/*****************************************************************************
* main.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include <comcat.h>
using namespace std;
static LONG i_class_ref= 0;
static HINSTANCE h_instance= 0;
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
*ppv = NULL;
if( CLSID_VLCPlugin == rclsid )
{
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance);
hr = plugin->QueryInterface(riid, ppv);
plugin->Release();
}
return hr;
};
STDAPI DllCanUnloadNow(VOID)
{
return (0 == i_class_ref) ? S_OK: S_FALSE;
};
STDAPI DllRegisterServer(VOID)
{
return S_OK;
};
STDAPI DllUnregisterServer(VOID)
{
return S_OK;
};
#ifdef BUILD_LOCALSERVER
/*
** easier to debug an application than a DLL on cygwin GDB :)
*/
#include <iostream>
STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
MSG msg;
if( FAILED(OleInitialize(NULL)) )
{
cerr << "cannot initialize OLE" << endl;
return 1;
}
IUnknown *classProc = NULL;
if( FAILED(DllGetClassObject(CLSID_VLCPlugin, IID_IUnknown, (LPVOID *)&classProc)) )
return 0;
DWORD dwRegisterClassObject;
if( FAILED(CoRegisterClassObject(CLSID_VLCPlugin, classProc,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegisterClassObject)) )
return 0;
DWORD dwRegisterActiveObject;
if( FAILED(RegisterActiveObject(classProc, CLSID_VLCPlugin,
ACTIVEOBJECT_WEAK, &dwRegisterActiveObject)) )
return 0;
classProc->Release();
/*
* Polling messages from event queue
*/
while( S_FALSE == DllCanUnloadNow() )
{
while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
if( msg.message == WM_QUIT )
break; // Leave the PeekMessage while() loop
/*if(TranslateAccelerator(ghwndApp, ghAccel, &msg))
continue;*/
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(msg.message == WM_QUIT)
break; // Leave the for() loop
WaitMessage();
}
if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject, NULL)) )
CoRevokeClassObject(dwRegisterClassObject);
// Reached on WM_QUIT message
CoUninitialize();
return ((int) msg.wParam);
};
#else
STDAPI_(BOOL) DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved )
{
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
h_instance = (HINSTANCE)hModule;
break;
default:
break;
}
return TRUE;
};
#endif
/*****************************************************************************
* objectsafety.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "objectsafety.h"
#include "axvlc_idl.h"
#if 0
const GUID IID_IObjectSafety =
{0xCB5BDC81,0x93C1,0x11cf,{0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64}};
#endif
STDMETHODIMP VLCObjectSafety::GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
)
{
if( (NULL == pdwSupportedOptions) || (NULL == pdwEnabledOptions) )
return E_POINTER;
*pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACESAFE_FOR_UNTRUSTED_CALLER;
if( (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
return NOERROR;
}
else if( (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid)
|| (IID_IPersistStorage == riid)
|| (IID_IPersistPropertyBag == riid) )
{
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
return NOERROR;
}
*pdwEnabledOptions = 0;
return E_NOINTERFACE;
};
STDMETHODIMP VLCObjectSafety::SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
)
{
if( (IID_IDispatch == riid)
|| (IID_IVLCControl == riid) )
{
if( (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwOptionSetMask)
&& (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwEnabledOptions) )
{
return NOERROR;
}
return E_FAIL;
}
else if( (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid)
|| (IID_IPersistStorage == riid)
|| (IID_IPersistPropertyBag == riid) )
{
if( (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwOptionSetMask)
&& (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwEnabledOptions) )
{
return NOERROR;
}
return E_FAIL;
}
return E_FAIL;
};
/*****************************************************************************
* objectsafety.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OBJECTSAFETY_H__
#define __OBJECTSAFETY_H__
#if HAVE_OBJSAFE_HEADER
/*
** at last, a version of mingw that supports this header
*/
#include <objsafe.h>
#else
// {CB5BDC81-93C1-11cf-8F20-00805F2CD064}
extern "C" const IID IID_IObjectSafety;
#define INTERFACESAFE_FOR_UNTRUSTED_CALLER 1L
#define INTERFACESAFE_FOR_UNTRUSTED_DATA 2L
struct IObjectSafety : public IUnknown
{
virtual STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD __RPC_FAR *pdwSupportedOptions,
DWORD __RPC_FAR *pdwEnabledOptions
) = 0;
virtual STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwSupportedOptions,
DWORD dwOptionSetMask
) = 0;
};
#endif
class VLCObjectSafety : public IObjectSafety
{
public:
VLCObjectSafety(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCObjectSafety() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IObjectSafety == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IUnknown methods
STDMETHODIMP GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,
DWORD *pdwEnabledOptions
);
STDMETHODIMP SetInterfaceSafetyOptions(
REFIID riid,
DWORD dwOptionSetMask,
DWORD dwEnabledOptions
);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* olecontrol.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "olecontrol.h"
#include "utils.h"
using namespace std;
STDMETHODIMP VLCOleControl::GetControlInfo(CONTROLINFO *pCI)
{
if( NULL == pCI )
return E_POINTER;
pCI->cb = sizeof(CONTROLINFO);
pCI->hAccel = NULL;
pCI->cAccel = 0;
pCI->dwFlags = 0;
return S_OK;
};
STDMETHODIMP VLCOleControl::OnMnemonic(LPMSG pMsg)
{
return E_NOTIMPL;
};
static HRESULT getAmbientProperty(VLCPlugin& instance, DISPID dispID, VARIANT& v)
{
HRESULT hr;
IOleObject *oleObj;
hr = instance.QueryInterface(IID_IOleObject, (LPVOID *)&oleObj);
if( SUCCEEDED(hr) )
{
IOleClientSite *clientSite;
hr = oleObj->GetClientSite(&clientSite);
if( SUCCEEDED(hr) && (NULL != clientSite) )
{
hr = GetObjectProperty(clientSite, dispID, v);
clientSite->Release();
}
oleObj->Release();
}
return hr;
};
STDMETHODIMP VLCOleControl::OnAmbientPropertyChange(DISPID dispID)
{
switch( dispID )
{
case DISPID_AMBIENT_BACKCOLOR:
break;
case DISPID_AMBIENT_DISPLAYNAME:
break;
case DISPID_AMBIENT_FONT:
break;
case DISPID_AMBIENT_FORECOLOR:
break;
case DISPID_AMBIENT_LOCALEID:
break;
case DISPID_AMBIENT_MESSAGEREFLECT:
break;
case DISPID_AMBIENT_SCALEUNITS:
break;
case DISPID_AMBIENT_TEXTALIGN:
break;
case DISPID_AMBIENT_USERMODE:
break;
case DISPID_AMBIENT_UIDEAD:
break;
case DISPID_AMBIENT_SHOWGRABHANDLES:
break;
case DISPID_AMBIENT_SHOWHATCHING:
break;
case DISPID_AMBIENT_DISPLAYASDEFAULT:
break;
case DISPID_AMBIENT_SUPPORTSMNEMONICS:
break;
case DISPID_AMBIENT_AUTOCLIP:
break;
case DISPID_AMBIENT_APPEARANCE:
break;
case DISPID_AMBIENT_CODEPAGE:
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(getAmbientProperty(*_p_instance, dispID, v)) )
{
_p_instance->setCodePage(V_I4(&v));
}
break;
case DISPID_AMBIENT_PALETTE:
break;
case DISPID_AMBIENT_CHARSET:
break;
case DISPID_AMBIENT_RIGHTTOLEFT:
break;
case DISPID_AMBIENT_TOPTOBOTTOM:
break;
default:
break;
}
return S_OK;
};
STDMETHODIMP VLCOleControl::FreezeEvents(BOOL bFreeze)
{
_p_instance->setSendEvents(! bFreeze);
return S_OK;
};
/*****************************************************************************
* olecontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLECONTROL_H__
#define __OLECONTROL_H__
#include <olectl.h>
class VLCOleControl : public IOleControl
{
public:
VLCOleControl(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleControl() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleControl == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleControl methods
STDMETHODIMP GetControlInfo(CONTROLINFO *pCI);
STDMETHODIMP OnMnemonic(LPMSG pMsg);
STDMETHODIMP OnAmbientPropertyChange(DISPID dispID);
STDMETHODIMP FreezeEvents(BOOL bFreeze);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* oleinplaceactiveobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceactiveobject.h"
using namespace std;
STDMETHODIMP VLCOleInPlaceActiveObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
return E_FAIL;
}
*pHwnd = NULL;
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceActiveObject::EnableModeless(BOOL fEnable)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::TranslateAccelerator(LPMSG lpmsg)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnFrameWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnDocWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ResizeBorder(LPCRECT prcBorder, LPOLEINPLACEUIWINDOW pUIWindow, BOOL fFrameWindow)
{
return E_NOTIMPL;
};
/*****************************************************************************
* oleinplaceactiveobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEINPLACEACTIVEOBJECT_H__
#define __OLEINPLACEACTIVEOBJECT_H__
#include "oleidl.h"
class VLCOleInPlaceActiveObject : public IOleInPlaceActiveObject
{
public:
VLCOleInPlaceActiveObject(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleInPlaceActiveObject() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceActiveObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleWindow methods
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
// IOleInPlaceActiveObject methods
STDMETHODIMP EnableModeless(BOOL);
STDMETHODIMP TranslateAccelerator(LPMSG);
STDMETHODIMP OnFrameWindowActivate(BOOL);
STDMETHODIMP OnDocWindowActivate(BOOL);
STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* oleinplaceobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceobject.h"
#include <docobj.h>
using namespace std;
STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
return E_FAIL;
}
*pHwnd = NULL;
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceObject::InPlaceDeactivate(void)
{
if( _p_instance->isInPlaceActive() )
{
UIDeactivate();
_p_instance->onInPlaceDeactivate();
LPOLEOBJECT p_oleObject;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
{
LPOLECLIENTSITE p_clientSite;
if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnInPlaceDeactivate();
p_inPlaceSite->Release();
}
p_clientSite->Release();
}
p_oleObject->Release();
}
return S_OK;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::UIDeactivate(void)
{
if( _p_instance->isInPlaceActive() )
{
if( _p_instance->hasFocus() )
{
_p_instance->setFocus(FALSE);
LPOLEOBJECT p_oleObject;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
{
LPOLECLIENTSITE p_clientSite;
if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
{
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnUIDeactivate(FALSE);
p_inPlaceSite->Release();
}
p_clientSite->Release();
}
p_oleObject->Release();
}
return S_OK;
}
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
if( _p_instance->isInPlaceActive() )
{
_p_instance->onPositionChange(lprcPosRect, lprcClipRect);
return S_OK;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleInPlaceObject::ReactivateAndUndo(void)
{
return INPLACE_E_NOTUNDOABLE;
};
/*****************************************************************************
* oleinplaceobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEINPLACEOBJECT_H__
#define __OLEINPLACEOBJECT_H__
class VLCOleInPlaceObject : public IOleInPlaceObject
{
public:
VLCOleInPlaceObject(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCOleInPlaceObject() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleWindow == riid)
&& (IID_IOleInPlaceObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleWindow methods
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
// IOleInPlaceObject methods
STDMETHODIMP InPlaceDeactivate(void);
STDMETHODIMP UIDeactivate(void);
STDMETHODIMP SetObjectRects(LPCRECT, LPCRECT);
STDMETHODIMP ReactivateAndUndo(void);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* oleobject.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleobject.h"
#include "utils.h"
#include <docobj.h>
using namespace std;
VLCOleObject::VLCOleObject(VLCPlugin *p_instance) :
_p_clientsite(NULL), _p_instance(p_instance)
{
CreateOleAdviseHolder(&_p_advise_holder);
};
VLCOleObject::~VLCOleObject()
{
_p_advise_holder->Release();
SetClientSite(NULL);
};
STDMETHODIMP VLCOleObject::Advise(IAdviseSink *pAdvSink, DWORD *dwConnection)
{
return _p_advise_holder->Advise(pAdvSink, dwConnection);
};
STDMETHODIMP VLCOleObject::Close(DWORD dwSaveOption)
{
_p_advise_holder->SendOnClose();
OleFlushClipboard();
return _p_instance->onClose(dwSaveOption);
};
STDMETHODIMP VLCOleObject::DoVerb(LONG iVerb, LPMSG lpMsg, LPOLECLIENTSITE pActiveSite,
LONG lIndex, HWND hwndParent, LPCRECT lprcPosRect)
{
if( 0 != lIndex )
return DV_E_LINDEX;
switch( iVerb )
{
case OLEIVERB_PRIMARY:
case OLEIVERB_SHOW:
case OLEIVERB_OPEN:
case OLEIVERB_INPLACEACTIVATE:
if( NULL == hwndParent )
return OLEOBJ_S_INVALIDHWND;
if( SUCCEEDED(doInPlaceActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect)) )
return S_OK;
return OLEOBJ_S_CANNOT_DOVERB_NOW;
case OLEIVERB_HIDE:
_p_instance->setVisible(FALSE);
return S_OK;
case OLEIVERB_UIACTIVATE:
return doUIActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect);
case OLEIVERB_DISCARDUNDOSTATE:
return S_OK;
default:
if( NULL == hwndParent )
return OLEOBJ_S_INVALIDHWND;
if( SUCCEEDED(doInPlaceActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect)) )
return OLEOBJ_S_INVALIDVERB;
return OLEOBJ_S_CANNOT_DOVERB_NOW;
}
};
HRESULT VLCOleObject::doInPlaceActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect)
{
RECT posRect;
RECT clipRect;
LPCRECT lprcClipRect = lprcPosRect;
if( NULL != pActiveSite )
{
// check if already activated
if( _p_instance->isInPlaceActive() )
{
// just attempt to show object then
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
return S_OK;
}
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(pActiveSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
if( S_OK != p_inPlaceSite->CanInPlaceActivate() )
return E_FAIL;
LPOLEINPLACEFRAME p_inPlaceFrame;
LPOLEINPLACEUIWINDOW p_inPlaceUIWindow;
OLEINPLACEFRAMEINFO oleFrameInfo;
if( SUCCEEDED(p_inPlaceSite->GetWindowContext(&p_inPlaceFrame, &p_inPlaceUIWindow, &posRect, &clipRect, &oleFrameInfo)) )
{
lprcPosRect = &posRect;
lprcClipRect = &clipRect;
if( NULL != p_inPlaceFrame )
p_inPlaceFrame->Release();
if( NULL != p_inPlaceUIWindow )
p_inPlaceUIWindow->Release();
}
}
if( FAILED(_p_instance->onActivateInPlace(lpMsg, hwndParent, lprcPosRect, lprcClipRect)) )
return E_FAIL;
if( NULL != p_inPlaceSite )
p_inPlaceSite->OnPosRectChange(lprcPosRect);
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
if( NULL != p_inPlaceSite )
{
p_inPlaceSite->OnInPlaceActivate();
p_inPlaceSite->Release();
}
if( NULL != lpMsg )
{
switch( lpMsg->message )
{
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
doUIActivate(lpMsg, pActiveSite, hwndParent, lprcPosRect);
break;
default:
break;
}
}
return S_OK;
}
return E_FAIL;
};
HRESULT VLCOleObject::doUIActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect)
{
if( NULL != pActiveSite )
{
// check if already activated
if( ! _p_instance->isInPlaceActive() )
return OLE_E_NOT_INPLACEACTIVE;
LPOLEINPLACESITE p_inPlaceSite;
if( SUCCEEDED(pActiveSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
{
p_inPlaceSite->OnUIActivate();
if( NULL != lprcPosRect )
{
p_inPlaceSite->OnPosRectChange(lprcPosRect);
}
p_inPlaceSite->Release();
}
pActiveSite->ShowObject();
_p_instance->setVisible(TRUE);
_p_instance->setFocus(TRUE);
return S_OK;
}
return E_FAIL;
};
STDMETHODIMP VLCOleObject::EnumAdvise(IEnumSTATDATA **ppEnumAdvise)
{
return _p_advise_holder->EnumAdvise(ppEnumAdvise);
};
STDMETHODIMP VLCOleObject::EnumVerbs(IEnumOleVerb **ppEnumOleVerb)
{
return OLE_S_USEREG;
};
STDMETHODIMP VLCOleObject::GetClientSite(LPOLECLIENTSITE *ppClientSite)
{
if( NULL == ppClientSite )
return E_POINTER;
if( NULL != _p_clientsite )
_p_clientsite->AddRef();
*ppClientSite= _p_clientsite;
return S_OK;
};
STDMETHODIMP VLCOleObject::GetClipboardData(DWORD dwReserved, LPDATAOBJECT *ppDataObject)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::GetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus)
{
if( NULL != pdwStatus )
return E_POINTER;
*pdwStatus = OLEMISC_RECOMPOSEONRESIZE
| OLEMISC_CANTLINKINSIDE
| OLEMISC_INSIDEOUT
| OLEMISC_ACTIVATEWHENVISIBLE
| OLEMISC_SETCLIENTSITEFIRST;
return S_OK;
};
STDMETHODIMP VLCOleObject::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMoniker)
{
if( NULL != _p_clientsite )
return _p_clientsite->GetMoniker(dwAssign,dwWhichMoniker, ppMoniker);
return E_UNEXPECTED;
};
STDMETHODIMP VLCOleObject::GetUserClassID(LPCLSID pClsid)
{
if( NULL == pClsid )
return E_POINTER;
pClsid = const_cast<LPCLSID>(&_p_instance->getClassID());
return S_OK;
};
STDMETHODIMP VLCOleObject::GetUserType(DWORD dwFormOfType, LPOLESTR *pszUserType)
{
return OLE_S_USEREG;
};
STDMETHODIMP VLCOleObject::InitFromData(LPDATAOBJECT pDataObject, BOOL fCreation, DWORD dwReserved)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::IsUpToDate(void)
{
return S_OK;
};
STDMETHODIMP VLCOleObject::SetClientSite(LPOLECLIENTSITE pClientSite)
{
if( NULL != _p_clientsite )
_p_clientsite->Release();
if( NULL != pClientSite )
{
pClientSite->AddRef();
/*
** retrieve container ambient properties
*/
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_I4;
if( SUCCEEDED(GetObjectProperty(pClientSite, DISPID_AMBIENT_CODEPAGE, v)) )
{
_p_instance->setCodePage(V_I4(&v));
VariantClear(&v);
}
}
_p_clientsite = pClientSite;
return S_OK;
};
STDMETHODIMP VLCOleObject::SetColorScheme(LOGPALETTE *pLogpal)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::SetExtent(DWORD dwDrawAspect, SIZEL *pSizel)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleObject::SetHostNames(LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
{
return S_OK;
};
STDMETHODIMP VLCOleObject::SetMoniker(DWORD dwWhichMoniker, LPMONIKER pMoniker)
{
return _p_advise_holder->SendOnRename(pMoniker);
};
STDMETHODIMP VLCOleObject::Unadvise(DWORD dwConnection)
{
return _p_advise_holder->Unadvise(dwConnection);
};
STDMETHODIMP VLCOleObject::Update(void)
{
return S_OK;
};
/*****************************************************************************
* oleobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __OLEOBJECT_H__
#define __OLEOBJECT_H__
class VLCOleObject : public IOleObject
{
public:
VLCOleObject(VLCPlugin *p_instance);
virtual ~VLCOleObject();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IOleObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IOleObject methods
STDMETHODIMP Advise(IAdviseSink *, LPDWORD);
STDMETHODIMP Close(DWORD);
STDMETHODIMP DoVerb(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
STDMETHODIMP EnumAdvise(IEnumSTATDATA **);
STDMETHODIMP EnumVerbs(IEnumOleVerb **);
STDMETHODIMP GetClientSite(LPOLECLIENTSITE *);
STDMETHODIMP GetClipboardData(DWORD, LPDATAOBJECT *);
STDMETHODIMP GetExtent(DWORD, SIZEL *);
STDMETHODIMP GetMiscStatus(DWORD, DWORD *);
STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *);
STDMETHODIMP GetUserClassID(CLSID *);
STDMETHODIMP GetUserType(DWORD, LPOLESTR *);
STDMETHODIMP InitFromData(IDataObject *, BOOL, DWORD);
STDMETHODIMP IsUpToDate(void);
STDMETHODIMP SetClientSite(LPOLECLIENTSITE);
STDMETHODIMP SetColorScheme(LOGPALETTE *);
STDMETHODIMP SetExtent(DWORD, SIZEL *);
STDMETHODIMP SetHostNames(LPCOLESTR, LPCOLESTR) ;
STDMETHODIMP SetMoniker(DWORD, LPMONIKER);
STDMETHODIMP Unadvise(DWORD);
STDMETHODIMP Update(void);
private:
HRESULT doInPlaceActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
HRESULT doUIActivate(LPMSG lpMsg, LPOLECLIENTSITE pActiveSite, HWND hwndParent, LPCRECT lprcPosRect);
IOleAdviseHolder *_p_advise_holder;
IOleClientSite *_p_clientsite;
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persistpropbag.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persistpropbag.h"
#include "utils.h"
using namespace std;
STDMETHODIMP VLCPersistPropertyBag::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::InitNew(void)
{
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog)
{
if( NULL == pPropBag )
return E_POINTER;
HRESULT hr = _p_instance->onInitNew();
if( FAILED(hr) )
return hr;
VARIANT value;
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("filename"), &value, pErrorLog) )
{
char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
if( NULL != src )
{
_p_instance->setSourceURL(src);
free(src);
}
VariantClear(&value);
}
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("src"), &value, pErrorLog) )
{
char *src = CStrFromBSTR(_p_instance->getCodePage(), V_BSTR(&value));
if( NULL != src )
{
_p_instance->setSourceURL(src);
free(src);
}
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autoplay"), &value, pErrorLog) )
{
_p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autostart"), &value, pErrorLog) )
{
_p_instance->setAutoStart(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("loop"), &value, pErrorLog) )
{
_p_instance->setLoopMode(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("mute"), &value, pErrorLog) )
{
_p_instance->setMute(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
{
_p_instance->setShowDisplay(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
return S_OK;
};
STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDiry, BOOL fSaveAllProperties)
{
if( NULL == pPropBag )
return E_POINTER;
return S_OK;
};
/*****************************************************************************
* persistpropbag.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTPROPBAG_H__
#define __PERSISTPROPBAG_H__
#include <ocidl.h>
class VLCPersistPropertyBag : public IPersistPropertyBag
{
public:
VLCPersistPropertyBag(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistPropertyBag() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistPropertyBag == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistPropertyBag methods
STDMETHODIMP InitNew(void);
STDMETHODIMP Load(LPPROPERTYBAG, LPERRORLOG);
STDMETHODIMP Save(LPPROPERTYBAG, BOOL, BOOL);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persiststorage.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persiststorage.h"
using namespace std;
STDMETHODIMP VLCPersistStorage::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistStorage::IsDirty(void)
{
return S_FALSE;
};
STDMETHODIMP VLCPersistStorage::InitNew(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStorage::Load(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStorage::Save(IStorage *pStg, BOOL fSameAsLoad)
{
if( NULL == pStg )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStorage::SaveCompleted(IStorage *pStg)
{
if( NULL == pStg )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStorage::HandsOffStorage(void)
{
return S_OK;
};
/*****************************************************************************
* persiststorage.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTSTORAGE_H__
#define __PERSISTSTORAGE_H__
#include <ocidl.h>
class VLCPersistStorage : public IPersistStorage
{
public:
VLCPersistStorage(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistStorage() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStorage == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistStorage methods
STDMETHODIMP IsDirty(void);
STDMETHODIMP InitNew(IStorage *);
STDMETHODIMP Load(IStorage *);
STDMETHODIMP Save(IStorage *, BOOL);
STDMETHODIMP SaveCompleted(IStorage *);
STDMETHODIMP HandsOffStorage(void);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persiststreaminit.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "persiststreaminit.h"
using namespace std;
STDMETHODIMP VLCPersistStreamInit::GetClassID(LPCLSID pClsID)
{
if( NULL == pClsID )
return E_POINTER;
*pClsID = _p_instance->getClassID();
return S_OK;
};
STDMETHODIMP VLCPersistStreamInit::InitNew(void)
{
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStreamInit::Load(LPSTREAM pStm)
{
if( NULL == pStm )
return E_POINTER;
return _p_instance->onInitNew();
};
STDMETHODIMP VLCPersistStreamInit::Save(LPSTREAM pStm, BOOL fClearDirty)
{
if( NULL == pStm )
return E_POINTER;
return S_OK;
};
STDMETHODIMP VLCPersistStreamInit::IsDirty(void)
{
return S_FALSE;
};
STDMETHODIMP VLCPersistStreamInit::GetSizeMax(ULARGE_INTEGER *pcbSize)
{
pcbSize->QuadPart = 0ULL;
return S_OK;
};
/*****************************************************************************
* persiststreaminit.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PERSISTSTREAMINIT_H__
#define __PERSISTSTREAMINIT_H__
#include <ocidl.h>
class VLCPersistStreamInit : public IPersistStreamInit
{
public:
VLCPersistStreamInit(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCPersistStreamInit() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IPersist == riid)
&& (IID_IPersistStreamInit == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IPersist methods
STDMETHODIMP GetClassID(LPCLSID);
// IPersistStreamInit methods
STDMETHODIMP IsDirty(void);
STDMETHODIMP InitNew(void);
STDMETHODIMP Load(LPSTREAM);
STDMETHODIMP Save(LPSTREAM, BOOL);
STDMETHODIMP GetSizeMax(ULARGE_INTEGER *);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* plugin.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleobject.h"
#include "olecontrol.h"
#include "oleinplaceobject.h"
#include "oleinplaceactiveobject.h"
#include "persistpropbag.h"
#include "persiststreaminit.h"
#include "persiststorage.h"
#include "provideclassinfo.h"
#include "connectioncontainer.h"
#include "objectsafety.h"
#include "vlccontrol.h"
#include "utils.h"
#include <string.h>
#include <winreg.h>
using namespace std;
////////////////////////////////////////////////////////////////////////
//class factory
// {E23FE9C6-778E-49d4-B537-38FCDE4887D8}
//const GUID CLSID_VLCPlugin =
// { 0xe23fe9c6, 0x778e, 0x49d4, { 0xb5, 0x37, 0x38, 0xfc, 0xde, 0x48, 0x87, 0xd8 } };
static LRESULT CALLBACK VLCInPlaceClassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch( uMsg )
{
case WM_ERASEBKGND:
return 1L;
case WM_PAINT:
PAINTSTRUCT ps;
if( GetUpdateRect(hWnd, NULL, FALSE) )
{
BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
}
return 0L;
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
};
static LRESULT CALLBACK VLCVideoClassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
VLCPlugin *p_instance = reinterpret_cast<VLCPlugin *>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
switch( uMsg )
{
case WM_ERASEBKGND:
return 1L;
case WM_PAINT:
PAINTSTRUCT ps;
RECT pr;
if( GetUpdateRect(hWnd, &pr, FALSE) )
{
BeginPaint(hWnd, &ps);
p_instance->onPaint(ps, pr);
EndPaint(hWnd, &ps);
}
return 0L;
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
};
VLCPluginClass::VLCPluginClass(LONG *p_class_ref, HINSTANCE hInstance) :
_p_class_ref(p_class_ref),
_hinstance(hInstance)
{
WNDCLASS wClass;
if( ! GetClassInfo(hInstance, getInPlaceWndClassName(), &wClass) )
{
wClass.style = CS_NOCLOSE|CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wClass.lpfnWndProc = VLCInPlaceClassWndProc;
wClass.cbClsExtra = 0;
wClass.cbWndExtra = 0;
wClass.hInstance = hInstance;
wClass.hIcon = NULL;
wClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wClass.hbrBackground = NULL;
wClass.lpszMenuName = NULL;
wClass.lpszClassName = getInPlaceWndClassName();
_inplace_wndclass_atom = RegisterClass(&wClass);
}
else
{
_inplace_wndclass_atom = 0;
}
if( ! GetClassInfo(hInstance, getVideoWndClassName(), &wClass) )
{
wClass.style = CS_NOCLOSE|CS_HREDRAW|CS_VREDRAW;
wClass.lpfnWndProc = VLCVideoClassWndProc;
wClass.cbClsExtra = 0;
wClass.cbWndExtra = 0;
wClass.hInstance = hInstance;
wClass.hIcon = NULL;
wClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wClass.hbrBackground = NULL;
wClass.lpszMenuName = NULL;
wClass.lpszClassName = getVideoWndClassName();
_video_wndclass_atom = RegisterClass(&wClass);
}
else
{
_video_wndclass_atom = 0;
}
_inplace_hbitmap = (HBITMAP)LoadImage(getHInstance(), TEXT("INPLACE-PICT"), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
AddRef();
};
VLCPluginClass::~VLCPluginClass()
{
if( 0 != _inplace_wndclass_atom )
UnregisterClass(MAKEINTATOM(_inplace_wndclass_atom), _hinstance);
if( 0 != _video_wndclass_atom )
UnregisterClass(MAKEINTATOM(_video_wndclass_atom), _hinstance);
if( NULL != _inplace_hbitmap )
DeleteObject(_inplace_hbitmap);
};
STDMETHODIMP VLCPluginClass::QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_INVALIDARG;
if( (IID_IUnknown == riid) || (IID_IClassFactory == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
*ppv = NULL;
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) VLCPluginClass::AddRef(void)
{
return InterlockedIncrement(_p_class_ref);
};
STDMETHODIMP_(ULONG) VLCPluginClass::Release(void)
{
ULONG refcount = InterlockedDecrement(_p_class_ref);
if( 0 == refcount )
{
delete this;
return 0;
}
return refcount;
};
STDMETHODIMP VLCPluginClass::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
*ppv = NULL;
if( NULL != pUnkOuter )
return CLASS_E_NOAGGREGATION;
VLCPlugin *plugin = new VLCPlugin(this);
if( NULL != plugin )
{
HRESULT hr = plugin->QueryInterface(riid, ppv);
plugin->Release();
return hr;
}
return E_OUTOFMEMORY;
};
STDMETHODIMP VLCPluginClass::LockServer(BOOL fLock)
{
if( fLock )
AddRef();
else
Release();
return S_OK;
};
////////////////////////////////////////////////////////////////////////
VLCPlugin::VLCPlugin(VLCPluginClass *p_class) :
_inplacewnd(NULL),
_p_class(p_class),
_i_ref(1UL),
_codepage(CP_ACP),
_psz_src(NULL),
_b_autostart(TRUE),
_b_loopmode(FALSE),
_b_showdisplay(TRUE),
_b_sendevents(TRUE),
_i_vlc(0)
{
p_class->AddRef();
vlcOleObject = new VLCOleObject(this);
vlcOleControl = new VLCOleControl(this);
vlcOleInPlaceObject = new VLCOleInPlaceObject(this);
vlcOleInPlaceActiveObject = new VLCOleInPlaceActiveObject(this);
vlcPersistStorage = new VLCPersistStorage(this);
vlcPersistStreamInit = new VLCPersistStreamInit(this);
vlcPersistPropertyBag = new VLCPersistPropertyBag(this);
vlcProvideClassInfo = new VLCProvideClassInfo(this);
vlcConnectionPointContainer = new VLCConnectionPointContainer(this);
vlcObjectSafety = new VLCObjectSafety(this);
vlcControl = new VLCControl(this);
};
VLCPlugin::~VLCPlugin()
{
vlcOleInPlaceObject->UIDeactivate();
vlcOleInPlaceObject->InPlaceDeactivate();
delete vlcControl;
delete vlcObjectSafety;
delete vlcConnectionPointContainer;
delete vlcProvideClassInfo;
delete vlcPersistPropertyBag;
delete vlcPersistStreamInit;
delete vlcPersistStorage;
delete vlcOleInPlaceActiveObject;
delete vlcOleInPlaceObject;
delete vlcOleControl;
delete vlcOleObject;
if( _psz_src )
free(_psz_src);
_p_class->Release();
};
STDMETHODIMP VLCPlugin::QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_INVALIDARG;
if( IID_IUnknown == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
else if( IID_IOleObject == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcOleObject);
return NOERROR;
}
else if( IID_IOleControl == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcOleControl);
return NOERROR;
}
else if( IID_IOleWindow == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcOleInPlaceObject);
return NOERROR;
}
else if( IID_IOleInPlaceObject == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcOleInPlaceObject);
return NOERROR;
}
else if( IID_IOleInPlaceActiveObject == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcOleInPlaceActiveObject);
return NOERROR;
}
else if( IID_IPersist == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcPersistPropertyBag);
return NOERROR;
}
else if( IID_IPersistStreamInit == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcPersistStreamInit);
return NOERROR;
}
else if( IID_IPersistStorage == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcPersistStorage);
return NOERROR;
}
else if( IID_IPersistPropertyBag == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcPersistPropertyBag);
return NOERROR;
}
else if( IID_IProvideClassInfo == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcProvideClassInfo);
return NOERROR;
}
else if( IID_IProvideClassInfo2 == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcProvideClassInfo);
return NOERROR;
}
else if( IID_IConnectionPointContainer == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcConnectionPointContainer);
return NOERROR;
}
else if( IID_IObjectSafety == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcObjectSafety);
return NOERROR;
}
else if( IID_IDispatch == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcControl);
return NOERROR;
}
else if( IID_IVLCControl == riid )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(vlcControl);
return NOERROR;
}
*ppv = NULL;
return E_NOINTERFACE;
};
STDMETHODIMP_(ULONG) VLCPlugin::AddRef(void)
{
return InterlockedIncrement((LONG *)&_i_ref);
};
STDMETHODIMP_(ULONG) VLCPlugin::Release(void)
{
if( ! InterlockedDecrement((LONG *)&_i_ref) )
{
delete this;
return 0;
}
return _i_ref;
};
//////////////////////////////////////
/*
** we use an in-place child window to represent plugin viewport,
** whose size is limited by the clipping rectangle
** all drawing within this window must follow
** cartesian coordinate system represented by _bounds.
*/
void VLCPlugin::calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect)
{
_bounds.right = lprPosRect->right-lprPosRect->left;
if( lprcClipRect->left <= lprPosRect->left )
{
// left side is not clipped out
_bounds.left = 0;
if( lprcClipRect->right >= lprPosRect->right )
{
// right side is not clipped out, no change
}
else if( lprcClipRect->right >= lprPosRect->left )
{
// right side is clipped out
lprPosRect->right = lprcClipRect->right;
}
else
{
// outside of clipping rectange, not visible
lprPosRect->right = lprPosRect->left;
}
}
else
{
// left side is clipped out
_bounds.left = lprPosRect->left-lprcClipRect->left;
_bounds.right += _bounds.left;
lprPosRect->left = lprcClipRect->left;
if( lprcClipRect->right >= lprPosRect->right )
{
// right side is not clipped out
}
else
{
// right side is clipped out
lprPosRect->right = lprcClipRect->right;
}
}
_bounds.bottom = lprPosRect->bottom-lprPosRect->top;
if( lprcClipRect->top <= lprPosRect->top )
{
// top side is not clipped out
_bounds.top = 0;
if( lprcClipRect->bottom >= lprPosRect->bottom )
{
// bottom side is not clipped out, no change
}
else if( lprcClipRect->bottom >= lprPosRect->top )
{
// bottom side is clipped out
lprPosRect->bottom = lprcClipRect->bottom;
}
else
{
// outside of clipping rectange, not visible
lprPosRect->right = lprPosRect->left;
}
}
else
{
_bounds.top = lprPosRect->top-lprcClipRect->top;
_bounds.bottom += _bounds.top;
lprPosRect->top = lprcClipRect->top;
if( lprcClipRect->bottom >= lprPosRect->bottom )
{
// bottom side is not clipped out
}
else
{
// bottom side is clipped out
lprPosRect->bottom = lprcClipRect->bottom;
}
}
};
HRESULT VLCPlugin::onInitNew(void)
{
if( 0 == _i_vlc )
{
char *ppsz_argv[] = { "vlc", "-vv" };
HKEY h_key;
DWORD i_type, i_data = MAX_PATH + 1;
char p_data[MAX_PATH + 1];
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
0, KEY_READ, &h_key ) == ERROR_SUCCESS )
{
if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
(LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
{
if( i_type == REG_SZ )
{
strcat( p_data, "\\vlc" );
ppsz_argv[0] = p_data;
}
}
RegCloseKey( h_key );
}
#if 0
ppsz_argv[0] = "C:\\cygwin\\home\\Damien_Fouilleul\\dev\\videolan\\vlc-trunk\\vlc";
#endif
_i_vlc = VLC_Create();
if( VLC_Init(_i_vlc, sizeof(ppsz_argv)/sizeof(char*), ppsz_argv) )
{
VLC_Destroy(_i_vlc);
_i_vlc = 0;
return E_FAIL;
}
return S_OK;
}
return E_UNEXPECTED;
};
HRESULT VLCPlugin::onClose(DWORD dwSaveOption)
{
if( _i_vlc )
{
if( isInPlaceActive() )
{
onInPlaceDeactivate();
}
VLC_CleanUp(_i_vlc);
VLC_Destroy(_i_vlc);
_i_vlc = 0;
}
return S_OK;
};
BOOL VLCPlugin::isInPlaceActive(void)
{
return (NULL != _inplacewnd);
};
HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
RECT posRect = *lprcPosRect;
calcPositionChange(&posRect, lprcClipRect);
_inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(),
"VLC Plugin In-Place Window",
WS_CHILD|WS_CLIPCHILDREN|WS_TABSTOP,
posRect.left,
posRect.top,
posRect.right-posRect.left,
posRect.bottom-posRect.top,
hwndParent,
0,
_p_class->getHInstance(),
NULL
);
if( NULL == _inplacewnd )
return E_FAIL;
SetWindowLongPtr(_inplacewnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
_videownd = CreateWindow(_p_class->getVideoWndClassName(),
"VLC Plugin Video Window",
WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
_bounds.left,
_bounds.top,
_bounds.right-_bounds.left,
_bounds.bottom-_bounds.top,
_inplacewnd,
0,
_p_class->getHInstance(),
NULL
);
if( NULL == _videownd )
{
DestroyWindow(_inplacewnd);
return E_FAIL;
}
SetWindowLongPtr(_videownd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
/* horrible cast there */
vlc_value_t val;
val.i_int = reinterpret_cast<int>(_videownd);
VLC_VariableSet(_i_vlc, "drawable", val);
setVisible(_b_showdisplay);
if( NULL != _psz_src )
{
// add target to playlist
char *cOptions[1];
int cOptionsCount = 0;
if( _b_loopmode )
{
cOptions[cOptionsCount++] = "loop";
}
VLC_AddTarget(_i_vlc, _psz_src, (const char **)&cOptions, cOptionsCount, PLAYLIST_APPEND, PLAYLIST_END);
if( _b_autostart )
{
VLC_Play(_i_vlc);
fireOnPlayEvent();
}
}
return S_OK;
};
HRESULT VLCPlugin::onInPlaceDeactivate(void)
{
VLC_Stop(_i_vlc);
fireOnStopEvent();
DestroyWindow(_videownd);
_videownd = NULL;
DestroyWindow(_inplacewnd);
_inplacewnd = NULL;
return S_OK;
};
BOOL VLCPlugin::isVisible(void)
{
return GetWindowLong(_inplacewnd, GWL_STYLE) & WS_VISIBLE;
};
void VLCPlugin::setVisible(BOOL fVisible)
{
ShowWindow(_inplacewnd, fVisible ? SW_SHOW : SW_HIDE);
};
void VLCPlugin::setFocus(BOOL fFocus)
{
if( fFocus )
SetActiveWindow(_inplacewnd);
};
BOOL VLCPlugin::hasFocus(void)
{
return GetActiveWindow() == _inplacewnd;
};
void VLCPlugin::onPaint(PAINTSTRUCT &ps, RECT &pr)
{
/*
** if VLC is playing, it may not display any VIDEO content
** hence, draw control logo
*/
int width = _bounds.right-_bounds.left;
int height = _bounds.bottom-_bounds.top;
HBITMAP pict = _p_class->getInPlacePict();
if( NULL != pict )
{
HDC hdcPict = CreateCompatibleDC(ps.hdc);
if( NULL != hdcPict )
{
BITMAP bm;
if( GetObject(pict, sizeof(BITMAPINFO), &bm) )
{
int dstWidth = bm.bmWidth;
if( dstWidth > width-4 )
dstWidth = width-4;
int dstHeight = bm.bmHeight;
if( dstHeight > height-4 )
dstHeight = height-4;
int dstX = (width-dstWidth)/2;
int dstY = (height-dstHeight)/2;
SelectObject(hdcPict, pict);
StretchBlt(ps.hdc, dstX, dstY, dstWidth, dstHeight,
hdcPict, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
DeleteDC(hdcPict);
ExcludeClipRect(ps.hdc, dstX, dstY, dstWidth+dstX, dstHeight+dstY);
}
}
}
FillRect(ps.hdc, &pr, (HBRUSH)GetStockObject(WHITE_BRUSH));
SelectObject(ps.hdc, GetStockObject(BLACK_BRUSH));
MoveToEx(ps.hdc, 0, 0, NULL);
LineTo(ps.hdc, width-1, 0);
LineTo(ps.hdc, width-1, height-1);
LineTo(ps.hdc, 0, height-1);
LineTo(ps.hdc, 0, 0);
};
void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
{
RECT posRect = *lprcPosRect;
calcPositionChange(&posRect, lprcClipRect);
/*
** change in-place window geometry to match clipping region
*/
MoveWindow(_inplacewnd,
posRect.left,
posRect.top,
posRect.right-posRect.left,
posRect.bottom-posRect.top,
FALSE);
/*
** change video window geometry to match object bounds within clipping region
*/
MoveWindow(_videownd,
_bounds.left,
_bounds.top,
_bounds.right-_bounds.left,
_bounds.bottom-_bounds.top,
FALSE);
RECT updateRect;
updateRect.left = -_bounds.left;
updateRect.top = -_bounds.top;
updateRect.right = _bounds.right-_bounds.left;
updateRect.bottom = _bounds.bottom-_bounds.top;
ValidateRect(_videownd, NULL);
InvalidateRect(_videownd, &updateRect, FALSE);
UpdateWindow(_videownd);
};
void VLCPlugin::fireOnPlayEvent(void)
{
if( _b_sendevents )
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(1, LOCALE_USER_DEFAULT, &dispparamsNoArgs);
}
};
void VLCPlugin::fireOnPauseEvent(void)
{
if( _b_sendevents )
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(2, LOCALE_USER_DEFAULT, &dispparamsNoArgs);
}
};
void VLCPlugin::fireOnStopEvent(void)
{
if( _b_sendevents )
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
vlcConnectionPointContainer->fireEvent(3, LOCALE_USER_DEFAULT, &dispparamsNoArgs);
}
};
/*****************************************************************************
* plugin.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#include <ole2.h>
#include <olectl.h>
#include <vlc/vlc.h>
extern const GUID CLSID_VLCPlugin;
extern const GUID LIBID_AXVLC;
extern const GUID DIID_DVLCEvents;
class VLCPluginClass : public IClassFactory
{
public:
VLCPluginClass(LONG *p_class_ref,HINSTANCE hInstance);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
/* IClassFactory methods */
STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
STDMETHODIMP LockServer(BOOL fLock);
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; };
HBITMAP getInPlacePict(void) const { return _inplace_hbitmap; };
protected:
virtual ~VLCPluginClass();
private:
LPLONG _p_class_ref;
HINSTANCE _hinstance;
ATOM _inplace_wndclass_atom;
ATOM _video_wndclass_atom;
HBITMAP _inplace_hbitmap;
};
class VLCPlugin : public IUnknown
{
public:
VLCPlugin(VLCPluginClass *p_class);
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
/* custom methods */
HRESULT getTypeLib(ITypeLib **pTL)
{ return LoadRegTypeLib(LIBID_AXVLC, 1, 0, LOCALE_NEUTRAL, pTL); };
REFCLSID getClassID(void) { return (REFCLSID)CLSID_VLCPlugin; };
REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; };
HRESULT onInitNew(void);
HRESULT onClose(DWORD dwSaveOption);
BOOL isInPlaceActive(void);
HRESULT onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprcPosRect, LPCRECT lprcClipRect);
HRESULT onInPlaceDeactivate(void);
HWND getInPlaceWindow(void) const { return _inplacewnd; };
BOOL isVisible(void);
void setVisible(BOOL fVisible);
BOOL hasFocus(void);
void setFocus(BOOL fFocus);
UINT getCodePage(void) { return _codepage; };
void setCodePage(UINT cp) { _codepage = cp; };
int getVLCObject(void) { return _i_vlc; };
// initial properties
void setSourceURL(const char *url) { _psz_src = strdup(url); };
void setAutoStart(BOOL autostart) { _b_autostart = autostart; };
void setLoopMode(BOOL loopmode) { _b_loopmode = loopmode; };
void setMute(BOOL mute) {
if( mute && _i_vlc )
{
VLC_VolumeMute(_i_vlc);
}
};
void setShowDisplay(BOOL show) { _b_showdisplay = show; };
void onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect);
void onPaint(PAINTSTRUCT &ps, RECT &pr);
// plugin events
void setSendEvents(BOOL sendevents) { _b_sendevents = sendevents; };
void fireOnPlayEvent(void);
void fireOnPauseEvent(void);
void fireOnStopEvent(void);
protected:
virtual ~VLCPlugin();
private:
void calcPositionChange(LPRECT lprPosRect, LPCRECT lprcClipRect);
//implemented interfaces
class VLCOleObject *vlcOleObject;
class VLCOleControl *vlcOleControl;
class VLCOleInPlaceObject *vlcOleInPlaceObject;
class VLCOleInPlaceActiveObject *vlcOleInPlaceActiveObject;
class VLCPersistStreamInit *vlcPersistStreamInit;
class VLCPersistStorage *vlcPersistStorage;
class VLCPersistPropertyBag *vlcPersistPropertyBag;
class VLCProvideClassInfo *vlcProvideClassInfo;
class VLCConnectionPointContainer *vlcConnectionPointContainer;
class VLCObjectSafety *vlcObjectSafety;
class VLCControl *vlcControl;
// in place activated window (Clipping window)
HWND _inplacewnd;
// video window (Drawing window)
HWND _videownd;
RECT _bounds;
VLCPluginClass *_p_class;
ULONG _i_ref;
UINT _codepage;
char *_psz_src;
BOOL _b_autostart;
BOOL _b_loopmode;
BOOL _b_showdisplay;
BOOL _b_sendevents;
int _i_vlc;
};
#endif
/*****************************************************************************
* provideclassinfo.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "provideclassinfo.h"
using namespace std;
STDMETHODIMP VLCProvideClassInfo::GetClassInfo(ITypeInfo **ppTI)
{
ITypeLib *p_typelib;
if( NULL == ppTI )
return E_POINTER;
HRESULT hr = _p_instance->getTypeLib(&p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getDispEventID(), ppTI);
if( FAILED(hr) )
{
*ppTI = NULL;
}
p_typelib->Release();
}
return hr;
};
STDMETHODIMP VLCProvideClassInfo::GetGUID(DWORD dwGuidKind, GUID *pGUID)
{
if( GUIDKIND_DEFAULT_SOURCE_DISP_IID != dwGuidKind )
return E_INVALIDARG;
if( NULL == pGUID )
return E_POINTER;
*pGUID = _p_instance->getDispEventID();
return S_OK;
};
/*****************************************************************************
* provideclassinfo.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __PROVIDECLASSINFO_H__
#define __PROVIDECLASSINFO_H__
#include <ocidl.h>
class VLCProvideClassInfo : public IProvideClassInfo2
{
public:
VLCProvideClassInfo(VLCPlugin *p_instance) : _p_instance(p_instance) {};
virtual ~VLCProvideClassInfo() {};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IProvideClassInfo == riid)
&& (IID_IProvideClassInfo2 == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };
// IProvideClassInfo methods
STDMETHODIMP GetClassInfo(ITypeInfo **);
// IProvideClassInfo2 methods
STDMETHODIMP GetGUID(DWORD, GUID *);
private:
VLCPlugin *_p_instance;
};
#endif
<HTML>
<TITLE>VLC ActiveX plugin test page</TITLE>
<BODY>
<SCRIPT LANGUAGE="JScript">
<!--
function go(targetURL)
{
var options = new Array(":input-repeat");
document.vlc.addTarget(targetURL, options, 4+8, -666);
};
//-->
</SCRIPT>
<TABLE>
<TR><TD>
MRL:
<INPUT size="80" name="targetTextField" value="">
<INPUT type=submit value="Go" onClick="go(targetTextField.value);">
</TD></TR>
<TR><TD>
<OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8"
width="640" height="480" id="vlc" events="True">
<param name="Src" value="" />
<param name="ShowDisplay" value="True" />
<param name="Loop" value="False" />
<param name="AutoPlay" value="False" />
</OBJECT>
<SCRIPT LANGUAGE="JScript">
<!--
function vlc::OnPlay()
{
alert("Playing");
};
function vlc::OnPause()
{
alert("Paused");
};
function vlc::OnStop()
{
alert("Stopped");
};
//-->
</SCRIPT>
</TD></TR>
<TR><TD>
<INPUT type=submit value="Play" onClick='document.vlc.play();'>
<INPUT type=submit value="Pause" onClick='document.vlc.pause();'>
<INPUT type=submit value="Stop" onClick='document.vlc.stop();'>
<INPUT type=submit value=" << " onClick='document.vlc.playSlower();'>
<INPUT type=submit value=" >> " onClick='document.vlc.playFaster();'>
<INPUT type=submit value="Mute" onClick='document.vlc.toggleMute();'>
<INPUT type=submit value="Show" onClick='document.vlc.Visible = true;'>
<INPUT type=submit value="Hide" onClick='document.vlc.Visible = false;'>
<INPUT type=submit value="Version" onClick='alert(document.vlc.VersionInfo);'>
</TD></TR>
</TABLE>
</BODY>
</HTML>
/*****************************************************************************
* utils.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "utils.h"
/*
** conversion facilities
*/
using namespace std;
char *CStrFromBSTR(int codePage, BSTR bstr)
{
UINT len = SysStringLen(bstr);
if( len > 0 )
{
size_t mblen = WideCharToMultiByte(codePage,
0, bstr, len, NULL, 0, NULL, NULL);
if( mblen > 0 )
{
char *buffer = (char *)malloc(mblen+1);
ZeroMemory(buffer, mblen+1);
if( WideCharToMultiByte(CP_ACP, 0, bstr, len, buffer, mblen, NULL, NULL) )
return buffer;
}
}
return NULL;
};
BSTR BSTRFromCStr(int codePage, const char *s)
{
int wideLen = MultiByteToWideChar(codePage, 0, s, -1, NULL, 0);
if( wideLen )
{
WCHAR* wideStr = (WCHAR*)malloc(wideLen*sizeof(WCHAR));
if( NULL != wideStr )
{
BSTR bstr;
ZeroMemory(wideStr, wideLen*sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen);
bstr = SysAllocString(wideStr);
free(wideStr);
return bstr;
}
}
return NULL;
};
/*
** properties
*/
HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v)
{
IDispatch *pDisp;
HRESULT hr = object->QueryInterface(IID_IDispatch, (LPVOID *)&pDisp);
if( SUCCEEDED(hr) )
{
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
VARIANT vres;
hr = pDisp->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, &dispparamsNoArgs, &vres, NULL, NULL);
if( SUCCEEDED(hr) )
{
if( V_VT(&v) != V_VT(&vres) )
{
hr = VariantChangeType(&v, &vres, 0, V_VT(&v));
VariantClear(&vres);
}
else
{
v = vres;
}
}
pDisp->Release();
}
return hr;
};
/*****************************************************************************
* utils.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef __UTILS_H__
#define __UTILS_H__
#include <ole2.h>
#include <vector>
// utilities
extern char *CStrFromBSTR(int codePage, BSTR bstr);
extern BSTR BSTRFromCStr(int codePage, const char *s);
// properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
// enumeration
template<class T> class VLCEnum : IUnknown
{
public:
VLCEnum(REFIID riid, std::vector<T> &);
VLCEnum(const VLCEnum<T> &);
virtual ~VLCEnum() {};
VLCEnum<T>& operator=(const VLCEnum<T> &t);
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
// IEnumXXXX methods
STDMETHODIMP Next(ULONG, T *, ULONG *);
STDMETHODIMP Skip(ULONG);
STDMETHODIMP Reset(void);
// cloning is implemented by subclasses and must use copy constructor
//STDMETHODIMP Clone(VLCEnum<T> **);
// cloning is implemented by subclasses and must use copy constructor
typedef void (*retainer)(T);
void setRetainOperation(retainer retain) { _retain = retain; };
private:
LONG _refcount;
std::vector<T> _v;
typename std::vector<T>::iterator _i;
REFIID _riid;
retainer _retain;
};
template<class T>
VLCEnum<T>::VLCEnum(REFIID riid, std::vector<T> &v) :
_refcount(1),
_v(v),
_riid(riid),
_retain(NULL)
{
_i= v.begin();
};
template<class T>
VLCEnum<T>::VLCEnum(const VLCEnum<T> &e) :
_refcount(1),
_v(e._v),
_riid(e._riid)
{
};
template<class T>
VLCEnum<T>& VLCEnum<T>::operator=(const VLCEnum<T> &e)
{
this->_refcount = 1;
this->_riid = e._riid;
this->_v = e._v;
this->_i = e._i;
};
template<class T>
STDMETHODIMP VLCEnum<T>::QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv ) return E_POINTER;
if( (IID_IUnknown == riid)
&& ( _riid == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return E_NOINTERFACE;
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::AddRef(void)
{
return InterlockedIncrement(&_refcount);
};
template<class T>
STDMETHODIMP_(ULONG) VLCEnum<T>::Release(void)
{
ULONG refcount = InterlockedDecrement(&_refcount);
if( 0 == refcount )
{
delete this;
return 0;
}
return refcount;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Next(ULONG celt, T *rgelt, ULONG *pceltFetched)
{
if( NULL == rgelt )
return E_POINTER;
if( (celt > 1) && (NULL == pceltFetched) )
return E_INVALIDARG;
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
{
rgelt[c] = *_i;
if( NULL != _retain ) _retain(rgelt[c]);
++_i;
++c;
}
if( NULL != pceltFetched )
*pceltFetched = c;
return (c == celt) ? S_OK : S_FALSE;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Skip(ULONG celt)
{
ULONG c = 0;
typename std::vector<T>::iterator end = _v.end();
while( (c < celt) && (_i != end) )
{
++_i;
++c;
}
return (c == celt) ? S_OK : S_FALSE;
};
template<class T>
STDMETHODIMP VLCEnum<T>::Reset(void)
{
_i= _v.begin();
return S_OK;
};
#endif
/*****************************************************************************
* vlccontrol.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "plugin.h"
#include "vlccontrol.h"
#include "utils.h"
VLCControl::~VLCControl()
{
if( _p_typeinfo )
_p_typeinfo->Release();
};
HRESULT VLCControl::getTypeInfo(void)
{
HRESULT hr = NOERROR;
if( NULL == _p_typeinfo )
{
ITypeLib *p_typelib;
HRESULT hr = _p_instance->getTypeLib(&p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(IID_IVLCControl, &_p_typeinfo);
if( FAILED(hr) )
{
_p_typeinfo = NULL;
}
p_typelib->Release();
}
}
return hr;
};
STDMETHODIMP VLCControl::GetTypeInfoCount(UINT* pctInfo)
{
if( SUCCEEDED(getTypeInfo()) )
*pctInfo = 1;
else
*pctInfo = 0;
return NOERROR;
};
STDMETHODIMP VLCControl::GetTypeInfo(UINT iTInfo, LCID lcid, LPTYPEINFO* ppTInfo)
{
if( NULL == ppTInfo )
return E_INVALIDARG;
if( SUCCEEDED(getTypeInfo()) )
{
_p_typeinfo->AddRef();
*ppTInfo = _p_typeinfo;
return NO_ERROR;
}
*ppTInfo = NULL;
return E_NOTIMPL;
};
STDMETHODIMP VLCControl::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames,
UINT cNames, LCID lcid, DISPID* rgDispID)
{
if( SUCCEEDED(getTypeInfo()) )
{
return DispGetIDsOfNames(_p_typeinfo, rgszNames, cNames, rgDispID);
}
return E_NOTIMPL;
};
STDMETHODIMP VLCControl::Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
if( SUCCEEDED(getTypeInfo()) )
{
return DispInvoke(this, _p_typeinfo, dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
}
return E_NOTIMPL;
};
STDMETHODIMP VLCControl::get_Value(VARIANT *pvarValue)
{
if( NULL == pvarValue )
return E_INVALIDARG;
V_VT(pvarValue) = VT_BOOL;
return get_Playing(&V_BOOL(pvarValue));
};
STDMETHODIMP VLCControl::put_Value(VARIANT pvarValue)
{
if( VT_BOOL != V_VT(&pvarValue) )
{
VARIANT boolValue;
HRESULT hr = VariantChangeType(&boolValue, &pvarValue, 0, VT_BOOL);
if( SUCCEEDED(hr) )
{
hr = get_Playing(&V_BOOL(&pvarValue));
//VariantClear(&boolValue);
}
return hr;
}
return get_Playing(&V_BOOL(&pvarValue));
};
STDMETHODIMP VLCControl::get_Visible(VARIANT_BOOL *isVisible)
{
if( NULL == isVisible )
return E_INVALIDARG;
if( _p_instance->isInPlaceActive() )
*isVisible = _p_instance->isVisible() ? VARIANT_TRUE : VARIANT_FALSE;
else
*isVisible = VARIANT_FALSE;
return NOERROR;
};
STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
{
if( _p_instance->isInPlaceActive() )
_p_instance->setVisible(isVisible != VARIANT_FALSE);
else
_p_instance->setShowDisplay(isVisible != VARIANT_FALSE);
return NOERROR;
};
STDMETHODIMP VLCControl::play(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_Play(i_vlc);
_p_instance->fireOnPlayEvent();
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::pause(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_Pause(i_vlc);
_p_instance->fireOnPauseEvent();
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::stop(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_Stop(i_vlc);
_p_instance->fireOnStopEvent();
return NOERROR;
}
return E_UNEXPECTED;
}
STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
{
if( NULL == isPlaying )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*isPlaying = VLC_IsPlaying(i_vlc) ? VARIANT_TRUE : VARIANT_FALSE;
return NOERROR;
}
*isPlaying = VARIANT_FALSE;
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::put_Playing(VARIANT_BOOL isPlaying)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
if( VARIANT_FALSE == isPlaying )
{
if( VLC_IsPlaying(i_vlc) )
VLC_Stop(i_vlc);
}
else
{
if( ! VLC_IsPlaying(i_vlc) )
VLC_Play(i_vlc);
}
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::get_Position(float *position)
{
if( NULL == position )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*position = VLC_PositionGet(i_vlc);
return NOERROR;
}
*position = 0.0f;
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::put_Position(float position)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_PositionSet(i_vlc, position);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::get_Time(int *seconds)
{
if( NULL == seconds )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*seconds = VLC_TimeGet(i_vlc);
return NOERROR;
}
*seconds = 0;
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::put_Time(int seconds)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_TimeSet(i_vlc, seconds, VLC_FALSE);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::shuttle(int seconds)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_TimeSet(i_vlc, seconds, VLC_TRUE);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::fullscreen(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_FullScreen(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::get_Length(int *seconds)
{
if( NULL == seconds )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*seconds = VLC_LengthGet(i_vlc);
return NOERROR;
}
*seconds = 0;
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::playFaster(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_SpeedFaster(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::playSlower(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_SpeedSlower(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::get_Volume(int *volume)
{
if( NULL == volume )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*volume = VLC_VolumeGet(i_vlc);
return NOERROR;
}
*volume = 0;
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::put_Volume(int volume)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_VolumeSet(i_vlc, volume);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::toggleMute(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_VolumeMute(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
static void freeTargetOptions(char **cOptions, int cOptionCount)
{
// clean up
for( long pos=0; pos<cOptionCount; ++pos )
{
char *cOption = cOptions[pos];
if( NULL != cOption )
free(cOption);
else
break;
}
if( NULL != cOptions )
free(cOptions);
};
static HRESULT createTargetOptions(int codePage, VARIANT *options, char ***cOptions, int *cOptionCount)
{
HRESULT hr = E_INVALIDARG;
if( VT_ERROR == V_VT(options) )
{
if( DISP_E_PARAMNOTFOUND == V_ERROR(options) )
{
// optional parameter not set
*cOptions = NULL;
*cOptionCount = 0;
return NOERROR;
}
}
else if( (VT_EMPTY == V_VT(options)) || (VT_NULL == V_VT(options)) )
{
// null parameter
*cOptions = NULL;
*cOptionCount = 0;
return NOERROR;
}
else if( VT_DISPATCH == V_VT(options) )
{
// collection parameter
VARIANT colEnum;
V_VT(&colEnum) = VT_UNKNOWN;
hr = GetObjectProperty(V_DISPATCH(options), DISPID_NEWENUM, colEnum);
if( SUCCEEDED(hr) )
{
IEnumVARIANT *enumVar;
hr = V_UNKNOWN(&colEnum)->QueryInterface(IID_IEnumVARIANT, (LPVOID *)&enumVar);
if( SUCCEEDED(hr) )
{
long pos = 0;
long capacity = 16;
VARIANT option;
*cOptions = (char **)malloc(capacity*sizeof(char *));
if( NULL != *cOptions )
{
ZeroMemory(*cOptions, sizeof(char *)*capacity);
while( SUCCEEDED(hr) && (S_OK == enumVar->Next(1, &option, NULL)) )
{
if( VT_BSTR == V_VT(&option) )
{
char *cOption = CStrFromBSTR(codePage, V_BSTR(&option));
(*cOptions)[pos] = cOption;
if( NULL != cOption )
{
++pos;
if( pos == capacity )
{
char **moreOptions = (char **)realloc(*cOptions, (capacity+16)*sizeof(char *));
if( NULL != moreOptions )
{
ZeroMemory(moreOptions+capacity, sizeof(char *)*16);
capacity += 16;
*cOptions = moreOptions;
}
else
hr = E_OUTOFMEMORY;
}
}
else
hr = E_OUTOFMEMORY;
}
else
hr = E_INVALIDARG;
VariantClear(&option);
}
*cOptionCount = pos;
if( FAILED(hr) )
{
// free already processed elements
freeTargetOptions(*cOptions, *cOptionCount);
}
}
else
hr = E_OUTOFMEMORY;
enumVar->Release();
}
}
}
else if( V_ISARRAY(options) )
{
// array parameter
SAFEARRAY *array = V_ISBYREF(options) ? *V_ARRAYREF(options) : V_ARRAY(options);
if( SafeArrayGetDim(array) != 1 )
return E_INVALIDARG;
long lBound = 0;
long uBound = 0;
SafeArrayGetLBound(array, 1, &lBound);
SafeArrayGetUBound(array, 1, &uBound);
// have we got any options
if( uBound > lBound )
{
VARTYPE vType;
HRESULT hr = SafeArrayGetVartype(array, &vType);
if( FAILED(hr) )
return hr;
long pos;
// marshall options into an array of C strings
if( VT_VARIANT == vType )
{
*cOptions = (char **)malloc(sizeof(char *)*(uBound-lBound));
if( NULL != options )
return E_OUTOFMEMORY;
for(pos=lBound; SUCCEEDED(hr) && (pos<uBound); ++pos )
{
VARIANT option;
hr = SafeArrayGetElement(array, &pos, &option);
if( SUCCEEDED(hr) )
{
if( VT_BSTR == V_VT(&option) )
{
char *cOption = CStrFromBSTR(codePage, V_BSTR(&option));
(*cOptions)[pos-lBound] = cOption;
if( NULL == cOption )
hr = E_OUTOFMEMORY;
}
else
hr = E_INVALIDARG;
VariantClear(&option);
}
}
}
else if( VT_BSTR == vType )
{
*cOptions = (char **)malloc(sizeof(char *)*(uBound-lBound));
if( NULL != options )
return E_OUTOFMEMORY;
ZeroMemory(cOptions, sizeof(char *)*(uBound-lBound));
for(pos=lBound; SUCCEEDED(hr) && (pos<uBound); ++pos )
{
BSTR option;
hr = SafeArrayGetElement(array, &pos, &option);
if( SUCCEEDED(hr) )
{
char *cOption = CStrFromBSTR(codePage, option);
(*cOptions)[pos-lBound] = cOption;
if( NULL == cOption )
hr = E_OUTOFMEMORY;
SysFreeString(option);
}
}
}
else
// unsupported type
return E_INVALIDARG;
*cOptionCount = pos-lBound;
if( FAILED(hr) )
{
// free already processed elements
freeTargetOptions(*cOptions, *cOptionCount);
}
}
else
{
// empty array
*cOptions = NULL;
*cOptionCount = 0;
return NOERROR;
}
}
return hr;
};
/*
** use VARIANT rather than a SAFEARRAY as argument type
** for compatibility with some scripting language (JScript)
*/
STDMETHODIMP VLCControl::addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position)
{
if( NULL == uri )
return E_INVALIDARG;
HRESULT hr = E_UNEXPECTED;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
int codePage = _p_instance->getCodePage();
char *cUri = CStrFromBSTR(codePage, uri);
if( NULL == cUri )
return E_OUTOFMEMORY;
int cOptionsCount;
char **cOptions;
if( FAILED(createTargetOptions(codePage, &options, &cOptions, &cOptionsCount)) )
return E_INVALIDARG;
VLC_AddTarget(i_vlc, cUri, (const char **)cOptions, cOptionsCount, mode, position);
hr = NOERROR;
freeTargetOptions(cOptions, cOptionsCount);
free(cUri);
}
return hr;
};
STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
{
if( NULL == index )
return E_INVALIDARG;
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*index = VLC_PlaylistIndex(i_vlc);
return NOERROR;
}
*index = 0;
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
*count = VLC_PlaylistNumberOfItems(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::playlistNext(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_PlaylistNext(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::playlistPrev(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_PlaylistPrev(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::playlistClear(void)
{
int i_vlc = _p_instance->getVLCObject();
if( i_vlc )
{
VLC_PlaylistClear(i_vlc);
return NOERROR;
}
return E_UNEXPECTED;
};
STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version)
{
if( NULL == version )
return E_INVALIDARG;
const char *versionStr = VLC_Version();
if( NULL != versionStr )
{
*version = BSTRFromCStr(_p_instance->getCodePage(), versionStr);
return NULL == *version ? E_OUTOFMEMORY : NOERROR;
}
*version = NULL;
return E_FAIL;
};
/*****************************************************************************
* vlccontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 VideoLAN
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLCCONTROL_H_
#define _VLCCONTROL_H_
#include <oaidl.h>
#include "axvlc_idl.h"
class VLCControl : public IVLCControl
{
public:
VLCControl(VLCPlugin *p_instance) : _p_instance(p_instance), _p_typeinfo(NULL) {};
virtual ~VLCControl();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( (NULL != ppv)
&& (IID_IUnknown == riid)
&& (IID_IDispatch == riid)
&& (IID_IVLCControl == riid) ) {
AddRef();
*ppv = dynamic_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->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*);
// IVLCControl methods
STDMETHODIMP get_Value(VARIANT *pvarValue);
STDMETHODIMP put_Value(VARIANT pvarValue);
STDMETHODIMP play(void);
STDMETHODIMP get_Visible(VARIANT_BOOL *visible);
STDMETHODIMP put_Visible(VARIANT_BOOL visible);
STDMETHODIMP pause(void);
STDMETHODIMP stop(void);
STDMETHODIMP get_Playing(VARIANT_BOOL *isPlaying);
STDMETHODIMP put_Playing(VARIANT_BOOL isPlaying);
STDMETHODIMP get_Position(float *position);
STDMETHODIMP put_Position(float position);
STDMETHODIMP get_Time(int *seconds);
STDMETHODIMP put_Time(int seconds);
STDMETHODIMP shuttle(int seconds);
STDMETHODIMP fullscreen();
STDMETHODIMP get_Length(int *seconds);
STDMETHODIMP playFaster(void);
STDMETHODIMP playSlower(void);
STDMETHODIMP get_Volume(int *volume);
STDMETHODIMP put_Volume(int volume);
STDMETHODIMP toggleMute(void);
STDMETHODIMP addTarget( BSTR uri, VARIANT options, enum VLCPlaylistMode mode, int position);
STDMETHODIMP get_PlaylistIndex(int *index);
STDMETHODIMP get_PlaylistCount(int *count);
STDMETHODIMP playlistNext(void);
STDMETHODIMP playlistPrev(void);
STDMETHODIMP playlistClear(void);
STDMETHODIMP get_VersionInfo(BSTR *version);
private:
HRESULT getTypeInfo();
VLCPlugin *_p_instance;
ITypeInfo *_p_typeinfo;
};
#endif
......@@ -279,9 +279,9 @@ VLC_LIBRARY_SUFFIX
case "${SYS}" in
mingw32|cygwin)
VLC_ADD_CFLAGS([pic plugin mozilla],[${CFLAGS_mingw32_special}])
VLC_ADD_CXXFLAGS([pic plugin mozilla],[${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}])
VLC_ADD_OBJCFLAGS([pic plugin mozilla],[${CFLAGS_mingw32_special}])
VLC_ADD_CFLAGS([pic plugin mozilla activex],[${CFLAGS_mingw32_special}])
VLC_ADD_CXXFLAGS([pic plugin mozilla activex],[${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}])
VLC_ADD_OBJCFLAGS([pic plugin mozilla activex],[${CFLAGS_mingw32_special}])
;;
*)
VLC_ADD_CFLAGS([pic plugin mozilla],[-fpic -fPIC])
......@@ -3915,6 +3915,30 @@ then
AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
fi
dnl
dnl Microsoft ActiveX support
dnl
AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
AC_ARG_ENABLE(activex,
[ --enable-activex build a vlc-based ActiveX control (default enabled on Win32)])
if test "${enable_activex}" != "no"
then
if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
then
AC_CHECK_PROG(MIDL, midl, :)
AM_CONDITIONAL(HAS_MIDL_COMPILER, test -n "${MIDL}")
AC_CHECK_HEADERS(ole2.h olectl.h,
[ VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid])
AC_CHECK_HEADERS(objsafe.h,
VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER])
)
],
[ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
)
fi
fi
dnl
dnl Mozilla plugin
dnl
......@@ -4145,6 +4169,7 @@ VLC_OUTPUT_VLC_CONFIG_IN
AC_CONFIG_FILES([
Makefile
activex/Makefile
debian/Makefile
doc/Makefile
intl/Makefile
......
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