Page 1 of 1
how to embed vlc activeX 8.2 in MFC?
Posted: 02 Aug 2005 14:38
by karl
1/ bug report : in vlccontrol.cpp, createTargetOptions(),
replace if( NULL != options ) with if( NULL != *cOptions ) in VT_ARRAY case
2/ activeX with IE works
, but doesn't work in MFC app
- when using CHMTLView, IE Webbrowser activeX fails to load html page with a vlc activeX embedded (a) ( infinite loop)
- when calling directly CoCreateInstance, CoCreateInstance(CLSID_VLCPlugin,0,CLSCTX_ALL,IID_IVLCControl,(void**)&pIwb), the vlcplugin object is not instanciated.
- when instantiating vlcplugin with
res = pIwb->QueryInterface(IID_IPersistStreamInit,(void**)&pStorage);
pStorage->InitNew();
same behavior than in (a) : infinite loop
3/ question : if I use mozilla browser active X instead IE, is there the same problem when loading the page with vlc activex?
Posted: 02 Aug 2005 15:21
by Quovodis
all the problems you described are fixed in the current development version of vlc (0.8.3). You could try to use a nightly build and verify that the errors you are describing are gone.
nightly builds are available @
http://vthr.via.ecp.fr/~videolan/
Posted: 02 Aug 2005 16:32
by karl
test with no success.
have you some test code that instantiates a vlc plugin+ vlc control activeX? the code in activex/main.cpp (winMain()) only instantiates vlccontrol
Posted: 02 Aug 2005 16:52
by karl
test with no success.
have you some test code that instantiates a vlc plugin+ vlc control activeX? the code in activex/main.cpp (winMain()) only instantiates vlccontrol
Posted: 02 Aug 2005 16:58
by Quovodis
does the following works for you:
CoCreateInstance(CLSID_VLCPlugin, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IUnknown,(void**)&pIwb)
as for the infinite loop,you should try to run you're target app through cygwin bash shell so that you can see VLC debug output. if you are working on an IDE, launch it from bash
Posted: 02 Aug 2005 17:32
by karl
actually creating the activex is not a problem.
CoCreateInstance() works. but when we retrieve an interface IID_IVLCControl, a call to playlistClear() return E_UNEXPECTED, which mean some initialisation stuff is missing to call the VLCPlugin::onInit().
(i can simulate a call to VLCPlugin::onInit() by persistStreamInitInterface->InitNew(). this freese the application. last loaded DLL before freeze = libdshow_plugin.dll, libvout_directx_plugin.dll, shell32.dll)
i notice some change on V7.net, since 8.3, V7 wizzard generates the correct wrapper class with properties, but fails to create the dialog containing the activeX resource. (no additional code, just insert the activeX in dialog, and associate a variable)
activeX works from bash
Posted: 02 Aug 2005 17:49
by karl
you are right, activeX within a dialog or an CHTMLView works when the application is launched from batch.
i don't understand why it doesn't work in debug mode
Posted: 02 Aug 2005 17:56
by Quovodis
as you guessed, InitNew() initialize the VLC library, which seems to be the cause of your problem. Typically, i've seen the library initialization locking up when VLC is being debugged, which may be what is happening to you. To alleviate this problem, you may want to re-compile the AX with ACTIVEX_DEBUG defined (which is used in plugin.cpp).
Unfortunately, I do not own any .NET IDE. Can you describe the errors you are getting regarding the dialog containing the ActiveX plugin ?
Posted: 02 Aug 2005 20:50
by The DJ
Might also be related to the console output that VLC does?
What if you specify all it's quiet options and fake-tty stuff and all that?
Posted: 05 Aug 2005 00:51
by karl
Unfortunately, I do not own any .NET IDE. Can you describe the errors you are getting regarding the dialog containing the ActiveX plugin
?
yes i can.
what works with 8.3
- insert the vlc activex plugin in a dialog with V7.net ide wizzard and generate a wrapper class
- instantiation in a html page
- instantation in the microsoft activex test container and invoke methods.
what doesn't work
- launch of a mfc dialog withvlc activex. there is an assert in occsite.cpp
Code: Select all
COleControlSite::XOleIPSite::GetWindowContext() : ASSERT(AfxIsValidAddress(pFrameInfo, pFrameInfo->cb));
the value
is not initialized, it should be equal to sizeof (OLEINFRAMEINFO)
in vlc plugin source, in the method GetWindowsContext
Code: Select all
OLEINPLACEFRAMEINFO oleFrameInfo;
if( SUCCEEDED(p_inPlaceSite->GetWindowContext(&p_inPlaceFrame, &p_inPlaceUIWindow, &posRect, &clipRect, &oleFrameInfo)) )
i think oleFrameInfo.cb should be initialized before calling the inplacesite com object.
the crash depends on the inplacesite container object and the checks on the parameters. for example, it works with MS test container, with WebBrowser container (html), but doesnt work with MFC/ CView default container.
there is another problem, the activex activation lock in vlc init when the application is launched under IDE.
Posted: 08 Aug 2005 11:29
by Quovodis
i think oleFrameInfo.cb should be initialized before calling the inplacesite com object.
yes, are absolutely right. my next commit will have this fix, thanks for the effort in regressing this one out
there is another problem, the activex activation lock in vlc init when the application is launched under IDE.
the problem lies with the VLC library (I think), which is heavily threaded and chokes when debugged under win32. There is a documented workaround in INSTALL.win32, whereby, the library should be initialized with the following switches: --fast-mutex --win9x-cv-method=1, which I do when the ACTIVEX_DEBUG flag is defined in pluging.cpp. I could make this the default, but I think VLC will suffer some performance issues when these guys are turned on.
However, for regression sake, could you try compiling the AX plugin with this flags turned on to validate that at least the problem goes away.
Posted: 08 Aug 2005 18:10
by Guest
There is a documented workaround in INSTALL.win32, whereby, the library should be initialized with the following switches: --fast-mutex --win9x-cv-method=1, which I do when the ACTIVEX_DEBUG flag is defined in pluging.cpp.
Ok. unfortunately i have not a build environment (cygwin) and i use only the activex dll generated (a solution could be to have two dll, with or without activex_debug and register the one required)
*remark on vlccontrop::createTargetOptions() for parsing safe array of BSTR options, replace ZeroMemory(cOptions, sizeof(char *)*(uBound-lBound)); with ZeroMemory(*cOptions, ...). It is anecdotic as the version with safearray of variant is fine.
Posted: 17 Aug 2005 18:14
by ®obbi
Well, today I tried the same with Delphi 6 and Delphi 2005. An instance of the activex control can be created, some properties are available (left, top,..., parent), but if I call a function ('i.e. playlistClear or play) then an exception is thrown that something was not initialized.
BTW, I used the current build from tonight (0.8.4-svn20050817)
procedure TForm1.CreatePlayerInstance;
var
VlcPlayer: TVLCPlugin;
begin
try
VlcPlayer := TVLCPlugin.Create(self);
VlcPlayer.Left := 50;
VlcPlayer.Top := 50;
VlcPlayer.Width := 400;
VlcPlayer.Height := 400;
VlcPlayer.playlistClear
VlcPlayer.play;
except
on E: Exception do
begin
ShowMessage(E.Message);
end;
end;
end;
Posted: 17 Aug 2005 21:47
by ®obbi
now registered