Commit 5bf4823d authored by Rafaël Carré's avatar Rafaël Carré

Remove activex project

It is now available at git://git.videolan.org/activex-vlc.git
Fetch, configure, and build it when making windows packages

Modify npapi-vlc dependencies, and move install of the dll in
package-win-common rule

Pass $(SHELL) to npapi & activex ./configure to be sure they pick
/bin/bash and not /bin/sh (which might be incompatible with libtool)
parent e6552497
......@@ -9,8 +9,7 @@
# - libs/* are needed by modules
BASE_SUBDIRS = po compat src bin modules share doc test
EXTRA_SUBDIRS = m4 \
libs/loader libs/srtp libs/unzip \
projects/activex
libs/loader libs/srtp libs/unzip
DIST_SUBDIRS = $(BASE_SUBDIRS) $(EXTRA_SUBDIRS)
SUBDIRS = po compat src
......@@ -29,9 +28,6 @@ if BUILD_VLC
SUBDIRS += bin
endif
SUBDIRS += modules share doc test
if BUILD_ACTIVEX
SUBDIRS += projects/activex
endif
EXTRA_DIST = \
HACKING \
......@@ -697,10 +693,11 @@ win32_xpi_destdir=$(win32_destdir)/vlc-plugin
if HAVE_WIN32
include extras/package/npapi.am
include extras/package/activex.am
endif
#Win-common is for win32 and wince
package-win-common: install
package-win-common: install build-npapi build-activex
# Check that tmp isn't in the way
@if test -e "$(win32_destdir)"; then \
echo "Error: please remove $(win32_destdir), it is in the way"; \
......@@ -796,8 +793,11 @@ if BUILD_OSDMENU
rm -f -- "$$file.tmp"; \
done
endif
if BUILD_ACTIVEX
cp $(top_srcdir)/projects/activex/axvlc.dll.manifest $(win32_destdir)
if !HAVE_WIN64
cp "$(top_builddir)/activex-vlc/src/axvlc.dll.manifest" "$(win32_destdir)/"
cp "$(top_builddir)/activex-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/"
cp "$(top_builddir)/npapi-vlc/src/npvlc.dll.manifest" "$(win32_destdir)/"
cp "$(top_builddir)/npapi-vlc/installed/lib/npvlc.dll" "$(win32_destdir)/"
endif
# SDK
......@@ -806,10 +806,10 @@ endif
cp -r $(destdir)/lib/pkgconfig "$(win32_destdir)/sdk/lib"
for file in libvlc.dll.a libvlc.la libvlccore.dll.a libvlccore.la; do \
cp -r $(destdir)/lib/$$file "$(win32_destdir)/sdk/lib"; done
if BUILD_ACTIVEX
if !HAVE_WIN64
mkdir -p "$(win32_destdir)/sdk/activex"
cp $(srcdir)/projects/activex/README.TXT $(win32_destdir)/sdk/activex/
cp $(srcdir)/projects/activex/test.html $(win32_destdir)/sdk/activex/
cp $(top_builddir)/activex-vlc/README $(win32_destdir)/sdk/activex/README.TXT
cp $(top_builddir)/activex-vlc/src/test.html $(win32_destdir)/sdk/activex/
endif
find $(win32_destdir) -type f \( -name "*xml" -or -name "*html" -or -name '*js' -or -name '*css' -or -name '*hosts' -or -iname '*txt' -or -name '*.cfg' -or -name '*.lua' \) -exec $(U2D) {} \;
......@@ -829,36 +829,32 @@ package-win-base: package-win-common
fi ; \
done
package-win32-webplugin-common: package-win-base build-npapi
package-win32-webplugin-common: package-win-base
mkdir -p "$(win32_xpi_destdir)/plugins"
find $(destdir) -maxdepth 4 -name "*$(LIBEXT)" -exec cp {} "$(win32_xpi_destdir)/" \;
if !HAVE_WIN64
cp $(top_srcdir)/npapi-vlc/src/npvlc.dll.manifest "$(win32_xpi_destdir)/plugins"
cp $(top_builddir)/npapi-vlc/src/npvlc.dll.manifest "$(win32_xpi_destdir)/plugins"
endif
cp "$(top_srcdir)/extras/package/win32/libvlc.dll.manifest" "$(win32_xpi_destdir)/plugins"
cp -r $(win32_destdir)/plugins/ "$(win32_xpi_destdir)/plugins"
rm -rf "$(win32_xpi_destdir)/plugins/plugins/*qt*"
rm -rf "$(win32_xpi_destdir)/plugins/plugins/*skins*"
package-win32-xpi: package-win32-webplugin-common build-npapi
package-win32-xpi: package-win32-webplugin-common
if !HAVE_WIN64
cp $(top_builddir)/npapi-vlc/src/install.rdf "$(win32_xpi_destdir)"
cd $(win32_xpi_destdir) && zip -r "../vlc-$(VERSION).xpi" install.rdf plugins
endif
package-win32-crx: package-win32-webplugin-common build-npapi
package-win32-crx: package-win32-webplugin-common
if !HAVE_WIN64
cp $(top_builddir)/npapi-vlc/src/manifest.json "$(win32_xpi_destdir)"
crxmake --pack-extension "$(win32_xpi_destdir)" \
--extension-output "$(win32_destdir)/vlc-$(VERSION).crx" --ignore-file install.rdf
endif
package-win32-base-exe: package-win-base build-npapi
package-win32-base-exe: package-win-base
# Script installer
if !HAVE_WIN64
cp "$(top_builddir)/npapi-vlc/installed/lib/npvlc.dll" "$(win32_destdir)/"
cp "$(top_builddir)/npapi-vlc/src/npvlc.dll.manifest" "$(win32_destdir)/"
endif
cp "$(top_builddir)/extras/package/win32/vlc.win32.nsi" "$(win32_destdir)/"
cp "$(top_builddir)/extras/package/win32/spad.nsi" "$(win32_destdir)/"
mkdir "$(win32_destdir)/languages"
......
......@@ -313,7 +313,7 @@ case "${host_os}" in
# add ws2_32 for closesocket, select, recv
VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm])
VLC_ADD_LDFLAGS([vlc],[-mwindows])
VLC_ADD_LIBS([activex win32text],[-lgdi32])
VLC_ADD_LIBS([win32text],[-lgdi32])
VLC_ADD_LIBS([cdda vcdx sdl_image aout_sdl vout_sdl],[-lwinmm])
VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap oldhttp stream_out_standard stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[-lws2_32])
VLC_ADD_LIBS([filesystem], [-lshlwapi])
......@@ -4242,57 +4242,6 @@ AC_ARG_ENABLE(vlc,
[ --enable-vlc build the VLC media player (default enabled)])
AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
dnl
dnl Microsoft ActiveX support
dnl
activex=false
AC_ARG_ENABLE(activex,
AS_HELP_STRING([--enable-activex],[build a vlc-based ActiveX control
(default enabled on Win32)]))
AC_ARG_WITH(wine-sdk-path,
[ --with-wine-sdk-path=PATH path to wine sdk])
if test "${enable_activex}" != "no"
then
if test "${SYS}" = "mingw32"
then
AC_CHECK_PROGS(MIDL, [midl], no)
if test "${with_wine_sdk_path}" != ""
then
WINE_SDK_PATH=${with_wine_sdk_path}
AC_PATH_PROG(WIDL, widl, no, [$WINE_SDK_PATH/bin:$WINE_SDK_PATH/tools/widl])
else
WIDL=no
fi
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(ole2.h,
[AC_CHECK_HEADERS(olectl.h,
[ VLC_ADD_CPPFLAGS([activex],[-DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_])
VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
VLC_ADD_LIBS([activex],[-lole32 -loleaut32 -luuid -lshlwapi])
AC_CHECK_HEADERS(objsafe.h,
VLC_ADD_CXXFLAGS([activex],[-DHAVE_OBJSAFE_HEADER]),,
[
#if HAVE_OLE2_H
# include <ole2.h>
#endif
]
)
activex=:
PLUGINS_BINDINGS="${PLUGINS_BINDINGS} activex"
],
[ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
)],
[ AC_MSG_ERROR([required OLE headers are missing from your system]) ]
)
AC_LANG_POP(C++)
fi
fi
AC_ARG_VAR(MIDL, [Microsoft IDL compiler (Win32 platform only)])
AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
AC_ARG_VAR(WIDL, [Wine IDL compiler (requires Wine SDK)])
AM_CONDITIONAL(HAS_WIDL_COMPILER, test "${WIDL}" != "no")
AM_CONDITIONAL(BUILD_ACTIVEX,${activex})
dnl
dnl Plugin and builtin checks
......@@ -4394,7 +4343,6 @@ VLC_OUTPUT_VLC_CONFIG_IN
AC_CONFIG_FILES([
Makefile
projects/activex/Makefile
doc/Makefile
libs/loader/Makefile
libs/srtp/Makefile
......@@ -4490,12 +4438,6 @@ AM_COND_IF([HAVE_WIN32], [
extras/package/win32/spad.nsi
extras/package/win32/vlc.win32.nsi
])
AM_COND_IF([BUILD_ACTIVEX], [
AC_CONFIG_FILES([
projects/activex/axvlc.inf
projects/activex/axvlc_rc.rc
])
])
])
AM_COND_IF([HAVE_DARWIN], [
......
#! /usr/bin/make -f
if HAVE_WIN64
build-activex:
touch $@
else
build-activex: stamp-activex-build
endif
stamp-activex-fetch:
rm -Rf activex-vlc
git clone git://git.videolan.org/activex-vlc.git activex-vlc
touch $@
stamp-activex-autogen: stamp-activex-fetch
# extras/package/activex.am
cd activex-vlc && \
$(SHELL) ./autogen.sh
touch $@
stamp-activex-configure: stamp-activex-autogen
cd activex-vlc && \
$(SHELL) ./configure \
--prefix=/ \
--host=$(host_alias) --build=$(build_alias) \
CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" \
CC="$(CC)" CFLAGS="$(CFLAGS)" \
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \
LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
SHELL="$(SHELL)" \
PKG_CONFIG_LIBDIR="../$(srcdir)/extras/contrib/lib/pkgconfig:../src"
touch $@
stamp-activex-build: stamp-activex-configure
cd activex-vlc && \
$(MAKE) $(MAKEFLAGS) all && \
$(MAKE) $(MAKEFLAGS) DESTDIR="$(abs_builddir)/activex-vlc/installed" install
touch $@
......@@ -28,6 +28,7 @@ stamp-npapi-configure: stamp-npapi-autogen
CC="$(CC)" CFLAGS="$(CFLAGS)" \
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \
LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
SHELL="$(SHELL)" \
PKG_CONFIG_LIBDIR="../$(srcdir)/extras/contrib/lib/pkgconfig:../src"
touch $@
......
......@@ -25,7 +25,6 @@
--enable-portaudio \
--enable-sdl \
--enable-qt4 \
--enable-activex \
--enable-sse --enable-mmx \
--enable-libcddb \
--enable-zvbi --disable-telx \
......
......@@ -14,5 +14,5 @@ CC=amd64-mingw32msvc-gcc CXX=amd64-mingw32msvc-g++ \
CONFIGURE="${root}configure" \
CONFIGOPTS="--host=amd64-mingw32msvc --build=i386-linux
--enable-dirac --enable-mkv --enable-taglib --enable-debug --enable-projectm
--disable-qt4 --disable-skins2 --disable-activex" \
--disable-qt4 --disable-skins2" \
sh ${root}extras/package/win32/configure-common.sh
......@@ -20,7 +20,7 @@
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
@BUILD_ACTIVEX_TRUE@ !define INSTALL_ACTIVEX
@HAVE_WIN64_FALSE@ !define INSTALL_ACTIVEX
@HAVE_WIN64_FALSE@ !define INSTALL_MOZILLA
@FILE_LIBVLCCORE_DLL@
......@@ -756,7 +756,9 @@ SectionEnd
!ifdef INSTALL_MOZILLA
!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
!endif
@BUILD_ACTIVEX_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
!ifdef INSTALL_ACTIVEX
!insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
!insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
......
###############################################################################
# Building the Activex plugin
###############################################################################
MOSTLYCLEANFILES =
EXTRA_DIST = $(SOURCES_activex) $(DIST_rsrc) $(DIST_misc)
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 \
position.h \
provideclassinfo.cpp \
provideclassinfo.h \
connectioncontainer.cpp \
connectioncontainer.h \
objectsafety.cpp \
objectsafety.h \
dataobject.cpp \
dataobject.h \
viewobject.cpp \
viewobject.h \
supporterrorinfo.cpp \
supporterrorinfo.h \
vlccontrol.cpp \
vlccontrol.h \
vlccontrol2.cpp \
vlccontrol2.h \
plugin.cpp \
plugin.h \
axvlc_idl.c \
axvlc_idl.h \
guiddef.h \
$(NULL)
DIST_rsrc = \
axvlc_rc.rc.in \
$(NULL)
DIST_misc = \
README.TXT \
axvlc.inf.in \
axvlc.def \
axvlc.dll.manifest \
axvlc.idl \
axvlc.tlb \
inplace.bmp \
vlc16x16.bmp \
test.html \
$(NULL)
if BUILD_ACTIVEX
lib_LTLIBRARIES = axvlc.la
LIBRARIES_libvlc = $(top_builddir)/src/libvlc.la \
$(top_builddir)/src/libvlccore.la
axvlc_la_SOURCES = $(SOURCES_activex)
axvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags activex`
axvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags activex`
axvlc_la_DEPENDENCIES = axvlc.def $(DATA_axvlc_rc) $(LIBRARIES_libvlc)
axvlc_la_LDFLAGS = -Wl,$(srcdir)/axvlc.def -Wl,$(DATA_axvlc_rc) \
-no-undefined -avoid-version -module \
`$(VLC_CONFIG) --ldflags activex libvlc`
axvlc_la_LIBADD = $(LIBRARIES_libvlc) \
`$(VLC_CONFIG) -libs activex`
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
noinst_axvlc_rc_DATA = axvlc_rc.$(OBJEXT)
noinst_axvlc_rcdir =
axvlc_rc.$(OBJEXT): axvlc_rc.rc inplace.bmp axvlc.tlb
$(WINDRES) --include-dir $(srcdir) -i $< -o $@
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 -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
if HAS_WIDL_COMPILER
axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
$(WIDL) -I$(WINE_SDK_PATH)/include -tuh -T axvlc.tlb -U axvlc_idl.c -H axvlc_idl.h axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
clean-tlb:
endif
endif
else
clean-tlb:
endif
###############################################################################
# Clean rules
###############################################################################
clean-local: clean-tlb
###############################################################################
# Force rules
###############################################################################
This diff is collapsed.
LIBRARY AXVLC.DLL
EXPORTS
DllMain = DllMain@12
DllCanUnloadNow = DllCanUnloadNow@0
DllGetClassObject = DllGetClassObject@12
DllRegisterServer = DllRegisterServer@0
DllUnregisterServer = DllUnregisterServer@0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="x86"
name="axvlc.dll"
type="win32"
/>
<description>VLC ActiveX plugin</description>
</assembly>
This diff is collapsed.
; Version number and signature of INF file.
;
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
axvlc.dll=axvlc.dll
vlc-@VERSION@-win32.exe=vlc-@VERSION@-win32.exe
[axvlc.dll]
FileVersion=@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0
clsid={9BE31822-FDAD-461B-AD51-BE1D1C159921}
RegisterServer=no
Hook=runinstaller
[vlc-@VERSION@-win32.exe]
FileVersion=@VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,0
file-win32-x86=http://downloads.videolan.org/pub/videolan/vlc/@VERSION@/win32/vlc-@VERSION@-win32.exe
[runinstaller]
run=%EXTRACT_DIR%\vlc-@VERSION@-win32.exe
/*** Autogenerated by WIDL 1.1.38 from axvlc.idl - Do not edit ***/
#include <rpc.h>
#include <rpcndr.h>
#include <initguid.h>
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_GUID(LIBID_AXVLC, 0xdf2bbe39, 0x40a8, 0x433b, 0xa2,0x79, 0x07,0x3f,0x48,0xda,0x94,0xb6);
DEFINE_GUID(IID_IVLCControl, 0xc2fa41d0, 0xb113, 0x476e, 0xac,0x8c, 0x9b,0xd1,0x49,0x99,0xc1,0xc1);
DEFINE_GUID(DIID_DVLCEvents, 0xdf48072f, 0x5ef8, 0x434e, 0x9b,0x40, 0xe2,0xf3,0xae,0x75,0x9b,0x5f);
DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f,0x3f,0xd9,0xd4);
DEFINE_GUID(IID_IVLCInput, 0x49e0dbd1, 0x9440, 0x466c, 0x9c,0x97, 0x95,0xc6,0x71,0x90,0xc6,0x03);
DEFINE_GUID(IID_IVLCPlaylistItems, 0xfd37fe32, 0x82bc, 0x4a25, 0xb0,0x56, 0x31,0x5f,0x4d,0xbb,0x19,0x4d);
DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d);
DEFINE_GUID(IID_IVLCSubtitle, 0x465e787a, 0x0556, 0x452f, 0x94,0x77, 0x95,0x4e,0x4a,0x94,0x00,0x03);
DEFINE_GUID(IID_IVLCMarquee, 0x8d076ad6, 0x9b6f, 0x4150, 0xa0,0xfd, 0x5d,0x7e,0x8c,0x8c,0xb0,0x2c);
DEFINE_GUID(IID_IVLCLogo, 0x8a4a20c2, 0x93f3, 0x44e8, 0x86,0x44, 0xbe,0xb2,0xe3,0x48,0x7e,0x84);
DEFINE_GUID(IID_IVLCDeinterlace, 0xbc97469f, 0xcb11, 0x4037, 0x8d,0xce, 0x5f,0xc9,0xf5,0xf8,0x53,0x07);
DEFINE_GUID(IID_IVLCVideo, 0x0aaedf0b, 0xd333, 0x4b27, 0xa0,0xc6, 0xbb,0xf3,0x14,0x13,0xa4,0x2e);
DEFINE_GUID(IID_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3);
DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8);
DEFINE_GUID(CLSID_VLCPlugin2, 0x9be31822, 0xfdad, 0x461b, 0xad,0x51, 0xbe,0x1d,0x1c,0x15,0x99,0x21);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
#define VERSION_NUMBER @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,@VERSION_EXTRA_RC@
1 BITMAP "vlc16x16.bmp"
1 VERSIONINFO
FILETYPE 1
FILEOS 4
PRODUCTVERSION VERSION_NUMBER
FILEVERSION VERSION_NUMBER
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "VideoLAN"
VALUE "FileVersion", "@VERSION@"
VALUE "FileDescription", "VLC media player (Activex Plugin)"
VALUE "LegalCopyright", "(c) @COPYRIGHT_YEARS@ VideoLAN and Authors"
VALUE "OLESelfRegister", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
2 BITMAP DISCARDABLE "inplace.bmp"
1 TYPELIB "axvlc.tlb"
This diff is collapsed.
/*****************************************************************************
* connectioncontainer.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2010 M2X BV
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __CONNECTIONCONTAINER_H__
#define __CONNECTIONCONTAINER_H__
#include <ocidl.h>
#include <vector>
#include <queue>
#include <map>
#include <cguid.h>
class VLCConnectionPoint : public IConnectionPoint
{
public:
VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid);
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, DISPPARAMS* pDispParams);
void firePropChangedEvent(DISPID dispId);
private:
REFIID _iid;
IGlobalInterfaceTable *m_pGIT;
IConnectionPointContainer *_p_cpc;
std::map<DWORD, LPUNKNOWN> _connections;
};
//////////////////////////////////////////////////////////////////////////
class VLCDispatchEvent {
public:
VLCDispatchEvent(DISPID dispId, DISPPARAMS dispParams) :
_dispId(dispId), _dispParams(dispParams) {};
VLCDispatchEvent(const VLCDispatchEvent&);
~VLCDispatchEvent();
DISPID _dispId;
DISPPARAMS _dispParams;
};
class VLCConnectionPointContainer : public IConnectionPointContainer
{
public:
VLCConnectionPointContainer(VLCPlugin *p_instance);
virtual ~VLCConnectionPointContainer();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv)
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IConnectionPointContainer == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// IConnectionPointContainer methods
STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
void freezeEvents(BOOL);
void fireEvent(DISPID, DISPPARAMS*);
void firePropChangedEvent(DISPID dispId);
public:
CRITICAL_SECTION csEvents;
HANDLE sEvents;
VLCPlugin *_p_instance;
BOOL isRunning;
BOOL freeze;
VLCConnectionPoint *_p_events;
VLCConnectionPoint *_p_props;
std::vector<LPCONNECTIONPOINT> _v_cps;
std::queue<class VLCDispatchEvent *> _q_events;
private:
HANDLE hThread;
};
#endif
/*****************************************************************************
* viewobject.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.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "dataobject.h"
#include "utils.h"
using namespace std;
//////////////////////////////////////////////////////////////////////////////
static const FORMATETC _metaFileFormatEtc =
{
CF_METAFILEPICT,
NULL,
DVASPECT_CONTENT,
-1,
TYMED_MFPICT,
};
static const FORMATETC _enhMetaFileFormatEtc =
{
CF_ENHMETAFILE,
NULL,
DVASPECT_CONTENT,
-1,
TYMED_ENHMF,
};
class VLCEnumFORMATETC : public VLCEnumIterator<IID_IEnumFORMATETC,
IEnumFORMATETC,
FORMATETC,
vector<FORMATETC>::iterator>
{
public:
VLCEnumFORMATETC(vector<FORMATETC> v) :
VLCEnumIterator<IID_IEnumFORMATETC,
IEnumFORMATETC,
FORMATETC,
vector<FORMATETC>::iterator>(v.begin(), v.end())
{};
};
//////////////////////////////////////////////////////////////////////////////
VLCDataObject::VLCDataObject(VLCPlugin *p_instance) : _p_instance(p_instance)
{
_v_formatEtc.push_back(_enhMetaFileFormatEtc);
_v_formatEtc.push_back(_metaFileFormatEtc);
CreateDataAdviseHolder(&_p_adviseHolder);
};
VLCDataObject::~VLCDataObject()
{
_p_adviseHolder->Release();
};
//////////////////////////////////////////////////////////////////////////////
STDMETHODIMP VLCDataObject::DAdvise(LPFORMATETC pFormatEtc, DWORD padvf,
LPADVISESINK pAdviseSink, LPDWORD pdwConnection)
{
return _p_adviseHolder->Advise(this,
pFormatEtc, padvf,pAdviseSink, pdwConnection);
};
STDMETHODIMP VLCDataObject::DUnadvise(DWORD dwConnection)
{
return _p_adviseHolder->Unadvise(dwConnection);
};
STDMETHODIMP VLCDataObject::EnumDAdvise(IEnumSTATDATA **ppenumAdvise)
{
return _p_adviseHolder->EnumAdvise(ppenumAdvise);
};
STDMETHODIMP VLCDataObject::EnumFormatEtc(DWORD dwDirection,
IEnumFORMATETC **ppEnum)
{
if( NULL == ppEnum )
return E_POINTER;
*ppEnum = new VLCEnumFORMATETC(_v_formatEtc);
return (NULL != *ppEnum ) ? S_OK : E_OUTOFMEMORY;
};
STDMETHODIMP VLCDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatEtcIn,
LPFORMATETC pFormatEtcOut)
{
HRESULT result = QueryGetData(pFormatEtcIn);
if( FAILED(result) )
return result;
if( NULL == pFormatEtcOut )
return E_POINTER;
*pFormatEtcOut = *pFormatEtcIn;
pFormatEtcOut->ptd = NULL;
return DATA_S_SAMEFORMATETC;
};
STDMETHODIMP VLCDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium)
{
if( NULL == pMedium )
return E_POINTER;
HRESULT result = QueryGetData(pFormatEtc);
if( SUCCEEDED(result) )
{
switch( pFormatEtc->cfFormat )
{
case CF_METAFILEPICT:
pMedium->tymed = TYMED_MFPICT;
pMedium->hMetaFilePict = NULL;
pMedium->pUnkForRelease = NULL;
result = getMetaFileData(pFormatEtc, pMedium);
break;
case CF_ENHMETAFILE:
pMedium->tymed = TYMED_ENHMF;
pMedium->hEnhMetaFile = NULL;
pMedium->pUnkForRelease = NULL;
result = getEnhMetaFileData(pFormatEtc, pMedium);
break;
default:
result = DV_E_FORMATETC;
}
}
return result;
};
STDMETHODIMP VLCDataObject::GetDataHere(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium)
{
if( NULL == pMedium )
return E_POINTER;
return E_NOTIMPL;
}
//////////////////////////////////////////////////////////////////////////////
HRESULT VLCDataObject::getMetaFileData(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium)
{
HDC hicTargetDev = CreateDevDC(pFormatEtc->ptd);
if( NULL == hicTargetDev )
return E_FAIL;
HDC hdcMeta = CreateMetaFile(NULL);
if( NULL != hdcMeta )
{
LPMETAFILEPICT pMetaFilePict =
(LPMETAFILEPICT)CoTaskMemAlloc(sizeof(METAFILEPICT));
if( NULL != pMetaFilePict )
{
SIZEL size = _p_instance->getExtent();
RECTL wBounds = { 0L, 0L, size.cx, size.cy };
pMetaFilePict->mm = MM_ANISOTROPIC;
pMetaFilePict->xExt = size.cx;
pMetaFilePict->yExt = size.cy;
DPFromHimetric(hicTargetDev, (LPPOINT)&size, 1);
SetMapMode(hdcMeta, MM_ANISOTROPIC);
SetWindowExtEx(hdcMeta, size.cx, size.cy, NULL);
RECTL bounds = { 0L, 0L, size.cx, size.cy };
_p_instance->onDraw(pFormatEtc->ptd, hicTargetDev, hdcMeta,
&bounds, &wBounds);
pMetaFilePict->hMF = CloseMetaFile(hdcMeta);
if( NULL != pMetaFilePict->hMF )
pMedium->hMetaFilePict = pMetaFilePict;
else
CoTaskMemFree(pMetaFilePict);
}
}
DeleteDC(hicTargetDev);
return (NULL != pMedium->hMetaFilePict) ? S_OK : E_FAIL;
};
HRESULT VLCDataObject::getEnhMetaFileData(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium)
{
HDC hicTargetDev = CreateDevDC(pFormatEtc->ptd);
if( NULL == hicTargetDev )
return E_FAIL;
SIZEL size = _p_instance->getExtent();
HDC hdcMeta = CreateEnhMetaFile(hicTargetDev, NULL, NULL, NULL);
if( NULL != hdcMeta )
{
RECTL wBounds = { 0L, 0L, size.cx, size.cy };
DPFromHimetric(hicTargetDev, (LPPOINT)&size, 1);
RECTL bounds = { 0L, 0L, size.cx, size.cy };
_p_instance->onDraw(pFormatEtc->ptd, hicTargetDev,
hdcMeta, &bounds, &wBounds);
pMedium->hEnhMetaFile = CloseEnhMetaFile(hdcMeta);
}
DeleteDC(hicTargetDev);
return (NULL != pMedium->hEnhMetaFile) ? S_OK : E_FAIL;
};
STDMETHODIMP VLCDataObject::QueryGetData(LPFORMATETC pFormatEtc)
{
if( NULL == pFormatEtc )
return E_POINTER;
const FORMATETC *formatEtc;
switch( pFormatEtc->cfFormat )
{
case CF_METAFILEPICT:
formatEtc = &_metaFileFormatEtc;
break;
case CF_ENHMETAFILE:
formatEtc = &_enhMetaFileFormatEtc;
break;
default:
return DV_E_FORMATETC;
}
if( pFormatEtc->dwAspect != formatEtc->dwAspect )
return DV_E_DVASPECT;
if( pFormatEtc->lindex != formatEtc->lindex )
return DV_E_LINDEX;
if( pFormatEtc->tymed != formatEtc->tymed )
return DV_E_TYMED;
return S_OK;
};
STDMETHODIMP VLCDataObject::SetData(LPFORMATETC pFormatEtc,
LPSTGMEDIUM pMedium, BOOL fRelease)
{
return E_NOTIMPL;
};
/*void VLCDataObject::onDataChange(void)
{
_p_adviseHolder->SendOnDataChange(this, 0, 0);
};*/
void VLCDataObject::onClose(void)
{
_p_adviseHolder->SendOnDataChange(this, 0, ADVF_DATAONSTOP);
if( S_OK == OleIsCurrentClipboard(dynamic_cast<LPDATAOBJECT>(this)) )
OleFlushClipboard();
};
/*****************************************************************************
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __DATAOBJECT_H__
#define __DATAOBJECT_H__
#include <objidl.h>
#include <vector>
class VLCDataObject : public IDataObject
{
public:
VLCDataObject(VLCPlugin *p_instance);
virtual ~VLCDataObject();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv)
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IDataObject == riid) ) {
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// IDataObject methods
STDMETHODIMP DAdvise(LPFORMATETC,DWORD,LPADVISESINK,LPDWORD);
STDMETHODIMP DUnadvise(DWORD);
STDMETHODIMP EnumDAdvise(IEnumSTATDATA**);
STDMETHODIMP EnumFormatEtc(DWORD, IEnumFORMATETC**);
STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC,LPFORMATETC);
STDMETHODIMP GetData(LPFORMATETC,LPSTGMEDIUM);
STDMETHODIMP GetDataHere(LPFORMATETC,LPSTGMEDIUM);
STDMETHODIMP QueryGetData(LPFORMATETC);
STDMETHODIMP SetData(LPFORMATETC,LPSTGMEDIUM,BOOL);
void onClose(void);
private:
HRESULT getMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium);
HRESULT getEnhMetaFileData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium);
VLCPlugin *_p_instance;
std::vector<FORMATETC> _v_formatEtc;
IDataAdviseHolder *_p_adviseHolder;
};
#endif
/*****************************************************************************
* guiddef.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __GUIDDEF_H__
#define __GUIDDEF_H__
/*
** Widl generated code requires guiddef.h,
** which is not available under MinGW
*/
#undef GUID_EXT
#define GUID_EXT
#include <initguid.h>
#endif
This diff is collapsed.
/*****************************************************************************
* objectsafety.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005-2010 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#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
using namespace std;
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)
|| (IID_IVLCControl2 == 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)
|| (IID_IVLCControl2 == 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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __OBJECTSAFETY_H__
#define __OBJECTSAFETY_H__
#if HAVE_OBJSAFE_HEADER
/*
** at last, a version of mingw that supports this header
*/
#include <objsafe.h>
#else
/*
** mingw does not yet support objsafe.h, redefine what we need here
*/
// {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)
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IObjectSafety == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "olecontrol.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 S_OK;
};
STDMETHODIMP VLCOleControl::OnAmbientPropertyChange(DISPID dispID)
{
HRESULT hr;
LPOLEOBJECT oleObj;
hr = QueryInterface(IID_IOleObject, (LPVOID *)&oleObj);
if( SUCCEEDED(hr) )
{
LPOLECLIENTSITE clientSite;
hr = oleObj->GetClientSite(&clientSite);
if( SUCCEEDED(hr) && (NULL != clientSite) )
{
_p_instance->onAmbientChanged(clientSite, dispID);
clientSite->Release();
}
oleObj->Release();
}
return S_OK;
};
STDMETHODIMP VLCOleControl::FreezeEvents(BOOL bFreeze)
{
_p_instance->freezeEvents(bFreeze);
return S_OK;
};
/*****************************************************************************
* olecontrol.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleControl == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceactiveobject.h"
using namespace std;
STDMETHODIMP VLCOleInPlaceActiveObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_POINTER;
*pHwnd = NULL;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
}
return E_FAIL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::EnableModeless(BOOL fEnable)
{
return S_OK;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ContextSensitiveHelp(BOOL fEnterMode)
{
return E_NOTIMPL;
};
STDMETHODIMP VLCOleInPlaceActiveObject::TranslateAccelerator(LPMSG lpmsg)
{
HRESULT hr = S_FALSE;
LPOLEOBJECT oleObj;
if( SUCCEEDED(QueryInterface(IID_IOleObject, (LPVOID *)&oleObj)) )
{
LPOLECLIENTSITE clientSite;
if( SUCCEEDED(oleObj->GetClientSite(&clientSite)) && (NULL != clientSite) )
{
IOleControlSite *controlSite;
if( SUCCEEDED(clientSite->QueryInterface(IID_IOleControlSite, (LPVOID *)&controlSite)) )
{
hr = controlSite->TranslateAccelerator(lpmsg,
((GetKeyState(VK_SHIFT) >> 15) & 1) |
((GetKeyState(VK_CONTROL) >> 14) & 2) |
((GetKeyState(VK_MENU) >> 13) & 4) );
controlSite->Release();
}
clientSite->Release();
}
oleObj->Release();
}
return hr;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnFrameWindowActivate(BOOL fActivate)
{
return S_OK;
};
STDMETHODIMP VLCOleInPlaceActiveObject::OnDocWindowActivate(BOOL fActivate)
{
return S_OK;
};
STDMETHODIMP VLCOleInPlaceActiveObject::ResizeBorder(LPCRECT prcBorder, LPOLEINPLACEUIWINDOW pUIWindow, BOOL fFrameWindow)
{
return S_OK;
};
/*****************************************************************************
* oleinplaceactiveobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleWindow == riid)
|| (IID_IOleInPlaceActiveObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "oleinplaceobject.h"
#include <docobj.h>
using namespace std;
STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
{
if( NULL == pHwnd )
return E_POINTER;
*pHwnd = NULL;
if( _p_instance->isInPlaceActive() )
{
if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
return S_OK;
}
return E_FAIL;
};
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)) )
{
LPOLEINPLACEFRAME p_inPlaceFrame;
LPOLEINPLACEUIWINDOW p_inPlaceUIWindow;
OLEINPLACEFRAMEINFO oleFrameInfo;
RECT posRect, clipRect;
oleFrameInfo.cb = sizeof(OLEINPLACEFRAMEINFO);
if( SUCCEEDED(p_inPlaceSite->GetWindowContext(&p_inPlaceFrame, &p_inPlaceUIWindow, &posRect, &clipRect, &oleFrameInfo)) )
{
if( p_inPlaceFrame )
{
p_inPlaceFrame->SetActiveObject(NULL, NULL);
p_inPlaceFrame->Release();
}
if( p_inPlaceUIWindow )
{
p_inPlaceUIWindow->SetActiveObject(NULL, NULL);
p_inPlaceUIWindow->Release();
}
}
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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleWindow == riid)
|| (IID_IOleInPlaceObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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
This diff is collapsed.
/*****************************************************************************
* oleobject.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IOleObject == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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, BOOL uiActivate);
IOleAdviseHolder *_p_advise_holder;
IOleClientSite *_p_clientsite;
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* persistpropbag.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "persistpropbag.h"
#include "utils.h"
#include "oleobject.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->onInit();
};
STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog)
{
HRESULT hr = _p_instance->onInit();
if( FAILED(hr) )
return hr;
if( NULL == pPropBag )
return E_INVALIDARG;
VARIANT value;
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("mrl"), &value, pErrorLog) )
{
_p_instance->setMRL(V_BSTR(&value));
VariantClear(&value);
}
else
{
/*
** try alternative syntax
*/
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("src"), &value, pErrorLog) )
{
_p_instance->setMRL(V_BSTR(&value));
VariantClear(&value);
}
else
{
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("filename"), &value, pErrorLog) )
{
_p_instance->setMRL(V_BSTR(&value));
VariantClear(&value);
}
}
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autoplay"), &value, pErrorLog) )
{
_p_instance->setAutoPlay(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
else
{
/*
** try alternative syntax
*/
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autostart"), &value, pErrorLog) )
{
_p_instance->setAutoPlay(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
}
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("toolbar"), &value, pErrorLog) )
{
_p_instance->setShowToolbar(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
SIZEL size = _p_instance->getExtent();
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("extentwidth"), &value, pErrorLog) )
{
size.cx = V_I4(&value);
VariantClear(&value);
}
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("extentheight"), &value, pErrorLog) )
{
size.cy = V_I4(&value);
VariantClear(&value);
}
_p_instance->setExtent(size);
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("autoloop"), &value, pErrorLog) )
{
_p_instance->setAutoLoop(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
else
{
/*
** try alternative syntax
*/
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("loop"), &value, pErrorLog) )
{
_p_instance->setAutoLoop(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("visible"), &value, pErrorLog) )
{
_p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
else
{
/*
** try alternative syntax
*/
V_VT(&value) = VT_BOOL;
if( S_OK == pPropBag->Read(OLESTR("showdisplay"), &value, pErrorLog) )
{
_p_instance->setVisible(V_BOOL(&value) != VARIANT_FALSE);
VariantClear(&value);
}
}
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("volume"), &value, pErrorLog) )
{
_p_instance->setVolume(V_I4(&value));
VariantClear(&value);
}
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("starttime"), &value, pErrorLog) )
{
_p_instance->setStartTime(V_I4(&value));
VariantClear(&value);
}
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("baseurl"), &value, pErrorLog) )
{
_p_instance->setBaseURL(V_BSTR(&value));
VariantClear(&value);
}
V_VT(&value) = VT_I4;
if( S_OK == pPropBag->Read(OLESTR("backcolor"), &value, pErrorLog) )
{
_p_instance->setBackColor(V_I4(&value));
VariantClear(&value);
}
else
{
/*
** try alternative syntax
*/
V_VT(&value) = VT_BSTR;
if( S_OK == pPropBag->Read(OLESTR("bgcolor"), &value, pErrorLog) )
{
long backcolor;
if( swscanf(V_BSTR(&value), L"#%lX", &backcolor) )
{
_p_instance->setBackColor(backcolor);
}
VariantClear(&value);
}
}
return _p_instance->onLoad();
};
STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
{
if( NULL == pPropBag )
return E_INVALIDARG;
VARIANT value;
VariantInit(&value);
V_VT(&value) = VT_BOOL;
V_BOOL(&value) = _p_instance->getAutoLoop()? VARIANT_TRUE : VARIANT_FALSE;
pPropBag->Write(OLESTR("AutoLoop"), &value);
VariantClear(&value);
V_VT(&value) = VT_BOOL;
V_BOOL(&value) = _p_instance->getAutoPlay()? VARIANT_TRUE : VARIANT_FALSE;
pPropBag->Write(OLESTR("AutoPlay"), &value);
VariantClear(&value);
V_VT(&value) = VT_BOOL;
V_BOOL(&value) = _p_instance->getShowToolbar()? VARIANT_TRUE : VARIANT_FALSE;
pPropBag->Write(OLESTR("Toolbar"), &value);
VariantClear(&value);
SIZEL size = _p_instance->getExtent();
V_VT(&value) = VT_I4;
V_I4(&value) = size.cx;
pPropBag->Write(OLESTR("ExtentWidth"), &value);
V_I4(&value) = size.cy;
pPropBag->Write(OLESTR("ExtentHeight"), &value);
V_VT(&value) = VT_BSTR;
V_BSTR(&value) = SysAllocStringLen(_p_instance->getMRL(),
SysStringLen(_p_instance->getMRL()));
pPropBag->Write(OLESTR("MRL"), &value);
VariantClear(&value);
V_VT(&value) = VT_BOOL;
V_BOOL(&value) = _p_instance->getVisible()? VARIANT_TRUE : VARIANT_FALSE;
pPropBag->Write(OLESTR("Visible"), &value);
VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getVolume();
pPropBag->Write(OLESTR("Volume"), &value);
VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getStartTime();
pPropBag->Write(OLESTR("StartTime"), &value);
VariantClear(&value);
V_VT(&value) = VT_BSTR;
V_BSTR(&value) = SysAllocStringLen(_p_instance->getBaseURL(),
SysStringLen(_p_instance->getBaseURL()));
pPropBag->Write(OLESTR("BaseURL"), &value);
VariantClear(&value);
V_VT(&value) = VT_I4;
V_I4(&value) = _p_instance->getBackColor();
pPropBag->Write(OLESTR("BackColor"), &value);
VariantClear(&value);
if( fClearDirty )
_p_instance->setDirty(FALSE);
return S_OK;
};
/*****************************************************************************
* persistpropbag.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __PERSISTPROPBAG_H__
#define __PERSISTPROPBAG_H__
#include <stdio.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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IPersist == riid)
|| (IID_IPersistPropertyBag == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#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 _p_instance->isDirty() ? S_OK : S_FALSE;
};
STDMETHODIMP VLCPersistStorage::InitNew(LPSTORAGE pStg)
{
return _p_instance->onInit();
};
STDMETHODIMP VLCPersistStorage::Load(LPSTORAGE pStg)
{
if( NULL == pStg )
return E_INVALIDARG;
LPSTREAM pStm = NULL;
HRESULT result = pStg->OpenStream(L"VideoLAN ActiveX Plugin Data", NULL,
STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &pStm);
if( FAILED(result) )
return result;
LPPERSISTSTREAMINIT pPersistStreamInit;
if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStreamInit)) )
{
result = pPersistStreamInit->Load(pStm);
pPersistStreamInit->Release();
}
pStm->Release();
return result;
};
STDMETHODIMP VLCPersistStorage::Save(LPSTORAGE pStg, BOOL fSameAsLoad)
{
if( NULL == pStg )
return E_INVALIDARG;
if( fSameAsLoad && (S_FALSE == IsDirty()) )
return S_OK;
LPSTREAM pStm = NULL;
HRESULT result = pStg->CreateStream(L"VideoLAN ActiveX Plugin Data",
STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &pStm);
if( FAILED(result) )
return result;
LPPERSISTSTREAMINIT pPersistStreamInit;
if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStreamInit)) )
{
result = pPersistStreamInit->Save(pStm, fSameAsLoad);
pPersistStreamInit->Release();
}
pStm->Release();
return result;
};
STDMETHODIMP VLCPersistStorage::SaveCompleted(IStorage *pStg)
{
return S_OK;
};
STDMETHODIMP VLCPersistStorage::HandsOffStorage(void)
{
return S_OK;
};
/*****************************************************************************
* persiststorage.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IPersist == riid)
|| (IID_IPersistStorage == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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
This diff is collapsed.
/*****************************************************************************
* persiststreaminit.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __PERSISTSTREAMINIT_H__
#define __PERSISTSTREAMINIT_H__
#include <ocidl.h>
class VLCPersistStreamInit : public IPersistStreamInit
{
public:
VLCPersistStreamInit(VLCPlugin *p_instance);
virtual ~VLCPersistStreamInit();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IPersist == riid)
|| (IID_IPersistStreamInit == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// 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;
class VLCPropertyBag *_p_props;
};
#endif
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* position.h: Support routines for logo and marquee plugin objects
*****************************************************************************
* Copyright (C) 2010 M2X BV
*
* Authors: JP Dinger <jpd (at) videolan (dot) org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef POSITION_H
#define POSITION_H
struct posidx_s { const char *n; size_t i; };
static const posidx_s posidx[] = {
{ "center", 0 },
{ "left", 1 },
{ "right", 2 },
{ "top", 4 },
{ "bottom", 8 },
{ "top-left", 5 },
{ "top-right", 6 },
{ "bottom-left", 9 },
{ "bottom-right", 10 },
};
enum { num_posidx = sizeof(posidx)/sizeof(*posidx) };
static inline const char *position_bynumber( size_t i )
{
for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
if( h->i == i )
return h->n;
return "undefined";
}
static inline bool position_byname( const char *n, size_t &i )
{
for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
if( !strcasecmp( n, h->n ) )
{ i=h->i; return true; }
return false;
}
#endif
/*****************************************************************************
* provideclassinfo.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#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(LOCALE_NEUTRAL, &p_typelib);
if( SUCCEEDED(hr) )
{
hr = p_typelib->GetTypeInfoOfGuid(_p_instance->getClassID(), 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 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __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 )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_IProvideClassInfo == riid)
|| (IID_IProvideClassInfo2 == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// IProvideClassInfo methods
STDMETHODIMP GetClassInfo(ITypeInfo **);
// IProvideClassInfo2 methods
STDMETHODIMP GetGUID(DWORD, GUID *);
private:
VLCPlugin *_p_instance;
};
#endif
/*****************************************************************************
* supporterrorinfo.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005-2010 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "supporterrorinfo.h"
#include "utils.h"
#include "axvlc_idl.h"
using namespace std;
STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
{
if( (riid == IID_IVLCAudio)
|| (riid == IID_IVLCInput)
|| (riid == IID_IVLCMarquee)
|| (riid == IID_IVLCLogo)
|| (riid == IID_IVLCPlaylist)
|| (riid == IID_IVLCPlaylistItems)
|| (riid == IID_IVLCSubtitle)
|| (riid == IID_IVLCVideo)
|| (riid == IID_IVLCControl2) )
{
return S_OK;
}
return S_FALSE;
};
void VLCSupportErrorInfo::setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description)
{
BSTR bstrDescription = BSTRFromCStr(CP_UTF8, description);
if( NULL != bstrDescription )
{
ICreateErrorInfo* pcerrinfo;
HRESULT hr = CreateErrorInfo(&pcerrinfo);
if( SUCCEEDED(hr) )
{
IErrorInfo* perrinfo;
pcerrinfo->SetSource((LPOLESTR)progid);
pcerrinfo->SetGUID(riid);
pcerrinfo->SetDescription((LPOLESTR)bstrDescription);
hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID*) &perrinfo);
if( SUCCEEDED(hr) )
{
::SetErrorInfo(0, perrinfo);
perrinfo->Release();
}
pcerrinfo->Release();
}
SysFreeString(bstrDescription);
}
};
/*****************************************************************************
* supporterrorinfo.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __SUPPORTERRORINFO_H__
#define __SUPPORTERRORINFO_H__
#include <oaidl.h>
class VLCSupportErrorInfo : public ISupportErrorInfo
{
public:
VLCSupportErrorInfo(VLCPlugin *p_instance) :
_p_instance(p_instance)
{};
virtual ~VLCSupportErrorInfo()
{};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_ISupportErrorInfo == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// ISupportErrorInfo methods
STDMETHODIMP InterfaceSupportsErrorInfo(REFIID riid);
// VLCSupportErrorInfo methods
void setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description);
private:
VLCPlugin *_p_instance;
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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