예제 #1
0
파일: capture.cpp 프로젝트: snorp/moon
void
VideoCaptureDevice::SetPalDevice (MoonCaptureDevice *device)
{
	CaptureDevice::SetPalDevice (device);

	MoonVideoCaptureDevice *video_device = (MoonVideoCaptureDevice*)device;

	VideoFormatCollection *col = MoonUnmanagedFactory::CreateVideoFormatCollection ();

	int num_formats;
	MoonVideoFormat **formats = video_device->GetSupportedFormats (&num_formats);
	for (int i = 0; i < num_formats; i ++)
	  col->Add (Value (VideoFormat (formats[i])));

	SetSupportedFormats (col);
	col->unref ();

	SetFriendlyName (video_device->GetFriendlyName());
}
void
ViewerClientInformation::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("ViewerClientInformation");
    if(searchNode == 0)
        return;

    DataNode *node;
    DataNode **children;

    // Clear all the ViewerClientInformationElements if we got any.
    bool clearedVars = false;
    // Go through all of the children and construct a new
    // ViewerClientInformationElement for each one of them.
    children = searchNode->GetChildren();
    if(children != 0)
    {
        for(int i = 0; i < searchNode->GetNumChildren(); ++i)
        {
            if(children[i]->GetKey() == std::string("ViewerClientInformationElement"))
            {
                if (!clearedVars)
                {
                    ClearVars();
                    clearedVars = true;
                }
                ViewerClientInformationElement temp;
                temp.SetFromNode(children[i]);
                AddVars(temp);
            }
        }
    }

    if((node = searchNode->GetNode("supportedFormats")) != 0)
        SetSupportedFormats(node->AsStringVector());
}