-
Notifications
You must be signed in to change notification settings - Fork 355
/
mmal.py
2481 lines (2140 loc) · 87.3 KB
/
mmal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Python header conversion
# Copyright (c) 2013-2017 Dave Jones <[email protected]>
#
# Original headers
# Copyright (c) 2012, Broadcom Europe Ltd
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from __future__ import (
unicode_literals,
print_function,
division,
absolute_import,
)
# Make Py2's str equivalent to Py3's
str = type('')
import ctypes as ct
import warnings
from .bcm_host import VCOS_UNSIGNED
_lib = ct.CDLL('libmmal.so')
# mmal.h #####################################################################
MMAL_VERSION_MAJOR = 0
MMAL_VERSION_MINOR = 1
MMAL_VERSION = (MMAL_VERSION_MAJOR << 16 | MMAL_VERSION_MINOR)
def MMAL_VERSION_TO_MAJOR(a):
return a >> 16
def MMAL_VERSION_TO_MINOR(a):
return a & 0xFFFF
# mmal_common.h ##############################################################
def MMAL_FOURCC(s):
return sum(ord(c) << (i * 8) for (i, c) in enumerate(s))
def FOURCC_str(n):
if n == 0:
return '\\0'
else:
return ''.join(chr(n >> i & 0xFF) for i in range(0, 32, 8))
MMAL_MAGIC = MMAL_FOURCC('mmal')
MMAL_FALSE = 0
MMAL_TRUE = 1
class MMAL_BOOL_T(ct.c_int32):
# This only exists to ensure we've got a distinct type to ct.c_int32
# for mmalobj to perform dict-lookups against
def __str__(self):
return ['MMAL_FALSE', 'MMAL_TRUE'][bool(self.value)]
def __repr__(self):
return str(self)
class MMAL_CORE_STATISTICS_T(ct.Structure):
_fields_ = [
('buffer_count', ct.c_uint32),
('first_buffer_time', ct.c_uint32),
('last_buffer_time', ct.c_uint32),
('max_delay', ct.c_uint32),
]
class MMAL_CORE_PORT_STATISTICS_T(ct.Structure):
_fields_ = [
('rx', MMAL_CORE_STATISTICS_T),
('tx', MMAL_CORE_STATISTICS_T),
]
MMAL_FIXED_16_16_T = ct.c_uint32
# mmal_types.h ###############################################################
MMAL_STATUS_T = ct.c_uint32 # enum
(
MMAL_SUCCESS,
MMAL_ENOMEM,
MMAL_ENOSPC,
MMAL_EINVAL,
MMAL_ENOSYS,
MMAL_ENOENT,
MMAL_ENXIO,
MMAL_EIO,
MMAL_ESPIPE,
MMAL_ECORRUPT,
MMAL_ENOTREADY,
MMAL_ECONFIG,
MMAL_EISCONN,
MMAL_ENOTCONN,
MMAL_EAGAIN,
MMAL_EFAULT,
) = range(16)
MMAL_STATUS_MAX = 0x7FFFFFFF
class MMAL_RECT_T(ct.Structure):
_fields_ = [
('x', ct.c_int32),
('y', ct.c_int32),
('width', ct.c_int32),
('height', ct.c_int32),
]
def __repr__(self):
return '(%d, %d)->(%d, %d)' % (
self.x, self.y, self.x + self.width, self.y + self.height)
class MMAL_RATIONAL_T(ct.Structure):
_fields_ = [
('num', ct.c_int32),
('den', ct.c_int32),
]
def __repr__(self):
return '%d/%d' % (self.num, self.den)
MMAL_TIME_UNKNOWN = ct.c_int64(1<<63).value
MMAL_FOURCC_T = ct.c_uint32
# mmal_format.h ##############################################################
MMAL_ES_TYPE_T = ct.c_uint32 # enum
(
MMAL_ES_TYPE_UNKNOWN,
MMAL_ES_TYPE_CONTROL,
MMAL_ES_TYPE_AUDIO,
MMAL_ES_TYPE_VIDEO,
MMAL_ES_TYPE_SUBPICTURE,
) = range(5)
class MMAL_VIDEO_FORMAT_T(ct.Structure):
_fields_ = [
('width', ct.c_uint32),
('height', ct.c_uint32),
('crop', MMAL_RECT_T),
('frame_rate', MMAL_RATIONAL_T),
('par', MMAL_RATIONAL_T),
('color_space', MMAL_FOURCC_T),
]
def __repr__(self):
return '<MMAL_VIDEO_FORMAT_T width=%d, height=%d, crop=%r, frame_rate=%r, par=%r, color_space=%r>' % (
self.width, self.height, self.crop, self.frame_rate, self.par, self.color_space)
class MMAL_AUDIO_FORMAT_T(ct.Structure):
_fields_ = [
('channels', ct.c_uint32),
('sample_rate', ct.c_uint32),
('bits_per_sample', ct.c_uint32),
('block_align', ct.c_uint32),
]
def __repr__(self):
return '<MMAL_AUDIO_FORMAT_T channels=%d, sample_rate=%d, bits_per_sample=%d, block_align=%d>' % (
self.channels, self.sample_rate, self.bits_per_sample, self.block_align)
class MMAL_SUBPICTURE_FORMAT_T(ct.Structure):
_fields_ = [
('x_offset', ct.c_uint32),
('y_offset', ct.c_uint32),
]
def __repr__(self):
return '<MMAL_SUBPICTURE_FORMAT_T x_offset=%d, y_offset=%d>' % (
self.x_offset, self.y_offset)
class MMAL_ES_SPECIFIC_FORMAT_T(ct.Union):
_fields_ = [
('audio', MMAL_AUDIO_FORMAT_T),
('video', MMAL_VIDEO_FORMAT_T),
('subpicture', MMAL_SUBPICTURE_FORMAT_T),
]
MMAL_ES_FORMAT_FLAG_FRAMED = 0x01
MMAL_ENCODING_UNKNOWN = 0
MMAL_ENCODING_VARIANT_DEFAULT = 0
class MMAL_ES_FORMAT_T(ct.Structure):
_fields_ = [
('type', MMAL_ES_TYPE_T),
('encoding', MMAL_FOURCC_T),
('encoding_variant', MMAL_FOURCC_T),
('es', ct.POINTER(MMAL_ES_SPECIFIC_FORMAT_T)),
('bitrate', ct.c_uint32),
('flags', ct.c_uint32),
('extradata_size', ct.c_uint32),
('extradata', ct.POINTER(ct.c_uint8)),
]
def __repr__(self):
return '<MMAL_ES_FORMAT_T type=%r, encoding=%r, ...>' % (self.type, self.encoding)
mmal_format_alloc = _lib.mmal_format_alloc
mmal_format_alloc.argtypes = []
mmal_format_alloc.restype = ct.POINTER(MMAL_ES_FORMAT_T)
mmal_format_free = _lib.mmal_format_free
mmal_format_free.argtypes = [ct.POINTER(MMAL_ES_FORMAT_T)]
mmal_format_free.restype = None
mmal_format_extradata_alloc = _lib.mmal_format_extradata_alloc
mmal_format_extradata_alloc.argtypes = [ct.POINTER(MMAL_ES_FORMAT_T), ct.c_uint]
mmal_format_extradata_alloc.restype = MMAL_STATUS_T
mmal_format_copy = _lib.mmal_format_copy
mmal_format_copy.argtypes = [ct.POINTER(MMAL_ES_FORMAT_T), ct.POINTER(MMAL_ES_FORMAT_T)]
mmal_format_copy.restype = None
mmal_format_full_copy = _lib.mmal_format_full_copy
mmal_format_full_copy.argtypes = [ct.POINTER(MMAL_ES_FORMAT_T), ct.POINTER(MMAL_ES_FORMAT_T)]
mmal_format_full_copy.restype = MMAL_STATUS_T
MMAL_ES_FORMAT_COMPARE_FLAG_TYPE = 0x01
MMAL_ES_FORMAT_COMPARE_FLAG_ENCODING = 0x02
MMAL_ES_FORMAT_COMPARE_FLAG_BITRATE = 0x04
MMAL_ES_FORMAT_COMPARE_FLAG_FLAGS = 0x08
MMAL_ES_FORMAT_COMPARE_FLAG_EXTRADATA = 0x10
MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_RESOLUTION = 0x0100
MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_CROPPING = 0x0200
MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_FRAME_RATE = 0x0400
MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_ASPECT_RATIO = 0x0800
MMAL_ES_FORMAT_COMPARE_FLAG_VIDEO_COLOR_SPACE = 0x1000
MMAL_ES_FORMAT_COMPARE_FLAG_ES_OTHER = 0x10000000
mmal_format_compare = _lib.mmal_format_compare
mmal_format_compare.argtypes = [ct.POINTER(MMAL_ES_FORMAT_T), ct.POINTER(MMAL_ES_FORMAT_T)]
mmal_format_compare.restype = ct.c_uint32
# mmal_buffer.h ##############################################################
class MMAL_BUFFER_HEADER_VIDEO_SPECIFIC_T(ct.Structure):
_fields_ = [
('planes', ct.c_uint32),
('offset', ct.c_uint32 * 4),
('pitch', ct.c_uint32 * 4),
('flags', ct.c_uint32),
]
class MMAL_BUFFER_HEADER_TYPE_SPECIFIC_T(ct.Union):
_fields_ = [
('video', MMAL_BUFFER_HEADER_VIDEO_SPECIFIC_T),
]
class MMAL_BUFFER_HEADER_PRIVATE_T(ct.Structure):
_fields_ = []
class MMAL_BUFFER_HEADER_T(ct.Structure):
pass
MMAL_BUFFER_HEADER_T._fields_ = [
('next', ct.POINTER(MMAL_BUFFER_HEADER_T)), # self-reference
('priv', ct.POINTER(MMAL_BUFFER_HEADER_PRIVATE_T)),
('cmd', ct.c_uint32),
('data', ct.POINTER(ct.c_uint8)),
('alloc_size', ct.c_uint32),
('length', ct.c_uint32),
('offset', ct.c_uint32),
('flags', ct.c_uint32),
('pts', ct.c_int64),
('dts', ct.c_int64),
('type', ct.POINTER(MMAL_BUFFER_HEADER_TYPE_SPECIFIC_T)),
('user_data', ct.c_void_p),
]
MMAL_BUFFER_HEADER_FLAG_EOS = (1<<0)
MMAL_BUFFER_HEADER_FLAG_FRAME_START = (1<<1)
MMAL_BUFFER_HEADER_FLAG_FRAME_END = (1<<2)
MMAL_BUFFER_HEADER_FLAG_FRAME = (MMAL_BUFFER_HEADER_FLAG_FRAME_START|MMAL_BUFFER_HEADER_FLAG_FRAME_END)
MMAL_BUFFER_HEADER_FLAG_KEYFRAME = (1<<3)
MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY = (1<<4)
MMAL_BUFFER_HEADER_FLAG_CONFIG = (1<<5)
MMAL_BUFFER_HEADER_FLAG_ENCRYPTED = (1<<6)
MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO = (1<<7)
MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT = (1<<8)
MMAL_BUFFER_HEADER_FLAG_CORRUPTED = (1<<9)
MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED = (1<<10)
MMAL_BUFFER_HEADER_FLAG_DECODEONLY = (1<<11)
MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START = (1<<16)
MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED = (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<0)
MMAL_BUFFER_HEADER_VIDEO_FLAG_TOP_FIELD_FIRST = (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<1)
MMAL_BUFFER_HEADER_VIDEO_FLAG_DISPLAY_EXTERNAL = (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<3)
MMAL_BUFFER_HEADER_VIDEO_FLAG_PROTECTED = (MMAL_BUFFER_HEADER_FLAG_FORMAT_SPECIFIC_START<<4)
mmal_buffer_header_acquire = _lib.mmal_buffer_header_acquire
mmal_buffer_header_acquire.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_acquire.restype = None
mmal_buffer_header_reset = _lib.mmal_buffer_header_reset
mmal_buffer_header_reset.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_reset.restype = None
mmal_buffer_header_release = _lib.mmal_buffer_header_release
mmal_buffer_header_release.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_release.restype = None
mmal_buffer_header_release_continue = _lib.mmal_buffer_header_release_continue
mmal_buffer_header_release_continue.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_release_continue.restype = None
MMAL_BH_PRE_RELEASE_CB_T = ct.CFUNCTYPE(
MMAL_BOOL_T,
ct.POINTER(MMAL_BUFFER_HEADER_T), ct.c_void_p)
mmal_buffer_header_pre_release_cb_set = _lib.mmal_buffer_header_pre_release_cb_set
mmal_buffer_header_pre_release_cb_set.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T), MMAL_BH_PRE_RELEASE_CB_T, ct.c_void_p]
mmal_buffer_header_pre_release_cb_set.restype = None
mmal_buffer_header_replicate = _lib.mmal_buffer_header_replicate
mmal_buffer_header_replicate.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T), ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_replicate.restype = MMAL_STATUS_T
mmal_buffer_header_mem_lock = _lib.mmal_buffer_header_mem_lock
mmal_buffer_header_mem_lock.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_mem_lock.restype = MMAL_STATUS_T
mmal_buffer_header_mem_unlock = _lib.mmal_buffer_header_mem_unlock
mmal_buffer_header_mem_unlock.argtypes = [ct.POINTER(MMAL_BUFFER_HEADER_T)]
mmal_buffer_header_mem_unlock.restype = None
# mmal_clock.h ###############################################################
MMAL_CLOCK_EVENT_MAGIC = MMAL_FOURCC('CKLM')
MMAL_CLOCK_EVENT_REFERENCE = MMAL_FOURCC('CREF')
MMAL_CLOCK_EVENT_ACTIVE = MMAL_FOURCC('CACT')
MMAL_CLOCK_EVENT_SCALE = MMAL_FOURCC('CSCA')
MMAL_CLOCK_EVENT_TIME = MMAL_FOURCC('CTIM')
MMAL_CLOCK_EVENT_UPDATE_THRESHOLD = MMAL_FOURCC('CUTH')
MMAL_CLOCK_EVENT_DISCONT_THRESHOLD = MMAL_FOURCC('CDTH')
MMAL_CLOCK_EVENT_REQUEST_THRESHOLD = MMAL_FOURCC('CRTH')
MMAL_CLOCK_EVENT_INPUT_BUFFER_INFO = MMAL_FOURCC('CIBI')
MMAL_CLOCK_EVENT_OUTPUT_BUFFER_INFO = MMAL_FOURCC('COBI')
MMAL_CLOCK_EVENT_LATENCY = MMAL_FOURCC('CLAT')
MMAL_CLOCK_EVENT_INVALID = 0
class MMAL_CLOCK_UPDATE_THRESHOLD_T(ct.Structure):
_fields_ = [
('threshold_lower', ct.c_int64),
('threshold_upper', ct.c_int64),
]
class MMAL_CLOCK_DISCONT_THRESHOLD_T(ct.Structure):
_fields_ = [
('threshold', ct.c_int64),
('duration', ct.c_int64),
]
class MMAL_CLOCK_REQUEST_THRESHOLD_T(ct.Structure):
_fields_ = [
('threshold', ct.c_int64),
('threshold_enable', MMAL_BOOL_T),
]
class MMAL_CLOCK_BUFFER_INFO_T(ct.Structure):
_fields_ = [
('time_stamp', ct.c_int64),
('arrival_time', ct.c_uint32),
]
class MMAL_CLOCK_LATENCY_T(ct.Structure):
_fields_ = [
('target', ct.c_int64),
('attack_period', ct.c_int64),
('attack_rate', ct.c_int64),
]
class _MMAL_CLOCK_EVENT_DATA(ct.Union):
_fields_ = [
('enable', MMAL_BOOL_T),
('scale', MMAL_RATIONAL_T),
('media_time', ct.c_int64),
('update_threshold', MMAL_CLOCK_UPDATE_THRESHOLD_T),
('discont_threshold', MMAL_CLOCK_DISCONT_THRESHOLD_T),
('request_threshold', MMAL_CLOCK_REQUEST_THRESHOLD_T),
('buffer', MMAL_CLOCK_BUFFER_INFO_T),
('latency', MMAL_CLOCK_LATENCY_T),
]
class MMAL_CLOCK_EVENT_T(ct.Structure):
_fields_ = [
('id', ct.c_uint32),
('magic', ct.c_uint32),
('buffer', ct.POINTER(MMAL_BUFFER_HEADER_T)),
('padding0', ct.c_uint32),
('data', _MMAL_CLOCK_EVENT_DATA),
('padding1', ct.c_uint64),
]
# Ensure MMAL_CLOCK_EVENT_T preserves 64-bit alignment
assert not ct.sizeof(MMAL_CLOCK_EVENT_T) & 0x07
def MMAL_CLOCK_EVENT_INIT(i):
return MMAL_CLOCK_EVENT_T(
id=i,
magic=MMAL_CLOCK_EVENT_MAGIC,
buffer=None,
padding0=0,
data=_MMAL_CLOCK_EVENT_DATA(enable=MMAL_FALSE),
padding1=0,
)
# mmal_parameters_common.h ###################################################
MMAL_PARAMETER_GROUP_COMMON = (0<<16)
MMAL_PARAMETER_GROUP_CAMERA = (1<<16)
MMAL_PARAMETER_GROUP_VIDEO = (2<<16)
MMAL_PARAMETER_GROUP_AUDIO = (3<<16)
MMAL_PARAMETER_GROUP_CLOCK = (4<<16)
MMAL_PARAMETER_GROUP_MIRACAST = (5<<16)
(
MMAL_PARAMETER_UNUSED,
MMAL_PARAMETER_SUPPORTED_ENCODINGS,
MMAL_PARAMETER_URI,
MMAL_PARAMETER_CHANGE_EVENT_REQUEST,
MMAL_PARAMETER_ZERO_COPY,
MMAL_PARAMETER_BUFFER_REQUIREMENTS,
MMAL_PARAMETER_STATISTICS,
MMAL_PARAMETER_CORE_STATISTICS,
MMAL_PARAMETER_MEM_USAGE,
MMAL_PARAMETER_BUFFER_FLAG_FILTER,
MMAL_PARAMETER_SEEK,
MMAL_PARAMETER_POWERMON_ENABLE,
MMAL_PARAMETER_LOGGING,
MMAL_PARAMETER_SYSTEM_TIME,
MMAL_PARAMETER_NO_IMAGE_PADDING,
MMAL_PARAMETER_LOCKSTEP_ENABLE,
) = range(MMAL_PARAMETER_GROUP_COMMON, MMAL_PARAMETER_GROUP_COMMON + 16)
class MMAL_PARAMETER_HEADER_T(ct.Structure):
_fields_ = [
('id', ct.c_uint32),
('size', ct.c_uint32),
]
class MMAL_PARAMETER_CHANGE_EVENT_REQUEST_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('change_id', ct.c_uint32),
('enable', MMAL_BOOL_T),
]
class MMAL_PARAMETER_BUFFER_REQUIREMENTS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('buffer_num_min', ct.c_uint32),
('buffer_size_min', ct.c_uint32),
('buffer_alignment_min', ct.c_uint32),
('buffer_num_recommended', ct.c_uint32),
('buffer_size_recommended', ct.c_uint32),
]
class MMAL_PARAMETER_SEEK_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('offset', ct.c_int64),
('flags', ct.c_uint32),
]
MMAL_PARAM_SEEK_FLAG_PRECISE = 0x01
MMAL_PARAM_SEEK_FLAG_FORWARD = 0x02
class MMAL_PARAMETER_STATISTICS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('buffer_count', ct.c_uint32),
('frame_count', ct.c_uint32),
('frames_skipped', ct.c_uint32),
('frames_discarded', ct.c_uint32),
('eos_seen', ct.c_uint32),
('maximum_frame_bytes', ct.c_uint32),
('total_bytes', ct.c_int64),
('corrupt_macroblocks', ct.c_uint32),
]
MMAL_CORE_STATS_DIR = ct.c_uint32 # enum
(
MMAL_CORE_STATS_RX,
MMAL_CORE_STATS_TX,
) = range(2)
MMAL_CORE_STATS_MAX = 0x7fffffff
class MMAL_PARAMETER_CORE_STATISTICS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('dir', MMAL_CORE_STATS_DIR),
('reset', MMAL_BOOL_T),
('stats', MMAL_CORE_STATISTICS_T),
]
class MMAL_PARAMETER_MEM_USAGE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('pool_mem_alloc_size', ct.c_uint32),
]
class MMAL_PARAMETER_LOGGING_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('set', ct.c_uint32),
('clear', ct.c_uint32),
]
# mmal_parameters_camera.h ###################################################
(
MMAL_PARAMETER_THUMBNAIL_CONFIGURATION,
MMAL_PARAMETER_CAPTURE_QUALITY,
MMAL_PARAMETER_ROTATION,
MMAL_PARAMETER_EXIF_DISABLE,
MMAL_PARAMETER_EXIF,
MMAL_PARAMETER_AWB_MODE,
MMAL_PARAMETER_IMAGE_EFFECT,
MMAL_PARAMETER_COLOUR_EFFECT,
MMAL_PARAMETER_FLICKER_AVOID,
MMAL_PARAMETER_FLASH,
MMAL_PARAMETER_REDEYE,
MMAL_PARAMETER_FOCUS,
MMAL_PARAMETER_FOCAL_LENGTHS,
MMAL_PARAMETER_EXPOSURE_COMP,
MMAL_PARAMETER_ZOOM,
MMAL_PARAMETER_MIRROR,
MMAL_PARAMETER_CAMERA_NUM,
MMAL_PARAMETER_CAPTURE,
MMAL_PARAMETER_EXPOSURE_MODE,
MMAL_PARAMETER_EXP_METERING_MODE,
MMAL_PARAMETER_FOCUS_STATUS,
MMAL_PARAMETER_CAMERA_CONFIG,
MMAL_PARAMETER_CAPTURE_STATUS,
MMAL_PARAMETER_FACE_TRACK,
MMAL_PARAMETER_DRAW_BOX_FACES_AND_FOCUS,
MMAL_PARAMETER_JPEG_Q_FACTOR,
MMAL_PARAMETER_FRAME_RATE,
MMAL_PARAMETER_USE_STC,
MMAL_PARAMETER_CAMERA_INFO,
MMAL_PARAMETER_VIDEO_STABILISATION,
MMAL_PARAMETER_FACE_TRACK_RESULTS,
MMAL_PARAMETER_ENABLE_RAW_CAPTURE,
MMAL_PARAMETER_DPF_FILE,
MMAL_PARAMETER_ENABLE_DPF_FILE,
MMAL_PARAMETER_DPF_FAIL_IS_FATAL,
MMAL_PARAMETER_CAPTURE_MODE,
MMAL_PARAMETER_FOCUS_REGIONS,
MMAL_PARAMETER_INPUT_CROP,
MMAL_PARAMETER_SENSOR_INFORMATION,
MMAL_PARAMETER_FLASH_SELECT,
MMAL_PARAMETER_FIELD_OF_VIEW,
MMAL_PARAMETER_HIGH_DYNAMIC_RANGE,
MMAL_PARAMETER_DYNAMIC_RANGE_COMPRESSION,
MMAL_PARAMETER_ALGORITHM_CONTROL,
MMAL_PARAMETER_SHARPNESS,
MMAL_PARAMETER_CONTRAST,
MMAL_PARAMETER_BRIGHTNESS,
MMAL_PARAMETER_SATURATION,
MMAL_PARAMETER_ISO,
MMAL_PARAMETER_ANTISHAKE,
MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS,
MMAL_PARAMETER_CAMERA_BURST_CAPTURE,
MMAL_PARAMETER_CAMERA_MIN_ISO,
MMAL_PARAMETER_CAMERA_USE_CASE,
MMAL_PARAMETER_CAPTURE_STATS_PASS,
MMAL_PARAMETER_CAMERA_CUSTOM_SENSOR_CONFIG,
MMAL_PARAMETER_ENABLE_REGISTER_FILE,
MMAL_PARAMETER_REGISTER_FAIL_IS_FATAL,
MMAL_PARAMETER_CONFIGFILE_REGISTERS,
MMAL_PARAMETER_CONFIGFILE_CHUNK_REGISTERS,
MMAL_PARAMETER_JPEG_ATTACH_LOG,
MMAL_PARAMETER_ZERO_SHUTTER_LAG,
MMAL_PARAMETER_FPS_RANGE,
MMAL_PARAMETER_CAPTURE_EXPOSURE_COMP,
MMAL_PARAMETER_SW_SHARPEN_DISABLE,
MMAL_PARAMETER_FLASH_REQUIRED,
MMAL_PARAMETER_SW_SATURATION_DISABLE,
MMAL_PARAMETER_SHUTTER_SPEED,
MMAL_PARAMETER_CUSTOM_AWB_GAINS,
MMAL_PARAMETER_CAMERA_SETTINGS,
MMAL_PARAMETER_PRIVACY_INDICATOR,
MMAL_PARAMETER_VIDEO_DENOISE,
MMAL_PARAMETER_STILLS_DENOISE,
MMAL_PARAMETER_ANNOTATE,
MMAL_PARAMETER_STEREOSCOPIC_MODE,
MMAL_PARAMETER_CAMERA_INTERFACE,
MMAL_PARAMETER_CAMERA_CLOCKING_MODE,
MMAL_PARAMETER_CAMERA_RX_CONFIG,
MMAL_PARAMETER_CAMERA_RX_TIMING,
MMAL_PARAMETER_DPF_CONFIG,
MMAL_PARAMETER_JPEG_RESTART_INTERVAL,
MMAL_PARAMETER_CAMERA_ISP_BLOCK_OVERRIDE,
) = range(MMAL_PARAMETER_GROUP_CAMERA, MMAL_PARAMETER_GROUP_CAMERA + 82)
class MMAL_PARAMETER_THUMBNAIL_CONFIG_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('enable', ct.c_uint32),
('width', ct.c_uint32),
('height', ct.c_uint32),
('quality', ct.c_uint32),
]
class MMAL_PARAMETER_EXIF_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('keylen', ct.c_uint32),
('value_offset', ct.c_uint32),
('valuelen', ct.c_uint32),
('data', ct.c_uint8 * 1),
]
MMAL_PARAM_EXPOSUREMODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_EXPOSUREMODE_OFF,
MMAL_PARAM_EXPOSUREMODE_AUTO,
MMAL_PARAM_EXPOSUREMODE_NIGHT,
MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW,
MMAL_PARAM_EXPOSUREMODE_BACKLIGHT,
MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT,
MMAL_PARAM_EXPOSUREMODE_SPORTS,
MMAL_PARAM_EXPOSUREMODE_SNOW,
MMAL_PARAM_EXPOSUREMODE_BEACH,
MMAL_PARAM_EXPOSUREMODE_VERYLONG,
MMAL_PARAM_EXPOSUREMODE_FIXEDFPS,
MMAL_PARAM_EXPOSUREMODE_ANTISHAKE,
MMAL_PARAM_EXPOSUREMODE_FIREWORKS,
) = range(13)
MMAL_PARAM_EXPOSUREMODE_MAX = 0x7fffffff
class MMAL_PARAMETER_EXPOSUREMODE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_EXPOSUREMODE_T),
]
MMAL_PARAM_EXPOSUREMETERINGMODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE,
MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT,
MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT,
MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX,
) = range(4)
MMAL_PARAM_EXPOSUREMETERINGMODE_MAX = 0x7fffffff
class MMAL_PARAMETER_EXPOSUREMETERINGMODE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_EXPOSUREMETERINGMODE_T),
]
MMAL_PARAM_AWBMODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_AWBMODE_OFF,
MMAL_PARAM_AWBMODE_AUTO,
MMAL_PARAM_AWBMODE_SUNLIGHT,
MMAL_PARAM_AWBMODE_CLOUDY,
MMAL_PARAM_AWBMODE_SHADE,
MMAL_PARAM_AWBMODE_TUNGSTEN,
MMAL_PARAM_AWBMODE_FLUORESCENT,
MMAL_PARAM_AWBMODE_INCANDESCENT,
MMAL_PARAM_AWBMODE_FLASH,
MMAL_PARAM_AWBMODE_HORIZON,
MMAL_PARAM_AWBMODE_GREYWORLD,
) = range(11)
MMAL_PARAM_AWBMODE_MAX = 0x7fffffff
class MMAL_PARAMETER_AWBMODE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_AWBMODE_T),
]
MMAL_PARAM_IMAGEFX_T = ct.c_uint32 # enum
(
MMAL_PARAM_IMAGEFX_NONE,
MMAL_PARAM_IMAGEFX_NEGATIVE,
MMAL_PARAM_IMAGEFX_SOLARIZE,
MMAL_PARAM_IMAGEFX_POSTERIZE,
MMAL_PARAM_IMAGEFX_WHITEBOARD,
MMAL_PARAM_IMAGEFX_BLACKBOARD,
MMAL_PARAM_IMAGEFX_SKETCH,
MMAL_PARAM_IMAGEFX_DENOISE,
MMAL_PARAM_IMAGEFX_EMBOSS,
MMAL_PARAM_IMAGEFX_OILPAINT,
MMAL_PARAM_IMAGEFX_HATCH,
MMAL_PARAM_IMAGEFX_GPEN,
MMAL_PARAM_IMAGEFX_PASTEL,
MMAL_PARAM_IMAGEFX_WATERCOLOUR,
MMAL_PARAM_IMAGEFX_FILM,
MMAL_PARAM_IMAGEFX_BLUR,
MMAL_PARAM_IMAGEFX_SATURATION,
MMAL_PARAM_IMAGEFX_COLOURSWAP,
MMAL_PARAM_IMAGEFX_WASHEDOUT,
MMAL_PARAM_IMAGEFX_POSTERISE,
MMAL_PARAM_IMAGEFX_COLOURPOINT,
MMAL_PARAM_IMAGEFX_COLOURBALANCE,
MMAL_PARAM_IMAGEFX_CARTOON,
MMAL_PARAM_IMAGEFX_DEINTERLACE_DOUBLE,
MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV,
MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST,
) = range(26)
MMAL_PARAM_IMAGEFX_MAX = 0x7fffffff
class MMAL_PARAMETER_IMAGEFX_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_IMAGEFX_T),
]
MMAL_MAX_IMAGEFX_PARAMETERS = 6
class MMAL_PARAMETER_IMAGEFX_PARAMETERS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('effect', MMAL_PARAM_IMAGEFX_T),
('num_effect_params', ct.c_uint32),
('effect_parameter', ct.c_uint32 * MMAL_MAX_IMAGEFX_PARAMETERS),
]
class MMAL_PARAMETER_COLOURFX_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('enable', ct.c_int32),
('u', ct.c_uint32),
('v', ct.c_uint32),
]
MMAL_CAMERA_STC_MODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_STC_MODE_OFF,
MMAL_PARAM_STC_MODE_RAW,
MMAL_PARAM_STC_MODE_COOKED,
) = range(3)
MMAL_PARAM_STC_MODE_MAX = 0x7fffffff
class MMAL_PARAMETER_CAMERA_STC_MODE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_CAMERA_STC_MODE_T),
]
MMAL_PARAM_FLICKERAVOID_T = ct.c_uint32 # enum
(
MMAL_PARAM_FLICKERAVOID_OFF,
MMAL_PARAM_FLICKERAVOID_AUTO,
MMAL_PARAM_FLICKERAVOID_50HZ,
MMAL_PARAM_FLICKERAVOID_60HZ,
) = range(4)
MMAL_PARAM_FLICKERAVOID_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_FLICKERAVOID_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_FLICKERAVOID_T),
]
MMAL_PARAM_FLASH_T = ct.c_uint32 # enum
(
MMAL_PARAM_FLASH_OFF,
MMAL_PARAM_FLASH_AUTO,
MMAL_PARAM_FLASH_ON,
MMAL_PARAM_FLASH_REDEYE,
MMAL_PARAM_FLASH_FILLIN,
MMAL_PARAM_FLASH_TORCH,
) = range(6)
MMAL_PARAM_FLASH_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_FLASH_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_FLASH_T),
]
MMAL_PARAM_REDEYE_T = ct.c_uint32 # enum
(
MMAL_PARAM_REDEYE_OFF,
MMAL_PARAM_REDEYE_ON,
MMAL_PARAM_REDEYE_SIMPLE,
) = range(3)
MMAL_PARAM_REDEYE_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_REDEYE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_REDEYE_T),
]
MMAL_PARAM_FOCUS_T = ct.c_uint32 # enum
(
MMAL_PARAM_FOCUS_AUTO,
MMAL_PARAM_FOCUS_AUTO_NEAR,
MMAL_PARAM_FOCUS_AUTO_MACRO,
MMAL_PARAM_FOCUS_CAF,
MMAL_PARAM_FOCUS_CAF_NEAR,
MMAL_PARAM_FOCUS_FIXED_INFINITY,
MMAL_PARAM_FOCUS_FIXED_HYPERFOCAL,
MMAL_PARAM_FOCUS_FIXED_NEAR,
MMAL_PARAM_FOCUS_FIXED_MACRO,
MMAL_PARAM_FOCUS_EDOF,
MMAL_PARAM_FOCUS_CAF_MACRO,
MMAL_PARAM_FOCUS_CAF_FAST,
MMAL_PARAM_FOCUS_CAF_NEAR_FAST,
MMAL_PARAM_FOCUS_CAF_MACRO_FAST,
MMAL_PARAM_FOCUS_FIXED_CURRENT,
) = range(15)
MMAL_PARAM_FOCUS_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_FOCUS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('value', MMAL_PARAM_FOCUS_T),
]
MMAL_PARAM_CAPTURE_STATUS_T = ct.c_uint32 # enum
(
MMAL_PARAM_CAPTURE_STATUS_NOT_CAPTURING,
MMAL_PARAM_CAPTURE_STATUS_CAPTURE_STARTED,
MMAL_PARAM_CAPTURE_STATUS_CAPTURE_ENDED,
) = range(3)
MMAL_PARAM_CAPTURE_STATUS_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_CAPTURE_STATUS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('status', MMAL_PARAM_CAPTURE_STATUS_T),
]
MMAL_PARAM_FOCUS_STATUS_T = ct.c_uint32 # enum
(
MMAL_PARAM_FOCUS_STATUS_OFF,
MMAL_PARAM_FOCUS_STATUS_REQUEST,
MMAL_PARAM_FOCUS_STATUS_REACHED,
MMAL_PARAM_FOCUS_STATUS_UNABLE_TO_REACH,
MMAL_PARAM_FOCUS_STATUS_LOST,
MMAL_PARAM_FOCUS_STATUS_CAF_MOVING,
MMAL_PARAM_FOCUS_STATUS_CAF_SUCCESS,
MMAL_PARAM_FOCUS_STATUS_CAF_FAILED,
MMAL_PARAM_FOCUS_STATUS_MANUAL_MOVING,
MMAL_PARAM_FOCUS_STATUS_MANUAL_REACHED,
MMAL_PARAM_FOCUS_STATUS_CAF_WATCHING,
MMAL_PARAM_FOCUS_STATUS_CAF_SCENE_CHANGED,
) = range(12)
MMAL_PARAM_FOCUS_STATUS_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_FOCUS_STATUS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('status', MMAL_PARAM_FOCUS_STATUS_T),
]
MMAL_PARAM_FACE_TRACK_MODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_FACE_DETECT_NONE,
MMAL_PARAM_FACE_DETECT_ON,
) = range(2)
MMAL_PARAM_FACE_DETECT_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_FACE_TRACK_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('mode', MMAL_PARAM_FACE_TRACK_MODE_T),
('maxRegions', ct.c_uint32),
('frames', ct.c_uint32),
('quality', ct.c_uint32),
]
class MMAL_PARAMETER_FACE_TRACK_FACE_T(ct.Structure):
_fields_ = [
('face_id', ct.c_int32),
('score', ct.c_int32),
('face_rect', MMAL_RECT_T),
('eye_rect', MMAL_RECT_T * 2),
('mouth_rect', MMAL_RECT_T),
]
class MMAL_PARAMETER_FACE_TRACK_RESULTS_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('num_faces', ct.c_uint32),
('frame_width', ct.c_uint32),
('frame_height', ct.c_uint32),
('faces', MMAL_PARAMETER_FACE_TRACK_FACE_T * 1),
]
MMAL_PARAMETER_CAMERA_CONFIG_TIMESTAMP_MODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_TIMESTAMP_MODE_ZERO,
MMAL_PARAM_TIMESTAMP_MODE_RAW_STC,
MMAL_PARAM_TIMESTAMP_MODE_RESET_STC,
) = range(3)
MMAL_PARAM_TIMESTAMP_MODE_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_CAMERA_CONFIG_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('max_stills_w', ct.c_uint32),
('max_stills_h', ct.c_uint32),
('stills_yuv422', ct.c_uint32),
('one_shot_stills', ct.c_uint32),
('max_preview_video_w', ct.c_uint32),
('max_preview_video_h', ct.c_uint32),
('num_preview_video_frames', ct.c_uint32),
('stills_capture_circular_buffer_height', ct.c_uint32),
('fast_preview_resume', ct.c_uint32),
('use_stc_timestamp', MMAL_PARAMETER_CAMERA_CONFIG_TIMESTAMP_MODE_T),
]
MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS = 4
MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES = 2
MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN = 16
class MMAL_PARAMETER_CAMERA_INFO_CAMERA_T(ct.Structure):
_fields_ = [
('port_id', ct.c_uint32),
('max_width', ct.c_uint32),
('max_height', ct.c_uint32),
('lens_present', MMAL_BOOL_T),
]
class MMAL_PARAMETER_CAMERA_INFO_CAMERA_V2_T(ct.Structure):
_fields_ = [
('port_id', ct.c_uint32),
('max_width', ct.c_uint32),
('max_height', ct.c_uint32),
('lens_present', MMAL_BOOL_T),
('camera_name', ct.c_char * MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN),
]
MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_T = ct.c_uint32 # enum
MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0
MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1
MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2
MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF
class MMAL_PARAMETER_CAMERA_INFO_FLASH_T(ct.Structure):
_fields_ = [
('flash_type', MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_T),
]
class MMAL_PARAMETER_CAMERA_INFO_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('num_cameras', ct.c_uint32),
('num_flashes', ct.c_uint32),
('cameras', MMAL_PARAMETER_CAMERA_INFO_CAMERA_T * MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS),
('flashes', MMAL_PARAMETER_CAMERA_INFO_FLASH_T * MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES),
]
class MMAL_PARAMETER_CAMERA_INFO_V2_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('num_cameras', ct.c_uint32),
('num_flashes', ct.c_uint32),
('cameras', MMAL_PARAMETER_CAMERA_INFO_CAMERA_V2_T * MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS),
('flashes', MMAL_PARAMETER_CAMERA_INFO_FLASH_T * MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES),
]
MMAL_PARAMETER_CAPTUREMODE_MODE_T = ct.c_uint32 # enum
(
MMAL_PARAM_CAPTUREMODE_WAIT_FOR_END,
MMAL_PARAM_CAPTUREMODE_WAIT_FOR_END_AND_HOLD,
MMAL_PARAM_CAPTUREMODE_RESUME_VF_IMMEDIATELY,
) = range(3)
class MMAL_PARAMETER_CAPTUREMODE_T(ct.Structure):
_fields_ = [
('hdr', MMAL_PARAMETER_HEADER_T),
('mode', MMAL_PARAMETER_CAPTUREMODE_MODE_T),