ffms2: Reindex and reload audio when the error handling mode is changed

Originally committed to SVN as r6891.
This commit is contained in:
Thomas Goyne 2012-06-07 21:03:11 +00:00
parent 8c17d45e8c
commit a51de67d68
2 changed files with 14 additions and 1 deletions

View file

@ -77,6 +77,12 @@ AudioController::AudioController(agi::Context *context)
OPT_SUB("Audio/Player", &AudioController::OnAudioPlayerChanged, this); OPT_SUB("Audio/Player", &AudioController::OnAudioPlayerChanged, this);
OPT_SUB("Audio/Provider", &AudioController::OnAudioProviderChanged, this); OPT_SUB("Audio/Provider", &AudioController::OnAudioProviderChanged, this);
OPT_SUB("Audio/Cache/Type", &AudioController::OnAudioProviderChanged, this); OPT_SUB("Audio/Cache/Type", &AudioController::OnAudioProviderChanged, this);
#ifdef WITH_FFMS2
// As with the video ones, it'd be nice to figure out a decent way to move
// this to the provider itself
OPT_SUB("Provider/Audio/FFmpegSource/Decode Error Handling", &AudioController::OnAudioProviderChanged, this);
#endif
} }

View file

@ -122,6 +122,13 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
TrackNumber = FFMS_TRACKMASK_ALL; TrackNumber = FFMS_TRACKMASK_ALL;
// else: do nothing (keep track mask as it is) // else: do nothing (keep track mask as it is)
// reindex if the error handling mode has changed
FFMS_IndexErrorHandling ErrorHandling = GetErrorHandlingMode();
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (2 << 8) | 0)
if (Index && FFMS_GetErrorHandling(Index) != ErrorHandling)
Index = NULL;
#endif
// moment of truth // moment of truth
if (!Index) { if (!Index) {
int TrackMask; int TrackMask;
@ -130,7 +137,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
else else
TrackMask = (1 << TrackNumber); TrackMask = (1 << TrackNumber);
Index = DoIndexing(Indexer, CacheName, TrackMask, GetErrorHandlingMode()); Index = DoIndexing(Indexer, CacheName, TrackMask, ErrorHandling);
// if tracknumber still isn't set we need to set it now // if tracknumber still isn't set we need to set it now
if (TrackNumber == FFMS_TRACKMASK_ALL) if (TrackNumber == FFMS_TRACKMASK_ALL)