Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Mi Jul 16, 2025 21:32

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 7 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Do Jul 26, 2007 10:00 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Hello,

Earlier I had asked a question in this forum about how to display video (MPEG2 originally, but AVI now) best in OpenGL, I originally wanted to port the video playing capability of my project that was using MediaPlayer_TLB and the TWMP (Windows Media Player) control across to OpenGL so that I could do some nice effects with the video. In the end, I didn't feel confident enough to go down this path - the guidance wasn't clear enough and there didn't appear to be any utility libraries that lended themself to achieving this.

So, in my project, which is now an 100% OpenGL user interface, I have resorted to using the MediaPlayer_TLB and TWMP control again. When I want to play a video from my UI, I make the TWMP control visible and full-screen, then cancel all the OpenGL rendering and play the video - illustrated below - it works well - except for one thing...

Bild

I can't seem to put anything on top of the TWMP window (in terms of the z-order)... by this I mean anything OpenGL (which is to be expected as my TForm's handle provides the device context) or anything from the VCL either. What I would obviously like to be able to do is put some form of overlay over this window... either for file information or remote control indicators (skip forwards, backwards, volume control etc.).

The TWMP control seems to take complete ownership of whatever is displayed onto the screen - no matter if you try and tell the VCL control to stay topmost. However. what would be perfect (and the best solution) was if I could either:

a) Render some OpenGL stuff to this TWMP video output window.
b) Copy the TWMP window stuff to an OpenGL window and display it with other stuff I render.
c) Come up with a better way of playing AVI video files in OpenGL properly.

Any ideas out there?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Jul 26, 2007 10:57 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
I think the ideal way is to cancel the use of TWMP. Its an additional window and mostly its using DX or some overlay technics. So its nearly impossible to do some funny stuff with it.

When i remind me right you can use directly DirectShow (TWMP may use it too). With DirectShow you must set an CallBackfunction and when this function will called you get the Pixturedata from the current frame. This data you can upload as texture and so you can display it fullscreen in you application or as an cover like on your screen.

But i dosn't done this before. So i don't know the handling of directshow. Maybe the following links can help you.

An small Code
http://www.delphigl.com/forum/viewtopic.php?p=34095#34095

and the resulting project of hackbart
http://www.delphigl.com/forum/viewtopic.php?t=4548

PS: The Callback from DirectShow is executed in an other Thread so you MUST synchronize them with your opengl thread. Otherwise opengl dosn't display anythink of your video. You should copy the video data into an seperated buffer and use this buffer in the openglthread to update the texture.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Jul 26, 2007 12:05 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Thank you; that was quite successful actually.

Well, I download hackbart's library project, and it compiles. I downloaded the Test project and that works. It opens an .AVI file, and plays it, with sound and everything - very nice. Opens up an "Activemovie Window" that is the same size as the video; seems to be using OpenGL too; haven't yet figured out how to make it full-screen programatically or anything like that (except by maximising the window of course, but then I still have a border), and I think it would require some further investigation to just get to the point where I am currently with TWMP.

I really do like the idea of removing TWMP; but I need to assess whether the time that I will invest in figuring this stuff out will allow me to achieve my aims... i.e. 1) the overlaying of information on the video playing window and 2) in the end I might like to 'alter' with the contents of the video window with OpenGL scaling and transformations.

Sounds like quite a lot of work to make progress here. Has anyone made further progress on this I wonder.

I haven't even yet figured out where it creates an actual window for rendering the video. I would obviously like to be able to tell it - render to my existing OpenGL device context if possible. Seems, to me, it would be somewhere in the depths of the "LoadFromFile" procedure (code prettified to my tastes!):

Code:
  1.   CoCreateInstance (CLSID_FilterGraph,Nil,CLSCTX_INPROC,IID_IGraphBuilder,dsGraph);
  2.   Renderer := TPreviewRenderer.Create (DataCallback);
  3.   if (Assigned (Renderer)) then
  4.   begin
  5.     dsGraph.AddFilter (Renderer,'Renderer');
  6.   end;
  7.   dsGraph.RenderFile (PWideChar (WideString (Filename)),Nil);
  8.   dsGraph.QueryInterface (IID_IMediaControl,dsMediaControl);
  9.   dsMediaControl.Run;
  10.  

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Jul 26, 2007 12:24 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Actually, found out that just the Test.dpr works on its own apparently - plays videos anyway. The other stuff is extra? Can anyone tell me what the idea behind it is?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Jul 26, 2007 13:08 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
After playing with this for a little bit, I have come to the conclusion that I have missed the point or I have confused myself.

