Delphi causes EOleExeption using SetPosition in VLC ActiveX

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

Delphi causes EOleExeption using SetPosition in VLC ActiveX

Postby Guest » 04 Apr 2006 12:36

Hi,
I wrote a simple Delphi 7 Example to use the VLC activeX Plugin ver. 0.8.5 test2.

Code: Select all

//*********************************************************** procedure TForm1.BtnOpenClick(Sender: TObject); var Parameter : array of String; Dateiname : String; begin if OpenDialog1.Execute then begin Dateiname := OpenDialog1.FileName; SetLength(Parameter,2); Parameter[0]:=':vout-filter=deinterlace'; Parameter[1]:=':deinterlace-mode=blend'; VLCPlugin1.addTarget(Dateiname ,Parameter ,VLCPlayListInsert ,0); end; end; //********************************************************* procedure TForm1.BtnPlayClick(Sender: TObject); begin VLCPlugin1.play; end; //*********************************************************** procedure TForm1.BtnFFClick(Sender: TObject); begin VLCPlugIn1.Position := 0.5; end; //***********************************************************
The application is working fine. I'm unsing *.vdr Files to test it.
With the BtnFF Button I want to seek to the middle of the movie.
But when I click on the BtnFF Button Delphi shows me:
Project Project1.exe raised expetion class EOleExeption with Message 'Schwerwiegender Fehler'. Process stopped. Use Step or Run to continue.
By pressing run I can continue the application and the seek to the middle of the movie works.

What can I do to prevent this Error Message?
Is there an other opportunity to seek in the movie? F.e. Simulation of some pressed Keys?

Thanks

Cu Trucki

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 04 Apr 2006 12:39

Sorry, I forgot the Login.
Trucki

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

Postby Quovodis » 04 Apr 2006 16:32

you cannot change the 'position' property if nothing is being played, try 'time' property instead, which seeks or starts to play at the time position in seconds

Guest

Postby Guest » 05 Apr 2006 06:49

Hi Quovodis,
thank you for your replay. I forgot to mention, that I first press the "Open" Button and select a *.vdr File. Then I press the "Play" Button to start playing the selected file. After VLC started to play the file I press the "BtnF" Button to seek to a Position and get the Error Message.

I tried to seek with the "time" property but it didn't show any effekt. But I think this is a Problem of the PES Format, because when I use the VLC GUI to play *.vdr files the time always shows me "00:00:00".

I hope somebody can help me. The VLC ActiveX Plugin is really great, but I can't use it.

Thanks

Cu Trucki

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 06 Apr 2006 11:01

UP

Nobody here who is using the Position Property of the ActiveX VLC Plugin with Borland?

Thanks
Trucki

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

Postby Quovodis » 06 Apr 2006 14:49

can you move the seek bar in VLC player when playing those VDR files ?
if not, then the position property will not work

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 06 Apr 2006 18:46

HI,
the Seekbar in the VLC 0.8.5 test2 GUI is working fine with *.vdr files. I also tried to use the Position Property in Delphi while I played *.wmv files.
Same Effekt. The Seek is working, but I always get this EOleExeption Error.

Any ideas?

Thanks

Trucki

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 07 Apr 2006 08:59

Hi,

I figuerd out that the VLC_PositionSet funktion needs 2 parameters. The ActiveX Position Property only needs one position Parameter. Why? Is there no possibility to switch between absolute and relative seeking?

Can I use the functions getVariable an SetVariable to seek?

I tried

Code: Select all

procedure TForm1.BtnFFClick(Sender: TObject); var tmp : OleVariant; begin tmp := VLCPlugIn1.getVariable('position'); VLCPlugIn1.setVariable('0.5',tmp); end;
but it seems that a position variable doesn't exists.

Trucki

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 Apr 2006 16:25

I reviewed some of the code in ActiveX and I have indeed found an issue with the 'position' property, which I have fixed in SVN. so try out the latest nightly build if you need to.

BTW, the 'position' property is internally translated into set/getVariable('position'), so using the property or the variable makes no difference.

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 09 Apr 2006 09:26

HI Quovodis,

thank you very much! I installed "vlc-0.8.5-test2-20060409-0001-win32.exe" and it's working! Cool!

Unfortunallity I found another problem with the VersionInfo function.

Code: Select all

procedure TForm1.Button1Click(Sender: TObject); begin LabelTime.Caption := VLCPLugin1.VersionInfo; end;
On a Button1 Click I only get a EOLESYSERROR: "Member not found" and no Info.

The VersionInfo function isn't really important for me. It's just to report that there could be a problem!

Thank you again for solving my problem!

Cu trucki

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

Postby Quovodis » 09 Apr 2006 18:31

VersionInfo is declared as a read-only variable in the ActiveX idl; I am not a Delphi expert, but maybe the call with Delphi should be as follow:

Code: Select all

VLCPLugin1.getVersionInfo

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 09 Apr 2006 19:06

Hi,
no, the ActiveX PlugIn hasn't got a property 'getVersionInfo' in Delphi.

I also tried VlcPlugin1.PlaylistIndex / Count. Same Error : 'Member not found' .

Maybe the ActiveX PlugIn still has a bug?

Unfortunality I need these Variables for my project.

Can I access these variables with get_variable(name as Sting)?
Where can I find the possible "Names as String" for the get_variable function?

Thank you again for your support!

Cu Trucki

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

Postby Quovodis » 09 Apr 2006 21:16

