now, if you do stuff PROPERLY, it works. even with ffmpeg.

Originally committed to SVN as r343.
This commit is contained in:
David Lamparter 2006-04-15 09:57:36 +00:00
parent a0ed84e388
commit a58e68f29a
1 changed files with 3 additions and 1 deletions

View File

@ -93,7 +93,9 @@ LAVCAudioProvider::LAVCAudioProvider(wxString _filename, VideoProvider *vpro)
throw _T("Failed to initialize resampling");
resample_ratio = (float)sample_rate / (float)codecContext->sample_rate;
num_samples = (__int64)(stream->duration / bytes_per_sample * resample_ratio);
double length = (double)stream->duration * av_q2d(stream->time_base);
num_samples = (__int64)(length * sample_rate);
buffer = (int16_t *)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
if (!buffer)