11import sys
2+ from enum import IntEnum
23
34from libc.stdint cimport uint8_t
45
5- from av.enum cimport define_enum
66from av.error cimport err_check
77from av.utils cimport check_ndarray
88from av.video.format cimport get_pix_fmt, get_video_format
@@ -20,18 +20,15 @@ cdef VideoFrame alloc_video_frame():
2020 """
2121 return VideoFrame.__new__ (VideoFrame, _cinit_bypass_sentinel)
2222
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
3532
3633cdef byteswap_array(array, bint big_endian):
3734 if (sys.byteorder == " big" ) != big_endian:
@@ -183,16 +180,17 @@ cdef class VideoFrame(Frame):
183180
184181 @property
185182 def pict_type (self ):
186- """ One of :class:`. PictureType` .
183+ """ Returns an integer that corresponds to the PictureType enum .
187184
188- Wraps :ffmpeg:`AVFrame.pict_type`.
185+ Wraps :ffmpeg:`AVFrame.pict_type`
189186
187+ :type: int
190188 """
191- return PictureType.get( self .ptr.pict_type, create = True )
189+ return self .ptr.pict_type
192190
193191 @pict_type.setter
194192 def pict_type (self , value ):
195- self .ptr.pict_type = PictureType[value]. value
193+ self .ptr.pict_type = value
196194
197195 @property
198196 def colorspace (self ):
0 commit comments