Add option to force all video opened with FFMS2 to BT.601 for VSFilter compatibility

Originally committed to SVN as r6535.
This commit is contained in:
Thomas Goyne 2012-03-07 04:25:46 +00:00
parent bb9859c70f
commit 366baff2f8
4 changed files with 20 additions and 1 deletions

View file

@ -344,6 +344,7 @@
},
"FFmpegSource" : {
"Decoding Threads" : -1,
"Force BT.601" : false,
"Unsafe Seeking" : false
}
}

View file

@ -59,6 +59,10 @@
#include "audio_player_portaudio.h"
#endif
#ifdef WITH_FFMS2
#include <ffms.h>
#endif
static wxArrayString vec_to_arrstr(std::vector<std::string> const& vec) {
wxArrayString arrstr;
transform(vec.begin(), vec.end(), std::back_inserter(arrstr), &lagi_wxString);
@ -589,6 +593,9 @@ Advanced_Video::Advanced_Video(wxTreebook *book, Preferences *parent): OptionPag
OptionAdd(ffms, _("Decoding threads"), "Provider/Video/FFmpegSource/Decoding Threads");
OptionAdd(ffms, _("Enable unsafe seeking"), "Provider/Video/FFmpegSource/Unsafe Seeking");
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (1 << 8) | 0)
OptionAdd(ffms, _("Force BT.601"), "Provider/Video/FFmpegSource/Force BT.601");
#endif
#endif
SetSizerAndFit(sizer);

View file

@ -94,6 +94,7 @@ VideoContext::VideoContext()
OPT_SUB("Provider/Video/FFmpegSource/Decoding Threads", &VideoContext::Reload, this);
OPT_SUB("Provider/Video/FFmpegSource/Unsafe Seeking", &VideoContext::Reload, this);
OPT_SUB("Provider/Video/FFmpegSource/Force BT.601", &VideoContext::Reload, this);
}
VideoContext::~VideoContext () {

View file

@ -179,7 +179,17 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
else
DAR = double(Width) / Height;
switch (TempFrame->ColorSpace) {
int CS = TempFrame->ColorSpace;
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (1 << 8) | 0)
if (CS != FFMS_CS_RGB && CS != FFMS_CS_BT470BG && OPT_GET("Provider/Video/FFmpegSource/Force BT.601")->GetBool()) {
if (FFMS_SetInputFormatV(VideoSource, FFMS_CS_BT470BG, FFMS_CR_MPEG, FFMS_GetPixFmt(""), &ErrInfo))
throw VideoOpenError(std::string("Failed to set input format: ") + ErrInfo.Buffer);
CS = FFMS_CS_BT470BG;
}
#endif
switch (CS) {
case FFMS_CS_RGB: ColorSpace = "RGB"; break;
case FFMS_CS_BT709: ColorSpace = "BT.709"; break;
case FFMS_CS_BT470BG: ColorSpace = "BT.601"; break;