git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
configure option for external libart (patch from Patrice Dumas)
[swftools.git]
/
src
/
wav2swf.c
diff --git
a/src/wav2swf.c
b/src/wav2swf.c
index
c5744b7
..
73d5258
100644
(file)
--- a/
src/wav2swf.c
+++ b/
src/wav2swf.c
@@
-24,12
+24,13
@@
#include "../lib/rfxswf.h"
#include "../lib/log.h"
#include "../lib/args.h"
#include "../lib/rfxswf.h"
#include "../lib/log.h"
#include "../lib/args.h"
-#include "wav.h"
+#include "../lib/wav.h"
char * filename = 0;
char * outputname = "output.swf";
int verbose = 2;
int stopframe0 = 0;
char * filename = 0;
char * outputname = "output.swf";
int verbose = 2;
int stopframe0 = 0;
+int stopframe1 = 0;
#define DEFINESOUND_MP3 1 //define sound uses mp3?- undefine for raw sound.
#define DEFINESOUND_MP3 1 //define sound uses mp3?- undefine for raw sound.
@@
-39,11
+40,11
@@
static struct options_t options[] = {
{"o", "output"},
{"r", "framerate"},
{"s", "samplerate"},
{"o", "output"},
{"r", "framerate"},
{"s", "samplerate"},
-{"b", "bitrate"},
{"d", "definesound"},
{"l", "loop"},
{"C", "cgi"},
{"S", "stop"},
{"d", "definesound"},
{"l", "loop"},
{"C", "cgi"},
{"S", "stop"},
+{"E", "end"},
{"b", "bitrate"},
{"v", "verbose"},
{0,0}
{"b", "bitrate"},
{"v", "verbose"},
{0,0}
@@
-86,6
+87,10
@@
int args_callback_option(char*name,char*val)
stopframe0 = 1;
return 0;
}
stopframe0 = 1;
return 0;
}
+ else if(!strcmp(name, "E")) {
+ stopframe1 = 1;
+ return 0;
+ }
else if(!strcmp(name, "C")) {
do_cgi = 1;
return 0;
else if(!strcmp(name, "C")) {
do_cgi = 1;
return 0;
@@
-157,11
+162,11
@@
void args_callback_usage(char *name)
printf("-o , --output <filename> Explicitly specify output file. (Otherwise, output will go to output.swf)\n");
printf("-r , --framerate <fps> Set file framerate to <fps> frames per second.\n");
printf("-s , --samplerate <sps> Set samplerate to <sps> frames per second (default: 11025).\n");
printf("-o , --output <filename> Explicitly specify output file. (Otherwise, output will go to output.swf)\n");
printf("-r , --framerate <fps> Set file framerate to <fps> frames per second.\n");
printf("-s , --samplerate <sps> Set samplerate to <sps> frames per second (default: 11025).\n");
- printf("-b , --bitrate bps Set mp3 bitrate to <bps>.\n");
printf("-d , --definesound Generate a DefineSound tag instead of streaming sound.\n");
printf("-l , --loop n (Only used with -d)\n");
printf("-C , --cgi For use as CGI- prepend http header, write to stdout.\n");
printf("-S , --stop Stop the movie at frame 0\n");
printf("-d , --definesound Generate a DefineSound tag instead of streaming sound.\n");
printf("-l , --loop n (Only used with -d)\n");
printf("-C , --cgi For use as CGI- prepend http header, write to stdout.\n");
printf("-S , --stop Stop the movie at frame 0\n");
+ printf("-E , --end Stop the movie at the end frame\n");
printf("-b , --bitrate <bps> Set mp3 bitrate to <bps> (default: 32)\n");
printf("-v , --verbose Be more verbose\n");
printf("\n");
printf("-b , --bitrate <bps> Set mp3 bitrate to <bps> (default: 32)\n");
printf("-v , --verbose Be more verbose\n");
printf("\n");
@@
-222,17
+227,24
@@
int main (int argc,char ** argv)
exit(1);
}
exit(1);
}
- if(!readWAV(filename, &wav))
+ if(!wav_read(filename, &wav))
{
msg("<fatal> Error reading %s", filename);
exit(1);
}
{
msg("<fatal> Error reading %s", filename);
exit(1);
}
- convertWAV2mono(&wav,&wav2, samplerate);
- //printWAVInfo(&wav);
- //printWAVInfo(&wav2);
+ wav_convert2mono(&wav,&wav2, samplerate);
+ //wav_print(&wav);
+ //wav_print(&wav2);
samples = (U16*)wav2.data;
numsamples = wav2.size/2;
samples = (U16*)wav2.data;
numsamples = wav2.size/2;
+#ifdef WORDS_BIGENDIAN
+ /* swap bytes */
+ for(t=0;t<numsamples;t++) {
+ samples[t] = (samples[t]>>8)&0xff | (samples[t]<<8)&0xff00;
+ }
+#endif
+
if(numsamples%blocksize != 0)
{
// apply padding, so that block is a multiple of blocksize
if(numsamples%blocksize != 0)
{
// apply padding, so that block is a multiple of blocksize
@@
-337,6
+349,15
@@
int main (int argc,char ** argv)
info.loops = loop;
swf_SetSoundInfo(tag, &info);
tag = swf_InsertTag(tag, ST_SHOWFRAME);
info.loops = loop;
swf_SetSoundInfo(tag, &info);
tag = swf_InsertTag(tag, ST_SHOWFRAME);
+ if(stopframe1) {
+ ActionTAG*action = 0;
+ tag = swf_InsertTag(tag, ST_DOACTION);
+ action = action_Stop(action);
+ action = action_End(action);
+ swf_ActionSet(tag, action);
+ swf_ActionFree(action);
+ tag = swf_InsertTag(tag, ST_SHOWFRAME);
+ }
tag = swf_InsertTag(tag, ST_END);
}
tag = swf_InsertTag(tag, ST_END);
}