Finding outputs

How can I get the output items of a camera? I tried cameraItem.GetRelated, but it only returned a microphone, a speaker and a metadata item.

When you use cameraitem.GetRelated the answer reflects the setup as you see it in the Management Client – Camera Properties, the Client tab.

It is not necessarily the hardware that decides this as the user can change it. Per default when adding a new camera the setup will reflect the microphone, speaker, and metadata channels in the same hardware device, but it can be changed by the user after adding the camera.

Historically there was no concept of Hardware in the MIP Configuration because the Smart Client don’t use it. In the same way there is no association between a camera and the output(s) on the same physical camera hardware.

There is an alternative to the MIP Configuration which is the Configuration API, and this follows the physical world in that hardware devices has camera devices and output devices. (For a short comparison overview run AccessViaSDK to see MIP Configuration and ConfigAPIClient to see Configuration API.)

After the historical speech I should answer your question.

Here is a snippet of code to get the outputs when you have a camera..

//using VideoOS.Platform;
//using VideoOS.Platform.ConfigurationItems;
void GetCameraOutput()
{
	Item cameraItem = TestGetCamera();
	if (cameraItem != null)
	{
		Camera camera = new Camera(cameraItem.FQID);
		Hardware hardware = new Hardware(cameraItem.FQID.ServerId, camera.ParentItemPath);
		var outputs = hardware.OutputFolder.Outputs;
		foreach (var output in outputs)
		{
			label1.Text += "ConfigAPI "+output.Name + Environment.NewLine;
			if (output.Enabled)
			{
				Item outputItem = Configuration.Instance.GetItem(Guid.Parse(output.Id), Kind.Output);
				if(outputItem != null)
				{
					label1.Text += "ConfigMIP " + outputItem.Name + Environment.NewLine;
				}                        
			}
		}
	}
}

In the code I do conversions back and forth between Item and ConfigurationItems.

Let me know if this works for you or you have follow up questions

Thanks, this works fine!