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:
parent
e99fc62382
commit
e247cc290e
5 changed files with 25 additions and 10 deletions
|
@ -77,7 +77,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
|
||||||
if (Index == NULL) {
|
if (Index == NULL) {
|
||||||
// index didn't exist or was invalid, we'll have to (re)create it
|
// index didn't exist or was invalid, we'll have to (re)create it
|
||||||
try {
|
try {
|
||||||
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll);
|
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false);
|
||||||
} catch (wxString temp) {
|
} catch (wxString temp) {
|
||||||
MsgString << temp;
|
MsgString << temp;
|
||||||
throw MsgString;
|
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)) {
|
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
|
// found an unindexed audio track, we'll need to reindex
|
||||||
try {
|
try {
|
||||||
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll);
|
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false);
|
||||||
} catch (wxString temp) {
|
} catch (wxString temp) {
|
||||||
MsgString << temp;
|
MsgString << temp;
|
||||||
throw MsgString;
|
throw MsgString;
|
||||||
|
@ -117,7 +117,14 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: provide a way to choose which audio track to load?
|
// 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) {
|
if (!AudioSource) {
|
||||||
wxString temp(FFMSErrMsg, wxConvUTF8);
|
wxString temp(FFMSErrMsg, wxConvUTF8);
|
||||||
MsgString << _T("failed to open audio track: ") << temp;
|
MsgString << _T("failed to open audio track: ") << temp;
|
||||||
|
|
|
@ -56,7 +56,7 @@ int __stdcall FFmpegSourceProvider::UpdateIndexingProgress(int State, int64_t Cu
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Do indexing
|
// 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];
|
char FFMSErrMsg[1024];
|
||||||
unsigned MsgSize = sizeof(FFMSErrMsg);
|
unsigned MsgSize = sizeof(FFMSErrMsg);
|
||||||
wxString MsgString;
|
wxString MsgString;
|
||||||
|
@ -69,7 +69,7 @@ FrameIndex *FFmpegSourceProvider::DoIndexing(FrameIndex *Index, wxString FileNam
|
||||||
Progress.ProgressDialog->SetProgress(0,1);
|
Progress.ProgressDialog->SetProgress(0,1);
|
||||||
|
|
||||||
// index all audio tracks
|
// 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) {
|
if (!Index) {
|
||||||
Progress.ProgressDialog->Destroy();
|
Progress.ProgressDialog->Destroy();
|
||||||
wxString temp(FFMSErrMsg, wxConvUTF8);
|
wxString temp(FFMSErrMsg, wxConvUTF8);
|
||||||
|
|
|
@ -47,7 +47,6 @@ class FFmpegSourceProvider {
|
||||||
public:
|
public:
|
||||||
static const int FFMSTrackMaskAll = -1;
|
static const int FFMSTrackMaskAll = -1;
|
||||||
static const int FFMSTrackMaskNone = 0;
|
static const int FFMSTrackMaskNone = 0;
|
||||||
static const int FFMSFirstSuitableTrack = -1;
|
|
||||||
|
|
||||||
struct IndexingProgressDialog {
|
struct IndexingProgressDialog {
|
||||||
volatile bool IndexingCanceled;
|
volatile bool IndexingCanceled;
|
||||||
|
@ -55,7 +54,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __stdcall UpdateIndexingProgress(int State, int64_t Current, int64_t Total, void *Private);
|
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 */
|
#endif /* WITH_FFMPEGSOURCE */
|
|
@ -126,7 +126,7 @@
|
||||||
////////////////
|
////////////////
|
||||||
// FFMpegSource
|
// FFMpegSource
|
||||||
#ifdef WITH_FFMPEGSOURCE
|
#ifdef WITH_FFMPEGSOURCE
|
||||||
#pragma comment(lib, "ffmpegsource2.lib")
|
#pragma comment(lib, "ffms2.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,8 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
||||||
if (Index == NULL) {
|
if (Index == NULL) {
|
||||||
// index didn't exist or was invalid, we'll have to (re)create it
|
// index didn't exist or was invalid, we'll have to (re)create it
|
||||||
try {
|
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) {
|
} catch (wxString temp) {
|
||||||
ErrorMsg << temp;
|
ErrorMsg << temp;
|
||||||
throw ErrorMsg;
|
throw ErrorMsg;
|
||||||
|
@ -112,7 +113,15 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
||||||
else
|
else
|
||||||
SeekMode = 1;
|
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) {
|
if (VideoSource == NULL) {
|
||||||
wxString temp(FFMSErrorMessage, wxConvUTF8);
|
wxString temp(FFMSErrorMessage, wxConvUTF8);
|
||||||
ErrorMsg << _T("failed to open video track: ") << temp;
|
ErrorMsg << _T("failed to open video track: ") << temp;
|
||||||
|
|
Loading…
Reference in a new issue