The Test.dpr plays a video file but... if you cut out large parts of code, i.e. remove "RenderScene", remove the TTimer, the "DataCallback" - then it still plays the video - so this code is obviously not being used at all to play the video. It was in the "RenderScene" where I saw the expected calls to "glBegin (GL_QUADS);" and "glTexCoord2f" and "glVertex3f" - and I thought that my first simple challenge would be to flip the video by altering some of these calls.

Sadly, it had no effect - because it is never being called. The cut-down version of Test.dpr looks like it could be amount to about four lines, just to play a video in a window - as it does already:

Code:
  1.   CoCreateInstance (CLSID_FilterGraph,Nil,CLSCTX_INPROC,IID_IGraphBuilder,dsGraph);
  2.   dsGraph.RenderFile (PWideChar (WideString (Filename)),Nil);
  3.   dsGraph.QueryInterface (IID_IMediaControl,dsMediaControl);
  4.   dsMediaControl.Run;
  5.  

I've obviously not got the hang of this. I think this video is being played in the ActiveMovie window and not on an OpenGL device context. So, I'm really not achieving what I wanted to achieve. There must be steps I am missing completely. If there is anyone out there who has successfully used this code to, say, play a video file upside down in an OpenGL window - that would be great to understand.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Back Again!
BeitragVerfasst: Sa Aug 18, 2007 19:49 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
I'm back again - after being called away for work for a while - and I still want to see if I can get .avi video being rendered with OpenGL.

Last time I asked this I was pointed to the glRender.zip and Renderer.zip files. I unpacked the glRender.zip to have a look at the Test.dpr file - it compiles simply enough - run the program, you get a file open dialogue - open an .avi and it starts to play in an ActiveMovie window - close the parent form and the video stops.

Brilliant - I'm very happy with the ease with which an .avi is displayed without seeming to use the TWMP (Windows Media Player control). Except, I can't figure out what it's really doing and why there appears to be loads of OpenGL code in there that doesn't really seem to do anything. If I remove the RenderScene; call from the TTimer, then the .avi still plays in the ActiveMovie window - all is exactly the same as before - except it is the RenderScene; procedure that does all the OpenGL stuff and once that is removed, well - that is obviously not being called anymore - so confusion on my part.

It looks to me, like its referencing a texture (I'm assuming this would be a single frame of the .avi file) and drawing it with GL_QUADS - but where? Where is it trying to draw it? Does it draw it for anyone else out there who can ran this simple test that the author provided?

I'm obviously just scratching the surface with this - I have looked at the Renderer project too. This is much more complicated and seems to go way over what I'm simply trying to do. It compiles - I moved my graphedt.exe into an appropriate folder (C:\Programme\GraphEdit\graphedt.exe') and the program ran OK - I selected an .avi file to render - and it played it - once again in an ActiveMovie window. Again, the TTimer that calls RenderScene; on the form with caption "OpenGL Video Renderer" is actually never called it seems.

On top of all that - to boot - I'm not even sure how this program is working - never mind what it is doing - or how it is doing it. The window that appears when you run the program is the graphedt.exe window - I can't even figure out how it's being called and told to run... apart from the fact that "C:\Programme\GraphEdit\graphedt.exe" is the local run parameters - sad, I know!

Appreciate any help out there from folk who've managed to use this code to display an .avi file via OpenGL - especially if you've done flipping and scaling of the GL_QUADS that you'd expect a frame to get displayed with too - and I'd be even more appreciative if you could share an example.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: ?
BeitragVerfasst: Sa Aug 18, 2007 19:59 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Random guess... this is about that callback and thread comment made by Lossy eX about four entries above, isn't it?

Well, I'm truly stuck.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 7 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.009s | 16 Queries | GZIP : On ]