Commit d784ee7a authored by Donald Haase's avatar Donald Haase
Browse files

Initial commit from vcdc-0.2-src

parents
If you're not set up with a recent-ish KOS (1.3.x) then get set up with that.
Easy-to-follow instructions can be found at:
http://cadcdev.sourceforge.net/softprj/kos/dcsetup.php
The makefile for this project is in the src directory (this_dir/src).
There are probably other files named "Makefile" in other folders. Those
should be safe to delete.
(If you're experienced with DC development, you can probably stop reading
at this point.)
Once you are set up with KOS, bring up a shell, navigate to the directory where
KOS resides (many of us keep it in /usr/local/dc/kos and I think that's where
Jim Ursetto's build script puts it) and type . ./environ.sh
(that's .<space>./environ.sh). Change to the directory that holds your makefile
and type 'make all dist' to build your elf, create an unscrambled bin, and
create a scrambled 1st_read.bin. If you don't end up with a 1st_read.bin,
you'll need to compile scramble. Scramble.c resides in the same directory as
the Makefile, so 'gcc -o scramble scramble.c' should do the trick (or, if you're
a cygwin user, 'gcc -o scramble.exe scramble.c').
That should be it.
What's What:
-libmpeg2 is the MPEG video decoding library.
-libvo is the video output library that comes with libmpeg2.
-mpglib is originally a small package based on and distributed with mpg123,
but this version is based on one I amputated from LAME, and had to carry a few
bits of LAME with it. This decodes MPEG audio. The version I'm currently using
also contains functions from mpg123 to downsample audio (for example, 2to1--
audio encoded at 44100Hz will play back at 22050Hz).
-vcdlib is the guts of our (S)VCD playback and contains functions for navigating
VCD Playback Control Items. The libvcd.h header file in the include directory is
almost 100% code taken from vcdimager and libcdio.
-src includes the demuxer ripped from mpeg2dec and the browser from GhettoPlay,
modified of course. The important file here if you're using this for a new
program is mpeg2play.c. This file is where you'll find the demuxer and the
functions that interface with the decoding libraries and output libraries.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
This started as a basic MPEG video and very basic VCD player, but now supports (or
at least tries to support) most of the more advanced features of VCD 2.0 and SVCD
(see the bottom of this file for exceptions). It should work with MPEG-1 and MPEG-2
video with reasonable (VCD/SVCD) resolutions, and MPEG layer 1, 2, and 3 audio
(tested with layers 2 and 3).
Please keep in mind that it is impossible for me to test for every possible scenario
a person could create when authoring a (S)VCD--there are definitely bugs in this player.
Odd behavior should be expected from time to time.
I'm pretty much adding to this file as I add to the project, so please forgive any
repetition of information.
THIS PLAYER PLAYS:
-----------------
*(S)VCD (real discs or bin/cue files produced with the GNU VCDImager suite)
**MPEG-1 and MPEG-2 program streams (*.mpg, *.mpeg)
MPEG-1 and MPEG-2 elementary video streams (*.m1v, *.m2v)
MPEG elementary audio streams (*.mp1, *.mp2, *.mp3)
Dreamcast Sofdec movies (*.sfd, untested and won't play audio)
Playstation2 pss movies (*.pss, barely tested and won't play audio--this may change)
*Not all features are implemented, and SVCD is largely untested. If using bin/cue files,
the cue sheet is not needed.
**I have found that certain files (eg, some from the Prelinger Archives at archive.org)
didn't play well in the 0.1 and 0.1a releases. The video playback was too slow (~20 fps
on the videos I had this problem with) and the audio would have a funny echo effect. This
is not a bug in the player. I found that these files do not contain B-frames, which the
player typically skips if it is falling behind. Skipping other frame types (eg, I-frames
or P-frames) will render your film unwatchable because these frames are used to construct
the next P- or B-frame. Playback speed has been improved in this version by handling the
audio and video output routines more efficiently, but it is possible that this problem is
not totally a thing of the past. If you suspect that your video lacks B-frames and is not
playing back well, the best remedy is to re-encode your files with TMPGEnc or similar to
conform to VCD standards and they should play back fine.
To save time, only re-encode the video and then multiplex the original audio with your
new *.m1v video file.
Also note that if you have video with a large picture, it's quite possible that the player
simply can't keep up even when skipping B-frames (it's a Dreamcast, not a PC, after all).
If this is the case, you may want to try resizing the video and/or using a lower bitrate.
The KVCD notch quantization matrix should allow you to produce decent-quality videos with
low bitrates with any software that allows you to use a custom quantization matrix. TMPGEnc
allows this and there are KVCD templates available for TMPGEnc. I'm too lazy to look up the
link at the moment, but Google is your friend. Please note that using high resolutions as are
commonly used with KVCD is probably not a good idea--I suggest that you keep the resolution at
352x240 for NTSC or 352x288 for PAL videos.
CONTROLS:
--------
In the menu:
-DPAD-UP/DOWN browses the menu.
-Y adds the selected file to a playlist.
-A plays a file/playlist or opens a folder.
-X gives you a rather crappy-looking settings menu.
-DPAD-LEFT/RIGHT change the settings in the settings menu.
-START will replay a VCD.
In a movie:
-A will pause/resume.
-Y will stop* and bring you back to the menu.
-Analog right will fast-forward.
VCD-only controls:
-D-Pad Right will skip** to the next chapter (or the 'next' item defined in the current PSD item).
-D-Pad Left will skip** to the previous chapter (or the 'prev' item defined in the current PSD item).
-B will display/hide a numerical entry box in the top right-hand corner of the screen, as well as
a pointer (controlable with the analog stick) if there are hotspots in the current PBC item.
-D-Pad Left/Right will increment/decrement the avobe-mentioned number by 1.
-D-Pad Up/Down will increment/decrement the number by 10.
-A will enter the chosen number and close the numerical selection box (or pause if that box is closed).
-START acts as the 'Default' button on a VCD remote.
-X acts as the 'Return' button on a VCD remote.
*If you're playing a playlist, Y will skip to the next movie in your list.
**This version will be released once VCD 2.0 playback control (PBC) has been figured out.
This will allow for MPEG stills and menus, but chapter skipping will most likely feel a bit
"off" with PBC enabled. It's not a bug--it's due to the way selection lists/playlists work
and any sort of workaround would be far from perfect. There is a menu item to turn off
PBC if it annoys you. See below for a brief description of PBC and why it might not feel right.
CREDITS
-------
I've used code from, based my code on, or consulted code/docs from the following projects:
(most are either the latest released tarballs or the current CVS/SVN as of June 2006 unless otherwise noted
with a particular version number):
mpeg2dec/libmpeg2 0.5.1 (and 0.4.1-cvs originally): http://libmpeg2.sourceforge.net/
a52dec: http://liba52.sourceforge.net/
mpglib from LAME, and a few other bits of LAME that were needed: http://lame.sourceforge.net/
mpg123: http://www.sourceforge.net/projects/mpg123/
mpadec: http://mpadec.sourceforge.net/
lvfdc: http://la.cible.free.fr/DreamCast/Libvfdc (earlier port of mpeg2dec to DC)
vcdimager 0.7.23: http://www.vcdimager.org/
libcdio version 0.77: http://savannah.gnu.org/projects/libcdio/
xine/xine-vcdnav: http://sourceforge.net/projects/xine/(deprecated xine cvs repo, _not_ Mercurial)
KallistiOS 1.3.x (Latest SVN as of 7/31/2008) : http://cadcdev.sourceforge.net/
GhettoPlay Vorbis (KOS example): http://cadcdev.sourceforge.net/
DCDivX beta 4: http://corecodec.org/projects/dcdivx/ (n.b: this player doesn't do DivX.)
The KallistiOS mailing list: http://sourceforge.net/mailarchive/message.php?msg_id=9597402
libID3: http://tangent.org/480/libID3.html
DC Movie Player: http://geocities.com/dcdev2003/download.html (dct64_sh4.c)
An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines: http://www.dranger.com/ffmpeg/
Some of the above projects didn't contribute much code directly (eg, xine-vcdnav)
but were used to figure out how mpeg streams and VideoCDs work. VCDImager was used
in this way (for example, look in vcdlib/libvcd.c in the open_vcd() function where we
load the VCD/INFO.VCD by reading sector 300 from CD), but additionally, virtually all of
include/libvcd.h (which, originally, was 100% of our "libvcd") is taken directly from
VCDImager except for a few pieces I had to get from libcdio. There isn't much here from
DC Movie Player for those who have been asking me to add the ability to play their favorite
file formats. Bero had a version of the dct64 function for mpglib that was optimized for
the sh4, so I took that. Similarly, the ffmpeg and SDL tutorial I consulted was used to get
an idea of how I wanted to handle audio and video synchronization (mainly synching audio to
an external clock) and not to get more file formats supported.
HISTORY/DEVELOPMENT/RAMBLING:
----------------------------
a52dec/liba52 should be pretty much gone from here. In my initial stage of figuring
out how to play a multiplexed stream, I did some tests under Linux, and the easiest
way to conduct these tests was to essentially overlay the demux functions from a52dec
and mpeg2dec because the demultiplexers in these programs are very very similar.
When this worked, I hooked in the mp3 decoder in a similar way and to output I ripped
an output system for Linux from mpadec. I had attempted to use mpadec for the decoding
as well, but I quite honestly couldn't figure out from the example how I was to go about
decoding something from a buffer in memory rather than the standard MP3 file they show how
to use. Everything I tried under Linux gave me a Segmentation Fault, and so I opted for
the easier-to-use mpglib. When this all worked, I started porting the whole thing to Dreamcast.
Unfortunately, a52dec didn't want to work the same on DC as mpglib did, and I decided to scrap
liba52, at least for the time being. There may be a few remnants left, most likely in the header
files in the include directory or in src/mpeg2play.c. My problems with liba52 were definitely
with my DC-specific code in the inital version, and I may (read MAY, not WILL) revisit the decision
to drop a52(AC3) support at some point in the future.
VCD playback was a bit of a hack initially, but it would not work at all had I not been
fortunate enough to see an entry in the KOS mailing list archives by Thierry Vermeylen
outlining his experiments with getting KOS to read 2352 bytes/sector. Once I got this
working, I was pretty much set on making this as full-featured a VCD player as I can make it.
It's pretty close now, supporting VCD 2.0 as well as SVCD/HQ-VCD with a few limitations.
Probably won't work too well on high-bitrate streams (It actually does OK on
VCD movies now). mpglib was choking on bad audio frames, so I took some time
and separated a more tolerant version from LAME, so you may still get some audio
corruption from time to time, but the player should recover and keep playing.
The original mpglib would play some horrific sound and then promptly die on you.
La Cible's Lvfdc proved useful mainly for ensuring that my demux function makes
sense, and it made writing video and audio output drivers for DC a lot easier
since I could copy a lot of what he did.
DCDivX also uses the menu from GhettoPlay, so it seemed the best place to go for things
such as disc-swap support, which buttons do what (not exactly the same, and completely different
during video playback), and things of that nature.
I wasn't sure I liked the license terms for libID3 v1.1 (it was BSD-like, but had some terms
that I wasn't sure were compatible with the GPL) so I looked for a newer version, and the
license for the newest version (1.2) looks to be the same as KOS. It took me all of five minutes
to redo the port, so it wasn't a major headache. I commented out what we don't use, and made some
minor changes to the parts we do use so it would compile.
Another library with odd license terms is mpg123. Fortunately, the files that I use are listed as
'part of the core decoder' or come right from mpglib (or LAME's mpglib), but jeez... saying that you
can use files x, y, and z under the GPL but not files a, b, and d, but something in file x calls a
function found in file a... We probably don't need a 32-band equalizer anyway (do we?)... I'm using one
anyway because it's easy, but I wrote my own function since 'equalizer.c' isn't 'part of the core
decoder,' and we don't really need separate equalizer arrays for the left and right channel anyway.
All that said... the EQ I hacked in is pretty crappy. Distorts and whatnot. I may or may not rewrite
it before releasing v0.2, but I should probably break it down into low/lo-mid/hi-mid/high and just let
the user adjust it as they like.
HOW PLAYBACK CONTROL (or PBC) WORKS ON VideoCD (A BRIEF AND INCOMPLETE EXPLANATION)
-----------------------------------------------------------------------------------
Playback control (PBC) on VideoCD makes use of a file called PSD.VCD. It's essentially a bunch of lists,
such as Playlists, Selection Lists, and End Lists. These lists will have Play Items, and a set of actions
defined, which will differ from list type to list type. The End List is easy to understand--it might show
a picture, and then end PBC. The others are a bit more complicated. Playlists and Selection Lists will
have a set of buttons defined, such as 'Previous,' or 'Next.' You are probably familiar with these two buttons
on your DVD player, and use them to skip to the next chapter on the disc, or the previous chapter on the disc.
On a VideoCD, these buttons don't work quite the same as on a DVD. When the VCD player reads a Playlist or
Selection List, these buttons are mapped to jump to a particular list, which will have another Play Item. If
the Play Item is a chapter (rather than an MPEG still), the VCD spec says that it should play from that chapter's
entry point to the end of that track (ie, the end of that movie file). If you press 'Next,' the disc will very
likely be authored to go to the next chapter, but that will be (chapter you last jumped to +1), rather than the
next chapter point after wherever you are now. Similarly, 'Prev' won't automatically take you to the chapter before
the point you're at now, but will very likely take you to (chapter you last jumped to -1). It is also entirely
possible that these buttons will be defined in such a way that they don't go to a 'previous' or 'next' chapter
at all, but do something different, such as play an MPEG still.
Selection Lists will allow a way to get around this because it allows for numerical buttons to be mapped to things.
If you are authoring a VCD with menus and chapter points defined, it would be advisable to use a selection list for
each chapter. Use the numerical selections to map to each chapter in each chapter's selection list. For example,
if you want to jump to chapter 5, chapter 5 must be the play item defined in a selection list. In that selection list,
define numerical button 1 to jump to the first chapter, and numerical button 9 to jump to the ninth chapter. You may
define up to 99 numerical options per Selection List. The VCDImager suite of software will allow you to do create discs
like this, and there are several GUIs available for VCDImager on Windows. For those familiar with XML (there may still be
a few people in the DC homebrew community making DreamInducer compilations), vcdXbuild is an excellent tool that will let
you build a complete description of a VCD or SVCD using XML in Notepad, and it will then read your XML file and create
a bin/cue image to be burned with CDRWin or another program that supports bin/cue.
WHAT DOESN'T (or might not) WORK
--------------------------------
I have spent a great deal of time attempting to support as much of the VideoCD 2.0 standard as I could (and SVCD/HQVCD as
well), but I have not managed to implement and test everything. Here is a (probably incomplete) list of what I have not
done, or have not tested:
- Delayed Jump-timing is not there. I have most of the code that this feature should require, but it will mean testing
and I haven't had time to author some VCDs with delayed jump-timing. If you enable this feature when you author a VCD,
what should happen is that when the user enters a valid selection, the current play item will play to the end before the
user-selected action is performed. While this will be the case on your DVD player, it won't be on your Dreamcast.
- End Lists (mainly affects SVCD) aren't tested. In the docs that I have from VCDImager etc., it looks like you can author
a disc so that the end list will tell you to enter a particular 'next disc,' with a disc number. I am not sure if VCD 2.0
allows this, but SVCD certainly does. Also, on SVCD only, you can display a 'change disc' picture. I wrote code that should
make these things work, and this code is enabled in the release version, but have not had time to test it. I figure that even
if the code is so bad that it crashes the program, it's at the end of the disc anyway (but I have looked it over, and it appears
to me that it will work just fine).
- Segment Play Items may be buggy. These are typically still images, but can contain audio, motion video, etc. I have only tested
still images without audio.
- Multi-default selection lists aren't very well tested. I attempted to test this, but screwed up the disc I authored. The way
it is supposed to work is that when you press the 'Default' button on a VCD remote (mapped to the START button in VC/DC), your
disc may be authored in such a way that the 'Default' entry varies depending on where you are in the current play item. I think
that I have it figured out correctly, but I'm not 100% confident that it works totally correctly. Also, the description that I
have of this feature is a tiny bit fuzzy, so I did a bit of guessing as to how to determine which of the default entries to use.
- Random selection of next item in Selection lists seems to work, but I haven't really tested how random it is. If there's no 'Next'
item defined in the Selection List and we time out before the user selects something, it's supposed to pick a random entry. It
definitely picks something, and I think that the random number generator functions properly, but I didn't pay that much attention to
this feature while testing.
- 'Playtime' in playlist items might not be totally accurate. The way I implemented this is really ugly anyway.
Those of you brave enough to actually try to do anything with this code (I'm
incredibly sloppy and I freely admit this) will probably find a SDL video driver
in libvo. This is not my driver. I don't think it worked on my Linux system,
and I don't think it will work on the Dreamcast. If you are using this code in
a Dreamcast program that uses SDL, you will probably want to shut down SDL,
play your movie file, shut down the PVR, and then reopen SDL. Feel free to
prove me wrong, of course. But also note that SDL limits your possible output
sizes to 320x240 and 640x480 (and maybe one other size) on the DC. My video
driver uses the PVR to resize the video to the size of the screen regardless of
the actual dimensions of the video.
And also note that I don't include the SDL video driver in my Makefile, so if
you want to play with it, make sure you make the needed change there and in the
headers for libvo, since I think I commented out/removed/#ifdefed out all
references to drivers not used by my program. (The initial port was some time
and I'm currently working on upgrading code I haven't looked at very much for
about a year).
One other thing to consider if you're using SDL is that SMPEG is not difficult
to port to the Dreamcast--Reaper did it with KOS 1.2.0, and I've had it compile
and work with even fewer changes with KOS 1.3.x, so that might be worth taking
a look at. Basically, you'll need to create a Makefile that includes all your
sources (except for any processor-specific ones--there may be a few), type
'Make,' and just watch the compiler output. Most of the errors you'll get are
simple fixes.
JHS, 5/29/2007
Warnings for anyone looking at the code to VC/DC before I clean things up.
It is very likely that there is code in mpeg2play.c that is not used--it's either commented out, surrounded by #if 0, or it's a
function that is never called. This is actually due to attempts at making the code work better, and these things will be cleaned
up eventually.
Aditionally, there may be some files in here that aren't being used. If it looks like a copy of a file that is being used and is
not listed in the makefile, it's probably an old version that I kept in case I wanted to retrieve some code I was replacing, or
a version that was broken but contained ideas I still wanted a record of at one time or another. So if it's not listed in the makefile
then it's safe to delete.
There will also be some files that aren't being used but aren't copies of other files--I'm trying to keep these in separate folders
to avoid confusion. The framerate regulation stuff is going to be moved to the vidclock folder (and cleaned up a whole lot--
commented-out stuff will be removed), and that folder probably contains an aborted attempt at implementing this before I just stuck
it all in mpeg2play.c out of laziness..
That's it for now. I'll try to make the source code release as clean as I can, but I have some bad habits when it comes to making
my code easy to read by anyone else.
##################################
#
# THINGS TO DO:
#
##################################
##################################
#
# USERLAND FEATURES:
#
###################################
In libvcd, we absolutely must check every navigation request the user inputs. /* Done, but needs testing. */
/* Right now, if the user presses an invalid button, the playloop will exit, return a value to the calling function,
which will cause it to exit, and give an invalid command to the calling function in libvcd.c. This in turn will
very often pass a value of 0xffff to Start_PBC(), which it recognizes as an instruction to exit to the VC/DC main menu.
Furthermore, it will cause the player to behave in a way not consistent with our goal, which is to provide a player
as compliant as possible to the VCD 2.0 specification (not that we have access to the actual specification docs). */
Change the Pause feature to allow us to use Stop, use the remote control, refresh the screen, and implement a screensaver.
/* This is not of the highest priority, but the way it works right now is pretty shitty. */
Fix the control button functions so that they are consistent! /* Should be done, but double-check. */
/* For now, leave stuff as-is while in development until we decide on a final layout for button/feature mapping. Since
this is primarily a VideoCD player, the VCD remote's needs take priority--all functions for other format types (generic
MPEG files, AVI files if we add in DCDivX or XviD) must bow to the needs of the VCD player functions.
Steal the equalizer code from mpg123! /* Sorta done. We got code that does the same thing without using non-GPLed code. */
/* This will give us a 32-band EQ. I'm thinking that it'll be a pain to
actually handle 32 different bands separately (screen space and whatnot)
but we could probably break it into chunks. Say, the lowest 8 would be 'low,'
then the next 8 'low mid,' then 'high mid,' and finally 'high.' Figure out
how it works, too... it looks like the dat file in there uses floating-point
numbers, but I think the EQ array is integers. */
PBC Cursors! Closed-Captioning (maybe)! Colors for things!
/* The VCD 0n CDI doc mentions this--we could totally make use of the CDI_VCD.CFG file to allow disc-makers to customize
the behavior of the player. */
Try allowing user to play individual VCD tracks from a menu /* Pretty much done. */
/* remember to malloc the TOC before trying to use it this time! (It'll probably work.) */
Handle different aspect ratios. /* Done--we only need to support 4:3 and 16:9 and this should be working now. */
/* Not a high priority--get it playing faster first. Also, this seems to work given certain resolutions,
and doesn't appear that it'll always work for what we need. :-S */
Write a better way to handle the controller stuff. If we base a lib on this, it would be nice
to have a way to pass in a custom set of controls via a struct or something.
/* Polling the controller once per frame would be better than once each time the buffer is
filled. Or a separate thread to keep track of controller events, but that might slow us down. */
Make the settings menu less ugly and more useful.
##################################
#
# INTERNAL FUNCTIONS:
#
###################################
Use header files and separate modules where appropriate to handle all the stuff we're accessing from multiple files.
/* This extensive use of 'extern this' and 'extern that' is ugly and will be confusing for people trying to look at
the code, I would imagine.
*/
Fix the demuxer to only allow the playback of one audio stream.
/* We can do something similar to the way we allow only the first video stream to be played back. This is vital for
SVCD support. */
Allow multi-channel mpeg audio streams.
/* Also needed for SVCD support! I'm not quite sure how to do this yet, but the decode_x_to_1 functions should be
able to be borrowed for this. We just need to figure out how to set a flag based on how many channels the stream
has and work from there. We might be able to decode at a lower quality and downmix in software, or use 8-bit output
or something to minimize the amount of data being copied to the spu if we find a bottleneck there. */
Support lpcm audio.
/* This should be really easy--encode a short segment with lpcm audio in TMPGEnc, play it back with mpeg2dec on the PC
and figure out the header and whatnot based on that. No decoding of audio necessary, as it's already PCM. The VCD
standard allows for this type of audio, so we should support it to be compliant. */
Use globals for things we're always going to need allocated. /* Done, but maybe a bad idea. */
/*
CDROM_TOC structs? We need only one--just malloc it and overwrite it when we need to.
Buffers? They're always roughly the same size. Just malloc one buffer that's 2352*10 bytes and we should be good.
*/
Handle the autopause flag in VCD sectors. /* Sucks, but done. */
/* We can extract the info we need from vcdimager/lib/vcd.c in the function _write_sequence around lines 1706-1805. We will
also probably need to look in sector.h and sector_private.h and ALSO in libcido-0.77/include/cdio/sector.h in the comments
up top describing the sector layout.*/
Handle loop jump delay.
/* We have code that should detect it, but need to figure a good way to implement it. */
Handle ptime in VCD PlayLists. /* Should be done. Barely tested, but seemed to work. */
/* We have code to calculate how many 1/15-second chunks a frame takes. We just need to hook it up. */
Remove duplicate features.
/* Mainly the remote control. We have one in libvcd, and one in our mpeg2play.c file. We could probably move this to another
module called controller.c or something. */
Handle bin/cue images.
/* See libcdio-0.77/include/cdio/sector.h in the comments up top describing the sector layout. */
Try to hack in the modified Berkley MPEG-1 decoder with the 1-pass IDCT. Might be faster?
/* I'm sure there's a way to use the mpeg2dec code to demux the stream and then
pick which decoder we want to use from there. */
Try to hack in Bero's sh4 idct from ffmpeg. May make the program faster?
/* Has been tried and did not work. Will try again if we need a speed boost after trying other stuff. */
##################################
#
# MISCELLANEOUS IDEAS AND SUCH:
#
###################################
Add support for more formats:
--DivX should be a gimmee (DCDivX). Try XviD too. Should give us support for newer stuff.
--PSS files shouldn't be hard. Start with lvfdc if I can find where I put it. Probably start from the win32 sound driver.
--ac3 audio is a maybe. liba52 should work--do something similar to the mp3 driver, and we should be okay.
--Sofdec files... maybeish (According to Bero's docs,sfd uses I and P frames only, so these may not play back full-speed anyway).
/* KallistiOS ##version##
aica_cmd_iface.h
(c)2000-2002 Dan Potter
Definitions for the SH-4/AICA interface. This file is meant to be
included from both the ARM and SH-4 sides of the fence.
*/
#ifndef __ARM_AICA_CMD_IFACE_H
#define __ARM_AICA_CMD_IFACE_H
/* $Id: aica_cmd_iface.h,v 1.3 2002/06/13 05:52:35 bardtx Exp $ */
#ifndef __ARCH_TYPES_H
typedef unsigned long uint8;
typedef unsigned long uint32;
#endif
/* Command queue; one of these for passing data from the SH-4 to the
AICA, and another for the other direction. If a command is written
to the queue and it is longer than the amount of space between the
head point and the queue size, the command will wrap around to
the beginning (i.e., queue commands _can_ be split up). */
typedef struct aica_queue {
uint32 head; /* Insertion point offset (in bytes) */
uint32 tail; /* Removal point offset (in bytes) */
uint32 size; /* Queue size (in bytes) */
uint32 valid; /* 1 if the queue structs are valid */
uint32 process_ok; /* 1 if it's ok to process the data */
uint32 data; /* Pointer to queue data buffer */
} aica_queue_t;
/* Command queue struct for commanding the AICA from the SH-4 */
typedef struct aica_cmd {
uint32 size; /* Command data size in dwords */
uint32 cmd; /* Command ID */
uint32 timestamp; /* When to execute the command (0 == now) */
uint32 cmd_id; /* Command ID, for cmd/response pairs, or channel id */
uint32 misc[4]; /* Misc Parameters / Padding */
uint8 cmd_data[0]; /* Command data */
} aica_cmd_t;
/* Maximum command size -- 256 dwords */
#define AICA_CMD_MAX_SIZE 256
/* This is the cmd_data for AICA_CMD_CHAN. Make this 16 dwords long
for two aica bus queues. */
typedef struct aica_channel {
uint32 cmd; /* Command ID */
uint32 base; /* Sample base in RAM */
uint32 type; /* (8/16bit/ADPCM) */
uint32 length; /* Sample length */
uint32 loop; /* Sample looping */
uint32 loopstart; /* Sample loop start */
uint32 loopend; /* Sample loop end */
uint32 freq; /* Frequency */
uint32 vol; /* Volume 0-255 */
uint32 pan; /* Pan 0-255 */
uint32 pos; /* Sample playback pos */
uint32 pad[5]; /* Padding */
} aica_channel_t;
/* Declare an aica_cmd_t big enough to hold an aica_channel_t
using temp name T, aica_cmd_t name CMDR, and aica_channel_t name CHANR */
#define AICA_CMDSTR_CHANNEL(T, CMDR, CHANR) \
uint8 T[sizeof(aica_cmd_t) + sizeof(aica_channel_t)]; \
aica_cmd_t * CMDR = (aica_cmd_t *)T; \
aica_channel_t * CHANR = (aica_channel_t *)(CMDR->cmd_data);
#define AICA_CMDSTR_CHANNEL_SIZE ((sizeof(aica_cmd_t) + sizeof(aica_channel_t))/4)
/* Command values (for aica_cmd_t) */
#define AICA_CMD_NONE 0x00000000 /* No command (dummy packet) */
#define AICA_CMD_PING 0x00000001 /* Check for signs of life */
#define AICA_CMD_CHAN 0x00000002 /* Perform a wavetable action */
#define AICA_CMD_SYNC_CLOCK 0x00000003 /* Reset the millisecond clock */
/* Response values (for aica_cmd_t) */
#define AICA_RESP_NONE 0x00000000
#define AICA_RESP_PONG 0x00000001 /* Response to CMD_PING */
#define AICA_RESP_DBGPRINT 0x00000002 /* Entire payload is a null-terminated string */
/* Command values (for aica_channel_t commands) */
#define AICA_CH_CMD_MASK 0x0000000f
#define AICA_CH_CMD_NONE 0x00000000
#define AICA_CH_CMD_START 0x00000001
#define AICA_CH_CMD_STOP 0x00000002
#define AICA_CH_CMD_UPDATE 0x00000003
/* Start values */
#define AICA_CH_START_MASK 0x00300000
#define AICA_CH_START_DELAY 0x00100000 /* Set params, but delay key-on */
#define AICA_CH_START_SYNC 0x00200000 /* Set key-on for all selected channels */
/* Update values */
#define AICA_CH_UPDATE_MASK 0x000ff000
#define AICA_CH_UPDATE_SET_FREQ 0x00001000 /* frequency */
#define AICA_CH_UPDATE_SET_VOL 0x00002000 /* volume */
#define AICA_CH_UPDATE_SET_PAN 0x00004000 /* panning */
/* Sample types */
#define AICA_SM_8BIT 1
#define AICA_SM_16BIT 0
#define AICA_SM_ADPCM 2
/* This is where our SH-4/AICA comm variables go... */
/* 0x000000 - 0x010000 are reserved for the program */
/* Location of the SH-4 to AICA queue; commands from here will be
periodically processed by the AICA and then removed from the queue. */
#define AICA_MEM_CMD_QUEUE 0x010000 /* 32K */
/* Location of the AICA to SH-4 queue; commands from here will be
periodically processed by the SH-4 and then removed from the queue. */
#define AICA_MEM_RESP_QUEUE 0x018000 /* 32K */
/* This is the channel base, which holds status structs for all the
channels. This is READ-ONLY from the SH-4 side. */
#define AICA_MEM_CHANNELS 0x020000 /* 64 * 16*4 = 4K */
/* The clock value (in milliseconds) */
#define AICA_MEM_CLOCK 0x021000 /* 4 bytes */
/* 0x021004 - 0x030000 are reserved for future expansion */
/* Open ram for sample data */
#define AICA_RAM_START 0x030000
#define AICA_RAM_END 0x200000
/* Quick access to the AICA channels */
#define AICA_CHANNEL(x) (AICA_MEM_CHANNELS + (x) * sizeof(aica_channel_t))
#endif /* __ARM_AICA_CMD_IFACE_H */
/*
* attributes.h
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_ATTRIBUTES_H
#define LIBMPEG2_ATTRIBUTES_H
/* use gcc attribs to align critical data structures */
#ifdef ATTRIBUTE_ALIGNED_MAX
#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
#else
#define ATTR_ALIGN(align)
#endif
#ifdef HAVE_BUILTIN_EXPECT
#define likely(x) __builtin_expect ((x) != 0, 1)
#define unlikely(x) __builtin_expect ((x) != 0, 0)
#else
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#endif /* LIBMPEG2_ATTRIBUTES_H */
/* include/config.h. Generated by configure. */
/* include/config.h.in. Generated from configure.in by autoheader. */
/* maximum supported data alignment */
#define ATTRIBUTE_ALIGNED_MAX 64
/* Define if you have the `__builtin_expect' function. */
#define HAVE_BUILTIN_EXPECT
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
//#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if the system has the type `struct timeval'. */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "mpeg2dec"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to 1 if you have the ANSI C header files. */
//#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
#define VERSION "0.5.1"
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#define inline __attribute__ ((__always_inline__))
#endif
/* Define as `__restrict' if that's what the C compiler calls it, or to
nothing if it is not supported. */
#define restrict __restrict__
#if 0
#ifdef _arch_dreamcast
typedef unsigned long long uint64_t;
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef long long int64_t;
typedef long int32_t;
typedef short int16_t;
typedef char int8_t;
#endif
#else
#include "mpglib_config.h"
#endif
/*
* id3 include stuff
*/
/* ====================================================================
Copyright (c) 2006, Tangent Org
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of TangentOrg nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
#ifndef __ID3_H__
#define __ID3_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <strings.h>
//#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#define VERSION_SIZE 8
typedef unsigned int id3flags;
typedef struct ID3 ID3;
struct ID3 {
char version[VERSION_SIZE]; //It will never be this large!
char *filename; // Filename is only added when available, will be null terminated
char *title;
size_t title_size;
char *artist;
size_t artist_size;
char *album;
size_t album_size;
char *year;
size_t year_size;
char *comment;
size_t comment_size;
char *track;
size_t track_size;
char *genre;
size_t genre_size;
char *encoder;
size_t encoder_size;
char *blob;
char signature[33];
void (*processor)(ID3 *info, const char *name, const char *ptr, size_t length);
char *data;
size_t data_size; // Length of the actual tag
void *passable; // Void pointer you can use in your processor() callback function
unsigned char *buffer; // Block of memory used to hold tags
unsigned char *ptr; // Pointer in block of memory used to hold tags
size_t length; // Size of the data in ptr
size_t size; // Size of the ptr
size_t tag_length; // Length of the actual tag
char user_memory; // If the user supplied memory to use for ptr
char allocated; // If the ID3 object was allocated
id3flags mask;
id3flags mask_found;
};
#define GENRE_MAX 148
#define ID3_INIT_SIZE 8192
#define isframeid(a) (isupper(a) || isdigit(a))
#define HUGE_STRING_LEN 8192
ID3 * create_ID3(ID3 *);
int destroy_ID3(ID3 *blob);
int parse_file_ID3(ID3 *info, char *filename);
int parse_blob_ID3(ID3 *info, unsigned char *blob, size_t blob_length);
void set_memory_ID3(ID3 *info, unsigned char *ptr, size_t size) ;
void set_flags_ID3(ID3 *info, id3flags mask);
int ID3_to_file(char *filename, char *newfile);
// Error Codes
typedef enum {
ID3_OK= 0,
ID3_ERR_EMPTY_FILE= 1,
ID3_ERR_NO_TAG= 2,
ID3_ERR_UNSUPPORTED_FORMAT= 3,
} id3_return;
typedef enum {
ID3_VERSION_1= 1,
ID3_VERSION_2= 2,
} id3_version;
#define TITLE_TAG 1 /* Title of the track*/
#define ARTIST_TAG 2 /* Performing Artist */
#define ALBUM_TAG 4 /* Album */
#define YEAR_TAG 8 /* Year for the track */
#define COMMENT_TAG 16 /* Comment */
#define TRACK_TAG 32 /* Track on the Album */
#define GENRE_TAG 64 /* Music Genre */
#define ENCODER_TAG 128 /* Encoder for the track */
#define VERSION_TAG 256 /* Version of the Tag */
#define KEEP_TAG 512 /* Encoder for the track */
#define SIGNATURE_TAG 1024 /* Create MD5 signature of the file */
#define KEEP_BLOB 2048 /* Keep the blob that the file used */
#define VERSION1_TAG (TITLE_TAG|ARTIST_TAG|ALBUM_TAG|YEAR_TAG|COMMENT_TAG|TRACK_TAG|GENRE_TAG) /* Encoder for the track */
#define ALL_TAG (TITLE_TAG|ARTIST_TAG|ALBUM_TAG|YEAR_TAG|COMMENT_TAG|TRACK_TAG|GENRE_TAG|ENCODER_TAG|VERSION_TAG|SIGNATURE_TAG) /* Encoder for the track */
#define DEBUG 1
#ifdef DEBUG
#define DEBUG_ENTER(A) const char *DEBUG_FUNCTION=A;printf("Entering %s\n", DEBUG_FUNCTION);fflush(stdout);
#define DEBUG_RETURN_MESSAGE(A,B) {printf("Leaving %s: ", DEBUG_FUNCTION);printf(A);printf("\n");fflush(stdout);return B;}
#define DEBUG_RETURN_VOID printf("Leaving %s\n", DEBUG_FUNCTION);fflush(stdout);
#define DEBUG_PRINT(A) printf("\t%s: ", DEBUG_FUNCTION); printf(A);printf("\n");fflush(stdout);
#define DEBUG_RETURN(A) {printf("Leaving %s\n", DEBUG_FUNCTION);fflush(stdout);return A;}
#define DEBUG_ASSERT(A) assert(A);
#define WATCHPOINT printf("WATCHPOINT %s %d\n", __FILE__, __LINE__);fflush(stdout);
#else
#define DEBUG_ENTER(a);
#define DEBUG_RETURN(a);
#define DEBUG_RETURN_MESSAGE(A,B);
#define DEBUG_RETURN_VOID;
#define DEBUG_PRINT(A);
#define DEBUG_ASSERT(A);
#define WATCHPOINT;
#endif
#endif
/*
* This is just a hack. Includes a file that defines
* what we need defined for the Dreamcast. Linux won't
* need this.
*/
#ifdef _arch_dreamcast
#include "mpglib_config.h"
#endif
This diff is collapsed.
/*
* mpeg2.h
* Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_MPEG2_H
#define LIBMPEG2_MPEG2_H
#define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
#define MPEG2_RELEASE MPEG2_VERSION (0, 5, 1) /* 0.5.1 */
#define SEQ_FLAG_MPEG2 1
#define SEQ_FLAG_CONSTRAINED_PARAMETERS 2
#define SEQ_FLAG_PROGRESSIVE_SEQUENCE 4
#define SEQ_FLAG_LOW_DELAY 8
#define SEQ_FLAG_COLOUR_DESCRIPTION 16
#define SEQ_MASK_VIDEO_FORMAT 0xe0
#define SEQ_VIDEO_FORMAT_COMPONENT 0
#define SEQ_VIDEO_FORMAT_PAL 0x20
#define SEQ_VIDEO_FORMAT_NTSC 0x40
#define SEQ_VIDEO_FORMAT_SECAM 0x60
#define SEQ_VIDEO_FORMAT_MAC 0x80
#define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0
typedef struct mpeg2_sequence_s {
unsigned int width, height;
unsigned int chroma_width, chroma_height;
unsigned int byte_rate;
unsigned int vbv_buffer_size;
uint32_t flags;
unsigned int picture_width, picture_height;
unsigned int display_width, display_height;
unsigned int pixel_width, pixel_height;
unsigned int frame_period;
uint8_t profile_level_id;
uint8_t colour_primaries;
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
} mpeg2_sequence_t;
#define GOP_FLAG_DROP_FRAME 1
#define GOP_FLAG_BROKEN_LINK 2
#define GOP_FLAG_CLOSED_GOP 4
typedef struct mpeg2_gop_s {
uint8_t hours;
uint8_t minutes;
uint8_t seconds;
uint8_t pictures;
uint32_t flags;
} mpeg2_gop_t;
#define PIC_MASK_CODING_TYPE 7
#define PIC_FLAG_CODING_TYPE_I 1
#define PIC_FLAG_CODING_TYPE_P 2
#define PIC_FLAG_CODING_TYPE_B 3
#define PIC_FLAG_CODING_TYPE_D 4
#define PIC_FLAG_TOP_FIELD_FIRST 8
#define PIC_FLAG_PROGRESSIVE_FRAME 16
#define PIC_FLAG_COMPOSITE_DISPLAY 32
#define PIC_FLAG_SKIP 64
#define PIC_FLAG_TAGS 128
#define PIC_FLAG_REPEAT_FIRST_FIELD 256
#define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
typedef struct mpeg2_picture_s {
unsigned int temporal_reference;
unsigned int nb_fields;
uint32_t tag, tag2;
uint32_t flags;
struct {
int x, y;
} display_offset[3];
} mpeg2_picture_t;
typedef struct mpeg2_fbuf_s {
uint8_t * buf[3];
void * id;
} mpeg2_fbuf_t;
typedef struct mpeg2_info_s {
const mpeg2_sequence_t * sequence;
const mpeg2_gop_t * gop;
const mpeg2_picture_t * current_picture;
const mpeg2_picture_t * current_picture_2nd;
const mpeg2_fbuf_t * current_fbuf;
const mpeg2_picture_t * display_picture;
const mpeg2_picture_t * display_picture_2nd;
const mpeg2_fbuf_t * display_fbuf;
const mpeg2_fbuf_t * discard_fbuf;
const uint8_t * user_data;
unsigned int user_data_len;
} mpeg2_info_t;
typedef struct mpeg2dec_s mpeg2dec_t;
typedef struct mpeg2_decoder_s mpeg2_decoder_t;
typedef enum {
STATE_BUFFER = 0,
STATE_SEQUENCE = 1,
STATE_SEQUENCE_REPEATED = 2,
STATE_GOP = 3,
STATE_PICTURE = 4,
STATE_SLICE_1ST = 5,
STATE_PICTURE_2ND = 6,
STATE_SLICE = 7,
STATE_END = 8,
STATE_INVALID = 9,
STATE_INVALID_END = 10,
STATE_SEQUENCE_MODIFIED = 11
} mpeg2_state_t;
typedef struct mpeg2_convert_init_s {
unsigned int id_size;
unsigned int buf_size[3];
void (* start) (void * id, const mpeg2_fbuf_t * fbuf,
const mpeg2_picture_t * picture, const mpeg2_gop_t * gop);
void (* copy) (void * id, uint8_t * const * src, unsigned int v_offset);
} mpeg2_convert_init_t;
typedef enum {
MPEG2_CONVERT_SET = 0,
MPEG2_CONVERT_STRIDE = 1,
MPEG2_CONVERT_START = 2
} mpeg2_convert_stage_t;
typedef int mpeg2_convert_t (int stage, void * id,
const mpeg2_sequence_t * sequence, int stride,
uint32_t accel, void * arg,
mpeg2_convert_init_t * result);
int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg);
int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride);
void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id);
void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf);
#define MPEG2_ACCEL_X86_MMX 1
#define MPEG2_ACCEL_X86_3DNOW 2
#define MPEG2_ACCEL_X86_MMXEXT 4
#define MPEG2_ACCEL_X86_SSE2 8
#define MPEG2_ACCEL_X86_SSE3 16
#define MPEG2_ACCEL_PPC_ALTIVEC 1
#define MPEG2_ACCEL_ALPHA 1
#define MPEG2_ACCEL_ALPHA_MVI 2
#define MPEG2_ACCEL_SPARC_VIS 1
#define MPEG2_ACCEL_SPARC_VIS2 2
#define MPEG2_ACCEL_ARM 1
#define MPEG2_ACCEL_DETECT 0x80000000
uint32_t mpeg2_accel (uint32_t accel);
mpeg2dec_t * mpeg2_init (void);
const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec);
void mpeg2_close (mpeg2dec_t * mpeg2dec);
void mpeg2_buffer (mpeg2dec_t * mpeg2dec, uint8_t * start, uint8_t * end);
int mpeg2_getpos (mpeg2dec_t * mpeg2dec);
mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec);
void mpeg2_reset (mpeg2dec_t * mpeg2dec, int full_reset);
void mpeg2_skip (mpeg2dec_t * mpeg2dec, int skip);
void mpeg2_slice_region (mpeg2dec_t * mpeg2dec, int start, int end);
void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2);
void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]);
void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer);
int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence,
unsigned int * pixel_width,
unsigned int * pixel_height);
typedef enum {
MPEG2_ALLOC_MPEG2DEC = 0,
MPEG2_ALLOC_CHUNK = 1,
MPEG2_ALLOC_YUV = 2,
MPEG2_ALLOC_CONVERT_ID = 3,
MPEG2_ALLOC_CONVERTED = 4
} mpeg2_alloc_t;
void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason);
void mpeg2_free (void * buf);
void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t),
int free (void *));
#endif /* LIBMPEG2_MPEG2_H */
/*
* mpeg2convert.h
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_MPEG2CONVERT_H
#define LIBMPEG2_MPEG2CONVERT_H
mpeg2_convert_t mpeg2convert_rgb32;
mpeg2_convert_t mpeg2convert_rgb24;
mpeg2_convert_t mpeg2convert_rgb16;
mpeg2_convert_t mpeg2convert_rgb15;
mpeg2_convert_t mpeg2convert_rgb8;
mpeg2_convert_t mpeg2convert_bgr32;
mpeg2_convert_t mpeg2convert_bgr24;
mpeg2_convert_t mpeg2convert_bgr16;
mpeg2_convert_t mpeg2convert_bgr15;
mpeg2_convert_t mpeg2convert_bgr8;
typedef enum {
MPEG2CONVERT_RGB = 0,
MPEG2CONVERT_BGR = 1
} mpeg2convert_rgb_order_t;
mpeg2_convert_t * mpeg2convert_rgb (mpeg2convert_rgb_order_t order,
unsigned int bpp);
mpeg2_convert_t mpeg2convert_uyvy;
#endif /* LIBMPEG2_MPEG2CONVERT_H */
/*
* mpegav.h
* Copyright (C) 2006 - 2008 Josh Sutherland.
* This file is part of VC/DC, a free MPEG-2 video player.
*
* VC/DC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MPEGAV_H
#define MPEGAV_H
#include "inttypes.h"
#include "libvcd.h"
int video_play(char * file_to_play);
int vcd_play(_EntriesVcd_sim *entries_list);
void set_audio_quality(int quality);
void set_eq(int setting);
void enable_eq (int enable);
/* This does not handle pausing! It just deals with the
fact that a pause was triggered, and shuts off audio
and resets the fps counter. */
void mpegav_pause();
/* Taken from xine to handle resampling of audio when ahead or behind. Use carefully,
because it does not preserve pitch! */
void _x_audio_out_resample_stereo(int16_t* input_samples, uint32_t in_samples,
int16_t* output_samples, uint32_t out_samples);
void _x_audio_out_resample_mono(int16_t* input_samples, uint32_t in_samples,
int16_t* output_samples, uint32_t out_samples);
/* Also taken from xine, these should preserve pitch. */
void stretch_mono(int16_t* input_samples, uint32_t in_samples,
int16_t* output_samples, uint32_t out_samples);
void stretch_stereo(int16_t* input_samples, uint32_t in_samples,
int16_t* output_samples, uint32_t out_samples);
#endif /* MPEGAV_H */
/*
* tendra.h
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_TENDRA_H
#define LIBMPEG2_TENDRA_H
#pragma TenDRA begin
#pragma TenDRA longlong type warning
#ifdef TenDRA_check
#pragma TenDRA conversion analysis (pointer-int explicit) off
#pragma TenDRA implicit function declaration off
/* avoid the "No declarations in translation unit" problem */
int TenDRA;
#endif /* TenDRA_check */
#endif /* LIBMPEG2_TENDRA_H */
/*
* vcdbuttons.h
* Copyright (C) 2006 - 2008 Josh Sutherland <OneThirty8@aol.com>
* This file is part of VC/DC, a free MPEG-2 video player.
*
* VC/DC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* VC/DC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VCDBUTTONS_H
#define _VCDBUTTONS_H
#include "libvcd.h"
/* Generic play/stop/ffwd buttons */
#define BUTTON_PAUSE 1
#define BUTTON_STOP 2
#define BUTTON_FFWD 3
#define BUTTON_PREV 4
#define BUTTON_NEXT 5
/* VCD remote buttons (return, default, numeric) */
#define BUTTON_RET 6
#define BUTTON_DEF 7
#define BUTTON_NUMERIC 8
/* Says we pushed a DC button, not a VCD button (yet). */
#define BUTTON_REMOTE 9
/* Says user tried to use the "Numeric Selection" when it is not available. */
#define BUTTON_NO_NUMBERS 138 /* ;-) */
/* This is a struct to hold the information needed for us to know
if the user has made a valid navigation request via the DC controller
and/or the onscreen numerical selection entry system. */
typedef struct
{
uint8 bsn; /* Base selection number--this is usually 1 but can be any number up to 99.*/
uint8 nos; /* Number of possible SelectionList numerical selections. */
/* The next few are fairly self-explanatory. */
uint16 prev_ofs;
uint16 next_ofs;
uint16 return_ofs;
uint16 default_ofs; /* This is for a button named 'default,' not what to
default to. */
uint16 ptime; /* Play time in 1/15 seconds. 0x0000 means full item. */
uint16 atime; /* Autopause delay--figured same as wtime in playlists. */
int jump_delay; /* Whether to jump immediately (0) or wait until the item is finished. */
PsdSelectionListDescriptorExtended_t *ExtList; /* List of selection areas. */
int x, y; /* For a pointer. */
} RemoteControl_t;
#define BUTTON_VALID 1
#define BUTTON_INVALID 0
#endif /*_VCDBUTTONS_H*/
#ifndef VCDC_VERSION_H
#define VCDC_VERSION_H
#define VCDC_VERSION " VC/DC 0.2 (C)2006-2009 "
#endif /*VC_DC_VERSION_H*/
/*
* video_out.h
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
* Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
*
* This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
* See http://libmpeg2.sourceforge.net/ for updates.
*
* mpeg2dec is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpeg2dec is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LIBMPEG2_VIDEO_OUT_H
#define LIBMPEG2_VIDEO_OUT_H
struct mpeg2_sequence_s;
struct mpeg2_convert_init_s;
typedef struct {
int (* convert) (int stage, void * id,
const struct mpeg2_sequence_s * sequence,
int stride, uint32_t accel, void * arg,
struct mpeg2_convert_init_s * result);
} vo_setup_result_t;
typedef struct vo_instance_s vo_instance_t;
struct vo_instance_s {
int (* setup) (vo_instance_t * instance, unsigned int width,
unsigned int height, unsigned int chroma_width,
unsigned int chroma_height, vo_setup_result_t * result);
void (* setup_fbuf) (vo_instance_t * instance, uint8_t ** buf, void ** id);
void (* set_fbuf) (vo_instance_t * instance, uint8_t ** buf, void ** id);
void (* start_fbuf) (vo_instance_t * instance,
uint8_t * const * buf, void * id);
void (* draw) (vo_instance_t * instance, uint8_t * const * buf, void * id);
void (* discard) (vo_instance_t * instance,
uint8_t * const * buf, void * id);
void (* close) (vo_instance_t * instance);
};
typedef vo_instance_t * vo_open_t (void);
typedef struct {
const char * name;
vo_open_t * open;
} vo_driver_t;
void vo_accel (uint32_t accel);
/* return NULL terminated array of all drivers */
vo_driver_t const * vo_drivers (void);
#endif /* LIBMPEG2_VIDEO_OUT_H */
# Used to build Makefile.in
INCLUDES = -I$(top_builddir)/include -I../include
lib_LTLIBRARIES = libid3.la
libid3_la_SOURCES = id3.c md5.c
noinst_HEADERS = md5.h
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment