当前位置: 首页>>代码示例>>C++>>正文


C++ VideoInfo::IsRGB24方法代码示例

本文整理汇总了C++中VideoInfo::IsRGB24方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoInfo::IsRGB24方法的具体用法?C++ VideoInfo::IsRGB24怎么用?C++ VideoInfo::IsRGB24使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VideoInfo的用法示例。


在下文中一共展示了VideoInfo::IsRGB24方法的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;
}
开发者ID:btb,项目名称:avxsynth,代码行数:23,代码来源:avxSynthAppInterface.cpp

示例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;
}
开发者ID:BackupTheBerlios,项目名称:aegisub-svn,代码行数:39,代码来源:draw_prs.cpp

示例3: dimzon_avs_init


//.........这里部分代码省略.........
				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())
		{
开发者ID:BrunoReX,项目名称:xvid4psp,代码行数:67,代码来源:AviSynthWrapper.cpp


注:本文中的VideoInfo::IsRGB24方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。