![]() ![]() This appears to be sufficient to make get_HorizontalLocked work properly, and it's simpler than including a video renderer or working around the Null Renderer deprecation issue. ![]() Instead of a Video Renderer or Null Renderer, I connected a Smart Tee filter to the output pin of the capture filter. Note that the graph will run successfully even if nothing is connected to the capture output pin, but in that case the value from get_HorizontalLocked remains zero, regardless of signal presence. ![]() connect a filter to the capture output pin of the capture filter.In order to obtain a meaningful value from get_HorizontalLocked, it appears to be necessary to: Thanks to Roman R.'s answer and comments, I was able to verify that IAMAnalogVideoDecoder->get_HorizontalLocked() can indeed be used to detect the presence of a PAL or NTSC video signal. UPDATEĪfter playing around with the capture device in GraphEdit, I noticed that the "Signal Detected" value is only updated if a (Video) Renderer is connected (and the graph is either running or paused): Not sure if that would do the job, but I would rather not introduce the dependency if it can be done using "pure" DirectShow. The AverMedia SDK does define an AVerGetSignalPresence() function. I suppose both programs produce this dialog using the filter property pages. However, in this case the "Signal detected" value does not change when a camera is (dis)connected. The dialog looks identical to the dialog that appears when I open the video device using ffmpeg: ffmpeg -f dshow -show_video_device_dialog true -i video=".". However, I could not find any mention of it in the DirectShow docs, nor in the property set for analog video decoder devices.Ĭould this be related to the horizontal sync, somehow? The "Signal Detected" value is actually what I am looking for. (Although the "Lines detected" value remains the same regardless of whether a camera is connected.) The "Signal Detected" value in this dialog changes when I (dis)connect a camera matching the specified standard. This is not the same thing as the AmCap sample for DirectShow, supplied with the Windows SDK (although it maybe based upon that). The dialog depicted below is a screenshot from the AMCap viewer software (Options->Video Device->Properties). horizontal sync, but that did not seem to make a difference, although I'm not sure my approach was correct. I can imagine that it may be necessary to run the graph in order to get updated information regarding e.g. The IAMAnalogVideoDecoder interface also defines a get_HorizontalLocked() method, which returns successful, but the output value does not appear to change, regardless of whether a camera is connected. The steps above work without actually running the graph. PDecoder->put_TVFormat(AnalogVideo_PAL_B) // or AnalogVideo_NTSC_M PBuild->FindInterface(&PIN_CATEGORY_ANALOGVIDEOIN, &MEDIATYPE_AnalogVideo, pCap, IID_IAMAnalogVideoDecoder, (void**)&pDecoder) PGraph->AddFilter(pCap, L"Capture Filter") PMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pCap) InitCaptureGraphBuilder(&pGraph, &pBuild) NOTE: declarations, error handling, cleanup, and details of device enumeration are omitted, for brevity The steps I took can be summarized as follows: // summary of steps used to set the video standard, given a device moniker Using the IAMAnalogVideoDecoder interface, I can read the current standard ( get_TVFormat()), write the standard ( put_TVFormat()), read the number of lines, and so on. The world of Windows/COM/DirectShow programming is still new to me, so any help is welcome. However, despite my best efforts, I have not been able to make this work.Ĭould someone explain how to detect whether a PAL or NTSC signal is present, using DirectShow in C++? Moreover, the (commercial) AMCap viewer software actually proves it can be done. I know it must be possible to auto-detect the type of signal, as described e.g. So, all I need to do is figure out how to detect whether a signal is present, after switching to PAL or NTSC. PAL, check for signal, and switch to the other standard if no signal is detected.īy cobbling together some examples from the DirectShow documentation, I am able to set the correct video standard manually, from the command line. The basic idea is to set one video standard, e.g. I would like the capture driver to be configured automatically for the correct video standard, either PAL or NTSC, based on the camera that is connected. Unfortunately, the driver for the AverMedia C039 capture card does not automatically set the correct video standard based on which camera is connected. I have two analog cameras, one produces a PAL signal, the other produces an NTSC signal: In order to record the composite-video signal from a variety of analog cameras, I use a basic USB video capture device produced by AverMedia ( C039).
0 Comments
Leave a Reply. |