View Full Version : Playing Video
DarknessX
19-05-2007, 09:02 PM
System: Windows XP
Compiler/IDE: FPC
API: Any
How/What would I use to play video in my Pascal Program? Is there any particular engine which supports this?
And can it be used in text-based mode?
imcold
31-05-2007, 10:53 PM
For mpeg-1 video you can use the smpeg library. Pascal headers and example console player are part of jedi-sdl.
jasonf
01-06-2007, 12:03 AM
Mate, I'm sorry, but why is this in the Help Me! section?...
You need to research this a bit more, or tell us what you're doing.
Help Me is the Bat Phone... If Mayor Gordon called Batman on the Batphone every time he couldn't find his socks, then Batman would ignore the batphone and Gotham City would be doomed.
This is a socks post mate. Mayor Gordon should have opened his sock drawer or looked in the tumble drier.
If you want to play video, you should really look into how video is played using the API for the platform requirements you're looking at.. not just stab in the dark and ask in the Help Me forum without thinking about how this might be done for yourself.
You say it has to work in text-based mode? Why is this?
There are Video codec's I've seen for Linux which convert raw video footage into ASCII if that's what you want, but I don't think it's what you mean... if you want to play video in a low resolution, then you should be more specific if it needs to be cross platform or run in DOS or whatever, you should say.
This is not a flame or a personal attack so please don't feel like I'm having a go at you. I really do want to see you do well and produce good games, also to be able to contribute to this community. All of which will be really cool. So please, give us more information and to do that, please take a little time to research a little more and then you'll be able to post in the relevant forum.
DarknessX
01-06-2007, 12:12 AM
Well, the thing being, is I am absolutely new at ANYTHING aside from plain old 'outdated' pascal. I don't know OOP, this is my first language, and I am what you might call a "noob".
Now, imcold answered part of my question, but I need to stick to non-graphical pascal, and be able to play a regular movie, IE, in a dos-box, play a video, like .mpeg or whatever. But, as I said, I wasn't stating that as a requirement. I have alot to learn in pascal yet; and if absolutely necessary, I will learn OOP. I've learned enough OOP to be able to read the code and half-understand it to make a translation to non-oop, but once you get me being forced to use blah.oop, it doesn't work, cause I've no clue how to... convert that.
Research on the topic is something that is not easy. I could google video "pascal" for hours and not find anything. I did notice Jedi-SDL played videos, just recently, but still can't even get Jedi-SDL to play me music. So... Sadly, I think videos are out of the question right now.
jasonf
01-06-2007, 12:48 AM
It looks like you've got yourself a hangup about Object Orientation, with a fair dose of The Fear to boot..
Objects Orientation is not hard or scary.. and unfortunately, unless you plan on working procedurally for the rest of your days, it's something you're going to have to work on.
Object Orientation is very very simple, it's just a slightly bit different to the procedural stuff you're used to.
Think of it as a way to wrap the data for something and the means to manipulate that data all up in a nice safe parcel.
It's exactly the same as creating a bunch of global functions to manipulate some data but instead of passing data to these functions, they already have the relevant chunk of data they're supposed to be working with.
Once you learn how to use OOP, you will wonder why you ever did anything else.
I used to be the same... I'd never done OOP until I started using Pascal (VB6 doesn't promote decent OOP, so I stuck with procedural coding)
Just think of it as a bunch of black boxes which handle a particular part of the functionality for your game. The only data they have is the data you pass to them and they have no way of messing up anything else.
It is a mind shift though... but a worthy one..
Trust me, there is nothing to be afraid of.
Once you're free from this OOP fear, you will be able to do anything.
DarknessX
01-06-2007, 12:54 AM
I think I agree, but I think (not trying to say your wrong, as you probably are right) that my problem lies more in the fact I'm not... eager to learn a new language. When I first started learning pascal, my first app was a 'diary' which you could record things with. It sucked, but it was something. I was all proud, but that was ALL I did for an entire year. I looked at some tutorials for a few minutes here and there, and eventually, I learned enough that I could learn without a tutorial. Now, I need to do the same with OOP.. It really helps that I already know pascal though :D
jasonf
01-06-2007, 01:11 AM
Well, if you want to learn any programming language apart from VBScript, you need to have an understanding of OOP.
Java, VB.net, C#, C++.. even JavaScript and Php to a point..
Right here's the quick & Ugly version..
You define your class based on the syntax of the language.
TDude = class()
Private
IDNumber : string;
Name : string;
Public
constructor create( Name : string; IDNumber : string );
end;
then in your code.. procedural or otherwise, it's the same..
Var
CurrentDude : TDude;
DudeList : TSomeCollectionClass;
Begin
DudeList := TSomeCollectionClass.create();
CurrentDude := TDude.create('Savage','D0001');
DudeList.add(CurrentDude);
CurrencDude := TDude.create('Technomage','D0002');
DudeList.add(CurrentDude);
end;
All this does is the same as create a record with name and ID, but now this data is completely self contained.. you don't need an array or anything, you can pass it around.. better still, you can create methods (Class procedures) to work with the data inside the class...
You'd do well to research this, I've typed so much because I'm keen for you to learn this stuff.. I believe it'll really help you.
DarknessX
01-06-2007, 01:29 AM
Thanks! I've looked around, had an amazing one-page tutorial all on making constructors, destructors, the create/destroy, override, all that blah.. Only to lose the shortcut in a FireFox crash. I appreciate the help, though. I'll try to re-find that tutorial.
imcold
01-06-2007, 05:26 AM
... but I need to stick to non-graphical pascal, and be able to play a regular movie, IE, in a dos-box, play a video, like .mpeg or whatever.
It's a console mode app... no graphical thingies, it just opens an output window for video, but in other ways it's a classical 'dosbox' app.
Screenshot (http://img183.imageshack.us/my.php?image=smpyn9.png) (I used a slightly modified version... it prints some additional info)
For compiling, you need these files:
jedi-sdl.inc
ogg.dll
sdl.pas
SDL_mixer.dll
sdl_mixer.pas
smpeg.dll
smpeg.pas
SMpegPlayer.dpr
vorbis.dll
vorbisfile.dll
Compile with: fpc -Sd smpegplayer.dpr
Also, no OOP. But if you're just beginning with SDL (and supporting libs), I think you could be a bit confused by the code. You can read some sdl/pascal tutorials first and return to it afterwards. I hope this helped a bit.
JSoftware
01-06-2007, 05:51 AM
Help Me is the Bat Phone... If Mayor Gordon called Batman on the Batphone every time he couldn't find his socks, then Batman would ignore the batphone and Gotham City would be doomed.
This is a socks post mate. Mayor Gordon should have opened his sock drawer or looked in the tumble drier.
No drunk-posting in the 'Help Me!' forums! :P
On topic: Do you want to display the video in some sort of ASCII-art rendering or have some sort of video rendering window?
jasonf
01-06-2007, 09:04 AM
Yeah, I'd had a couple :drunk: :D apolgies, if it's any concilation, I've got a bit of a headache this morning :doh:
DarknessX, I hope you didn't take my comments in a negative way. Good luck with your game.
DarknessX
01-06-2007, 10:44 AM
imcold: Wheres the file? In the SDL code? Or elsewhere? lol :P
Jasonf: No problems.
imcold
01-06-2007, 01:09 PM
imcold: Wheres the file? In the SDL code? Or elsewhere? It's a part of jedi-sdl (http://sourceforge.net/projects/jedi-sdl/), it's exactly here (http://jedi-sdl.cvs.sourceforge.net/jedi-sdl/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dpr?revision=1.2&view=markup). You'll need the whole package to build it, and some libraries to run it too: sdl, sdl_mixer, smpeg. They should be somewhere on the official SDL site (http://libsdl.org).
DarknessX
02-06-2007, 06:45 PM
OK, thanks imcold. Exactly what I needed. Once I get my memory problem with BASS fixed, I'll see about doing that :)
GuyWithDogs
13-06-2007, 03:52 PM
Now, I need to do the same with OOP.. It really helps that I already know pascal though :D
http://delphi.about.com has a tutorial on programming in Delphi that might help you out. You can download the files, or get it sent via email. Hit that site and check the links on the left.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.