how to embed vlc activeX 8.2 in MFC?

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
karl

how to embed vlc activeX 8.2 in MFC?

Postby karl » 02 Aug 2005 14:38

1/ bug report : in vlccontrol.cpp, createTargetOptions(),
replace if( NULL != options ) with if( NULL != *cOptions ) in VT_ARRAY case

2/ activeX with IE works :D , 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?

Quovodis
Cone that earned his stripes
Cone that earned his stripes
Posts: 271
Joined: 16 Jun 2004 11:13
Location: Cork, Ireland

Postby Quovodis » 02 Aug 2005 15:21

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/

karl

Postby karl » 02 Aug 2005 16:32

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

karl

Postby karl » 02 Aug 2005 16:52

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

Quovodis
Cone that earned his stripes
Cone that earned his stripes
Posts: 271
Joined: 16 Jun 2004 11:13
Location: Cork, Ireland

Postby Quovodis » 02 Aug 2005 16:58

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

karl

Postby karl » 02 Aug 2005 17:32

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)

karl

activeX works from bash

Postby karl » 02 Aug 2005 17:49

:D 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

Quovodis
Cone that earned his stripes
Cone that earned his stripes
Posts: 271
Joined: 16 Jun 2004 11:13
Location: Cork, Ireland

Postby Quovodis » 02 Aug 2005 17:56

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 ?

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Postby The DJ » 02 Aug 2005 20:50

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?
Don't use PMs for support questions.

karl

Postby karl » 05 Aug 2005 00:51

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

Code: Select all

pFrameInfo->cb
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.

Quovodis
Cone that earned his stripes
Cone that earned his stripes
Posts: 271
Joined: 16 Jun 2004 11:13
Location: Cork, Ireland

Postby Quovodis » 08 Aug 2005 11:29

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.

Guest

Postby Guest » 08 Aug 2005 18:10

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.

®obbi

Postby ®obbi » 17 Aug 2005 18:14

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;

®obbi
New Cone
New Cone
Posts: 3
Joined: 17 Aug 2005 21:44

Postby ®obbi » 17 Aug 2005 21:47

now registered ;-) :idea:
It's unbelievable, but it's true ®


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 9 guests