1
1
import sys
2
+ from enum import IntEnum
2
3
3
4
from libc.stdint cimport uint8_t
4
5
5
- from av.enum cimport define_enum
6
6
from av.error cimport err_check
7
7
from av.utils cimport check_ndarray
8
8
from av.video.format cimport get_pix_fmt, get_video_format
@@ -20,18 +20,15 @@ cdef VideoFrame alloc_video_frame():
20
20
"""
21
21
return VideoFrame.__new__ (VideoFrame, _cinit_bypass_sentinel)
22
22
23
-
24
- PictureType = define_enum(" PictureType" , __name__ , (
25
- (" NONE" , lib.AV_PICTURE_TYPE_NONE, " Undefined" ),
26
- (" I" , lib.AV_PICTURE_TYPE_I, " Intra" ),
27
- (" P" , lib.AV_PICTURE_TYPE_P, " Predicted" ),
28
- (" B" , lib.AV_PICTURE_TYPE_B, " Bi-directional predicted" ),
29
- (" S" , lib.AV_PICTURE_TYPE_S, " S(GMC)-VOP MPEG-4" ),
30
- (" SI" , lib.AV_PICTURE_TYPE_SI, " Switching intra" ),
31
- (" SP" , lib.AV_PICTURE_TYPE_SP, " Switching predicted" ),
32
- (" BI" , lib.AV_PICTURE_TYPE_BI, " BI type" ),
33
- ))
34
-
23
+ class PictureType (IntEnum ):
24
+ NONE = lib.AV_PICTURE_TYPE_NONE # Undefined
25
+ I = lib.AV_PICTURE_TYPE_I # Intra
26
+ P = lib.AV_PICTURE_TYPE_P # Predicted
27
+ B = lib.AV_PICTURE_TYPE_B # Bi-directional predicted
28
+ S = lib.AV_PICTURE_TYPE_S # S(GMC)-VOP MPEG-4
29
+ SI = lib.AV_PICTURE_TYPE_SI # Switching intra
30
+ SP = lib.AV_PICTURE_TYPE_SP # Switching predicted
31
+ BI = lib.AV_PICTURE_TYPE_BI # BI type
35
32
36
33
cdef byteswap_array(array, bint big_endian):
37
34
if (sys.byteorder == " big" ) != big_endian:
@@ -183,16 +180,17 @@ cdef class VideoFrame(Frame):
183
180
184
181
@property
185
182
def pict_type (self ):
186
- """ One of :class:`. PictureType` .
183
+ """ Returns an integer that corresponds to the PictureType enum .
187
184
188
- Wraps :ffmpeg:`AVFrame.pict_type`.
185
+ Wraps :ffmpeg:`AVFrame.pict_type`
189
186
187
+ :type: int
190
188
"""
191
- return PictureType.get( self .ptr.pict_type, create = True )
189
+ return self .ptr.pict_type
192
190
193
191
@pict_type.setter
194
192
def pict_type (self , value ):
195
- self .ptr.pict_type = PictureType[value]. value
193
+ self .ptr.pict_type = value
196
194
197
195
@property
198
196
def colorspace (self ):
0 commit comments