qcamera.sip 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. // qcamera.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtMultimedia Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. %If (Qt_6_2_0 -)
  22. class QCamera : public QObject
  23. {
  24. %TypeHeaderCode
  25. #include <qcamera.h>
  26. %End
  27. %ConvertToSubClassCode
  28. static struct class_graph {
  29. const char *name;
  30. sipTypeDef **type;
  31. int yes, no;
  32. } graph[] = {
  33. #if QT_VERSION >= 0x060800
  34. {sipName_QAudioBufferInput, &sipType_QAudioBufferInput, -1, 1},
  35. #else
  36. {0, 0, -1, 1},
  37. #endif
  38. #if QT_VERSION >= 0x060800
  39. {sipName_QAudioBufferOutput, &sipType_QAudioBufferOutput, -1, 2},
  40. #else
  41. {0, 0, -1, 2},
  42. #endif
  43. {sipName_QAudioDecoder, &sipType_QAudioDecoder, -1, 3},
  44. {sipName_QAudioInput, &sipType_QAudioInput, -1, 4},
  45. {sipName_QAudioOutput, &sipType_QAudioOutput, -1, 5},
  46. {sipName_QAudioSink, &sipType_QAudioSink, -1, 6},
  47. {sipName_QAudioSource, &sipType_QAudioSource, -1, 7},
  48. {sipName_QCamera, &sipType_QCamera, -1, 8},
  49. {sipName_QImageCapture, &sipType_QImageCapture, -1, 9},
  50. {sipName_QMediaCaptureSession, &sipType_QMediaCaptureSession, -1, 10},
  51. {sipName_QMediaDevices, &sipType_QMediaDevices, -1, 11},
  52. {sipName_QMediaPlayer, &sipType_QMediaPlayer, -1, 12},
  53. {sipName_QMediaRecorder, &sipType_QMediaRecorder, -1, 13},
  54. #if QT_VERSION >= 0x060500
  55. {sipName_QScreenCapture, &sipType_QScreenCapture, -1, 14},
  56. #else
  57. {0, 0, -1, 14},
  58. #endif
  59. {sipName_QSoundEffect, &sipType_QSoundEffect, -1, 15},
  60. #if QT_VERSION >= 0x060800
  61. {sipName_QVideoFrameInput, &sipType_QVideoFrameInput, -1, 16},
  62. #else
  63. {0, 0, -1, 16},
  64. #endif
  65. {sipName_QVideoSink, &sipType_QVideoSink, -1, 17},
  66. #if QT_VERSION >= 0x060600
  67. {sipName_QWindowCapture, &sipType_QWindowCapture, -1, -1},
  68. #else
  69. {0, 0, -1, -1},
  70. #endif
  71. };
  72. int i = 0;
  73. sipType = NULL;
  74. do
  75. {
  76. struct class_graph *cg = &graph[i];
  77. if (cg->name != NULL && sipCpp->inherits(cg->name))
  78. {
  79. sipType = *cg->type;
  80. i = cg->yes;
  81. }
  82. else
  83. i = cg->no;
  84. }
  85. while (i >= 0);
  86. %End
  87. public:
  88. enum Error
  89. {
  90. NoError,
  91. CameraError,
  92. };
  93. enum FocusMode
  94. {
  95. FocusModeAuto,
  96. FocusModeAutoNear,
  97. FocusModeAutoFar,
  98. FocusModeHyperfocal,
  99. FocusModeInfinity,
  100. FocusModeManual,
  101. };
  102. enum FlashMode
  103. {
  104. FlashOff,
  105. FlashOn,
  106. FlashAuto,
  107. };
  108. enum TorchMode
  109. {
  110. TorchOff,
  111. TorchOn,
  112. TorchAuto,
  113. };
  114. enum ExposureMode
  115. {
  116. ExposureAuto,
  117. ExposureManual,
  118. ExposurePortrait,
  119. ExposureNight,
  120. ExposureSports,
  121. ExposureSnow,
  122. ExposureBeach,
  123. ExposureAction,
  124. ExposureLandscape,
  125. ExposureNightPortrait,
  126. ExposureTheatre,
  127. ExposureSunset,
  128. ExposureSteadyPhoto,
  129. ExposureFireworks,
  130. ExposureParty,
  131. ExposureCandlelight,
  132. ExposureBarcode,
  133. };
  134. enum WhiteBalanceMode
  135. {
  136. WhiteBalanceAuto,
  137. WhiteBalanceManual,
  138. WhiteBalanceSunlight,
  139. WhiteBalanceCloudy,
  140. WhiteBalanceShade,
  141. WhiteBalanceTungsten,
  142. WhiteBalanceFluorescent,
  143. WhiteBalanceFlash,
  144. WhiteBalanceSunset,
  145. };
  146. enum class Feature
  147. {
  148. ColorTemperature,
  149. ExposureCompensation,
  150. IsoSensitivity,
  151. ManualExposureTime,
  152. CustomFocusPoint,
  153. FocusDistance,
  154. };
  155. typedef QFlags<QCamera::Feature> Features;
  156. QCamera(const QCameraDevice &cameraDevice, QObject *parent /TransferThis/ = 0);
  157. QCamera(QCameraDevice::Position position, QObject *parent /TransferThis/ = 0);
  158. explicit QCamera(QObject *parent /TransferThis/ = 0);
  159. virtual ~QCamera();
  160. bool isAvailable() const;
  161. bool isActive() const;
  162. QMediaCaptureSession *captureSession() const;
  163. QCameraDevice cameraDevice() const;
  164. void setCameraDevice(const QCameraDevice &cameraDevice);
  165. QCameraFormat cameraFormat() const;
  166. void setCameraFormat(const QCameraFormat &format);
  167. QCamera::Error error() const;
  168. QString errorString() const;
  169. QCamera::Features supportedFeatures() const;
  170. QCamera::FocusMode focusMode() const;
  171. void setFocusMode(QCamera::FocusMode mode);
  172. bool isFocusModeSupported(QCamera::FocusMode mode) const;
  173. QPointF focusPoint() const;
  174. QPointF customFocusPoint() const;
  175. void setCustomFocusPoint(const QPointF &point);
  176. void setFocusDistance(float d);
  177. float focusDistance() const;
  178. float minimumZoomFactor() const;
  179. float maximumZoomFactor() const;
  180. float zoomFactor() const;
  181. void setZoomFactor(float factor);
  182. QCamera::FlashMode flashMode() const;
  183. bool isFlashModeSupported(QCamera::FlashMode mode) const;
  184. bool isFlashReady() const;
  185. QCamera::TorchMode torchMode() const;
  186. bool isTorchModeSupported(QCamera::TorchMode mode) const;
  187. QCamera::ExposureMode exposureMode() const;
  188. bool isExposureModeSupported(QCamera::ExposureMode mode) const;
  189. float exposureCompensation() const;
  190. int isoSensitivity() const;
  191. int manualIsoSensitivity() const;
  192. float exposureTime() const;
  193. float manualExposureTime() const;
  194. int minimumIsoSensitivity() const;
  195. int maximumIsoSensitivity() const;
  196. float minimumExposureTime() const;
  197. float maximumExposureTime() const;
  198. QCamera::WhiteBalanceMode whiteBalanceMode() const;
  199. bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const;
  200. int colorTemperature() const;
  201. public slots:
  202. void setActive(bool active);
  203. void start();
  204. void stop();
  205. void zoomTo(float zoom, float rate);
  206. void setFlashMode(QCamera::FlashMode mode);
  207. void setTorchMode(QCamera::TorchMode mode);
  208. void setExposureMode(QCamera::ExposureMode mode);
  209. void setExposureCompensation(float ev);
  210. void setManualIsoSensitivity(int iso);
  211. void setAutoIsoSensitivity();
  212. void setManualExposureTime(float seconds);
  213. void setAutoExposureTime();
  214. void setWhiteBalanceMode(QCamera::WhiteBalanceMode mode);
  215. void setColorTemperature(int colorTemperature);
  216. signals:
  217. void activeChanged(bool);
  218. void errorChanged();
  219. void errorOccurred(QCamera::Error error, const QString &errorString);
  220. void cameraDeviceChanged();
  221. void cameraFormatChanged();
  222. void supportedFeaturesChanged();
  223. void focusModeChanged();
  224. void zoomFactorChanged(float);
  225. void minimumZoomFactorChanged(float);
  226. void maximumZoomFactorChanged(float);
  227. void focusDistanceChanged(float);
  228. void customFocusPointChanged();
  229. void flashReady(bool);
  230. void flashModeChanged();
  231. void torchModeChanged();
  232. void exposureTimeChanged(float speed);
  233. void isoSensitivityChanged(int);
  234. void exposureCompensationChanged(float);
  235. void exposureModeChanged();
  236. void whiteBalanceModeChanged() const;
  237. void colorTemperatureChanged() const;
  238. void focusPointChanged();
  239. void manualExposureTimeChanged(float speed);
  240. void manualIsoSensitivityChanged(int);
  241. };
  242. %End