Remove compatibility with old versions of FFMS2

2.22 was released oct 2015, so I think a more recent version is a fairly safe assumption
This commit is contained in:
Ryan Lucia 2018-12-30 14:19:11 -05:00
parent ad52260665
commit a1ec3767e4
3 changed files with 0 additions and 42 deletions

View file

@ -126,10 +126,8 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
// reindex if the error handling mode has changed
FFMS_IndexErrorHandling ErrorHandling = GetErrorHandlingMode();
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (2 << 8) | 0)
if (Index && FFMS_GetErrorHandling(Index) != ErrorHandling)
Index = nullptr;
#endif
// moment of truth
if (!Index) {
@ -167,7 +165,6 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
throw agi::AudioProviderError("unknown or unsupported sample format");
}
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (4 << 8) | 0)
if (channels > 1 || bytes_per_sample != 2) {
std::unique_ptr<FFMS_ResampleOptions, decltype(&FFMS_DestroyResampleOptions)>
opt(FFMS_CreateResampleOptions(AudioSource), FFMS_DestroyResampleOptions);
@ -181,7 +178,6 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
float_samples = false;
}
}
#endif
}
}

View file

@ -50,20 +50,6 @@
#include <wx/intl.h>
#include <wx/choicdlg.h>
#if FFMS_VERSION < ((2 << 24) | (22 << 16) | (0 << 8) | 0)
enum {
FFMS_LOG_QUIET = -8,
FFMS_LOG_PANIC = 0,
FFMS_LOG_FATAL = 8,
FFMS_LOG_ERROR = 16,
FFMS_LOG_WARNING = 24,
FFMS_LOG_INFO = 32,
FFMS_LOG_VERBOSE = 40,
FFMS_LOG_DEBUG = 48,
FFMS_LOG_TRACE = 56
};
#endif
FFmpegSourceProvider::FFmpegSourceProvider(agi::BackgroundRunner *br)
: br(br)
{
@ -95,7 +81,6 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer,
ps->SetProgress(Current, Total);
return ps->IsCancelled();
};
#if FFMS_VERSION >= ((2 << 24) | (21 << 16) | (0 << 8) | 0)
if (Track == TrackSelection::All)
FFMS_TrackTypeIndexSettings(Indexer, FFMS_TYPE_AUDIO, 1, 0);
else if (Track != TrackSelection::None)
@ -103,15 +88,6 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer,
FFMS_TrackTypeIndexSettings(Indexer, FFMS_TYPE_VIDEO, 1, 0);
FFMS_SetProgressCallback(Indexer, callback, ps);
Index = FFMS_DoIndexing2(Indexer, IndexEH, &ErrInfo);
#else
int Trackmask = 0;
if (Track == TrackSelection::All)
Trackmask = std::numeric_limits<int>::max();
else if (Track != TrackSelection::None)
Trackmask = 1 << static_cast<int>(Track);
Index = FFMS_DoIndexing(Indexer, Trackmask, 0,
nullptr, nullptr, IndexEH, callback, ps, &ErrInfo);
#endif
});
if (Index == nullptr)
@ -131,12 +107,6 @@ std::map<int, std::string> FFmpegSourceProvider::GetTracksOfType(FFMS_Indexer *I
std::map<int,std::string> TrackList;
int NumTracks = FFMS_GetNumTracksI(Indexer);
// older versions of ffms2 can't index audio tracks past 31
#if FFMS_VERSION < ((2 << 24) | (21 << 16) | (0 << 8) | 0)
if (Type == FFMS_TYPE_AUDIO)
NumTracks = std::min(NumTracks, std::numeric_limits<int>::digits);
#endif
for (int i=0; i<NumTracks; i++) {
if (FFMS_GetTrackTypeI(Indexer, i) == Type) {
if (auto CodecName = FFMS_GetCodecNameI(Indexer, i))

View file

@ -90,7 +90,6 @@ public:
void GetFrame(int n, VideoFrame &out) override;
void SetColorSpace(std::string const& matrix) override {
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (1 << 8) | 0)
if (matrix == ColorSpace) return;
if (matrix == RealColorSpace)
FFMS_SetInputFormatV(VideoSource, CS, CR, FFMS_GetPixFmt(""), nullptr);
@ -99,7 +98,6 @@ public:
else
return;
ColorSpace = matrix;
#endif
}
int GetFrameCount() const override { return VideoInfo->NumFrames; }
@ -223,10 +221,6 @@ void FFmpegSourceVideoProvider::LoadVideo(agi::fs::path const& filename, std::st
// set thread count
int Threads = OPT_GET("Provider/Video/FFmpegSource/Decoding Threads")->GetInt();
#if FFMS_VERSION < ((2 << 24) | (30 << 16) | (0 << 8) | 0)
if (FFMS_GetVersion() < ((2 << 24) | (17 << 16) | (2 << 8) | 1) && FFMS_GetSourceType(Index) == FFMS_SOURCE_LAVF)
Threads = 1;
#endif
// set seekmode
// TODO: give this its own option?
@ -261,7 +255,6 @@ void FFmpegSourceVideoProvider::LoadVideo(agi::fs::path const& filename, std::st
CS = Width > 1024 || Height >= 600 ? AGI_CS_BT709 : AGI_CS_BT470BG;
RealColorSpace = ColorSpace = colormatrix_description(CS, CR);
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (1 << 8) | 0)
if (CS != AGI_CS_RGB && CS != AGI_CS_BT470BG && ColorSpace != colormatrix && colormatrix == "TV.601") {
CS = AGI_CS_BT470BG;
ColorSpace = colormatrix_description(CS, CR);
@ -271,7 +264,6 @@ void FFmpegSourceVideoProvider::LoadVideo(agi::fs::path const& filename, std::st
if (FFMS_SetInputFormatV(VideoSource, CS, CR, FFMS_GetPixFmt(""), &ErrInfo))
throw VideoOpenError(std::string("Failed to set input format: ") + ErrInfo.Buffer);
}
#endif
const int TargetFormat[] = { FFMS_GetPixFmt("bgra"), -1 };
if (FFMS_SetOutputFormatV2(VideoSource, TargetFormat, Width, Height, FFMS_RESIZER_BICUBIC, &ErrInfo))