update ffms2 providers to account for latest API breakage and rename ffmpegsource2.lib to ffms2.lib in setup.cpp

Originally committed to SVN as r2395.
This commit is contained in:
Karl Blomster 2008-09-28 00:40:37 +00:00
parent e99fc62382
commit e247cc290e
5 changed files with 25 additions and 10 deletions

View File

@ -77,7 +77,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
if (Index == NULL) {
// index didn't exist or was invalid, we'll have to (re)create it
try {
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll);
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false);
} catch (wxString temp) {
MsgString << temp;
throw MsgString;
@ -102,7 +102,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
if (FFMS_GetNumFrames(FrameData, FFMSErrMsg, MsgSize) <= 0 && (FFMS_GetTrackType(FrameData, FFMSErrMsg, MsgSize) == FFMS_TYPE_AUDIO)) {
// found an unindexed audio track, we'll need to reindex
try {
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll);
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false);
} catch (wxString temp) {
MsgString << temp;
throw MsgString;
@ -117,7 +117,14 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
}
// FIXME: provide a way to choose which audio track to load?
AudioSource = FFMS_CreateAudioSource(FileNameWX.char_str(), FFMSFirstSuitableTrack, Index, FFMSErrMsg, MsgSize);
int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_AUDIO, FFMSErrMsg, MsgSize);
if (TrackNumber < 0) {
wxString temp(FFMSErrMsg, wxConvUTF8);
MsgString << _T("couldn't find any audio tracks: ") << temp;
throw MsgString;
}
AudioSource = FFMS_CreateAudioSource(FileNameWX.char_str(), TrackNumber, Index, FFMSErrMsg, MsgSize);
if (!AudioSource) {
wxString temp(FFMSErrMsg, wxConvUTF8);
MsgString << _T("failed to open audio track: ") << temp;

View File

@ -56,7 +56,7 @@ int __stdcall FFmpegSourceProvider::UpdateIndexingProgress(int State, int64_t Cu
///////////
// Do indexing
FrameIndex *FFmpegSourceProvider::DoIndexing(FrameIndex *Index, wxString FileNameWX, wxString CacheName, int Trackmask) {
FrameIndex *FFmpegSourceProvider::DoIndexing(FrameIndex *Index, wxString FileNameWX, wxString CacheName, int Trackmask, bool IgnoreDecodeErrors) {
char FFMSErrMsg[1024];
unsigned MsgSize = sizeof(FFMSErrMsg);
wxString MsgString;
@ -69,7 +69,7 @@ FrameIndex *FFmpegSourceProvider::DoIndexing(FrameIndex *Index, wxString FileNam
Progress.ProgressDialog->SetProgress(0,1);
// index all audio tracks
Index = FFMS_MakeIndex(FileNameWX.char_str(), Trackmask, FFMSTrackMaskNone, NULL, FFmpegSourceProvider::UpdateIndexingProgress, &Progress, FFMSErrMsg, MsgSize);
Index = FFMS_MakeIndex(FileNameWX.char_str(), Trackmask, FFMSTrackMaskNone, NULL, IgnoreDecodeErrors, FFmpegSourceProvider::UpdateIndexingProgress, &Progress, FFMSErrMsg, MsgSize);
if (!Index) {
Progress.ProgressDialog->Destroy();
wxString temp(FFMSErrMsg, wxConvUTF8);

View File

@ -47,7 +47,6 @@ class FFmpegSourceProvider {
public:
static const int FFMSTrackMaskAll = -1;
static const int FFMSTrackMaskNone = 0;
static const int FFMSFirstSuitableTrack = -1;
struct IndexingProgressDialog {
volatile bool IndexingCanceled;
@ -55,7 +54,7 @@ public:
};
static int __stdcall UpdateIndexingProgress(int State, int64_t Current, int64_t Total, void *Private);
FrameIndex *DoIndexing(FrameIndex *Index, wxString Filename, wxString Cachename, int Trackmask);
FrameIndex *DoIndexing(FrameIndex *Index, wxString Filename, wxString Cachename, int Trackmask, bool IgnoreDecodeErrors);
};
#endif /* WITH_FFMPEGSOURCE */

View File

@ -126,7 +126,7 @@
////////////////
// FFMpegSource
#ifdef WITH_FFMPEGSOURCE
#pragma comment(lib, "ffmpegsource2.lib")
#pragma comment(lib, "ffms2.lib")
#endif

View File

@ -90,7 +90,8 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
if (Index == NULL) {
// index didn't exist or was invalid, we'll have to (re)create it
try {
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll);
// ignore audio decoding errors here, we don't care right now
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, true);
} catch (wxString temp) {
ErrorMsg << temp;
throw ErrorMsg;
@ -112,7 +113,15 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
else
SeekMode = 1;
VideoSource = FFMS_CreateVideoSource(FileNameWX.char_str(), FFMSFirstSuitableTrack, Index, "", Threads, SeekMode, FFMSErrorMessage, MessageSize);
// FIXME: provide a way to choose which audio track to load?
int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_VIDEO, FFMSErrorMessage, MessageSize);
if (TrackNumber < 0) {
wxString temp(FFMSErrorMessage, wxConvUTF8);
ErrorMsg << _T("couldn't find any video tracks: ") << temp;
throw ErrorMsg;
}
VideoSource = FFMS_CreateVideoSource(FileNameWX.char_str(), TrackNumber, Index, "", Threads, SeekMode, FFMSErrorMessage, MessageSize);
if (VideoSource == NULL) {
wxString temp(FFMSErrorMessage, wxConvUTF8);
ErrorMsg << _T("failed to open video track: ") << temp;