summaryrefslogtreecommitdiff
path: root/avi2swf
diff options
context:
space:
mode:
authorkramm <kramm>2004-09-20 16:11:16 +0000
committerkramm <kramm>2004-09-20 16:11:16 +0000
commitd6b5ebb01904d445f6ed9e00a54ca5e1e6c800cd (patch)
treec18dd91cca70d7efe160f90b54be6524b4abd1e8 /avi2swf
parentfc408e5f0214a25910220fc798412a344ec7c5e1 (diff)
renamed rate to samplerate.
Diffstat (limited to 'avi2swf')
-rw-r--r--avi2swf/v2swf.c8
-rw-r--r--avi2swf/videoreader.h2
-rw-r--r--avi2swf/videoreader_avifile.cc10
3 files changed, 10 insertions, 10 deletions
diff --git a/avi2swf/v2swf.c b/avi2swf/v2swf.c
index e983c36a..2caed7b8 100644
--- a/avi2swf/v2swf.c
+++ b/avi2swf/v2swf.c
@@ -168,7 +168,7 @@ static void writeShape(v2swf_internal_t*i, int id, int gfxid, int width, int hei
static int getSamples(videoreader_t*video, S16*data, int len, double speedup)
{
double pos = 0;
- double ratio = (double) video->rate * speedup / swf_mp3_in_samplerate;
+ double ratio = (double) video->samplerate * speedup / swf_mp3_in_samplerate;
int rlen = (int)(len * ratio);
int t;
S16 tmp[576*32];
@@ -209,7 +209,7 @@ static void writeAudioForOneFrame(v2swf_internal_t* i)
msg("writeAudioForOneFrame()");
- if(i->video->channels<=0 || i->video->rate<=0)
+ if(i->video->channels<=0 || i->video->samplerate<=0)
return; /* no sound in video */
blocksize = (i->samplerate > 22050) ? 1152 : 576;
@@ -229,7 +229,7 @@ static void writeAudioForOneFrame(v2swf_internal_t* i)
/* The pre-processing of sound samples in getSamples(..) above
re-samples the sound to swf_mp3_in_samplerate. It is best to
simply make it the original samplerate: */
- swf_mp3_in_samplerate = i->video->rate;
+ swf_mp3_in_samplerate = i->video->samplerate;
/* first run - initialize */
swf_mp3_channels = 1;//i->video->channels;
@@ -268,7 +268,7 @@ static void writeAudioForOneFrame(v2swf_internal_t* i)
/* write num frames, max 1 block */
for(pos=0;pos<num;pos++) {
if(!getSamples(i->video, block1, blocksize * (double)swf_mp3_in_samplerate/swf_mp3_out_samplerate, speedup)) {
- i->video->rate = i->video->channels = 0; //end of soundtrack
+ i->video->samplerate = i->video->channels = 0; //end of soundtrack
return;
}
if(!pos) {
diff --git a/avi2swf/videoreader.h b/avi2swf/videoreader.h
index 73799a2a..1924eafc 100644
--- a/avi2swf/videoreader.h
+++ b/avi2swf/videoreader.h
@@ -18,7 +18,7 @@ typedef struct _videoreader_t
/* audio */
int channels;
- int rate;
+ int samplerate;
/* progress */
int frame;
diff --git a/avi2swf/videoreader_avifile.cc b/avi2swf/videoreader_avifile.cc
index 653412f0..0cd2599b 100644
--- a/avi2swf/videoreader_avifile.cc
+++ b/avi2swf/videoreader_avifile.cc
@@ -269,7 +269,7 @@ int videoreader_avifile_open(videoreader_t* v, char* filename)
v->height = head.dwHeight;
dwMicroSecPerFrame = head.dwMicroSecPerFrame;
samplesperframe = astream->GetEndPos()/astream->GetEndTime()*head.dwMicroSecPerFrame/1000000;
- v->rate = (int)(astream->GetEndPos()/astream->GetEndTime());
+ v->samplerate = (int)(astream->GetEndPos()/astream->GetEndTime());
v->fps = 1000000.0/dwMicroSecPerFrame;
i->soundbits = 16;
#else
@@ -290,11 +290,11 @@ int videoreader_avifile_open(videoreader_t* v, char* filename)
audioinfo = i->astream->GetStreamInfo();
v->channels = wave.nChannels;
- v->rate = wave.nSamplesPerSec;
+ v->samplerate = wave.nSamplesPerSec;
i->soundbits = wave.wBitsPerSample;
- if(v->channels==0 || v->rate==0 || i->soundbits==0 || wave.wFormatTag!=1) {
- v->rate = audioinfo->GetAudioSamplesPerSec();
+ if(v->channels==0 || v->samplerate==0 || i->soundbits==0 || wave.wFormatTag!=1) {
+ v->samplerate = audioinfo->GetAudioSamplesPerSec();
v->channels = audioinfo->GetAudioChannels();
i->soundbits = audioinfo->GetAudioBitsPerSample();
}
@@ -308,7 +308,7 @@ int videoreader_avifile_open(videoreader_t* v, char* filename)
i->do_audio = 0;
i->soundbits = 0;
v->channels = 0;
- v->rate = 0;
+ v->samplerate = 0;
}
}
#endif