diff --git a/av/codec/codec.py b/av/codec/codec.py index d094a8dd0..fbe8bbcd9 100644 --- a/av/codec/codec.py +++ b/av/codec/codec.py @@ -26,6 +26,8 @@ class Properties(Flag): LOSSY = lib.AV_CODEC_PROP_LOSSY LOSSLESS = lib.AV_CODEC_PROP_LOSSLESS REORDER = lib.AV_CODEC_PROP_REORDER + FIELDS = lib.AV_CODEC_PROP_FIELDS + ENHANCEMENT = lib.AV_CODEC_PROP_ENHANCEMENT BITMAP_SUB = lib.AV_CODEC_PROP_BITMAP_SUB TEXT_SUB = lib.AV_CODEC_PROP_TEXT_SUB @@ -34,13 +36,10 @@ class Capabilities(IntEnum): none = 0 draw_horiz_band = lib.AV_CODEC_CAP_DRAW_HORIZ_BAND dr1 = lib.AV_CODEC_CAP_DR1 - hwaccel = 1 << 4 delay = lib.AV_CODEC_CAP_DELAY small_last_frame = lib.AV_CODEC_CAP_SMALL_LAST_FRAME - hwaccel_vdpau = 1 << 7 experimental = lib.AV_CODEC_CAP_EXPERIMENTAL channel_conf = lib.AV_CODEC_CAP_CHANNEL_CONF - neg_linesizes = 1 << 11 frame_threads = lib.AV_CODEC_CAP_FRAME_THREADS slice_threads = lib.AV_CODEC_CAP_SLICE_THREADS param_change = lib.AV_CODEC_CAP_PARAM_CHANGE @@ -49,9 +48,9 @@ class Capabilities(IntEnum): avoid_probing = lib.AV_CODEC_CAP_AVOID_PROBING hardware = lib.AV_CODEC_CAP_HARDWARE hybrid = lib.AV_CODEC_CAP_HYBRID - encoder_reordered_opaque = 1 << 20 - encoder_flush = 1 << 21 - encoder_recon_frame = 1 << 22 + encoder_reordered_opaque = lib.AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE + encoder_flush = lib.AV_CODEC_CAP_ENCODER_FLUSH + encoder_recon_frame = lib.AV_CODEC_CAP_ENCODER_RECON_FRAME class PixFmtLoss(IntFlag): @@ -68,6 +67,8 @@ class PixFmtLoss(IntFlag): ALPHA = 0x0008 # loss of alpha bit COLORQUANT = 0x0010 # loss due to color quantization CHROMA = 0x0020 # loss of chroma (e.g. RGB to gray conversion) + EXCESS_RESOLUTION = 0x0040 # loss due to unneeded extra resolution + EXCESS_DEPTH = 0x0080 # loss due to unneeded extra color depth class UnknownCodecError(ValueError): @@ -367,12 +368,66 @@ def get_codec_names(): return names +@cython.cfunc +def get_media_type_name(media_type: lib.AVMediaType) -> str: + name = lib.av_get_media_type_string(media_type) + return "unknown" if name == cython.NULL else name + + +@cython.cfunc +def get_codec_summaries(): + summaries: dict = {} + desc = cython.declare( + cython.pointer[cython.const[lib.AVCodecDescriptor]], cython.NULL + ) + while True: + desc = lib.avcodec_descriptor_next(desc) + if not desc: + break + summaries[desc.name] = [ + desc.long_name or "", + get_media_type_name(desc.type), + desc.props, + lib.avcodec_find_decoder(desc.id) != cython.NULL, + lib.avcodec_find_encoder(desc.id) != cython.NULL, + ] + + canonical_names: set = set(summaries) + + ptr = cython.declare(cython.pointer[cython.const[lib.AVCodec]]) + opaque: cython.p_void = cython.NULL + while True: + ptr = lib.av_codec_iterate(cython.address(opaque)) + if not ptr: + break + if ptr.name in canonical_names: + continue + + desc = lib.avcodec_descriptor_get(ptr.id) + summary = summaries.setdefault( + ptr.name, + [ + ptr.long_name or "", + get_media_type_name(ptr.type), + desc.props if desc else 0, + False, + False, + ], + ) + summary[3 if lib.av_codec_is_decoder(ptr) else 4] = True + + return summaries + + codecs_available = get_codec_names() def dump_codecs(): """Print information about available codecs.""" + def _type_char(media_type: str) -> str: + return "T" if media_type == "attachment" else media_type[0].upper() + print( """Codecs: D..... = Decoding supported @@ -380,34 +435,24 @@ def dump_codecs(): ..V... = Video codec ..A... = Audio codec ..S... = Subtitle codec + ..D... = Data codec + ..T... = Attachment codec ...I.. = Intra frame-only codec ....L. = Lossy compression .....S = Lossless compression ------""" ) - for name in sorted(codecs_available): - try: - e_codec = Codec(name, "w") - except ValueError: - e_codec = None - - try: - d_codec = Codec(name, "r") - except ValueError: - d_codec = None - - # TODO: Assert these always have the same properties. - codec = e_codec or d_codec - - try: - print( - f" {'.D'[bool(d_codec)]}{'.E'[bool(e_codec)]}{codec.type[0].upper()}" - f"{'.I'[codec.intra_only]}{'.L'[codec.lossy]}{'.S'[codec.lossless]}" - f" {codec.name:<18} {codec.long_name}" - ) - except Exception as e: - print(f"...... {codec.name:<18} ERROR: {e}") + for name, (long_name, media_type, props, can_decode, can_encode) in sorted( + get_codec_summaries().items() + ): + print( + f" {'.D'[can_decode]}{'.E'[can_encode]}{_type_char(media_type)}" + f"{'.I'[bool(props & lib.AV_CODEC_PROP_INTRA_ONLY)]}" + f"{'.L'[bool(props & lib.AV_CODEC_PROP_LOSSY)]}" + f"{'.S'[bool(props & lib.AV_CODEC_PROP_LOSSLESS)]}" + f" {name:<18} {long_name}" + ) def dump_hwconfigs(): diff --git a/av/codec/codec.pyi b/av/codec/codec.pyi index be3953dd3..5203b6101 100644 --- a/av/codec/codec.pyi +++ b/av/codec/codec.pyi @@ -18,6 +18,8 @@ class Properties(Flag): LOSSY = cast(ClassVar[Properties], ...) LOSSLESS = cast(ClassVar[Properties], ...) REORDER = cast(ClassVar[Properties], ...) + FIELDS = cast(ClassVar[Properties], ...) + ENHANCEMENT = cast(ClassVar[Properties], ...) BITMAP_SUB = cast(ClassVar[Properties], ...) TEXT_SUB = cast(ClassVar[Properties], ...) @@ -25,14 +27,10 @@ class Capabilities(IntEnum): none = cast(int, ...) draw_horiz_band = cast(int, ...) dr1 = cast(int, ...) - hwaccel = cast(int, ...) delay = cast(int, ...) small_last_frame = cast(int, ...) - hwaccel_vdpau = cast(int, ...) - subframes = cast(int, ...) experimental = cast(int, ...) channel_conf = cast(int, ...) - neg_linesizes = cast(int, ...) frame_threads = cast(int, ...) slice_threads = cast(int, ...) param_change = cast(int, ...) @@ -53,6 +51,8 @@ class PixFmtLoss(IntFlag): ALPHA = cast(ClassVar[PixFmtLoss], ...) COLORQUANT = cast(ClassVar[PixFmtLoss], ...) CHROMA = cast(ClassVar[PixFmtLoss], ...) + EXCESS_RESOLUTION = cast(ClassVar[PixFmtLoss], ...) + EXCESS_DEPTH = cast(ClassVar[PixFmtLoss], ...) class UnknownCodecError(ValueError): ... diff --git a/av/codec/context.py b/av/codec/context.py index d5120e6db..b9d73a7d9 100644 --- a/av/codec/context.py +++ b/av/codec/context.py @@ -89,6 +89,7 @@ class Flags2(IntEnum): export_mvs = lib.AV_CODEC_FLAG2_EXPORT_MVS skip_manual = lib.AV_CODEC_FLAG2_SKIP_MANUAL ro_flush_noop = lib.AV_CODEC_FLAG2_RO_FLUSH_NOOP + icc_profiles = lib.AV_CODEC_FLAG2_ICC_PROFILES class OptionType(IntEnum): diff --git a/av/codec/context.pyi b/av/codec/context.pyi index 3dfb52285..690c34ba4 100644 --- a/av/codec/context.pyi +++ b/av/codec/context.pyi @@ -54,6 +54,7 @@ class Flags2(IntEnum): export_mvs = cast(int, ...) skip_manual = cast(int, ...) ro_flush_noop = cast(int, ...) + icc_profiles = cast(int, ...) class OptionType(IntEnum): FLAGS = cast(int, ...) diff --git a/av/codec/hwaccel.py b/av/codec/hwaccel.py index efb408849..c21225ce8 100644 --- a/av/codec/hwaccel.py +++ b/av/codec/hwaccel.py @@ -23,9 +23,8 @@ class HWDeviceType(IntEnum): mediacodec = lib.AV_HWDEVICE_TYPE_MEDIACODEC vulkan = lib.AV_HWDEVICE_TYPE_VULKAN d3d12va = lib.AV_HWDEVICE_TYPE_D3D12VA - amf = 13 # FFmpeg >=8 - ohcodec = 14 - # TODO: When ffmpeg major is changed, check this enum. + amf = lib.AV_HWDEVICE_TYPE_AMF + ohcodec = lib.AV_HWDEVICE_TYPE_OHCODEC class HWConfigMethod(IntEnum): diff --git a/av/format.py b/av/format.py index 86eff2c73..d14bb16e4 100644 --- a/av/format.py +++ b/av/format.py @@ -26,6 +26,7 @@ def build_container_format( class Flags(Flag): no_file = lib.AVFMT_NOFILE need_number: "Needs '%d' in filename." = lib.AVFMT_NEEDNUMBER + experimental: "Format is not selected automatically, it must be requested by name." = lib.AVFMT_EXPERIMENTAL show_ids: "Show format stream IDs numbers." = lib.AVFMT_SHOW_IDS global_header: "Format wants global header." = lib.AVFMT_GLOBALHEADER no_timestamps: "Format does not need / have any timestamps." = lib.AVFMT_NOTIMESTAMPS @@ -135,6 +136,11 @@ def flags(self): def no_file(self): return bool(self.flags & lib.AVFMT_NOFILE) + @property + def fixed_framesize(self): + """Whether the format wants fixed size audio frames. FFmpeg 9 and up.""" + return bool(self.flags & 0x80000) # AVFMT_FIXED_FRAMESIZE + @cython.cfunc def get_output_format_names() -> set[str]: diff --git a/av/format.pyi b/av/format.pyi index 81c5c42ca..369caaeb7 100644 --- a/av/format.pyi +++ b/av/format.pyi @@ -6,6 +6,7 @@ from typing import ClassVar, Literal, cast class Flags(Flag): no_file = cast(ClassVar[Flags], ...) need_number = cast(ClassVar[Flags], ...) + experimental = cast(ClassVar[Flags], ...) show_ids = cast(ClassVar[Flags], ...) global_header = cast(ClassVar[Flags], ...) no_timestamps = cast(ClassVar[Flags], ...) @@ -17,7 +18,6 @@ class Flags(Flag): no_bin_search = cast(ClassVar[Flags], ...) no_gen_search = cast(ClassVar[Flags], ...) no_byte_seek = cast(ClassVar[Flags], ...) - allow_flush = cast(ClassVar[Flags], ...) ts_nonstrict = cast(ClassVar[Flags], ...) ts_negative = cast(ClassVar[Flags], ...) seek_to_pts = cast(ClassVar[Flags], ...) @@ -38,5 +38,7 @@ class ContainerFormat: def flags(self) -> int: ... @property def no_file(self) -> bool: ... + @property + def fixed_framesize(self) -> bool: ... formats_available: set[str] diff --git a/av/sidedata/sidedata.py b/av/sidedata/sidedata.py index fcda121e1..171bd4462 100644 --- a/av/sidedata/sidedata.py +++ b/av/sidedata/sidedata.py @@ -46,6 +46,10 @@ class Type(Enum): DYNAMIC_HDR_VIVID = lib.AV_FRAME_DATA_DYNAMIC_HDR_VIVID AMBIENT_VIEWING_ENVIRONMENT = lib.AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT VIDEO_HINT = lib.AV_FRAME_DATA_VIDEO_HINT + LCEVC = lib.AV_FRAME_DATA_LCEVC + VIEW_ID = lib.AV_FRAME_DATA_VIEW_ID + THREE_D_REFERENCE_DISPLAYS = lib.AV_FRAME_DATA_3D_REFERENCE_DISPLAYS + EXIF = lib.AV_FRAME_DATA_EXIF @cython.cfunc diff --git a/av/sidedata/sidedata.pyi b/av/sidedata/sidedata.pyi index 3f8ef398e..5925aaff6 100644 --- a/av/sidedata/sidedata.pyi +++ b/av/sidedata/sidedata.pyi @@ -34,6 +34,10 @@ class Type(Enum): DYNAMIC_HDR_VIVID = cast(ClassVar[Type], ...) AMBIENT_VIEWING_ENVIRONMENT = cast(ClassVar[Type], ...) VIDEO_HINT = cast(ClassVar[Type], ...) + LCEVC = cast(ClassVar[Type], ...) + VIEW_ID = cast(ClassVar[Type], ...) + THREE_D_REFERENCE_DISPLAYS = cast(ClassVar[Type], ...) + EXIF = cast(ClassVar[Type], ...) class SideData(Buffer): type: Type diff --git a/av/video/reformatter.pxd b/av/video/reformatter.pxd index 1645d3943..0b6a9245a 100644 --- a/av/video/reformatter.pxd +++ b/av/video/reformatter.pxd @@ -19,12 +19,14 @@ cdef extern from "libswscale/swscale.h" nogil: cdef int SWS_SINC cdef int SWS_LANCZOS cdef int SWS_SPLINE + cdef int SWS_STRICT cdef int SWS_PRINT_INFO cdef int SWS_FULL_CHR_H_INT cdef int SWS_FULL_CHR_H_INP cdef int SWS_DIRECT_BGR cdef int SWS_ACCURATE_RND cdef int SWS_BITEXACT + cdef int SWS_UNSTABLE cdef int SWS_ERROR_DIFFUSION cdef int SWS_CS_ITU709 cdef int SWS_CS_FCC diff --git a/av/video/reformatter.py b/av/video/reformatter.py index 9402cf398..2ee91bdd1 100644 --- a/av/video/reformatter.py +++ b/av/video/reformatter.py @@ -19,12 +19,14 @@ class Interpolation(IntFlag): SINC: "Unwindowed Sinc" = SWS_SINC LANCZOS: "3-tap sinc/sinc" = SWS_LANCZOS SPLINE: "Unwindowed natural cubic spline" = SWS_SPLINE + STRICT: "Error out on underspecified conversions" = SWS_STRICT PRINT_INFO: "Emit verbose scaler info to the log" = SWS_PRINT_INFO FULL_CHR_H_INT: "Full chroma interpolation" = SWS_FULL_CHR_H_INT FULL_CHR_H_INP: "Full chroma input" = SWS_FULL_CHR_H_INP DIRECT_BGR: "Direct BGR" = SWS_DIRECT_BGR ACCURATE_RND: "Accurate rounding" = SWS_ACCURATE_RND BITEXACT: "Bit-exact output" = SWS_BITEXACT + UNSTABLE: "Prefer experimental code paths (testing only)" = SWS_UNSTABLE ERROR_DIFFUSION: "Error diffusion dither" = SWS_ERROR_DIFFUSION @@ -78,6 +80,7 @@ class ColorTrc(IntEnum): SMPTE2084: "SMPTE 2084 (PQ, HDR10)" = lib.AVCOL_TRC_SMPTE2084 SMPTE428: "SMPTE 428-1" = lib.AVCOL_TRC_SMPTE428 ARIB_STD_B67: "ARIB STD-B67 (HLG)" = lib.AVCOL_TRC_ARIB_STD_B67 + V_LOG: "Panasonic V-Log (not part of H.273)" = lib.AVCOL_TRC_V_LOG class ColorPrimaries(IntEnum): @@ -98,6 +101,7 @@ class ColorPrimaries(IntEnum): SMPTE431: "SMPTE 431-2 (DCI-P3)" = lib.AVCOL_PRI_SMPTE431 SMPTE432: "SMPTE 432-1 (Display P3)" = lib.AVCOL_PRI_SMPTE432 EBU3213: "EBU 3213-E / JEDEC P22" = lib.AVCOL_PRI_EBU3213 + V_GAMUT: "Panasonic V-Gamut (not part of H.273)" = lib.AVCOL_PRI_V_GAMUT @cython.cfunc diff --git a/av/video/reformatter.pyi b/av/video/reformatter.pyi index 480860d0b..9d382e123 100644 --- a/av/video/reformatter.pyi +++ b/av/video/reformatter.pyi @@ -15,12 +15,14 @@ class Interpolation(IntFlag): SINC = cast(int, ...) LANCZOS = cast(int, ...) SPLINE = cast(int, ...) + STRICT = cast(int, ...) PRINT_INFO = cast(int, ...) FULL_CHR_H_INT = cast(int, ...) FULL_CHR_H_INP = cast(int, ...) DIRECT_BGR = cast(int, ...) ACCURATE_RND = cast(int, ...) BITEXACT = cast(int, ...) + UNSTABLE = cast(int, ...) ERROR_DIFFUSION = cast(int, ...) class Colorspace(IntEnum): @@ -65,6 +67,7 @@ class ColorTrc(IntEnum): SMPTE2084 = cast(int, ...) SMPTE428 = cast(int, ...) ARIB_STD_B67 = cast(int, ...) + V_LOG = cast(int, ...) class ColorPrimaries(IntEnum): BT709 = cast(int, ...) @@ -79,6 +82,7 @@ class ColorPrimaries(IntEnum): SMPTE431 = cast(int, ...) SMPTE432 = cast(int, ...) EBU3213 = cast(int, ...) + V_GAMUT = cast(int, ...) class VideoReformatter: def reformat( diff --git a/include/avcodec.pxd b/include/avcodec.pxd index d6d3d82b4..ae1afafc9 100644 --- a/include/avcodec.pxd +++ b/include/avcodec.pxd @@ -1,11 +1,7 @@ from libc.stdint cimport int64_t, uint8_t, uint16_t, uint32_t, uint64_t cdef extern from "libavutil/channel_layout.h" nogil: - ctypedef enum AVChannel: - AV_CHAN_NONE = -1 - AV_CHAN_FRONT_LEFT - AV_CHAN_FRONT_RIGHT - AV_CHAN_FRONT_CENTER + ctypedef int AVChannel ctypedef struct AVChannelLayout: int nb_channels @@ -38,6 +34,8 @@ cdef extern from "libavcodec/avcodec.h" nogil: AV_CODEC_PROP_LOSSY AV_CODEC_PROP_LOSSLESS AV_CODEC_PROP_REORDER + AV_CODEC_PROP_FIELDS + AV_CODEC_PROP_ENHANCEMENT AV_CODEC_PROP_BITMAP_SUB AV_CODEC_PROP_TEXT_SUB @@ -57,6 +55,8 @@ cdef extern from "libavcodec/avcodec.h" nogil: AV_CODEC_CAP_HARDWARE AV_CODEC_CAP_HYBRID AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE + AV_CODEC_CAP_ENCODER_FLUSH + AV_CODEC_CAP_ENCODER_RECON_FRAME cdef enum: AV_PROFILE_UNKNOWN = -99 @@ -97,6 +97,7 @@ cdef extern from "libavcodec/avcodec.h" nogil: AV_CODEC_FLAG2_EXPORT_MVS AV_CODEC_FLAG2_SKIP_MANUAL AV_CODEC_FLAG2_RO_FLUSH_NOOP + AV_CODEC_FLAG2_ICC_PROFILES cdef enum: AV_PKT_FLAG_KEY @@ -108,20 +109,13 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef enum: AV_FRAME_FLAG_CORRUPT AV_FRAME_FLAG_KEY - AV_FRAME_FLAG_DISCARD AV_FRAME_FLAG_INTERLACED cdef enum: - FF_COMPLIANCE_VERY_STRICT - FF_COMPLIANCE_STRICT FF_COMPLIANCE_NORMAL - FF_COMPLIANCE_UNOFFICIAL - FF_COMPLIANCE_EXPERIMENTAL cdef enum AVCodecID: AV_CODEC_ID_NONE - AV_CODEC_ID_MPEG2VIDEO - AV_CODEC_ID_MPEG1VIDEO AV_CODEC_ID_PCM_ALAW AV_CODEC_ID_PCM_BLURAY AV_CODEC_ID_PCM_DVD @@ -202,10 +196,10 @@ cdef extern from "libavcodec/avcodec.h" nogil: const char *name const char *long_name int props - const char *const *mime_types const AVProfile *profiles const AVCodecDescriptor* avcodec_descriptor_get(AVCodecID) + const AVCodecDescriptor* avcodec_descriptor_next(const AVCodecDescriptor *prev) cdef enum: AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX @@ -292,7 +286,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef AVCodecContext* avcodec_alloc_context3(const AVCodec *codec) cdef void avcodec_free_context(AVCodecContext **ctx) - cdef const AVClass* avcodec_get_class() cdef const AVCodec* avcodec_find_decoder(AVCodecID id) cdef const AVCodec* avcodec_find_encoder(AVCodecID id) cdef const AVCodec* avcodec_find_decoder_by_name(const char *name) @@ -340,6 +333,10 @@ cdef extern from "libavcodec/avcodec.h" nogil: AV_FRAME_DATA_DYNAMIC_HDR_VIVID AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT AV_FRAME_DATA_VIDEO_HINT + AV_FRAME_DATA_LCEVC + AV_FRAME_DATA_VIEW_ID + AV_FRAME_DATA_3D_REFERENCE_DISPLAYS + AV_FRAME_DATA_EXIF cdef struct AVFrameSideData: AVFrameSideDataType type @@ -452,14 +449,10 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame) cdef int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) - cdef struct AVCodecParser: - int codec_ids[7] - cdef struct AVCodecParserContext: int64_t pts int64_t dts int64_t pos - int64_t last_pos int64_t offset int duration int key_frame @@ -500,7 +493,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef extern from "libavcodec/bsf.h" nogil: cdef struct AVBitStreamFilter: const char *name - const AVCodecID *codec_ids cdef struct AVCodecParameters: pass diff --git a/include/avfilter.pxd b/include/avfilter.pxd index 2905a8c88..5be0872e0 100644 --- a/include/avfilter.pxd +++ b/include/avfilter.pxd @@ -38,8 +38,6 @@ cdef extern from "libavfilter/avfilter.h" nogil: cdef int avfilter_init_str(AVFilterContext *ctx, const char *args) cdef int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) - cdef void avfilter_free(AVFilterContext*) - cdef const AVClass* avfilter_get_class() cdef struct AVFilterLink: AVFilterContext *src @@ -62,8 +60,6 @@ cdef extern from "libavfilter/avfilter.h" nogil: cdef struct AVFilterInOut: char *name - AVFilterContext *filter_ctx - int pad_idx AVFilterInOut *next cdef AVFilterGraph* avfilter_graph_alloc() @@ -73,14 +69,6 @@ cdef extern from "libavfilter/avfilter.h" nogil: const AVFilter *filter, const char *name ) - cdef int avfilter_graph_create_filter( - AVFilterContext **filt_ctx, - const AVFilter *filt, - const char *name, - const char *args, - void *opaque, - AVFilterGraph *graph_ctx - ) cdef int avfilter_link( AVFilterContext *src, unsigned int srcpad, diff --git a/include/avformat.pxd b/include/avformat.pxd index 920f18d84..4a4181b4d 100644 --- a/include/avformat.pxd +++ b/include/avformat.pxd @@ -14,7 +14,6 @@ cdef extern from "libavformat/avformat.h" nogil: cdef int AVIO_FLAG_WRITE cdef enum AVMediaType: - AVMEDIA_TYPE_UNKNOWN AVMEDIA_TYPE_VIDEO AVMEDIA_TYPE_AUDIO AVMEDIA_TYPE_DATA @@ -31,7 +30,6 @@ cdef extern from "libavformat/avformat.h" nogil: int64_t start_time int64_t duration int64_t nb_frames - int64_t cur_dts AVDictionary *metadata AVRational avg_frame_rate AVRational r_frame_rate @@ -49,7 +47,6 @@ cdef extern from "libavformat/avformat.h" nogil: unsigned char* buffer int buffer_size int write_flag - int direct int seekable int max_packet_size void *opaque @@ -95,6 +92,7 @@ cdef extern from "libavformat/avformat.h" nogil: cdef enum: AVFMT_NOFILE AVFMT_NEEDNUMBER + AVFMT_EXPERIMENTAL AVFMT_SHOW_IDS AVFMT_GLOBALHEADER AVFMT_NOTIMESTAMPS @@ -200,7 +198,6 @@ cdef extern from "libavformat/avformat.h" nogil: const char *filename ) cdef void avformat_free_context(AVFormatContext *ctx) - cdef const AVClass* avformat_get_class() cdef void av_dump_format(AVFormatContext *ctx, int index, const char *url, int is_output) cdef int av_read_frame(AVFormatContext *ctx, AVPacket *packet) cdef int av_seek_frame( @@ -223,8 +220,6 @@ cdef extern from "libavformat/avformat.h" nogil: cdef const AVInputFormat* av_demuxer_iterate(void **opaque) cdef const AVOutputFormat* av_muxer_iterate(void **opaque) - cdef set pyav_get_available_formats() - cdef struct AVIndexEntry: int64_t pos int64_t timestamp diff --git a/include/avutil.pxd b/include/avutil.pxd index 8818fdd14..034635b7c 100644 --- a/include/avutil.pxd +++ b/include/avutil.pxd @@ -35,18 +35,11 @@ cdef extern from "libavutil/avutil.h" nogil: AV_PIX_FMT_YUV420P cdef enum AVColorSpace: - AVCOL_SPC_RGB AVCOL_SPC_BT709 - AVCOL_SPC_UNSPECIFIED - AVCOL_SPC_RESERVED AVCOL_SPC_FCC - AVCOL_SPC_BT470BG AVCOL_SPC_SMPTE170M AVCOL_SPC_SMPTE240M - AVCOL_SPC_YCOCG AVCOL_SPC_BT2020_NCL - AVCOL_SPC_BT2020_CL - AVCOL_SPC_NB cdef enum AVColorRange: AVCOL_RANGE_UNSPECIFIED @@ -64,11 +57,10 @@ cdef extern from "libavutil/avutil.h" nogil: AVCOL_PRI_FILM AVCOL_PRI_BT2020 AVCOL_PRI_SMPTE428 - AVCOL_PRI_SMPTEST428_1 AVCOL_PRI_SMPTE431 AVCOL_PRI_SMPTE432 AVCOL_PRI_EBU3213 - AVCOL_PRI_JEDEC_P22 + AVCOL_PRI_V_GAMUT cdef enum AVColorTransferCharacteristic: AVCOL_TRC_BT709 @@ -86,10 +78,9 @@ cdef extern from "libavutil/avutil.h" nogil: AVCOL_TRC_BT2020_10 AVCOL_TRC_BT2020_12 AVCOL_TRC_SMPTE2084 - AVCOL_TRC_SMPTEST2084 AVCOL_TRC_SMPTE428 - AVCOL_TRC_SMPTEST428_1 AVCOL_TRC_ARIB_STD_B67 + AVCOL_TRC_V_LOG cdef void* av_malloc(size_t size) cdef void* av_mallocz(size_t size) @@ -108,7 +99,6 @@ cdef extern from "libavutil/avutil.h" nogil: int num int den cdef int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) - cdef int64_t av_rescale(int64_t a, int64_t b, int64_t c) cdef const char* av_get_media_type_string(AVMediaType media_type) cdef extern from "libavutil/buffer.h" nogil: @@ -188,7 +178,6 @@ cdef extern from "libavutil/frame.h" nogil: cdef int av_frame_get_buffer(AVFrame *frame, int align) cdef int av_frame_make_writable(AVFrame *frame) cdef int av_frame_copy_props(AVFrame *dst, const AVFrame *src) - cdef AVFrameSideData* av_frame_get_side_data(const AVFrame *frame, AVFrameSideDataType type) cdef extern from "libavutil/hwcontext.h" nogil: cdef struct AVHWDeviceContext: @@ -210,6 +199,8 @@ cdef extern from "libavutil/hwcontext.h" nogil: AV_HWDEVICE_TYPE_MEDIACODEC AV_HWDEVICE_TYPE_VULKAN AV_HWDEVICE_TYPE_D3D12VA + AV_HWDEVICE_TYPE_AMF + AV_HWDEVICE_TYPE_OHCODEC ctypedef struct AVHWFramesContext: const AVClass *av_class @@ -235,14 +226,6 @@ cdef extern from "libavutil/hwcontext.h" nogil: cdef int av_hwframe_ctx_init(AVBufferRef *ref) cdef extern from "libavutil/imgutils.h" nogil: - cdef int av_image_alloc( - uint8_t *pointers[4], - int linesizes[4], - int width, - int height, - AVPixelFormat pix_fmt, - int align - ) cdef int av_image_fill_pointers( uint8_t *pointers[4], AVPixelFormat pix_fmt, @@ -253,7 +236,6 @@ cdef extern from "libavutil/imgutils.h" nogil: cdef extern from "libavutil/log.h" nogil: cdef struct AVClass: - const char *class_name const char *(*item_name)(void*) nogil const AVOption *option @@ -312,12 +294,6 @@ cdef extern from "libavutil/opt.h" nogil: AV_OPT_TYPE_UINT AV_OPT_TYPE_FLAG_ARRAY - cdef union AVOption_default_val: - int64_t i64 - double dbl - const char *str - AVRational q - cdef enum: AV_OPT_FLAG_ENCODING_PARAM AV_OPT_FLAG_DECODING_PARAM @@ -337,7 +313,6 @@ cdef extern from "libavutil/opt.h" nogil: const char *help AVOptionType type int offset - AVOption_default_val default_val double min double max int flags @@ -355,7 +330,6 @@ cdef extern from "libavutil/pixdesc.h" nogil: int plane int step int offset - int shift int depth cdef enum AVPixFmtFlags: @@ -377,7 +351,6 @@ cdef extern from "libavutil/pixdesc.h" nogil: cdef const AVPixFmtDescriptor* av_pix_fmt_desc_get(AVPixelFormat pix_fmt) cdef const AVPixFmtDescriptor* av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) - cdef const char *av_get_pix_fmt_name(AVPixelFormat pix_fmt) cdef AVPixelFormat av_get_pix_fmt(const char *name) int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)