本文整理汇总了C++中VideoInfo::IsTFF方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoInfo::IsTFF方法的具体用法?C++ VideoInfo::IsTFF怎么用?C++ VideoInfo::IsTFF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoInfo
的用法示例。
在下文中一共展示了VideoInfo::IsTFF方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dimzon_avs_init
//.........这里部分代码省略.........
else
{
//"2.5 Baked API will see all new planar as YV12"
//YV411, YV24, YV16 и Y8 в IsYV12() определяются как YV12
strncpy_s(pstr->err, ERRMSG_LEN, "AviSynthWrapper: Requested PixelType isn't valid or such conversion is not yet implemented!", _TRUNCATE);
return 5;
}
if (filter.length() > 0)
{
res = pstr->env->Invoke(filter.c_str(), AVSValue(&res, 1));
pstr->clp = res.AsClip();
VideoInfo infh = pstr->clp->GetVideoInfo();
if (pixel_type_req == inf.CS_BGR32 && !infh.IsRGB32() ||
pixel_type_req == inf.CS_BGR24 && !infh.IsRGB24() ||
pixel_type_req == inf.CS_YUY2 && !infh.IsYUY2() ||
pixel_type_req == inf.CS_YV12 && !infh.IsYV12() ||
pixel_type_req == inf.CS_I420 && !infh.IsYV12())
{
strncpy_s(pstr->err, ERRMSG_LEN, err_string.c_str(), _TRUNCATE);
return 5;
}
}
}
if (inf.HasAudio())
{
string filter = "";
string err_string = "";
//Original и Requested SampleType
if (vi != NULL) vi->sample_type_orig = inf.sample_type;
int sample_type_req = (vi != NULL) ? vi->sample_type : 0;
if (sample_type_req == 0) { /*Выводим звук как он есть, без проверок и преобразований*/ }
else if (sample_type_req == SAMPLE_FLOAT) { if (inf.sample_type != SAMPLE_FLOAT) { filter = "ConvertAudioToFloat"; err_string = "AviSynthWrapper: Cannot convert audio to FLOAT!"; }}
else if (sample_type_req == SAMPLE_INT32) { if (inf.sample_type != SAMPLE_INT32) { filter = "ConvertAudioTo32bit"; err_string = "AviSynthWrapper: Cannot convert audio to INT32!"; }}
else if (sample_type_req == SAMPLE_INT24) { if (inf.sample_type != SAMPLE_INT24) { filter = "ConvertAudioTo24bit"; err_string = "AviSynthWrapper: Cannot convert audio to INT24!"; }}
else if (sample_type_req == SAMPLE_INT16) { if (inf.sample_type != SAMPLE_INT16) { filter = "ConvertAudioTo16bit"; err_string = "AviSynthWrapper: Cannot convert audio to INT16!"; }}
else if (sample_type_req == SAMPLE_INT8) { if (inf.sample_type != SAMPLE_INT8) { filter = "ConvertAudioTo8bit"; err_string = "AviSynthWrapper: Cannot convert audio to INT8!"; }}
else
{
strncpy_s(pstr->err, ERRMSG_LEN, "AviSynthWrapper: Requested SampleType isn't valid or such conversion is not yet implemented!", _TRUNCATE);
return 6;
}
if (filter.length() > 0)
{
res = pstr->env->Invoke(filter.c_str(), res);
pstr->clp = res.AsClip();
VideoInfo infh = pstr->clp->GetVideoInfo();
if (sample_type_req == SAMPLE_FLOAT && infh.sample_type != SAMPLE_FLOAT ||
sample_type_req == SAMPLE_INT32 && infh.sample_type != SAMPLE_INT32 ||
sample_type_req == SAMPLE_INT24 && infh.sample_type != SAMPLE_INT24 ||
sample_type_req == SAMPLE_INT16 && infh.sample_type != SAMPLE_INT16 ||
sample_type_req == SAMPLE_INT8 && infh.sample_type != SAMPLE_INT8)
{
strncpy_s(pstr->err, ERRMSG_LEN, err_string.c_str(), _TRUNCATE);
return 6;
}
}
}
inf = pstr->clp->GetVideoInfo();
if (vi != NULL) {
vi->width = inf.width;
vi->height = inf.height;
vi->raten = inf.fps_numerator;
vi->rated = inf.fps_denominator;
vi->field_based = (inf.IsFieldBased()) ? 1 : 0;
vi->first_field = (inf.IsTFF()) ? 1 : (inf.IsBFF()) ? 2 : 0;
vi->num_frames = inf.num_frames;
//if (vi->pixel_type == 0) vi->pixel_type = inf.pixel_type;
//if (vi->sample_type == 0) vi->sample_type = inf.sample_type;
vi->pixel_type = inf.pixel_type;
vi->sample_type = inf.sample_type;
vi->audio_samples_per_second = inf.audio_samples_per_second;
vi->num_audio_samples = inf.num_audio_samples;
vi->nchannels = inf.nchannels;
}
//Нужен ли нам вообще этот res?!
if(pstr->res) delete pstr->res;
pstr->res = new AVSValue(res);
pstr->err[0] = 0;
return 0;
}
catch(AvisynthError err)
{
strncpy_s(pstr->err, ERRMSG_LEN, err.msg, _TRUNCATE);
return AVS_GERROR;
}
}
示例2: dimzon_avs_invoke
//.........这里部分代码省略.........
args[actual_len] = pstr->clp; //pstr->res->AsClip();
actual_len += 1;
//pstr->clp; pstr->res->AsClip(); //С обработкой после прошлых вызовов Invoke
//pstr->env->GetVar("last").AsClip(); //"Чистый" выход скрипта
}
else if (was_letters && !was_digits && !was_spaces && lower.compare("true") == 0)
{
//Bool (true)
args[actual_len] = true;
actual_len += 1;
}
else if (was_letters && !was_digits && !was_spaces && lower.compare("false") == 0)
{
//Bool (false)
args[actual_len] = false;
actual_len += 1;
}
else if (!was_letters && was_digits && !was_spaces && lower.find(".") != string::npos)
{
//Float (double..)
args[actual_len] = atof(arg[i]);
actual_len += 1;
}
else if (!was_letters && was_digits && !was_spaces)
{
//Integer
args[actual_len] = atoi(arg[i]);
actual_len += 1;
}
else
{
//String
args[actual_len] = arg[i];
actual_len += 1;
}
}
}
AVSValue res = pstr->env->Invoke(func, AVSValue(args, actual_len));
if (!res.IsClip())
{
//Вывод результата
if (res.IsBool())
{
if(!res.AsBool()) *func_out = 0;
else *func_out = FLT_MAX;
}
else if (res.IsInt()) *func_out = (float)res.AsInt();
else if (res.IsFloat()) *func_out = (float)res.AsFloat();
else if (res.IsString()) { *func_out = FLT_MAX; strncpy_s(pstr->err, ERRMSG_LEN, res.AsString(), _TRUNCATE); }
}
else
{
pstr->clp = res.AsClip();
VideoInfo inf = pstr->clp->GetVideoInfo();
if (vi != NULL)
{
vi->width = inf.width;
vi->height = inf.height;
vi->raten = inf.fps_numerator;
vi->rated = inf.fps_denominator;
vi->field_based = (inf.IsFieldBased()) ? 1 : 0;
vi->first_field = (inf.IsTFF()) ? 1 : (inf.IsBFF()) ? 2 : 0;
vi->num_frames = inf.num_frames;
//Или не меняем?
if (vi->pixel_type_orig == 0) vi->pixel_type_orig = inf.pixel_type;
if (vi->sample_type_orig == 0) vi->sample_type_orig = inf.sample_type;
vi->pixel_type = inf.pixel_type;
vi->sample_type = inf.sample_type;
vi->num_audio_samples = inf.num_audio_samples;
vi->audio_samples_per_second = inf.audio_samples_per_second;
vi->nchannels = inf.nchannels;
}
//Нужен ли нам вообще этот res?!
if(pstr->res) delete pstr->res;
pstr->res = new AVSValue(res);
pstr->err[0] = 0;
}
return 0;
}
catch(AvisynthError err)
{
strncpy_s(pstr->err, ERRMSG_LEN, err.msg, _TRUNCATE);
return AVS_GERROR;
}
catch(IScriptEnvironment::NotFound)
{
strncpy_s(pstr->err, ERRMSG_LEN, "AviSynthWrapper: Wrong function name or invalid parameters was passed to Invoke!", _TRUNCATE);
return AVS_VARNFOUND
}
}