mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 12:22:51 +08:00
Merge pull request #15467 from elmsfu:dshow/add_save_graph_file
This commit is contained in:
commit
59c182ed2b
@ -2936,6 +2936,22 @@ int videoInput::start(int deviceID, videoDevice *VD){
|
|||||||
DebugPrintOut("SETUP: Device is setup and ready to capture.\n\n");
|
DebugPrintOut("SETUP: Device is setup and ready to capture.\n\n");
|
||||||
VD->readyToCapture = true;
|
VD->readyToCapture = true;
|
||||||
|
|
||||||
|
// check for optional saving the direct show graph to a file
|
||||||
|
const char* graph_filename = getenv("OPENCV_DSHOW_SAVEGRAPH_FILENAME");
|
||||||
|
if (graph_filename) {
|
||||||
|
size_t filename_len = strlen(graph_filename);
|
||||||
|
std::vector<WCHAR> wfilename(filename_len + 1);
|
||||||
|
size_t len = mbstowcs(&wfilename[0], graph_filename, filename_len + 1);
|
||||||
|
CV_Assert(len == filename_len);
|
||||||
|
|
||||||
|
HRESULT res = SaveGraphFile(VD->pGraph, &wfilename[0]);
|
||||||
|
if (SUCCEEDED(res)) {
|
||||||
|
DebugPrintOut("Saved DSHOW graph to %s\n", graph_filename);
|
||||||
|
} else {
|
||||||
|
DebugPrintOut("Failed to save DSHOW graph to %s\n", graph_filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Release filters - seen someone else do this
|
//Release filters - seen someone else do this
|
||||||
//looks like it solved the freezes
|
//looks like it solved the freezes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user