Make FFmpegSource video and audio providers build again after FFMS2 changes last night.

Originally committed to SVN as r2944.
This commit is contained in:
Niels Martin Hansen 2009-05-16 12:47:23 +00:00
parent 7fcfaa5dc6
commit ef407b6e68
6 changed files with 22 additions and 22 deletions

View file

@ -73,7 +73,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
// generate a default name for the cache file // generate a default name for the cache file
wxString CacheName = GetCacheFilename(filename.c_str()); wxString CacheName = GetCacheFilename(filename.c_str());
FrameIndex *Index; FFIndex *Index;
Index = FFMS_ReadIndex(CacheName.char_str(), FFMSErrMsg, MsgSize); Index = FFMS_ReadIndex(CacheName.char_str(), FFMSErrMsg, MsgSize);
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
@ -89,15 +89,15 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
// index exists, but does it have indexing info for the audio track(s)? // index exists, but does it have indexing info for the audio track(s)?
int NumTracks = FFMS_GetNumTracks(Index); int NumTracks = FFMS_GetNumTracks(Index);
if (NumTracks <= 0) { if (NumTracks <= 0) {
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
throw _T("FFmpegSource audio provider: no tracks found in index file"); throw _T("FFmpegSource audio provider: no tracks found in index file");
} }
for (int i = 0; i < NumTracks; i++) { for (int i = 0; i < NumTracks; i++) {
FrameInfoVector *FrameData = FFMS_GetTITrackIndex(Index, i, FFMSErrMsg, MsgSize); FFTrack *FrameData = FFMS_GetTITrackIndex(Index, i, FFMSErrMsg, MsgSize);
if (FrameData == NULL) { if (FrameData == NULL) {
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
wxString temp(FFMSErrMsg, wxConvUTF8); wxString temp(FFMSErrMsg, wxConvUTF8);
MsgString << _T("Couldn't get track data: ") << temp; MsgString << _T("Couldn't get track data: ") << temp;
@ -108,7 +108,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
if (FFMS_GetNumFrames(FrameData) <= 0 && (FFMS_GetTrackType(FrameData) == FFMS_TYPE_AUDIO)) { if (FFMS_GetNumFrames(FrameData) <= 0 && (FFMS_GetTrackType(FrameData) == 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 {
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false); Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false);
} catch (wxString temp) { } catch (wxString temp) {
@ -130,7 +130,7 @@ 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?
int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_AUDIO, FFMSErrMsg, MsgSize); int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_AUDIO, FFMSErrMsg, MsgSize);
if (TrackNumber < 0) { if (TrackNumber < 0) {
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
wxString temp(FFMSErrMsg, wxConvUTF8); wxString temp(FFMSErrMsg, wxConvUTF8);
MsgString << _T("Couldn't find any audio tracks: ") << temp; MsgString << _T("Couldn't find any audio tracks: ") << temp;
@ -138,7 +138,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
} }
AudioSource = FFMS_CreateAudioSource(FileNameWX.mb_str(wxConvLocal), TrackNumber, Index, FFMSErrMsg, MsgSize); AudioSource = FFMS_CreateAudioSource(FileNameWX.mb_str(wxConvLocal), TrackNumber, Index, FFMSErrMsg, MsgSize);
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
if (!AudioSource) { if (!AudioSource) {
wxString temp(FFMSErrMsg, wxConvUTF8); wxString temp(FFMSErrMsg, wxConvUTF8);
@ -146,7 +146,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
throw MsgString; throw MsgString;
} }
const AudioProperties AudioInfo = *FFMS_GetAudioProperties(AudioSource); const TAudioProperties AudioInfo = *FFMS_GetTAudioProperties(AudioSource);
if (AudioInfo.Float) if (AudioInfo.Float)
throw _T("FFmpegSource audio provider: I don't know what to do with floating point audio"); throw _T("FFmpegSource audio provider: I don't know what to do with floating point audio");

View file

@ -45,7 +45,7 @@
// FFmpegSource audio provider // FFmpegSource audio provider
class FFmpegSourceAudioProvider : public AudioProvider, FFmpegSourceProvider { class FFmpegSourceAudioProvider : public AudioProvider, FFmpegSourceProvider {
private: private:
AudioBase *AudioSource; FFAudio *AudioSource;
char FFMSErrMsg[1024]; char FFMSErrMsg[1024];
unsigned MsgSize; unsigned MsgSize;

View file

@ -71,7 +71,7 @@ int FFMS_CC FFmpegSourceProvider::UpdateIndexingProgress(int State, int64_t Curr
/////////// ///////////
// Do indexing // Do indexing
FrameIndex *FFmpegSourceProvider::DoIndexing(FrameIndex *Index, wxString FileNameWX, wxString CacheName, int Trackmask, bool IgnoreDecodeErrors) { FFIndex *FFmpegSourceProvider::DoIndexing(FFIndex *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;

View file

@ -60,7 +60,7 @@ public:
bool CleanCache(); bool CleanCache();
static int FFMS_CC UpdateIndexingProgress(int State, int64_t Current, int64_t Total, void *Private); static int FFMS_CC UpdateIndexingProgress(int State, int64_t Current, int64_t Total, void *Private);
FrameIndex *DoIndexing(FrameIndex *Index, wxString Filename, wxString Cachename, int Trackmask, bool IgnoreDecodeErrors); FFIndex *DoIndexing(FFIndex *Index, wxString Filename, wxString Cachename, int Trackmask, bool IgnoreDecodeErrors);
wxString GetCacheFilename(const wxString& filename); wxString GetCacheFilename(const wxString& filename);
virtual FFmpegSourceProvider::~FFmpegSourceProvider() {} virtual FFmpegSourceProvider::~FFmpegSourceProvider() {}

View file

@ -89,7 +89,7 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
wxString CacheName = GetCacheFilename(filename.c_str()); wxString CacheName = GetCacheFilename(filename.c_str());
// try to read index // try to read index
FrameIndex *Index = FFMS_ReadIndex(CacheName.char_str(), FFMSErrorMessage, MessageSize); FFIndex *Index = FFMS_ReadIndex(CacheName.char_str(), FFMSErrorMessage, MessageSize);
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 {
@ -132,7 +132,7 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
// FIXME: provide a way to choose which audio track to load? // FIXME: provide a way to choose which audio track to load?
int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_VIDEO, FFMSErrorMessage, MessageSize); int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_VIDEO, FFMSErrorMessage, MessageSize);
if (TrackNumber < 0) { if (TrackNumber < 0) {
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
wxString temp(FFMSErrorMessage, wxConvUTF8); wxString temp(FFMSErrorMessage, wxConvUTF8);
ErrorMsg << _T("Couldn't find any video tracks: ") << temp; ErrorMsg << _T("Couldn't find any video tracks: ") << temp;
@ -140,7 +140,7 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
} }
VideoSource = FFMS_CreateVideoSource(FileNameWX.mb_str(wxConvLocal), TrackNumber, Index, "", Threads, SeekMode, FFMSErrorMessage, MessageSize); VideoSource = FFMS_CreateVideoSource(FileNameWX.mb_str(wxConvLocal), TrackNumber, Index, "", Threads, SeekMode, FFMSErrorMessage, MessageSize);
FFMS_DestroyFrameIndex(Index); FFMS_DestroyFFIndex(Index);
Index = NULL; Index = NULL;
if (VideoSource == NULL) { if (VideoSource == NULL) {
wxString temp(FFMSErrorMessage, wxConvUTF8); wxString temp(FFMSErrorMessage, wxConvUTF8);
@ -149,21 +149,21 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
} }
// load video properties // load video properties
VideoInfo = FFMS_GetVideoProperties(VideoSource); VideoInfo = FFMS_GetTVideoProperties(VideoSource);
// get frame info data // get frame info data
FrameInfoVector *FrameData = FFMS_GetVSTrackIndex(VideoSource); FFTrack *FrameData = FFMS_GetVSTrackIndex(VideoSource);
if (FrameData == NULL) if (FrameData == NULL)
throw _T("FFmpegSource video provider: failed to get frame data"); throw _T("FFmpegSource video provider: failed to get frame data");
const TrackTimeBase *TimeBase = FFMS_GetTimeBase(FrameData); const TTrackTimeBase *TimeBase = FFMS_GetTimeBase(FrameData);
if (TimeBase == NULL) if (TimeBase == NULL)
throw _T("FFmpegSource video provider: failed to get track time base"); throw _T("FFmpegSource video provider: failed to get track time base");
const FrameInfo *CurFrameData; const TFrameInfo *CurFrameData;
// build list of keyframes and timecodes // build list of keyframes and timecodes
for (int CurFrameNum = 0; CurFrameNum < VideoInfo->NumFrames; CurFrameNum++) { for (int CurFrameNum = 0; CurFrameNum < VideoInfo->NumFrames; CurFrameNum++) {
CurFrameData = FFMS_GetFrameInfo(FrameData, CurFrameNum, FFMSErrorMessage, MessageSize); CurFrameData = FFMS_GetTFrameInfo(FrameData, CurFrameNum, FFMSErrorMessage, MessageSize);
if (CurFrameData == NULL) { if (CurFrameData == NULL) {
wxString temp(FFMSErrorMessage, wxConvUTF8); wxString temp(FFMSErrorMessage, wxConvUTF8);
ErrorMsg << _T("Couldn't get framedata for frame ") << CurFrameNum << _T(": ") << temp; ErrorMsg << _T("Couldn't get framedata for frame ") << CurFrameNum << _T(": ") << temp;
@ -259,7 +259,7 @@ const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int _n, int FormatType)
} }
// decode frame // decode frame
const AVFrameLite *SrcFrame = FFMS_GetFrame(VideoSource, n, FFMSErrorMessage, MessageSize); const TAVFrameLite *SrcFrame = FFMS_GetFrame(VideoSource, n, FFMSErrorMessage, MessageSize);
if (SrcFrame == NULL) { if (SrcFrame == NULL) {
wxString temp(FFMSErrorMessage, wxConvUTF8); wxString temp(FFMSErrorMessage, wxConvUTF8);
ErrorMsg << _T("Failed to retrieve frame: ") << temp; ErrorMsg << _T("Failed to retrieve frame: ") << temp;

View file

@ -47,8 +47,8 @@
// FFmpegSource video provider // FFmpegSource video provider
class FFmpegSourceVideoProvider : public VideoProvider, FFmpegSourceProvider { class FFmpegSourceVideoProvider : public VideoProvider, FFmpegSourceProvider {
private: private:
VideoBase *VideoSource; FFVideo *VideoSource;
const VideoProperties *VideoInfo; const TVideoProperties *VideoInfo;
int FrameNumber; int FrameNumber;
wxArrayInt KeyFramesList; wxArrayInt KeyFramesList;