[Scummvm-cvs-logs] SF.net SVN: scummvm: [22855] tools/trunk
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Sat Jun 3 08:43:23 CEST 2006
Revision: 22855
Author: kirben
Date: 2006-06-02 23:43:16 -0700 (Fri, 02 Jun 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22855&view=rev
Log Message:
-----------
Allow compression of separate audio file, if available too
Modified Paths:
--------------
tools/trunk/Makefile
tools/trunk/README
tools/trunk/encode_dxa.cpp
Modified: tools/trunk/Makefile
===================================================================
--- tools/trunk/Makefile 2006-06-03 04:10:14 UTC (rev 22854)
+++ tools/trunk/Makefile 2006-06-03 06:43:16 UTC (rev 22855)
@@ -60,7 +60,7 @@
compress_scumm_bun$(EXEEXT): compress_scumm_bun.o compress.o util.o
$(CXX) $(LDFLAGS) -o $@ $+
-encode_dxa$(EXEEXT): encode_dxa.o util.o
+encode_dxa$(EXEEXT): encode_dxa.o compress.o util.o
$(CXX) $(LDFLAGS) -o $@ $+ -lpng -lz
extract_loom_tg16$(EXEEXT): extract_loom_tg16.o util.o
@@ -105,7 +105,7 @@
# Most compress_* tools (except for compress_queen) use compress.h
compress_saga.o compress_scumm_sou.o compress_scumm_bun.o \
compress_simon.o compress_sword1.o compress_sword2.o \
-compress_kyra.o compress.o: compress.h
+compress_kyra.o compress.o encode_dxa.o: compress.h
# Virtually everything depends on util.h
compress_saga.o compress_scumm_sou.o compress_scumm_bun.o \
Modified: tools/trunk/README
===================================================================
--- tools/trunk/README 2006-06-03 04:10:14 UTC (rev 22854)
+++ tools/trunk/README 2006-06-03 06:43:16 UTC (rev 22855)
@@ -24,17 +24,19 @@
There is currently no support for this game in ScummVM!
extract_mm_c64
- Extracts data files from Commodore 64 version of Maniac Mansion.
+ Extracts data files from the Commodore 64 version of Maniac
+ Mansion.
extract_mm_nes
- Extracts data files from NES version of Maniac Mansion.
+ Extracts data files from the NES version of Maniac Mansion.
extract_simon1_amiga
- Extracts the graphics or music files in AGA/ECS
- versions of Simon the Sorcerer 1 for Amiga
+ Extracts the graphics or music files in AGA and ECS
+ versions of Simon the Sorcerer 1 for Amiga.
extract_zak_c64
- Extracts data files from Commodore 64 version of Zak McKracken
+ Extracts data files from the Commodore 64 version of Zak
+ McKracken.
Compression Tools:
compress_scumm_sou
@@ -43,20 +45,21 @@
compress_queen
Used to rebuild the datafile of Flight of the Amazon Queen,
- to allow optional MP3/Ogg/FLAC compression.
+ and allow optional MP3, Vorbis or FLAC compression.
compress_saga
- Compress SAGA engine digital sound files into MP3 and Ogg
- Vorbis format.
+ Used to compress SAGA engine digital sound files to MP3 or
+ Vorbis.
There is currently no support for compressed sound files in
ScummVM!
compress_simon
- Compresses Simon voc/wav files to MP3/Ogg/FLAC.
+ Used to compress the Feeble Files or Simon 1/2 voc/wav files
+ to MP3, Vorbis or FLAC.
compress_sword1
- Used to compress Broken Sword 1's music and speech files
- using mp3 or vorbis.
+ Used to compress Broken Sword 1's music and speech files to
+ MP3 or Vorbis.
compress_sword2
Used to compress Broken Sword 2's music and speech .clu
@@ -114,24 +117,26 @@
Creates DXA file out of extracted Smacker video.
To extract a video use RAD Game Tools and perform 2 passes
- on it. Let's say, your video is called 'intro.smk'.
+ on it. For example, if your video is called 'intro.smk'.
- 1. Extract video to PNG, 256 colors (chose PNG format
+ 1. Extract the video to PNG, 256 colors (choose PNG format
and tick the checkbox). It will create bunch of files named
- 'introXXX.png' where XXX is frame number. Make sure you
+ 'introXXX.png', where XXX is frame number. Make sure you have
extracted 256 colors PNGs, otherwise encode_dxa will complain.
- 2. Put files 'intro.smk', and 'intro*.png' to a single
- directory, say, video/
+ 2. Extract the audio to WAV format, you will get an
+ 'intro.wav' file.
- 3. Run `encode_dxa intro /path/to/directory/video/`
- or for simplicity cd to that directory and run
- `encode_data intro ./`
+ 3. Put files 'intro.smk', 'intro.wav' and 'intro*.png' into a
+ single directory.
- 4. You will get intro.dxa file in result.
+ 4. Run `encode_dxa intro` in that directory
- Additionally you may use batch processing of SMK files in
- RAD Game Tools. Just select more than one file and push
+ 5. You will get an intro.dxa file and intro.flac/mp3/ogg file
+ in result.
+
+ Additionally you may use batch processing mode of SMK files in
+ RAD Game Tools. Just select more than one file and push the
'Convert' button. It will ask you either you want them
- processed in batch and will do this for you. All buttons
+ processed in batch mode and will do this for you. All buttons
and conversion options work the same.
Modified: tools/trunk/encode_dxa.cpp
===================================================================
--- tools/trunk/encode_dxa.cpp 2006-06-03 04:10:14 UTC (rev 22854)
+++ tools/trunk/encode_dxa.cpp 2006-06-03 06:43:16 UTC (rev 22855)
@@ -21,6 +21,7 @@
*
*/
+#include "compress.h"
#include "util.h"
#include <png.h>
@@ -40,6 +41,7 @@
#include "zmbv.h"
#endif
+static CompressMode gCompMode = kMP3Mode;
class DxaEncoder {
private:
@@ -349,25 +351,113 @@
fclose(smk);
}
+void convertWAV(char *wavName, char *prefix) {
+ const char *ext;
+ char outName[256];
+
+ switch (gCompMode) {
+ case kMP3Mode:
+ ext = "mp3"; break;
+ case kVorbisMode:
+ ext = "ogg"; break;
+ case kFlacMode:
+ ext = "fla"; break;
+ default:
+ error("Unknown compression mode");
+ }
+
+ printf("Encoding audio...");
+ fflush(stdout);
+
+ sprintf(outName, "%s.%s", prefix, ext);
+ encodeAudio(wavName, false, -1, outName, gCompMode);
+}
+
void showhelp(char *exename) {
- printf("\nUsage: %s <inputfile> <inputdir>\n", exename);
+ printf("\nUsage: %s <inputfile> \n", exename);
+
+ printf("\nParams:\n");
+ printf(" --mp3 encode to MP3 format (default)\n");
+ printf(" --vorbis encode to Vorbis format\n");
+ printf(" --flac encode to Flac format\n");
+ printf("(If one of these is specified, it must be the first parameter.)\n");
+
+ printf("\nMP3 mode params:\n");
+ printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%d)\n", minBitrDef);
+ printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%d)\n", maxBitrDef);
+ printf(" --vbr LAME uses the VBR mode (default)\n");
+ printf(" --abr LAME uses the ABR mode\n");
+ printf(" -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:%d)\n", vbrqualDef);
+ printf(" -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:%d)\n", algqualDef);
+ printf(" --silent the output of LAME is hidden (default:disabled)\n");
+
+ printf("\nVorbis mode params:\n");
+ printf(" -b <rate> <rate> is the nominal bitrate (default:unset)\n");
+ printf(" -m <rate> <rate> is the minimum bitrate (default:unset)\n");
+ printf(" -M <rate> <rate> is the maximum bitrate (default:unset)\n");
+ printf(" -q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:%d)\n", oggqualDef);
+ printf(" --silent the output of oggenc is hidden (default:disabled)\n");
+
+ printf("\nFlac mode params:\n");
+ printf(" [params] optional arguments passed directly to the encoder\n");
+ printf(" recommended is: --best -b 1152\n");
+
+ printf("\n --help this help message\n");
+
+ printf("\n\nIf a parameter is not given the default value is used\n");
+ printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n");
+ printf("Use the `mac' option instead of a filename if converting simon2mac sounds\n");
exit(2);
}
int main(int argc, char *argv[]) {
- printf("Dxa encoder (c) 2006 Benjamin Haisch\n");
-
- if (argc < 3)
+ if (argc < 2)
showhelp(argv[0]);
char strbuf[512];
int width, height, framerate, frames;
- char *prefix = argv[1];
- char *datapath = argv[2];
+ /* compression mode */
+ gCompMode = kMP3Mode;
+ int i = 1;
+ if (!strcmp(argv[1], "--mp3")) {
+ gCompMode = kMP3Mode;
+ i++;
+ } else if (!strcmp(argv[1], "--vorbis")) {
+ gCompMode = kVorbisMode;
+ i++;
+ } else if (!strcmp(argv[1], "--flac")) {
+ gCompMode = kFlacMode;
+ i++;
+ }
+ switch (gCompMode) {
+ case kMP3Mode:
+ if (!process_mp3_parms(argc, argv, i))
+ showhelp(argv[0]);
+ break;
+ case kVorbisMode:
+ if (!process_ogg_parms(argc, argv, i))
+ showhelp(argv[0]);
+ break;
+ case kFlacMode:
+ if (!process_flac_parms(argc, argv, i))
+ showhelp(argv[0]);
+ break;
+ }
+
+ i = argc - 1;
+ char *prefix = argv[i++];
+
+ // check if the wav file exists.
+ sprintf(strbuf, "%s.wav", prefix);
+ struct stat statinfo;
+ if (!stat(strbuf, &statinfo)) {
+ convertWAV(strbuf, prefix);
+ }
+
// read some data from the Smacker file.
- sprintf(strbuf, "%s%s.smk", datapath, prefix);
+ sprintf(strbuf, "%s.smk", prefix);
readSmackerInfo(strbuf, width, height, framerate, frames);
printf("Width = %d, Height = %d, Framerate = %d, Frames = %d\n",
@@ -383,18 +473,18 @@
uint8 *image, *palette;
int framenum = 0;
- printf("Encoding...");
+ printf("Encoding video...");
fflush(stdout);
for (int f = 0; f < frames; f++) {
if (frames > 999)
- sprintf(strbuf, "%s%s%04d.png", datapath, prefix, framenum);
+ sprintf(strbuf, "%s%04d.png", prefix, framenum);
else if (frames > 99)
- sprintf(strbuf, "%s%s%03d.png", datapath, prefix, framenum);
+ sprintf(strbuf, "%s%03d.png", prefix, framenum);
else if (frames > 9)
- sprintf(strbuf, "%s%s%02d.png", datapath, prefix, framenum);
+ sprintf(strbuf, "%s%02d.png", prefix, framenum);
else
- sprintf(strbuf, "%s%s%d.png", datapath, prefix, framenum);
+ sprintf(strbuf, "%s%d.png", prefix, framenum);
int r = read_png_file(strbuf, image, palette, width, height);
@@ -421,7 +511,7 @@
}
}
- printf("\rEncoding...100%% (%d of %d)\n", frames, frames);
+ printf("\rEncoding video...100%% (%d of %d)\n", frames, frames);
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list