Lisp HUG Maillist Archive

Video in LWW

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


(Eric) Re: Video in LWW

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


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


Re: (Eric) Re: Video in LWW

One question though: did you use any of CAPI's wrapping functionality (such as the ole-control-pane) which you then could manipulate through Win32 API calls? Or did you create all new windows/controls "from scratch" using the Win32 API?

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


Re: Video in LWW

Erik Ronström <erik.ronstrom@doremir.com> wrote:

> Has anyone successfully displayed video content from a LWW/CAPI application?

Have you considered using Microsoft's Media Control Interface (MCI) API?
Playing around with 'mciSendString' looks like an easy way to get started.
You'd probably have to write your own FLI definitions, but that shouldn't
be too difficult.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd757151%28v=vs..85%29.aspx

Arthur

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Video in LWW

I would not qualify this as LispWorks problem

Long time ago I rewrote apple frame grabber example in Haskell for instance (minimung project on Hackage)

You can check that out

It boils down to bridging some grabber apis and having way to bitblt the region (which is in LispWorks AFAIR)

And since you have decent language everything should run as fast as you want it to ;)

On Sunday, January 19, 2014, Erik Ronström <erik.ronstrom@doremir.com> 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

Re: (Eric) Re: Video in LWW

Tja! Erik -

No, I kept the thing absolutely as simple as I could - plus, I have never really worked with the ole-control-panel & friends.

What I have is not very pretty Lisp at all - Looks, of course, like C written in Lisp. Sort of like writing C in FORTRAN-style 30-years ago :(

But, it works! :)

Everything directly related to the real-time streaming video is built "from scratch" using FLI'd calls into the WIN32 morass.

Regards,

Jack

ps - "An exercise for the student..."  It would be useful for someone to, somehow, add such video things to CAPI as a new pane class etc. However, I really don't see exactly how to do that as, at least in my case, the streaming video window is, in fact, just that - a new WIN32 window. Perhaps, that is what a pane is - not sure - but, that would make sense. Perhaps doing that would not be as difficult as I might think. I was not able to spend any time on that as I have seventy customers out in the wild clamoring for the webcam addition...



At 02:24 AM 1/19/2014, Erik Ronström wrote:

One question though: did you use any of CAPI's wrapping functionality (such as the ole-control-pane) which you then could manipulate through Win32 API calls? Or did you create all new windows/controls "from scratch" using the Win32 API?

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

Re: Video in LWW

At 04:52 AM 1/19/2014, Yakov Zaytsev wrote:
><snip>
>
>It boils down to bridging some grabber apis and having way to bitblt 
>the region (which is in LispWorks AFAIR)
<snip>


....and, the common bits path is/can be the clipboard...

Regards,

Jack Harper
Secure Outcomes Inc
Evergreen, Colorado USA

ps - In my webcam case, the WIN32 video routines include one that 
displays the real-time streaming video in a separate alien WIN32 
window - unknown to CAPI - and so I do not have to copy the streaming 
image into Lisp Space for fast fluid updates. I only copy the frozen 
single frame image that I am interested to mangle inside CAPI.




_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:34 UTC