Beispiel #1
0
Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
:
    blockPointField_(dict.lookup("vertices")),
    scaleFactor_(1.0),
    topologyPtr_(createTopology(dict, regionName))
{
    calcMergeInfo();
}
Beispiel #2
0
    bool init()
    {
        std::stringstream fileName;
        fileName << config.outputFile << getProcessId() << ".log";
        log.open(fileName.str());
        log.setLevel(Logging::INFO);
        log.Info() << "Initialization of node "<< getProcessId() << std::endl;

        if (config.nodesNumber > MPI::COMM_WORLD.Get_size())
        {
            log.Fatal() << "Not enough processors. Expected "
                     << config.nodesNumber
                     << std::endl;
            return false;
        }

        if (!createTopology(config.topologyType))
        {
            log.Fatal() << "Could not create topology\n";
            return false;
        }
        return true;
    }
ResultCode::Result VideoCaptureDevice::init(IMFMediaSource *pSource, DeviceSettings deviceSettings, 
											CaptureSettings captureSettings, MediaType MT)
{
	ResultCode::Result result = ResultCode::UNKNOWN_ERROR;

	GUID VideoFormat;

	CComPtr<IMFMediaType> pMediaType;

	CComPtr<IMFActivate> pSinkActivate;		

	CComPtr<IMFTopology> pTopology;
	
	unsigned int bpp = 0;

	switch (captureSettings.videoFormat)
	{
		case CaptureVideoFormat::RGB32:
			VideoFormat = MFVideoFormat_RGB32;
			bpp = 4;
			break;
		case CaptureVideoFormat::AYUV:
			VideoFormat = MFVideoFormat_AYUV;
			bpp = 4;
			break;
		case CaptureVideoFormat::RGB24:
		default:
			VideoFormat = MFVideoFormat_RGB24;
			bpp = 3;
			break;						
	}

	unsigned int imageSize = MT.MF_MT_FRAME_SIZE * bpp;

	pIReadWriteBuffer = ReadWriteBufferFactory::getInstance().createIReadWriteBuffer(captureSettings.readMode, 
																					 imageSize);
					
	result = MediaFoundation::getInstance().createMediaType(&pMediaType);

	if(result != ResultCode::OK)
	{
		goto finish;
	}

	result = MediaFoundation::getInstance().setGUID(pMediaType, MF_MT_MAJOR_TYPE, MFMediaType_Video);

	if(result != ResultCode::OK)
	{
		goto finish;
	}

	result = MediaFoundation::getInstance().setGUID(pMediaType, MF_MT_SUBTYPE, VideoFormat);

	if(result != ResultCode::OK)
	{
		goto finish;
	}


	pLocalSink = new VideoCaptureSink(pIReadWriteBuffer);
	

	result = MediaFoundation::getInstance().createSampleGrabberSinkActivate(pMediaType, pLocalSink, &pSinkActivate);

	if(result != ResultCode::OK)
	{
		goto finish;
	}
	
	result = MediaFoundation::getInstance().setUINT32(pSinkActivate, MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, TRUE);

	if(result != ResultCode::OK)
	{
		goto finish;
	}

	result = MediaFoundation::getInstance().createTopology(&pTopology);

	if(result != ResultCode::OK)
	{
		goto finish;
	}

	result = createTopology(pSource, deviceSettings.indexStream, pSinkActivate, pTopology);

	if(result != ResultCode::OK)
	{
		goto finish;
	}
	

	result = MediaFoundation::getInstance().createSession(&pSession);

	if(result != ResultCode::OK)
	{
		goto finish;
	}

	pLocalSession = new VideoCaptureSession;

	result = pLocalSession->init(pSession, captureSettings.pIStopCallback);

	if(result != ResultCode::OK)
	{
		goto finish;
	}

	result = MediaFoundation::getInstance().beginGetEvent(pSession, pLocalSession, 0);

	if(result != ResultCode::OK)
	{
		goto finish;
	}
	

	result = MediaFoundation::getInstance().setTopology(pSession, pTopology);

	if(result != ResultCode::OK)
	{
		goto finish;
	}


	pLocalSource = pSource;


finish:

	return result;
}