I'm trying to write a simple helper application that is used to prompt the user to turn on a camcorder if no signal is detected, which in this case would mean the camcorder is off and/or the HDMI cable is not plugged into the PCMCIA capture card. If the signal is present, then I launch the respective recording application, in this case Wirecast.
How could I perhaps go about creating this using C# in VisualStudio?
Update
I think I'm alot closer now by trying a suggestion based in one of the comments suggesting to use GraphEdit and seeing what is available on the hardware. I was able to find within the properties of the capture device, a 'Signal Detected' flag that changes from 0 to 1 if the camcorder is on/off or the HDMI cable is unplugged, which is what I want.
Now, How would I go about accessing this flag through code? I think I'm really close, but don't know how to access the structure of cElems and pElems from the caGUID. cElems returns a value of 3, which is the same number of tabs displayed in the GraphEdit property window shown below in a screenshot. pElems returns a different value every time I run the app, so I'm not sure what's going on in that structure. I would think the flag I'm looking for lies somewhere within those structures.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DirectShowLib;
namespace Test
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, "Global\\" + appGuid))
            {
                if (!mutex.WaitOne(0, false))
                {
                    return;
                }
                DsDevice[] capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
                foreach (var dev in capDevices)
                {
                    if (dev.DevicePath == @"@device:pnp:\\?\pci#ven_1131&dev_7160&subsys_12abf50a&rev_03#6&37bccbbe&0&000800e1#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{6f814be9-9af6-43cf-9249-c0340100021c}")
                    {
                        IFilterGraph2 m_FilterGraph = (IFilterGraph2)new FilterGraph();
                        IBaseFilter capFilter = null;
                        ICaptureGraphBuilder2 capGraph = null;
                        capGraph = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
                        int hr;
                        hr = capGraph.SetFiltergraph(m_FilterGraph);
                        hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, dev.Name, out capFilter);
                        ISpecifyPropertyPages pProp = capFilter as ISpecifyPropertyPages;
                        FilterInfo filterInfo;
                        hr = capFilter.QueryFilterInfo(out filterInfo);
                        DsCAUUID caGUID;
                        hr = pProp.GetPages(out caGUID);
                        Console.WriteLine(caGUID.cElems);
                        Console.WriteLine(caGUID.pElems);
                        // caGUID.cElems returns '3', which is the correct number of tabs in the property pages shown in GraphEdit.
                        // caGUID.pElems returns a different value every time
                        break;
                    }
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }
        private static string appGuid = "z0a76b5a-02cd-15c5-b9d9-d303zcdde7b9";
    }
}

