本文整理汇总了C++中VideoInfo::IsRGB32方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoInfo::IsRGB32方法的具体用法?C++ VideoInfo::IsRGB32怎么用?C++ VideoInfo::IsRGB32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoInfo
的用法示例。
在下文中一共展示了VideoInfo::IsRGB32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MPlayerCommandVideo
int AvxContext::MPlayerCommandVideo(char *command) {
char format[sizeof("bgr32")];
bool flipVertical = false;
if (vi.IsRGB24()) {
sprintf(format, "bgr24");
flipVertical = true;
} else if (vi.IsRGB32()) {
sprintf(format, "bgr32");
flipVertical = true;
} else if (vi.IsYUY2()) {
sprintf(format, "yuy2");
} else if (vi.IsYV12()) {
sprintf(format, "yv12");
} else {
AVXLOG_ERROR("%s", "Unsupported colorspace");
return -1;
}
sprintf(command, MPLAYER " %s -demuxer rawvideo -rawvideo w=%d:h=%d:format=%s - 1> /dev/null",
flipVertical ? "-flip" : "", vi.width, vi.height, format);
return 0;
}
示例2: GetFrame
/////////////
// Get frame
PVideoFrame __stdcall DrawPRS::GetFrame(int n, IScriptEnvironment* env) {
// Avisynth frame
PVideoFrame avsFrame = child->GetFrame(n,env);
try {
// Check if there is anything to be drawn
if (file.HasDataAtFrame(n)) {
// Create the PRSFrame structure
env->MakeWritable(&avsFrame);
PRSVideoFrame frame;
frame.data[0] = (char*) avsFrame->GetWritePtr();
frame.w = avsFrame->GetRowSize()/4;
frame.h = avsFrame->GetHeight();
frame.pitch = avsFrame->GetPitch();
frame.flipColors = true;
frame.flipVertical = true;
// Set colorspace
VideoInfo vi = child->GetVideoInfo();
if (vi.IsYV12()) frame.colorSpace = ColorSpace_YV12;
else if (vi.IsYUY2()) frame.colorSpace = ColorSpace_YUY2;
else if (vi.IsRGB32()) frame.colorSpace = ColorSpace_RGB32;
else if (vi.IsRGB24()) frame.colorSpace = ColorSpace_RGB24;
// Draw into the frame
file.DrawFrame(n,&frame);
}
}
// Catch exception
catch (const std::exception &e) {
env->ThrowError(e.what());
}
// Return frame
return avsFrame;
}
示例3: dimzon_avs_init
//.........这里部分代码省略.........
//Если надо, добавляем Distributor() - после импорта
AVSValue mt_test = pstr->env->Invoke("GetMTMode", false);
const int mt_mode = mt_test.IsInt() ? mt_test.AsInt() : 0;
if (mt_mode > 0 && mt_mode < 5)
{
if (mt_mode != 1 && vi->mt_import == MT_ADDM1DISTR)
pstr->env->Invoke("SetMTMode", 1);
res = pstr->env->Invoke("Distributor", res);
}
}
catch (IScriptEnvironment::NotFound) { /*AviSynth без MT*/ }
if (!res.IsClip())
{
strncpy_s(pstr->err, ERRMSG_LEN, "After adding \"Distributor()\" the script's return was not a video clip.", _TRUNCATE);
return 4;
}
}
pstr->clp = res.AsClip();
VideoInfo inf = pstr->clp->GetVideoInfo();
if (inf.HasVideo())
{
string filter = "";
string err_string = "";
//Original и Requested PixelType
if (vi != NULL) vi->pixel_type_orig = inf.pixel_type;
int pixel_type_req = (vi != NULL) ? vi->pixel_type : 0;
if (pixel_type_req == 0) { /*Выводим видео как оно есть, без проверок и преобразований*/ }
else if (pixel_type_req == inf.CS_BGR32) { if (!inf.IsRGB32()) { filter = "ConvertToRGB32"; err_string = "AviSynthWrapper: Cannot convert video to RGB32!"; }}
else if (pixel_type_req == inf.CS_BGR24) { if (!inf.IsRGB24()) { filter = "ConvertToRGB24"; err_string = "AviSynthWrapper: Cannot convert video to RGB24!"; }}
else if (pixel_type_req == inf.CS_YUY2) { if (!inf.IsYUY2()) { filter = "ConvertToYUY2"; err_string = "AviSynthWrapper: Cannot convert video to YUY2!"; }}
else if (pixel_type_req == inf.CS_YV12) { if (!inf.IsYV12()) { filter = "ConvertToYV12"; err_string = "AviSynthWrapper: Cannot convert video to YV12!"; }}
else if (pixel_type_req == inf.CS_I420) { if (!inf.IsYV12()) { filter = "ConvertToYV12"; err_string = "AviSynthWrapper: Cannot convert video to YV12!"; }}
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())