CameraProvider.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. * @file
  30. * <b>Libargus API: Camera Provider API</b>
  31. *
  32. * @b Description: This file defines the CameraProvider object and interface.
  33. */
  34. #ifndef _ARGUS_CAMERA_PROVIDER_H
  35. #define _ARGUS_CAMERA_PROVIDER_H
  36. namespace Argus
  37. {
  38. /**
  39. * Object providing the entry point to the libargus runtime.
  40. *
  41. * It provides methods for querying the cameras in the system and for
  42. * creating camera devices.
  43. *
  44. * @defgroup ArgusCameraProvider CameraProvider
  45. * @ingroup ArgusObjects
  46. */
  47. class CameraProvider : public InterfaceProvider, public Destructable
  48. {
  49. public:
  50. /**
  51. * Creates and returns a new CameraProvider.
  52. * If a CameraProvider object has already been created,
  53. * this method will return a pointer to that object.
  54. *
  55. * @param[out] status Optional pointer to return success/status of the call.
  56. */
  57. static CameraProvider* create(Status* status = NULL);
  58. protected:
  59. ~CameraProvider() {}
  60. };
  61. /**
  62. * @class ICameraProvider
  63. *
  64. * Interface to the core CameraProvider methods.
  65. *
  66. * @ingroup ArgusCameraProvider
  67. */
  68. DEFINE_UUID(InterfaceID, IID_CAMERA_PROVIDER, a00f33d7,8564,4226,955c,2d,1b,cd,af,a3,5f);
  69. class ICameraProvider : public Interface
  70. {
  71. public:
  72. static const InterfaceID& id() { return IID_CAMERA_PROVIDER; }
  73. /**
  74. * Returns the version number of the libargus implementation. This string will begin with
  75. * the major and minor version numbers, separated by a period, and may be followed by
  76. * any additional vendor-specific version information.
  77. */
  78. virtual const std::string& getVersion() const = 0;
  79. /**
  80. * Returns the vendor string for the libargus implementation.
  81. */
  82. virtual const std::string& getVendor() const = 0;
  83. /**
  84. * Returns whether or not an extension is supported by this libargus implementation.
  85. * This is generally used during process initialization to ensure that all required
  86. * extensions are present before initializing any CaptureSessions. Note, however,
  87. * that having an extension be supported does not imply that the resources or
  88. * devices required for that extension are available; standard interface checking
  89. * and any other extension-specific runtime checks, as described by the extension
  90. * documentation, should always be performed before any extension is used.
  91. * @param[in] extension the extension identifier.
  92. */
  93. virtual bool supportsExtension(const ExtensionName& extension) const = 0;
  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. * Sets the number of sessions needed for dual and/or single sensors sync session usecase.
  107. * @param[in] dualSensors Number of sessions needed for dual sync sensors.
  108. * @param[in] singleSensor Number of sessions needed for single sync sensors.
  109. *
  110. * @returns success/status of the call.
  111. */
  112. virtual Status setSyncSensorSessionsCount(uint32_t dualSensors,
  113. uint32_t singleSensor) = 0;
  114. /**
  115. * Creates and returns a new CaptureSession using the given device.
  116. * STATUS_UNAVAILABLE will be placed into @c status if the device is already in use.
  117. * @param[in] device The device to use for the CaptureSession.
  118. * @param[out] status Optional pointer to return success/status of the call.
  119. * @returns The new CaptureSession, or NULL if an error occurred.
  120. */
  121. virtual CaptureSession* createCaptureSession(CameraDevice* device,
  122. Status* status = NULL) = 0;
  123. /**
  124. * Creates and returns a new CaptureSession using the given device(s).
  125. * STATUS_UNAVAILABLE will be placed into @c status if any of the devices are already in use.
  126. * @param[in] devices The device(s) to use for the CaptureSession.
  127. * @param[out] status Optional pointer to return success/status of the call.
  128. * @returns The new CaptureSession, or NULL if an error occurred.
  129. */
  130. virtual CaptureSession* createCaptureSession(const std::vector<CameraDevice*>& devices,
  131. Status* status = NULL) = 0;
  132. protected:
  133. ~ICameraProvider() {}
  134. };
  135. } // namespace Argus
  136. #endif // _ARGUS_CAMERA_PROVIDER_H