|
1. Thanks - now I know what @ does (I added it before posting that message. I always use \\.
The problem was found by myself - lOl.
I had a problem with Initialise method, but I solved the problem and now It works fine.
Thanks for help anyway
|
|
|
|
|
Will this work on Xbox360 too?
|
|
|
|
|
I have not tested the class on the XBox 360 (Since I don't own one...), but it would be interesting to try it. It does use the "Third-Party" DirectShowLib-2005.dll, which may be a problem (or not, since it is Managed code). Anyway, there is no harm in giving it a try! Please let me know how you make out, if you do decide to experiment.
|
|
|
|
|
I dont own Xbox360 too, and thats why I'm asking.
|
|
|
|
|
Thanks for sharing this. This will definitely help with some future projects I have planned.
|
|
|
|
|
Gr8 article.
Can anyone provide me url where to find sourcecode for compressing and uncompressing video frame with H.264 algorithm.
Thank you.
|
|
|
|
|
|
Due to popular demand I have extended the VideoTexture class to now consume .avi, .mpeg, .wmv video clips as well as live video. This update has been sent to CodeProject today (30 July 2007), and should be available in a couple of days. Thanks to alexreg for his assistance and encouragement.
|
|
|
|
|
Great job with this... it seems to be working for me (although it actually displays from my TV tuner, since I don't have a web cam), and the code is well structured and documented. I'm be really keen to see if you'll produce a version of this that renders AVIs/MPEGs. This is something I'm desperate to include in my XNA game. Perhaps I'll play around with it, and let you know if I get it to play back video.
|
|
|
|
|
Thanks for your comments. I have had several people ask me about extending the class to play AVI's or MPEG files. This should be quite doable, and perhaps I will take a look at the problem this weekend. Cheers!
|
|
|
|
|
Sounds great... and just let us know please if you'd like us to put any notice/license in the game, apart from the DirectShow.NET one.
|
|
|
|
|
I have taken a look at adding support for playing video files as textures this morning, and I have something working fairly well. I am in the process of refactoring it to accomodate the additional complexities of starting, pausing, looping, positioning, controlling playback rates, and so on within the VideoTexture class itself - things that were not really needed for live video. Also, I am trying to work through the problem of handling DirectShow graph events without using a windows control in the class; it is a bit tricky, and a bit ugly, to manually use the MediaEvent.GetEventHandle() method with a kernel32.dll pInvoke to WaitForSingleObject, but I have not been able to figure out anything clean for it... It will take a few days (from today) to update this CodeProject page; Send me an email if you are keen to get the work-in-progress (StephenBognerATshawDOTnet) and I will send you what I have.
As far as notice/license goes, all this stuff is Open Source or Public Domain; so use it as you see fit, at your own risk. As far as credit goes, none is required. I could not do any of this programming without the generosity of others showing me how over the years; I am just trying to give back a little bit.
Cheers!
|
|
|
|
|
Great to hear you've made progress so quickly. I'll be thanking you hugely when I get this in my game! I should be able to wait a few days, as this isn't integral to the immediate development of what I'm personally working on, albeit something very useful. If it ends up taking longer, that's not a problem of course, but I may just get curious enough to see the in-progress code... Also, I originally tried to write something like this myself, and I felt the same way about being forced to use the Windows message loop and a control to receive event feedback. I'd thought that I'd actually found another solution to it, in fact. I'll send you an email letting telling you about it (if I can dig it out from my old project or wherever it was).
(P.S. I'll be more than happy to credit you for this, so just let me know if you don't want your name to appear - that's really a side point for the moment though...)
|
|
|
|
|
File playback is now working, with the following issues:
1. The playback rate seems to be too fast, and I have not been able to control the speed of playback using MediaSeeking.SetRate() or MediaPositions.put_Rate() because these methods are apparently not implimented in DirectShow.NET (at least that is the exception that is raised). Maybe I will have to write my own method to step through frames at a known rate... This is probably a good idea for a class that will be used for a VideoTexture anyway, since it is very likely that users will want to control the rate at which the texure flows over the geometry anyway.
2. I have implimented event capture using MediaEventEx.GetEventHandle() and Kernel32.WaitForSingleObject(), but it only captures the first event (ClockChanged), and does not want to reset and send additional events (like Completed, which I am watching for to enable looping). I will have to hit the net to see what I am doing wrong...
3. As an alternate approach, I set up a timer to call my HandleGraphEvents method at regular intervals. Not as efficient as only calling it when events are raised (like in 2), but I don't need to use the Windows message loop. It also works, but again it only reports the ClockChanged event, and nothing else - including the Completed event, which I think should obviously be raised at the end of the clip. I have to confess that I am a bit confused about why polling MediaEventEx.GetEvent() is coming up dry... Any thoughts?
|
|
|
|
|
Update: I tested with a few calls that generate events, and sure enough both techniques were capturing the events as expected. The problem is that I am still not getting the "Completed" event when the clip finishes. Don't know why yet. Later...
|
|
|
|
|
Hi - I've been trying to send you some sample code on how to get events working with the video and DirectShow, but it seems that your email isn't working. I've tried twice now and received Delivery Notification Errors both times. Anyway I've uploaded the code to my FTP server - http://www.blueprintgames.com/developers/alex/misc/DxPlay.zip - if you'd like to take a look. I believe it's all working, since it's part of a sample library for DirectShow.NET. Good luck!
|
|
|
|
|
Thanks. I got it, and have used the event notification technique from it. It gives the same outcome as the WaitForSingleObject technique, but no P/Invoke is needed. I am still not getting the "Complete" event, so I am still trying to sort out looping. Also, Run, Pause, Stop are behaving badly... More work needed...
|
|
|
|
|
Hmm... these seem like fairly major problems. I wonder if there's just part of the setup code that's causing all this. Well if you're still stuck on this soon feel free to send the working code to me and I'll see what I can do.
|
|
|
|
|
Hey, just checking up on your progress with the code again. If you're really stumped, feel free to send me an email as I've mentioned, otherwise it would be good to hear how you've sorted our these issues.
|
|
|
|
|
Thanks for the offer of help; I am still stumped on the reason why I am not getting the "Completed" event when I think I should, and any hints would be welcome. Let me clean up some of the junk from my working code, and I will send it to you.
I have however made (fairly) good progress on the rest of the issues after digging into the DirectShow documentation and trying a half dozen different variations on the filter graphs to see if I could get some of the "not implemented" functionality with a different combination of filters. I have working graphs for .wmv and .avi; I have not tested .mpeg yet.
|
|
|
|
|
I have solved the issues that I was having, and have a working VideoTexture, VideoComponent, and xnaVideoViewer classes. The software is now able to create VideoTextures from live video, and .avi, .mpeg, and .wmv files. I will try to update CodeProject with these classes within the next day or so, but in the meantime I will email you the project zip. Cheers!
|
|
|
|
|
Hi Alex;
I have sent an updated article (including the new code) to CodeProject tonight, and I would like to send you the code as well since I am not sure how long it will take for the fresh article to appear here. However, your CodeProject email is not working because you have "not confirmed your email". If you send me email at StephenBogner@shaw.ca I will reply with the .zip of the project.
Thanks for your interest, and help. Cheers!
|
|
|
|
|
Hi again,
I sent an email to you several days ago, but I'm not sure if you received it...
Anyway I've just resent it using the email facility of CodeProject.
Alex
|
|
|
|
|
|
Thanks for your comments. I hope people find the class easy to use. When I find the time I may extend it to play video from files, since I know this is also something people have been looking for. For my own work, I have only been using live video streams so far. By the way, I think your tutorials are great!
Steve.
|
|
|
|