mirror of https://github.com/odrling/Aegisub
Make FFmpegSource video and audio providers build again after FFMS2 changes last night.
Originally committed to SVN as r2944.
This commit is contained in:
parent
d6cea9d93e
commit
a60d16913d
|
@ -73,7 +73,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
|
|||
// generate a default name for the cache file
|
||||
wxString CacheName = GetCacheFilename(filename.c_str());
|
||||
|
||||
FrameIndex *Index;
|
||||
FFIndex *Index;
|
||||
Index = FFMS_ReadIndex(CacheName.char_str(), FFMSErrMsg, MsgSize);
|
||||
if (Index == NULL) {
|
||||
// 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)?
|
||||
int NumTracks = FFMS_GetNumTracks(Index);
|
||||
if (NumTracks <= 0) {
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
throw _T("FFmpegSource audio provider: no tracks found in index file");
|
||||
}
|
||||
|
||||
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) {
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
wxString temp(FFMSErrMsg, wxConvUTF8);
|
||||
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)) {
|
||||
// found an unindexed audio track, we'll need to reindex
|
||||
try {
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
Index = DoIndexing(Index, FileNameWX, CacheName, FFMSTrackMaskAll, false);
|
||||
} catch (wxString temp) {
|
||||
|
@ -130,7 +130,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
|
|||
// FIXME: provide a way to choose which audio track to load?
|
||||
int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_AUDIO, FFMSErrMsg, MsgSize);
|
||||
if (TrackNumber < 0) {
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
wxString temp(FFMSErrMsg, wxConvUTF8);
|
||||
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);
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
if (!AudioSource) {
|
||||
wxString temp(FFMSErrMsg, wxConvUTF8);
|
||||
|
@ -146,7 +146,7 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
|
|||
throw MsgString;
|
||||
}
|
||||
|
||||
const AudioProperties AudioInfo = *FFMS_GetAudioProperties(AudioSource);
|
||||
const TAudioProperties AudioInfo = *FFMS_GetTAudioProperties(AudioSource);
|
||||
|
||||
if (AudioInfo.Float)
|
||||
throw _T("FFmpegSource audio provider: I don't know what to do with floating point audio");
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
// FFmpegSource audio provider
|
||||
class FFmpegSourceAudioProvider : public AudioProvider, FFmpegSourceProvider {
|
||||
private:
|
||||
AudioBase *AudioSource;
|
||||
FFAudio *AudioSource;
|
||||
|
||||
char FFMSErrMsg[1024];
|
||||
unsigned MsgSize;
|
||||
|
|
|
@ -71,7 +71,7 @@ int FFMS_CC FFmpegSourceProvider::UpdateIndexingProgress(int State, int64_t Curr
|
|||
|
||||
///////////
|
||||
// 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];
|
||||
unsigned MsgSize = sizeof(FFMSErrMsg);
|
||||
wxString MsgString;
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
bool CleanCache();
|
||||
|
||||
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);
|
||||
|
||||
virtual FFmpegSourceProvider::~FFmpegSourceProvider() {}
|
||||
|
|
|
@ -89,7 +89,7 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
|||
wxString CacheName = GetCacheFilename(filename.c_str());
|
||||
|
||||
// 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) {
|
||||
// index didn't exist or was invalid, we'll have to (re)create it
|
||||
try {
|
||||
|
@ -132,7 +132,7 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
|||
// FIXME: provide a way to choose which audio track to load?
|
||||
int TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_VIDEO, FFMSErrorMessage, MessageSize);
|
||||
if (TrackNumber < 0) {
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
wxString temp(FFMSErrorMessage, wxConvUTF8);
|
||||
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);
|
||||
FFMS_DestroyFrameIndex(Index);
|
||||
FFMS_DestroyFFIndex(Index);
|
||||
Index = NULL;
|
||||
if (VideoSource == NULL) {
|
||||
wxString temp(FFMSErrorMessage, wxConvUTF8);
|
||||
|
@ -149,21 +149,21 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
|||
}
|
||||
|
||||
// load video properties
|
||||
VideoInfo = FFMS_GetVideoProperties(VideoSource);
|
||||
VideoInfo = FFMS_GetTVideoProperties(VideoSource);
|
||||
|
||||
// get frame info data
|
||||
FrameInfoVector *FrameData = FFMS_GetVSTrackIndex(VideoSource);
|
||||
FFTrack *FrameData = FFMS_GetVSTrackIndex(VideoSource);
|
||||
if (FrameData == NULL)
|
||||
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)
|
||||
throw _T("FFmpegSource video provider: failed to get track time base");
|
||||
|
||||
const FrameInfo *CurFrameData;
|
||||
const TFrameInfo *CurFrameData;
|
||||
|
||||
// build list of keyframes and timecodes
|
||||
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) {
|
||||
wxString temp(FFMSErrorMessage, wxConvUTF8);
|
||||
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
|
||||
const AVFrameLite *SrcFrame = FFMS_GetFrame(VideoSource, n, FFMSErrorMessage, MessageSize);
|
||||
const TAVFrameLite *SrcFrame = FFMS_GetFrame(VideoSource, n, FFMSErrorMessage, MessageSize);
|
||||
if (SrcFrame == NULL) {
|
||||
wxString temp(FFMSErrorMessage, wxConvUTF8);
|
||||
ErrorMsg << _T("Failed to retrieve frame: ") << temp;
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
// FFmpegSource video provider
|
||||
class FFmpegSourceVideoProvider : public VideoProvider, FFmpegSourceProvider {
|
||||
private:
|
||||
VideoBase *VideoSource;
|
||||
const VideoProperties *VideoInfo;
|
||||
FFVideo *VideoSource;
|
||||
const TVideoProperties *VideoInfo;
|
||||
|
||||
int FrameNumber;
|
||||
wxArrayInt KeyFramesList;
|
||||
|
|
Loading…
Reference in New Issue