From acfb815484221fd8ac7deedfbd7ca6f993cea258 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 28 Oct 2008 04:39:10 +0000 Subject: [PATCH] Semi-fix for ffms2 Originally committed to SVN as r2428. --- aegisub/video_provider_ffmpegsource.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/aegisub/video_provider_ffmpegsource.cpp b/aegisub/video_provider_ffmpegsource.cpp index 8a1a86f9a..cb5f81600 100644 --- a/aegisub/video_provider_ffmpegsource.cpp +++ b/aegisub/video_provider_ffmpegsource.cpp @@ -79,18 +79,23 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps) // make sure we don't have anything messy lying around Close(); - wxString FileNameWX(filename.c_str(), wxConvFile); + wxString FileNameWX = wxFileName(wxString(filename.c_str(), wxConvFile)).GetShortPath(); // generate a name for the cache file - wxString CacheName = wxString(GetCacheFilename(filename).c_str(),wxConvFile); + wxString CacheName = GetCacheFilename(filename); // try to read index Index = FFMS_ReadIndex(CacheName.char_str(), FFMSErrorMessage, MessageSize); if (Index == NULL) { // index didn't exist or was invalid, we'll have to (re)create it try { - // ignore audio decoding errors here, we don't care right now - Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, true); + try { + // ignore audio decoding errors here, we don't care right now + Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, true); + } catch (...) { + // Try without audio + Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskNone, true); + } } catch (wxString temp) { ErrorMsg << temp; throw ErrorMsg;