OSVR-Core
GetIVideoProcAmp.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_GetIVideoProcAmp_h_GUID_F35BD30E_FB93_45BF_9957_8E7F69290E46
26 #define INCLUDED_GetIVideoProcAmp_h_GUID_F35BD30E_FB93_45BF_9957_8E7F69290E46
27 
28 #ifdef _MSC_VER
29 #define OSVR_HAVE_IVIDEOPROCAMP
32 #endif
33 
34 #ifdef OSVR_HAVE_IVIDEOPROCAMP
35 // Internal Includes
36 #include "comutils/ComPtr.h"
37 
38 // Library/third-party includes
39 // - none
40 
41 // Standard includes
42 #include <iostream>
43 
44 #include <strmif.h>
45 #include <vidcap.h> // for IKsTopologyInfo
46 #include <ksmedia.h> // for KSNODETYPE_VIDEO_PROCESSING
47 
48 inline comutils::Ptr<IVideoProcAmp> getIVideoProcAmp(IBaseFilter &filter) {
49  auto ret = comutils::Ptr<IVideoProcAmp>{};
50 
51  auto ksTopoInfo = comutils::Ptr<IKsTopologyInfo>{};
52  filter.QueryInterface(__uuidof(IKsTopologyInfo), AttachPtr(ksTopoInfo));
53  if (!ksTopoInfo) {
54  std::cout << "directx_camera_server: Couldn't get IKsTopologyInfo"
55  << std::endl;
56  return ret;
57  }
58  auto numNodes = DWORD{0};
59  ksTopoInfo->get_NumNodes(&numNodes);
60 
61  std::cout << "directx_camera_server: has " << numNodes << " nodes"
62  << std::endl;
63  for (DWORD i = 0; i < numNodes; ++i) {
64  GUID nodeType;
65  ksTopoInfo->get_NodeType(i, &nodeType);
66  if (nodeType == KSNODETYPE_VIDEO_PROCESSING) {
67  std::cout
68  << "directx_camera_server: node has video processing type: "
69  << i << std::endl;
70  ksTopoInfo->CreateNodeInstance(i, __uuidof(IVideoProcAmp),
71  AttachPtr(ret));
72  if (ret) {
73  return ret;
74  }
75  }
76  }
77  return ret;
78 }
79 #endif // OSVR_HAVE_IVIDEOPROCAMP
80 
81 #endif // INCLUDED_GetIVideoProcAmp_h_GUID_F35BD30E_FB93_45BF_9957_8E7F69290E46
Header with a template alias for the desired COM smart pointer.
boost::intrusive_ptr< T > Ptr
Template alias for our desired COM smart pointer.
Definition: ComPtr.h:40