mirror of https://github.com/odrling/Aegisub
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:
parent
b7ba56024f
commit
bac9ddf8d3
|
@ -168,7 +168,7 @@ AudioProvider *AudioProvider::GetAudioProvider(wxString filename, AudioDisplay *
|
||||||
|
|
||||||
// Select provider
|
// Select provider
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
provider = new AvisynthAudioProvider(filename);
|
//provider = new AvisynthAudioProvider(filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_LAVC
|
#ifdef USE_LAVC
|
||||||
|
|
|
@ -121,7 +121,11 @@ void LAVCAudioProvider::LoadAudio(wxString file) {
|
||||||
result = avcodec_open(codecContext,codec);
|
result = avcodec_open(codecContext,codec);
|
||||||
if (result < 0) throw _T("Failed to open audio decoder");
|
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
|
// Catch errors
|
||||||
|
@ -154,4 +158,5 @@ void LAVCAudioProvider::Close() {
|
||||||
// Get audio
|
// Get audio
|
||||||
void LAVCAudioProvider::GetAudio(void *buf, __int64 start, __int64 count) {
|
void LAVCAudioProvider::GetAudio(void *buf, __int64 start, __int64 count) {
|
||||||
// TODO
|
// TODO
|
||||||
|
for (__int64 i=0;i<count;i++) ((short*)buf)[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue