[vlc-devel] Fwd: VideoLan VLC player, ActiveX plugin

Jean-Paul Saman jpsaman at videolan.org
Mon Aug 8 16:14:40 CEST 2011


---------- Forwarded message ----------
From: udo <udo at loewenwasser.de>
Date: Fri, Aug 5, 2011 at 5:38 PM
Subject: VideoLan VLC player, ActiveX plugin
To: Damien Fouilleul <Damien.Fouilleul at laposte.net>, Jean-Paul Saman
<jpsaman at videolan.org>


Hi,

I should first of all admit that you did a great job to create such a
nice piece as VLC.

I wanted to embed the COM object of the player in a slide show to play
some background music, especially with Internet Explorer (because HTML
AUDIO tags don't really work in Internet explorer).

I added the according OBJECT and EMBED tags in a test page, but the
only results I saw was Internet Explorer crash.


So I checked out the actual sources, and modified the them to build
the COM object and to start a debug session in Visual Studio (I was
using VStudio 2003 .net edition).

These are the modifications to improve stability:

1) plugin.cpp, Method VLCPlugin::initVLC()
1a) There is some chance that the player is not accessible within the
Browser environment, I added some checks to see if the VLC module can
be loaded:
    if(!libvlc_new || !libvlc_get_version) return;

Note: I had a lot of NULL-Pointer exceptions due to incompatible VLC
installations and inaccessible VLC modules within the browser
environment.

1b) There are different versions of VLC with significantly different
API's, so I added a version check before creating the VLC instance,
and catch exception during initialization:
    try {
        const char *pszVersion = libvlc_get_version();
        int iMinor = 0, iMajor = 0;
        sscanf(pszVersion, "%d.%d", &iMajor, &iMinor);
        if(iMajor * 100 + iMinor < 101) return;
        _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv);
    } catch(...) {
        _p_libvlc = 0;
    }

1.c) Improve locating of VLC player, I added the path to the VLC
installation to the Dll-search path (mostly required for debugging
purposes).

2) vlc_win32_fullscreen.cpp, method VLCWindowsManager::LibVlcAttach()
Version 8 of Intenet Explorer sometimes calls
VLCWindowsManager::LibVlcAttach() before
VLCWindowsManager::CreateWindows was called, which again results in a
NULL-Pointer exception, the player cannot be instantiated. A little
check if(_HolderWnd) prevents this exception.

The attached .diff - Files again show my modifications.

Please let me know if I you have any more questions,

best regards

Udo Kolb
-------------- next part --------------
446,448d445
< #ifdef _MSC_VER
< typedef BOOL (WINAPI *tSetDllDirectoryW)(LPCWSTR);
< #endif
452,455d448
< #ifdef _MSC_VER
< 	static HMODULE hModKernel32 = 0;
< 	static tSetDllDirectoryW pSetDllDirectoryW = 0;
< #endif
495,502d487
< #ifdef _MSC_VER
< 				if(!pSetDllDirectoryW && !hModKernel32) {
< 					hModKernel32 = LoadLibrary(TEXT("kernel32"));
< 					if(hModKernel32) 
< 						pSetDllDirectoryW = (tSetDllDirectoryW) GetProcAddress(hModKernel32, "SetDllDirectoryW");
< 				}
< 				if(pSetDllDirectoryW)pSetDllDirectoryW ( w_pluginpath );
< #endif
530,540c515
< 	/** @todo Check if libvlc is accessible */
< 	if(!libvlc_new || !libvlc_get_version) return;
< 	try {
< 		const char *pszVersion = libvlc_get_version();
< 		int iMinor = 0, iMajor = 0;
< 		sscanf(pszVersion, "%d.%d", &iMajor, &iMinor);
< 		if(iMajor * 100 + iMinor < 101) return;
< 		_p_libvlc = libvlc_new(ppsz_argc, ppsz_argv);
< 	} catch(...) {
< 		_p_libvlc = 0;
< 	}
---
>     _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv);
-------------- next part --------------
843,846c843,844
< 	if(_HolderWnd) {
< 		libvlc_media_player_set_hwnd(p_md, _HolderWnd->getHWND());
< 	    _p_md=p_md;
< 	}
---
>     _p_md=p_md;
>     libvlc_media_player_set_hwnd(p_md, _HolderWnd->getHWND());


More information about the vlc-devel mailing list