lavc audio provider can now read the file and get its length, bitrate, and number of channels.

Originally committed to SVN as r321.
This commit is contained in:
Rodrigo Braz Monteiro 2006-04-14 06:53:05 +00:00
parent b7ba56024f
commit bac9ddf8d3
2 changed files with 7 additions and 2 deletions

View File

@ -168,7 +168,7 @@ AudioProvider *AudioProvider::GetAudioProvider(wxString filename, AudioDisplay *
// Select provider
#ifdef __WINDOWS__
provider = new AvisynthAudioProvider(filename);
//provider = new AvisynthAudioProvider(filename);
#endif
#ifdef USE_LAVC

View File

@ -121,7 +121,11 @@ void LAVCAudioProvider::LoadAudio(wxString file) {
result = avcodec_open(codecContext,codec);
if (result < 0) throw _T("Failed to open audio decoder");
// TODO: rest of opening
// Set variables
sample_rate = codecContext->sample_rate;
channels = codecContext->channels;
bytes_per_sample = 2; //codecContext->sample_fmt;
num_samples = stream->duration / bytes_per_sample;
}
// Catch errors
@ -154,4 +158,5 @@ void LAVCAudioProvider::Close() {
// Get audio
void LAVCAudioProvider::GetAudio(void *buf, __int64 start, __int64 count) {
// TODO
for (__int64 i=0;i<count;i++) ((short*)buf)[i] = 0;
}