Expose more enums #1512
Replies: 2 comments
-
I don't understand why putting all enums in the library would be a benefit when library users can just define enums for themselves. It would just bloat the library size to all the enums and their string names. I would rather consider it on a case by case basis. Defining enums as a library user example: from enum import IntEnum
class ColorPrimaries(IntEnum):
reserved0 = 0
bt709 = 1
unspecified = 2
reserved = 3
bt470m = 4
bt470bg = 5
smpte170m = 6
smpte240m = 7
film = 8
bt2020 = 9
vid_stream.color_primaries = ColorPrimaries.unspecified.value |
Beta Was this translation helpful? Give feedback.
-
Hi. Thanks for replying! The enum you provided is what I'm asking PyAV code to provide.
As mentioned I'm asking specifically for: IMHO these enum definitions belong in PyAV code and not in users' code, for several reasons:
In C code, users can do: frame->color_primaries = AVCOL_PRI_BT709 so it makes sense that in PyAV it will be something like: frame.color_primaries = ColorPrimaries.BT709 and not: frame.color_primaries = 1 In the same way ffmpeg defines these fields for users, and the ffmpeg library doesn't expect its users to use "magic numbers" or duplicate enum definitions across dependencies, I would expect PyAV to expose these enums for the same fields. As I mentioned, PyAV already exposes Thanks again, and thanks for the library! It's very useful. |
Beta Was this translation helpful? Give feedback.
-
I'm interested in getting and setting attributes of
av.VideoStream
,av.VideoCodecContext
andav.VideoFrame
that are defined as enums, such asAVColorSpace
,AVColorRange
,AVColorPrimaries
,AVPixelFormat
.For example:
We already expose
av.video.frame.PictureType
which is one enum that can be set as an attribute ofav.VideoFrame
. Please consider exposing the enums mentioned above.Here is a list of all enums defined in pyav as
cdef enum
, please consider exposing enums that users may want to get/set:Beta Was this translation helpful? Give feedback.
All reactions