Anyone have any ideas?
Create a C Structure that has all the frame information in it
Make a loop and then read each frame into the structure then pass it to your
display function, not forgetting to pause.
I don't actually know what to do with sound. But I assume it is something
similar. Is the sound synced to the frame or is it a separate stream that
runs at a different rate?
Sound data synced to frames
+-------------+ +-------------+ +-------------+ +-------------+
| | | | | | | |
| Frame 1 | | Frame 2 | | Frame 3 | | Frame 4 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
+-------------+ +-------------+ +-------------+ +-------------+
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
|Snd 1| |Snd 2| |Snd 3| |Snd 4| |Snd 5| |Snd 6| |Snd 7| |Snd 8|
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
Sound data not synced to frames
+-------------+ +-------------+ +-------------+ +-------------+
| | | | | | | |
| Frame 1 | | Frame 2 | | Frame 3 | | Frame 4 |
| | | | | | | |
| | | | | | | |
| | | | | | | |
+-------------+ +-------------+ +-------------+ +-------------+
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
|Snd 1| |Snd 2| |Snd 3| |Snd 4| |Snd 5| |Snd 6| |Snd 7| |Snd 8|
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
Richard James
Well yeah, making a movie player like that is easy, but I think I asked my
question wrong.
I mean a movie player which supports some well known format, so artists can
create lets say an avi out of a flash movie for instance. Im kinda hoping
that its possible to write a movie player that supports avi files where the
movie isnt compressed at all.
There are open source solutions which already exist to play virtually
all popular movie formats.
--
LTP
:)
>>> What is relatively the easiest way to write a movie player? This is for
>>> an embedded platform.
>>> The movie does not have to be compressed as long as it can be streamed
>>> from a flash card
> Well yeah, making a movie player like that is easy, but I think I asked my
> question wrong.
> I mean a movie player which supports some well known format, so artists
> can create lets say an avi out of a flash movie for instance. Im kinda
> hoping that its possible to write a movie player that supports avi files
> where the movie isnt compressed at all.
Are you asking does AVI support uncompressed movies? The answer is yes. AVI
is a container format, it does not specify how movies are encoded.
see
http://en.wikipedia.org/wiki/Audio_Video_Interleave
As for writing such a player yourself, you are probably reinventing the
wheel. Most platforms and frameworks have players for AVI format videos or
mpeg ones. e.g. DirectX, SDL etc.
Richard James
i can only find some which only run on mac, windows or linux. Arent there
any platform independant ones written in C?
>i can only find some which only run on mac, windows or linux. Arent there
>any platform independant ones written in C?
Nope. Your question reveals a deep misunderstanding of the C
language. There is *NO* built-in support for graphics, sound, or any
other sort of multimedia in the C/C++ programming language. [Well,
ascii art might be doable, but that usually needs help, too.] Under
C/C++, all sorts of multimedia are done not by the language itself,
but by addon libraries -- e.g. DirectX on Windows, OpenGL on other
platforms, etc. The core language is deliberately minimalist in what
it supports, which is one of the major reasons why C/C++ have taken
off.
Bottom line: you're going to need some 3rd party code to talk to
any sort of framebuffer. If you're using Windows, Mac, or Linux, this
has been done. If you're using a more obscure platform, you'll need to
write your own -- especially because you're more limited in CPU and
RAM than the 'big 3'. You can look at animated GIFs as a possible
starting point, but it's likely to be a lot of work from here.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
>
> i can only find some which only run on mac, windows or linux. Arent
> there any platform independant ones written in C?
>
I doubt such thing as hardware accelerated (-aided) graphics can be
completely platform-independent. You might have a look at SDL...
I know that, but I do think its possible to do it platform independant, just
the display code will have to be different over platforms. Why cant you ask
for a get_next_frame() and get a void * or char * back with the size
information etc that you can use to display the frame.
I made a movie player like that you have a directory full with bitmaps named
1.bmp, 2.bmp and you just loop over them with
for(i = 0; i < x; i++) { load_bitmap(i); plot_bitmap(i, x, y);
destroy_bitmap(i); }
very platform independant, only the actual plotting is platform dependant :)
this looks nice for small images, even on 40mhz processor, but breaks down
on 1024x768 images of course.
Thats why I'm looking for a library or something before trying to write this
myself. If there isnt one, maybe here's a good way to make some money lol
Sorry, but this sounds like you happen to have a solution that
worked for you, and think it'll apply to everyone. There's just too
much variety of hardware for this to be meaningful. Consider pixel
formats: some systems only push 8 bit color. Some are 16 bit, in 4444,
5550, 5551, or 5650. 24/32 bit have RGB vs BGR ordering issues. Then
there's alignment and other issues. You can try to sweep these
differences under the rug, and say it's up to the display code to
reformat the color information, but that's going to have severe
performance problems on slower systems, compared to doing that in the
middle of your decode. You're going to thrash your cache if you have
to flip BGR to RGB as a second pass on a decompression buffer.
To decompress things *well* and *efficiently*, you need to know how
the hardware (or graphics API) expects the data. And that's why C/C++
properly say just about zero when it comes to multimedia. The
implementation details are just so significant that they need to be
considered. And therefore, multimedia shouldn't be part of the
programming language, but code to make multimedia happen can be
written in that language.
yeah true, the advantage of systems like this is that you can just write to
one particular hardware configuration which will always be the same. Guess
I'll write own then.
> >>>>> What is relatively the easiest way to write a movie player? This is
> >>>>> for
> >>>>> an embedded platform.
> >>>>> The movie does not have to be compressed as long as it can be streamed
> >>>>> from a flash card
> > i can only find some which only run on mac, windows or linux. Arent there
> > any platform independant ones written in C?
> Doesn't VLC (found atwww.videolan.org) fit all the criteria here?
> *Open source
> *Platform independent
I think he means "platform independent" as in not needing
any platform at all (no OS). I have no idea if VLC would
be useful for him. Maybe. Another option might be
mplayer, which I know has been stuffed into really tight
spaces; for example geexbox:
http://www.geexbox.org/en/index.html
Isaac Kuo