Re: (Eric) Re: Video in LWW
Thank you very much for sharing your insights – it is both enlightening and encouraging! If I make any progress, I will let you know!
Erik
19 jan 2014 kl. 02:02 skrev Jack Harper:
> Greetings Eric -
>
> I don't know if any of this might be of any real help, but I just went through a vaguely similar exercise in futility and frustration...
>
> I built LW/CAPI software that reads and displays a real-time streaming video source -- a webcam -- now working nicely and quite fluidly.
>
>
> I discovered a number of things - mostly by trial and error and occasional raw thought...
>
> (a) There is no documentation about any of this - video in or video out - anywhere on this planet. It does not exist. LogiTech, in my case manufacturer of the webcam, was of absolutely zero help. Best I can tell, that company has no human employees at all - just robots building webcams on a barge off the coast of China...
>
> (b) The fundamental problem, I think, is that you must use windowing elements from two separate worlds - CAPI and WIN32 et. al. At least in my case, CAPI has no idea that the streaming video window is there at all. I did FLI'd WIN32 calls to setup the real-time streaming video window and simply overlaid those things on top of the underlying CAPI panes etc.
>
> (c) Things improved very slightly when I finally figured out to make the alien WIN32 video windows child windows of the current CAPI pane - (capi:simple-pane-handle ) was helpful there, once I stumbled across it. This at least stopped my video window from simply vanishing from view whenever CAPI decided to come to life.
>
> (d) However, I think the most important thing to know is that you might need to setup your own WIN32 messages dispatch code inside Lisp. Before I did that, the streaming video simply refused to update - nothing but static images that, of course, vanished here and there as CAPI sprang back to life:
>
> (while (not (zerop (fli-peek-message msg-pointer 0 0 0 pm-remove))) ; Is there a WIN32 Message Queued Up?
>
> (fli-translate-message msg-pointer) ; Yes: Well, Loop and process the Wretched Things until Exhausted...
>
> (fli-dispatch-message msg-pointer)))))
>
>
> (while) is a, well, while macro that I use a lot. The FLI things are, of course, calls into WIN32 - this is all very standard straight WIN32 programming stuff taught back in grade school...
>
> After some thought, I realized that the streaming video window, living and controlled in C space, was completely unknown to Lisp - and Lisp has its own WIN32 message handling loop as above - so, messages to update directed to the video window simply were never handled and could not possibly be handled - so, I had to do it myself from Lisp Space.
>
> I was amazed and delighted to suddenly see 15fps streaming video magically appear in my CAPI application once I sorted all that out mentally - and after another case of Rum...
>
> (e) Be sure to have something that allows CAPI messages to also be frequently handled - I use a while loop around:
>
> (mp:mailbox-read control-mailbox "Waiting for Godot..." 0.0)
>
> So, I have a single loop with a finite state machine that handles CAPI buttons and all that - inside the loop is the (mp:mailbox ) with zero delay to allow CAPI message dispatching etc - and also the horrible WIN32 message handling gizmo, which needs to be triggered as fast as possible with no delays for fluid video. If you are missing one of those, then either CAPI or WIN32 will not update correctly - at least in my case.
>
>
> Anyway, I hope some of this might be of help in your endeavors.
>
> Regards,
>
> Jack Harper
> Secure Outcomes Inc
> Evergreen, Colorado USA
>
>
>
>
> At 05:20 PM 1/18/2014, Erik Ronström wrote:
>
>> Hi,
>>
>> I know this has been asked before, but I cannot find any straight answers when googling:
>>
>> Has anyone successfully displayed video content from a LWW/CAPI application?
>>
>> I've struggled with it several days now, with little success. I began with the simple solution to display html pages in a browser-pane, linking to html5 videos or simply YouTube embeds. It worked sometimes, but often the video didn't show up, or I got all kinds of error messages, sometimes from the browser and sometimes from LispWorks itself. The errors seemed to appear completely randomly.
>>
>> After that, I've been trying to use an ole-control-pane to embed a media player (WMPlayer.OCX). But it is very buggy, sometimes there is only sound and no video, sometimes it crashes, sometimes it freezes.
>>
>> As a last resort, I'm now considering building a stand-alone application in another language (such as C++) which can be opened from my LW app. But it is not very elegant, and it makes GUI integration hard or impossible.
>>
>> Any suggestions? Thanks in advance!
>>
>> Erik
>>
>>
>>
>> _______________________________________________
>> Lisp Hug - the mailing list for LispWorks users
>> lisp-hug@lispworks.com
>> http://www.lispworks.com/support/lisp-hug.html
>
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html