these are 'hidden' properties; they are marked that way so that they don't appear in in property page, but they should be usuable in programming (and they are for VB, Javascript, etc...)
I don't know why Delphi can't use them, seems like an oversight from borland.

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 10 Apr 2006 08:12

Hi,
by installing the activex Plugin, Delphi automaticly creates an AVLC_TLB.pas file in his Import Directory.

In this File you can find lines like this:

Code: Select all

TVLCPlugin = class(TOleControl) ... property Playing: WordBool index 101 read GetWordBoolProp; property Length: Integer index 104 read GetIntegerProp; ... property PlaylistIndex: Integer index -1 read GetIntegerProp; property PlaylistCount: Integer index -1 read GetIntegerProp; property VersionInfo: WideString index -1 read GetWideStringProp; ... property Position: Single index 102 read GetSingleProp write SetSingleProp stored False;
With these lines of the TVLCPlugIn Object Delphi knows which function it should use for read or write access. I don't understand very mutch of ActiveX programming, but I can't access properties which have the index Number -1 and I don't understand the difference between the declaration of the properies PlayListIndex and PlayListCount.

Unfortunality I do not unterstand enough to find the reason for these strange indexes in the ActiveX Plugin Sourcecode.

I hope you can help me.

Thanks Trucki

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

Postby Quovodis » 10 Apr 2006 15:15

indexes are allocated for all methods and properties inside an ActiveX TypeLibrary, OLE Object Viewer dump the content of the TypeLibrary and displays the indexes as follow:

Code: Select all

[id(0x60020015), propget, helpstring("Returns index of current target in playlist.")] HRESULT PlaylistIndex([out, retval] int* index); [id(0x60020016), propget, helpstring("Returns number of items in playlist.")] HRESULT PlaylistCount([out, retval] int* index);
Delphi 7 should have been able to retrieve those indexes since it managed to do so for the others.

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 10 Apr 2006 16:25

HI,
But I don't know how I can force Delphi to get these Index Numbers. Do you have an idea how I can solve this problem?
Thanks
Trucki

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

Postby Quovodis » 10 Apr 2006 17:10

why not changing the -1 indexes in AVLC_TLB.pas with the right values after importing, and recompile it

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 11 Apr 2006 07:59

ok, sorry for this silly question, but where can I find the right indexes?

Are they really: ?
- hex : 0x60020015 for PlaylistIndex
- hex : 0x60020016 for PlaylistCount


What programm did you use to geht the OLE Viewer dump? I tried Micro$ofts OLE Viewer but I don't kno hiw to use it.

Cu trucki

Trucki
Blank Cone
Blank Cone
Posts: 16
Joined: 04 Apr 2006 12:17

Postby Trucki » 11 Apr 2006 08:19

OK,
sorry for the last question! I just replaced in the AXVLC_TLB.pas the lines

Code: Select all

property PlaylistIndex: Integer index -1 read GetIntegerProp; property PlaylistCount: Integer index -1 read GetIntegerProp;
with

Code: Select all

property PlaylistIndex: Integer index $60020015 read GetIntegerProp; property PlaylistCount: Integer index $60020016 read GetIntegerProp;
and recompiled.

It works!

What programm did you use to get the OLE Viewer dump? Do you also know the index for the VersionInfo property?

Thanks

Cu Trucki

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

Postby Quovodis » 11 Apr 2006 10:25

there you go:

http://www.microsoft.com/windows2000/te ... view-o.asp

I don't think that the more recent version of Deplhi have this problem (at least no-one reported any of the sort).

Anyway, If you don't mind, could you had a section on your experience using Deplhi 7 in the ActiveX wiki (http://wiki.videolan.org/index.php/ActiveX/Delphi)

James23
New Cone
New Cone
Posts: 3
Joined: 17 Mar 2008 03:42
Contact:

Re: Delphi causes EOleExeption using SetPosition in VLC ActiveX

Postby James23 » 17 Mar 2008 04:10

The ActiveX Position Property only needs one position Parameter.

Themasteratdelphi
New Cone
New Cone
Posts: 6
Joined: 16 Apr 2008 06:11

Re: Delphi causes EOleExeption using SetPosition in VLC ActiveX

Postby Themasteratdelphi » 16 Apr 2008 06:51

if your sure the error is irrelavent of the intended outcome, ie it sill works even after the error is shown, then you can enclose the problem statement with the try and finally statements (used just like begin and end; except finally is also followed by end;).

for example:

Code: Select all

try //insert probelem statement finally //insert rest of procedure end;
with the try finally statements errors are ignored after the try and before finally, the statements after finally are ran regardless of error, finally must be used to mark the end of try, it has no other use as if try was allowed on its own for one statement it would have the same effect, ie everything after the statement would be ran regardless.

there is also try and except which is used in the same way except if there is an error, the code between except and end; is ran, but not if there is no error.

for example:

Code: Select all

try // insert code that could sometimes cause an error except //handle any error with this code. example: messagedlg('An error occured', mterror, [mbok], 0); end;
this should sort out the error but will not stop it from occuring. You must handle the error if it could cause the program to become instable. The is done with the on [exceptionName] do statement, this follows except, this can be used to customise what happens according to the error, and can make sure nothing tries to use erronious data.

hope this helps, i can see you've been having quite a few problems.

note: during a debug run in delphi the error is still picked up and is shown. It only runs without showing the error when executed as standalone ie not in debug.

also i recommend not changing the original source code for fear of instability and also how these changes could effect other machines when running your program, if any. this is probably the best way to get round the problem.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 16 guests