Libargus API
Libargus Camera API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CameraProvider.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2017, 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 /**
30  * @file
31  * <b>Libargus API: Camera Provider API</b>
32  *
33  * @b Description: This file defines the CameraProvider object and interface.
34  */
35 
36 #ifndef _ARGUS_CAMERA_PROVIDER_H
37 #define _ARGUS_CAMERA_PROVIDER_H
38 
39 namespace Argus
40 {
41 
42 /**
43  * Object providing the entry point to the libargus runtime.
44  *
45  * It provides methods for querying the cameras in the system and for
46  * creating camera devices.
47  *
48  * @defgroup ArgusCameraProvider CameraProvider
49  * @ingroup ArgusObjects
50  */
52 {
53 public:
54 
55  /**
56  * Creates and returns a new CameraProvider.
57  * If a CameraProvider object has already been created,
58  * this method will return a pointer to that object.
59  *
60  * @param[out] status Optional pointer to return success/status of the call.
61  */
62  static CameraProvider* create(Status* status = NULL);
63 
64 protected:
66 };
67 
68 /**
69  * @class ICameraProvider
70  *
71  * Interface to the core CameraProvider methods.
72  *
73  * @ingroup ArgusCameraProvider
74  */
75 DEFINE_UUID(InterfaceID, IID_CAMERA_PROVIDER, a00f33d7,8564,4226,955c,2d,1b,cd,af,a3,5f);
76 
77 class ICameraProvider : public Interface
78 {
79 public:
80  static const InterfaceID& id() { return IID_CAMERA_PROVIDER; }
81 
82  /**
83  * Returns the version number of the libargus implementation. This string will begin with
84  * the major and minor version numbers, separated by a period, and may be followed by
85  * any additional vendor-specific version information.
86  */
87  virtual const std::string& getVersion() const = 0;
88 
89  /**
90  * Returns the vendor string for the libargus implementation.
91  */
92  virtual const std::string& getVendor() const = 0;
93 
94  /**
95  * Returns whether or not an extension is supported by this libargus implementation.
96  * This is generally used during process initialization to ensure that all required
97  * extensions are present before initializing any CaptureSessions. Note, however,
98  * that having an extension be supported does not imply that the resources or
99  * devices required for that extension are available; standard interface checking
100  * and any other extension-specific runtime checks, as described by the extension
101  * documentation, should always be performed before any extension is used.
102  * @param[in] extension the extension identifier.
103  */
104  virtual bool supportsExtension(const ExtensionName& extension) const = 0;
105 
106  /**
107  * Returns the list of camera devices that are exposed by the provider. This
108  * includes devices that may already be in use by active CaptureSessions, and
109  * it's the application's responsibility to check device availability and/or
110  * handle any errors returned when CaptureSession creation fails due to a
111  * device already being in use.
112  * @param[out] devices A vector that will be populated by the available devices.
113  *
114  * @returns success/status of the call.
115  */
116  virtual Status getCameraDevices(std::vector<CameraDevice*>* devices) const = 0;
117 
118  /**
119  * Creates and returns a new CaptureSession using the given device.
120  * STATUS_UNAVAILABLE will be placed into @c status if the device is already in use.
121  * @param[in] device The device to use for the CaptureSession.
122  * @param[out] status Optional pointer to return success/status of the call.
123  * @returns The new CaptureSession, or NULL if an error occurred.
124  */
126  Status* status = NULL) = 0;
127 
128  /**
129  * Creates and returns a new CaptureSession using the given device(s).
130  * STATUS_UNAVAILABLE will be placed into @c status if any of the devices are already in use.
131  * @param[in] devices The device(s) to use for the CaptureSession.
132  * @param[out] status Optional pointer to return success/status of the call.
133  * @returns The new CaptureSession, or NULL if an error occurred.
134  */
135  virtual CaptureSession* createCaptureSession(const std::vector<CameraDevice*>& devices,
136  Status* status = NULL) = 0;
137 
138 protected:
140 };
141 
142 } // namespace Argus
143 
144 #endif // _ARGUS_CAMERA_PROVIDER_H