Argus API
Argus Camera API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CameraProvider.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA CORPORATION nor the names of its
13  * contributors may be used to endorse or promote products derived
14  * from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _ARGUS_CAMERA_PROVIDER_H
30 #define _ARGUS_CAMERA_PROVIDER_H
31 
32 
33 namespace Argus
34 {
35 
36 /**
37  * A CameraProvider instance provides the entry point to the Argus runtime.
38  * It provides methods for querying the cameras in the system and for
39  * creating camera devices.
40  */
42 {
43 public:
44 
45  /**
46  * Creates and returns a new Argus CameraProvider.
47  * If a CameraProvider object has already been created,
48  * this method will return a pointer to that object.
49  *
50  * @param[out] status Optional pointer to return success/status of the call.
51  */
52  static CameraProvider* create(Status* status = NULL);
53 
54 protected:
56 };
57 
58 /**
59  * @class ICameraProvider
60  *
61  * The core interface provided by a CameraProvider.
62  */
63 DEFINE_UUID(InterfaceID, IID_CAMERA_PROVIDER, a00f33d7,8564,4226,955c,2d,1b,cd,af,a3,5f);
64 
65 class ICameraProvider : public Interface
66 {
67 public:
68  static const InterfaceID& id() { return IID_CAMERA_PROVIDER; }
69 
70  /**
71  * Returns the version number of the Argus implementation. This string will begin with
72  * the major and minor version numbers, separated by a period, and may be followed by
73  * any additional vendor-specific version information.
74  */
75  virtual const std::string& getVersion() const = 0;
76 
77  /**
78  * Returns the vendor string for the Argus implementation.
79  */
80  virtual const std::string& getVendor() const = 0;
81 
82  /**
83  * Returns whether or not an extension is supported by this Argus implementation.
84  * This is generally used during process initialization to ensure that all required
85  * extensions are present before initializing any CaptureSessions. Note, however,
86  * that having an extension be supported does not imply that the resources or
87  * devices required for that extension are available; standard interface checking
88  * and any other extension-specific runtime checks, as described by the extension
89  * documentation, should always be performed before any extension is used.
90  * @param[in] extension the extension identifier.
91  */
92  virtual bool supportsExtension(const ExtensionName& extension) const = 0;
93 
94  /**
95  * Returns the list of camera devices that are exposed by the provider. This
96  * includes devices that may already be in use by active CaptureSessions, and
97  * it's the application's responsibility to check device availability and/or
98  * handle any errors returned when CaptureSession creation fails due to a
99  * device already being in use.
100  * @param[out] devices, a vector that will be populated by the available devices.
101  *
102  * @returns success/status of the call.
103  */
104  virtual Status getCameraDevices(std::vector<CameraDevice*>* devices) const = 0;
105 
106  /**
107  * Creates and returns a new CaptureSession using the given device.
108  * STATUS_UNAVAILABLE will be placed into @c status if the device is already in use.
109  * @param[in] devices The device(s) to use for the CaptureSession.
110  * @param[out] status Optional pointer to return success/status of the call.
111  * @returns The new CaptureSession, or NULL if an error occurred.
112  */
114  Status* status = NULL) = 0;
115 
116  /**
117  * Creates and returns a new CaptureSession using the given device(s).
118  * STATUS_UNAVAILABLE will be placed into @c status if any of the devices are already in use.
119  * @param[in] devices The device(s) to use for the CaptureSession.
120  * @param[out] status Optional pointer to return success/status of the call.
121  * @returns The new CaptureSession, or NULL if an error occurred.
122  */
123  virtual CaptureSession* createCaptureSession(const std::vector<CameraDevice*>& devices,
124  Status* status = NULL) = 0;
125 
126 protected:
128 };
129 
130 } // namespace Argus
131 
132 #endif // _ARGUS_CAMERA_PROVIDER_H