Play Videos?

Archives Forums/Win32 Discussion/Play Videos?

time-killer-games(Posted 2014) [#1]
Anyone know of a module or script better than the one builtin to winmm.dll? Here's the topic about that dll, but it isn't what I need:

http://www.blitzbasic.com/Community/posts.php?topic=45546

The problem is the video can't loop endlessly (as an option) and can't stretch to fill different aspect ratios and sizes. While the video control can resize, it only can if the destination size is both the same aspect ratio and a multiple of the original video's size.

DirectShow is the perfect alternative as I've seen C++ examples of what it can do but I have no idea how to incorperate that into blitzmax.

Any ideas? Thanks.


xlsior(Posted 2014) [#2]
What are you hoping to accomplish?

Do you need a generic video player that can support multiple formats, or do you 'just' need something to play a cutscene video or something where you control the file format yourself?

Which language are you trying to use it with? blitzmax, b3d, ...?

If you control the video formats yourself, then there are several video playback modules available for blitzmax: pantsonhead wrote two modules, one to play back Ogg Vorbis (MIT or BSD license, don't remember), and one for MPEG (GPL licensed). IIRC Brucey also has some video playback module somewhere in his SVN repository.


time-killer-games(Posted 2014) [#3]
I'm using blitzmax. I'm trying to create a DLL that can play videos for use in a game engine. AVI, MP4, MPG, and/or WMV are my most preferred formats.

Apparently there's a QuickTime module too but requires having quick time installed + a lot of other things that are kinda inconvenient.

Thanks for the info, I have a look at those and will get back to you. :) I've tried Brucey's video player but it can only handle OGG which isn't my preference, but if that turns out to be my only option, it's better than nothing! :)


col(Posted 2014) [#4]
Hiya tkg,

I use directshow at work and I've made complete apps and directshow filters that do all kinds of amazing things. With directshow you can play any audio or video file as long the host machine has the appropriate codecs and DS filters. It can really simple as DS defaults to using an intelligent system to create a playback graph automatically, which means that its actually quite trivial to achieve, or you can also be very specific as to which filters/codecs/media types/media formats are used for recording and playback.

Youre best to make the dll in c++, as you suggest, then use a simple c style interface as an API to the dll. In 'Max its then trivial to load the dll and create function bindings to the dll functions. If you wanted to you can then wrap those functions in 'Max Types to give you an OO style interface in 'Max.

What kind of help do you need and I'll help.


time-killer-games(Posted 2014) [#5]
Thanks Dave! Here's my current code but I have a long way to go before it will compile without errors, but it least it should show you what I want to achieve function-wise. I personally only care about AVI playback. It doesn't have to be that fancy or support that many potential codecs.



I can give you the required headers too if you need it, but it would make things more confusing as my DLL is being based on a DS video player for an open source GPL game engine known as ENIGMA. If you help me with this, and we actually get it working, I'd love to make it as an extension for GameMaker:Studio as I originally planned, but also a BlitzMax module as many people I've seen here have wanted this too.

I don't know the extent of how much you'd be willing to help me with this, any chance we could discuss this on Facebook, email, or some other means you'd prefer, I can do Skype too, whatever you need. :) Thank you so much! :D

My email is samuelvenable@... I'll check my spam folder as that's were new mailers end up :)


Brucey(Posted 2014) [#6]
What kind of help do you need and I'll help.

Heh :-)

I'd love to make it as an extension for GameMaker:Studio

It seems a bit strange, to me at least, that you continue to try to use BlitzMax to staple things to the side of GameMaker.
Maybe you are using the wrong tools to begin with, if GameMaker isn't doing what you want?
But I don't think BlitzMax is the ideal tool for making add-ons for GameMaker.

You'd probably be better off learning C++ properly, perhaps?
Or move to a product that does what you need?


col(Posted 2014) [#7]
It seems a bit strange, to me at least, that you continue to try to use BlitzMax to staple things to the side of GameMaker.


I must have missed those posts :p

I agree with the rest of what Brucey said:- if is your main goal is writing add-ons for GameMaker then using BlitzMax to do it is double the work. Youd be better off just sinking your teeth into c++, but each to their own.

On the other hand, having a little DShow module for 'Max would increase choice for the windows users for audio and video playback ( DShow is typical MS overkill and over featured ), but hey even if it is just for Windows and not for the lesser known OSs :0)


time-killer-games(Posted 2014) [#8]
@Brucey - The features I'm adding to GameMaker many users complained about because YYG dropped support for them completely. And so I'm adding it all back. I personally don't need it, but it's in high demand at the moment. As I already stated at this point I'll be doing it in c++ instead. Thanks. :)

@col so you've changed your mind about helping? It's okay, I understand.


col(Posted 2014) [#9]
Nah, ive not changed my mind at all :P if you can email the other files over it will be a doddle.

May as well make the bindings for Max too while we're at it.

edit:- the email addy is in my profile
edit2:- is there any particular reason youre saving the graph instance? do you want to playback more than video at the same time?


col(Posted 2014) [#10]
In the meantime to whet your appetite you can create and build an extremely basic player using this code...

compile this code as a dll, say with a silly name like DShowForMax.dll or whatever you want to call it.
Ive removed all of the error checking just for clarity. its VERY important to check those hr values in case something has gone wrong.


Maxcode:




Put the dll file in the same folder as the 'max exe so that the 'max exe can find it easily enough. There is a little bit of graph state checking to show you how it can be done.

It should be a good start to get you going and enough to finish up what you have tried to do so far. It will play any file format that you have codecs and filters for. You can use the same dll for all audio files too ( same applies for codecs/filters ) but you'll just need to make sure the query for the IVideoWindow succeeds or fails and skip the relevant video code path etc.

I understand that you were putting the graphs into a list but here i use a single graph for a single vid to get something up and running for you. Its trivial enough to do what you were doing before - using a list and an index etc.

Any probs let me know.


time-killer-games(Posted 2014) [#11]
Awsome! This is great! Thank you!!! BTW I reponded to your email :) I'm trying your code as we speak and I'll get back to you asap! :D

Edit. It gave me errors. Do I need VisualStudio express' headers and compiler for this? I'm using CodeBlocks and MinGW at the moment.

Edit2. Any chance you could just send me the DLL binary and VS project folder? That would be perfect! I'll be sure to credit you if you don't already mention yourself in the credits. :)


col(Posted 2014) [#12]
Hiya,

You'll need a windows sdk for definite. I dont see why it wouldn't work with express editions of studio and/or code blocks, its mainly MFC components thats missing from the express versions of studio and the sdks anyway.

I'll send you the binary and project files over now... Sent.


time-killer-games(Posted 2014) [#13]
Thank you so much for all the help col! I did a couple replies to your email be sure to check that when you get the chance! Thank you! :D


time-killer-games(Posted 2014) [#14]
This topic may be closed. Thanks.


xlsior(Posted 2014) [#15]
There is no "open" or "closed", all postings/threads can be added to indefinitely.


Matty(Posted 2014) [#16]
Unless it is locked....