From d8ebaa593230d6116bb21a10221342670dcbba73 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Sun, 8 Feb 2026 16:04:10 -0500 Subject: [PATCH] Make `include/` smaller Since almost everything needs libav, put as little as possible to reduce the need to recompile everything. `swscale` can be returned back to `include/` if another file besides `reformatter` needs it. --- av/_core.pxd | 15 +++++ av/_core.py | 20 +++---- av/logging.pxd | 6 ++ av/logging.py | 3 +- av/subtitles/subtitle.pxd | 2 - av/utils.py | 7 --- av/video/reformatter.pxd | 72 +++++++++++++++++++++++- av/video/reformatter.py | 77 ++++++++++++------------- include/{libavcodec => }/avcodec.pxd | 68 ++++++++++++++++------ include/{libavfilter => }/avfilter.pxd | 53 ++++++++++++----- include/{libavformat => }/avformat.pxd | 0 include/{libavutil => }/avutil.pxd | 0 include/libav.pxd | 23 ++------ include/libavcodec/bsf.pxd | 20 ------- include/libavcodec/hwaccel.pxd | 13 ----- include/libavdevice/avdevice.pxd | 5 -- include/libavfilter/avfiltergraph.pxd | 37 ------------ include/libavfilter/buffersink.pxd | 2 - include/libavfilter/buffersrc.pxd | 2 - include/libswresample/swresample.pxd | 4 -- include/libswscale/swscale.pxd | 78 -------------------------- 21 files changed, 232 insertions(+), 275 deletions(-) create mode 100644 av/_core.pxd rename include/{libavcodec => }/avcodec.pxd (91%) rename include/{libavfilter => }/avfilter.pxd (58%) rename include/{libavformat => }/avformat.pxd (100%) rename include/{libavutil => }/avutil.pxd (100%) delete mode 100644 include/libavcodec/bsf.pxd delete mode 100644 include/libavcodec/hwaccel.pxd delete mode 100644 include/libavdevice/avdevice.pxd delete mode 100644 include/libavfilter/avfiltergraph.pxd delete mode 100644 include/libavfilter/buffersink.pxd delete mode 100644 include/libavfilter/buffersrc.pxd delete mode 100644 include/libswresample/swresample.pxd delete mode 100644 include/libswscale/swscale.pxd diff --git a/av/_core.pxd b/av/_core.pxd new file mode 100644 index 000000000..49f665b6e --- /dev/null +++ b/av/_core.pxd @@ -0,0 +1,15 @@ +cdef extern from "libavdevice/avdevice.h" nogil: + cdef int avdevice_version() + cdef char* avdevice_configuration() + cdef char* avdevice_license() + void avdevice_register_all() + +cdef extern from "libswscale/swscale.h" nogil: + cdef int swscale_version() + cdef char* swscale_configuration() + cdef char* swscale_license() + +cdef extern from "libswresample/swresample.h" nogil: + cdef int swresample_version() + cdef char* swresample_configuration() + cdef char* swresample_license() diff --git a/av/_core.py b/av/_core.py index 2384fa457..d9ad01074 100644 --- a/av/_core.py +++ b/av/_core.py @@ -1,7 +1,7 @@ import cython import cython.cimports.libav as lib -lib.avdevice_register_all() +avdevice_register_all() # Exports. time_base = lib.AV_TIME_BASE @@ -41,9 +41,9 @@ def decode_version(v): license=lib.avformat_license(), ), "libavdevice": dict( - version=decode_version(lib.avdevice_version()), - configuration=lib.avdevice_configuration(), - license=lib.avdevice_license(), + version=decode_version(avdevice_version()), + configuration=avdevice_configuration(), + license=avdevice_license(), ), "libavfilter": dict( version=decode_version(lib.avfilter_version()), @@ -51,14 +51,14 @@ def decode_version(v): license=lib.avfilter_license(), ), "libswscale": dict( - version=decode_version(lib.swscale_version()), - configuration=lib.swscale_configuration(), - license=lib.swscale_license(), + version=decode_version(swscale_version()), + configuration=swscale_configuration(), + license=swscale_license(), ), "libswresample": dict( - version=decode_version(lib.swresample_version()), - configuration=lib.swresample_configuration(), - license=lib.swresample_license(), + version=decode_version(swresample_version()), + configuration=swresample_configuration(), + license=swresample_license(), ), } diff --git a/av/logging.pxd b/av/logging.pxd index 8bd9fb730..b5a99be02 100644 --- a/av/logging.pxd +++ b/av/logging.pxd @@ -1,6 +1,12 @@ +cimport libav as lib + + cdef extern from "Python.h" nogil: void PyErr_PrintEx(int set_sys_last_vars) int Py_IsInitialized() void PyErr_Display(object, object, object) +cdef extern from "stdio.h" nogil: + cdef int vsnprintf(char *output, int n, const char *format, lib.va_list args) + cpdef get_last_error() diff --git a/av/logging.py b/av/logging.py index a937b26a2..dbd247d56 100644 --- a/av/logging.py +++ b/av/logging.py @@ -44,7 +44,6 @@ from threading import Lock, get_ident import cython -import cython.cimports.libav as lib from cython.cimports.libc.stdio import fprintf, stderr from cython.cimports.libc.stdlib import free, malloc @@ -338,7 +337,7 @@ def log_callback( # Format the message. message: cython.char[1024] - lib.vsnprintf(message, 1023, format, args) + vsnprintf(message, 1023, format, args) # Get the name. name: cython.p_const_char = cython.NULL diff --git a/av/subtitles/subtitle.pxd b/av/subtitles/subtitle.pxd index 508eb9034..4f8556742 100644 --- a/av/subtitles/subtitle.pxd +++ b/av/subtitles/subtitle.pxd @@ -4,12 +4,10 @@ cimport libav as lib cdef class SubtitleProxy: cdef lib.AVSubtitle struct - cdef class SubtitleSet: cdef SubtitleProxy proxy cdef readonly tuple rects - cdef class Subtitle: cdef SubtitleProxy proxy cdef lib.AVSubtitleRect *ptr diff --git a/av/utils.py b/av/utils.py index bdf11bbb5..300d315f2 100644 --- a/av/utils.py +++ b/av/utils.py @@ -5,9 +5,6 @@ from cython.cimports import libav as lib from cython.cimports.av.error import err_check -# === DICTIONARIES === -# ==================== - @cython.cfunc def _decode(s: cython.pointer[cython.char], encoding, errors) -> str: @@ -47,10 +44,6 @@ def dict_to_avdict( ) -# === FRACTIONS === -# ================= - - @cython.cfunc def avrational_to_fraction( input: cython.pointer[cython.const[lib.AVRational]], diff --git a/av/video/reformatter.pxd b/av/video/reformatter.pxd index d031f4dcf..433824e8c 100644 --- a/av/video/reformatter.pxd +++ b/av/video/reformatter.pxd @@ -1,12 +1,80 @@ cimport libav as lib +from libc.stdint cimport uint8_t from av.video.frame cimport VideoFrame -cdef class VideoReformatter: +cdef extern from "libswscale/swscale.h" nogil: + cdef struct SwsContext: + pass + cdef struct SwsFilter: + pass + cdef int SWS_FAST_BILINEAR + cdef int SWS_BILINEAR + cdef int SWS_BICUBIC + cdef int SWS_X + cdef int SWS_POINT + cdef int SWS_AREA + cdef int SWS_BICUBLIN + cdef int SWS_GAUSS + cdef int SWS_SINC + cdef int SWS_LANCZOS + cdef int SWS_SPLINE + cdef int SWS_CS_ITU709 + cdef int SWS_CS_FCC + cdef int SWS_CS_ITU601 + cdef int SWS_CS_ITU624 + cdef int SWS_CS_SMPTE170M + cdef int SWS_CS_SMPTE240M + cdef int SWS_CS_DEFAULT - cdef lib.SwsContext *ptr + cdef int sws_scale( + SwsContext *ctx, + const uint8_t *const *src_slice, + const int *src_stride, + int src_slice_y, + int src_slice_h, + unsigned char *const *dst_slice, + const int *dst_stride, + ) + cdef void sws_freeContext(SwsContext *ctx) + cdef SwsContext *sws_getCachedContext( + SwsContext *context, + int src_width, + int src_height, + lib.AVPixelFormat src_format, + int dst_width, + int dst_height, + lib.AVPixelFormat dst_format, + int flags, + SwsFilter *src_filter, + SwsFilter *dst_filter, + double *param, + ) + cdef const int* sws_getCoefficients(int colorspace) + cdef int sws_getColorspaceDetails( + SwsContext *context, + int **inv_table, + int *srcRange, + int **table, + int *dstRange, + int *brightness, + int *contrast, + int *saturation + ) + cdef int sws_setColorspaceDetails( + SwsContext *context, + const int inv_table[4], + int srcRange, + const int table[4], + int dstRange, + int brightness, + int contrast, + int saturation + ) +cdef class VideoReformatter: + cdef SwsContext *ptr cdef _reformat(self, VideoFrame frame, int width, int height, lib.AVPixelFormat format, int src_colorspace, int dst_colorspace, int interpolation, diff --git a/av/video/reformatter.py b/av/video/reformatter.py index 8005b7ed7..b72162ede 100644 --- a/av/video/reformatter.py +++ b/av/video/reformatter.py @@ -1,41 +1,40 @@ from enum import IntEnum import cython -import cython.cimports.libav as lib from cython.cimports.av.error import err_check from cython.cimports.av.video.format import VideoFormat from cython.cimports.av.video.frame import alloc_video_frame class Interpolation(IntEnum): - FAST_BILINEAR: "Fast bilinear" = lib.SWS_FAST_BILINEAR - BILINEAR: "Bilinear" = lib.SWS_BILINEAR - BICUBIC: "Bicubic" = lib.SWS_BICUBIC - X: "Experimental" = lib.SWS_X - POINT: "Nearest neighbor / point" = lib.SWS_POINT - AREA: "Area averaging" = lib.SWS_AREA - BICUBLIN: "Luma bicubic / chroma bilinear" = lib.SWS_BICUBLIN - GAUSS: "Gaussian" = lib.SWS_GAUSS - SINC: "Sinc" = lib.SWS_SINC - LANCZOS: "Bicubic spline" = lib.SWS_LANCZOS + FAST_BILINEAR: "Fast bilinear" = SWS_FAST_BILINEAR + BILINEAR: "Bilinear" = SWS_BILINEAR + BICUBIC: "Bicubic" = SWS_BICUBIC + X: "Experimental" = SWS_X + POINT: "Nearest neighbor / point" = SWS_POINT + AREA: "Area averaging" = SWS_AREA + BICUBLIN: "Luma bicubic / chroma bilinear" = SWS_BICUBLIN + GAUSS: "Gaussian" = SWS_GAUSS + SINC: "Sinc" = SWS_SINC + LANCZOS: "Bicubic spline" = SWS_LANCZOS class Colorspace(IntEnum): - ITU709 = lib.SWS_CS_ITU709 - FCC = lib.SWS_CS_FCC - ITU601 = lib.SWS_CS_ITU601 - ITU624 = lib.SWS_CS_ITU624 - SMPTE170M = lib.SWS_CS_SMPTE170M - SMPTE240M = lib.SWS_CS_SMPTE240M - DEFAULT = lib.SWS_CS_DEFAULT + ITU709 = SWS_CS_ITU709 + FCC = SWS_CS_FCC + ITU601 = SWS_CS_ITU601 + ITU624 = SWS_CS_ITU624 + SMPTE170M = SWS_CS_SMPTE170M + SMPTE240M = SWS_CS_SMPTE240M + DEFAULT = SWS_CS_DEFAULT # Lowercase for b/c. - itu709 = lib.SWS_CS_ITU709 - fcc = lib.SWS_CS_FCC - itu601 = lib.SWS_CS_ITU601 - itu624 = lib.SWS_CS_ITU624 - smpte170m = lib.SWS_CS_SMPTE170M - smpte240m = lib.SWS_CS_SMPTE240M - default = lib.SWS_CS_DEFAULT + itu709 = SWS_CS_ITU709 + fcc = SWS_CS_FCC + itu601 = SWS_CS_ITU601 + itu624 = SWS_CS_ITU624 + smpte170m = SWS_CS_SMPTE170M + smpte240m = SWS_CS_SMPTE240M + default = SWS_CS_DEFAULT class ColorRange(IntEnum): @@ -65,10 +64,10 @@ def _resolve_enum_value(value, enum_class, default): _SWS_CS_TO_AVCOL_SPC = cython.declare( dict, { - lib.SWS_CS_ITU709: lib.AVCOL_SPC_BT709, - lib.SWS_CS_FCC: lib.AVCOL_SPC_FCC, - lib.SWS_CS_ITU601: lib.AVCOL_SPC_SMPTE170M, - lib.SWS_CS_SMPTE240M: lib.AVCOL_SPC_SMPTE240M, + SWS_CS_ITU709: lib.AVCOL_SPC_BT709, + SWS_CS_FCC: lib.AVCOL_SPC_FCC, + SWS_CS_ITU601: lib.AVCOL_SPC_SMPTE170M, + SWS_CS_SMPTE240M: lib.AVCOL_SPC_SMPTE240M, }, ) @@ -84,7 +83,7 @@ class VideoReformatter: def __dealloc__(self): with cython.nogil: - lib.sws_freeContext(self.ptr) + sws_freeContext(self.ptr) def reformat( self, @@ -212,7 +211,7 @@ def _reformat( return frame with cython.nogil: - self.ptr = lib.sws_getCachedContext( + self.ptr = sws_getCachedContext( self.ptr, frame.ptr.width, frame.ptr.height, @@ -239,7 +238,7 @@ def _reformat( if src_colorspace != dst_colorspace or src_color_range != dst_color_range: with cython.nogil: - ret = lib.sws_getColorspaceDetails( + ret = sws_getColorspaceDetails( self.ptr, cython.address(inv_tbl), cython.address(src_colorspace_range), @@ -254,16 +253,14 @@ def _reformat( with cython.nogil: # Grab the coefficients for the requested transforms. # The inv_table brings us to linear, and `tbl` to the new space. - if src_colorspace != lib.SWS_CS_DEFAULT: + if src_colorspace != SWS_CS_DEFAULT: inv_tbl = cython.cast( - cython.p_int, lib.sws_getCoefficients(src_colorspace) - ) - if dst_colorspace != lib.SWS_CS_DEFAULT: - tbl = cython.cast( - cython.p_int, lib.sws_getCoefficients(dst_colorspace) + cython.p_int, sws_getCoefficients(src_colorspace) ) + if dst_colorspace != SWS_CS_DEFAULT: + tbl = cython.cast(cython.p_int, sws_getCoefficients(dst_colorspace)) - ret = lib.sws_setColorspaceDetails( + ret = sws_setColorspaceDetails( self.ptr, inv_tbl, src_color_range, @@ -290,7 +287,7 @@ def _reformat( ) with cython.nogil: - lib.sws_scale( + sws_scale( self.ptr, cython.cast("const unsigned char *const *", frame.ptr.data), cython.cast("const int *", frame.ptr.linesize), diff --git a/include/libavcodec/avcodec.pxd b/include/avcodec.pxd similarity index 91% rename from include/libavcodec/avcodec.pxd rename to include/avcodec.pxd index 9b7304d05..09c7dabf0 100644 --- a/include/libavcodec/avcodec.pxd +++ b/include/avcodec.pxd @@ -1,19 +1,6 @@ -from libc.stdint cimport int64_t, uint8_t, uint16_t, uint32_t +from libc.stdint cimport int64_t, uint8_t, uint16_t, uint32_t, uint64_t - -cdef extern from "libavcodec/packet.h" nogil: - const AVPacketSideData *av_packet_side_data_get( - const AVPacketSideData *sd, int nb_sd, AVPacketSideDataType type - ) - uint8_t* av_packet_get_side_data( - const AVPacket *pkt, AVPacketSideDataType type, size_t *size - ) - int av_packet_add_side_data( - AVPacket *pkt, AVPacketSideDataType type, uint8_t *data, size_t size - ) - const char *av_packet_side_data_name(AVPacketSideDataType type) - -cdef extern from "libavutil/channel_layout.h": +cdef extern from "libavutil/channel_layout.h" nogil: ctypedef enum AVChannelOrder: pass ctypedef enum AVChannel: @@ -37,7 +24,6 @@ cdef extern from "libavutil/channel_layout.h": int av_channel_description(char *buf, size_t buf_size, AVChannel channel_id) AVChannel av_channel_layout_channel_from_index(AVChannelLayout *channel_layout, unsigned int idx) - cdef extern from "libavcodec/avcodec.h" nogil: cdef set pyav_get_available_codecs() cdef int avcodec_version() @@ -54,7 +40,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef size_t AV_INPUT_BUFFER_PADDING_SIZE cdef int64_t AV_NOPTS_VALUE - # AVCodecDescriptor.props cdef enum: AV_CODEC_PROP_INTRA_ONLY AV_CODEC_PROP_LOSSY @@ -63,7 +48,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: AV_CODEC_PROP_BITMAP_SUB AV_CODEC_PROP_TEXT_SUB - # AVCodec.capabilities cdef enum: AV_CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DR1 @@ -222,6 +206,20 @@ cdef extern from "libavcodec/avcodec.h" nogil: AVCodecDescriptor* avcodec_descriptor_get(AVCodecID) + cdef enum: + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX + AV_CODEC_HW_CONFIG_METHOD_INTERNAL + AV_CODEC_HW_CONFIG_METHOD_AD_HOC + + cdef struct AVCodecHWConfig: + AVPixelFormat pix_fmt + int methods + AVHWDeviceType device_type + cdef const AVCodecHWConfig* avcodec_get_hw_config(const AVCodec *codec, int index) + cdef struct AVHWAccel: + pass + cdef struct AVCodecContext: AVClass *av_class @@ -474,3 +472,37 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef int avcodec_parameters_to_context( AVCodecContext *codec, const AVCodecParameters *par ) + + +cdef extern from "libavcodec/bsf.h" nogil: + cdef struct AVBitStreamFilter: + const char *name + AVCodecID *codec_ids + + cdef struct AVCodecParameters: + pass + + cdef struct AVBSFContext: + const AVBitStreamFilter *filter + const AVCodecParameters *par_in + const AVCodecParameters *par_out + + cdef int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf) + cdef int av_bsf_init(AVBSFContext *ctx) + cdef void av_bsf_free(AVBSFContext **ctx) + cdef AVBitStreamFilter* av_bsf_iterate(void **opaque) + cdef int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) + cdef int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt) + cdef void av_bsf_flush(AVBSFContext *ctx) + +cdef extern from "libavcodec/packet.h" nogil: + const AVPacketSideData *av_packet_side_data_get( + const AVPacketSideData *sd, int nb_sd, AVPacketSideDataType type + ) + uint8_t* av_packet_get_side_data( + const AVPacket *pkt, AVPacketSideDataType type, size_t *size + ) + int av_packet_add_side_data( + AVPacket *pkt, AVPacketSideDataType type, uint8_t *data, size_t size + ) + const char *av_packet_side_data_name(AVPacketSideDataType type) diff --git a/include/libavfilter/avfilter.pxd b/include/avfilter.pxd similarity index 58% rename from include/libavfilter/avfilter.pxd rename to include/avfilter.pxd index db67507b4..5eb11ecc2 100644 --- a/include/libavfilter/avfilter.pxd +++ b/include/avfilter.pxd @@ -22,8 +22,6 @@ cdef extern from "libavfilter/avfilter.h" nogil: cdef AVFilter* avfilter_get_by_name(const char *name) cdef const AVFilter* av_filter_iterate(void **opaque) - cdef struct AVFilterLink # Defined later. - cdef struct AVFilterContext: AVClass *av_class AVFilter *filter @@ -48,7 +46,6 @@ cdef extern from "libavfilter/avfilter.h" nogil: AVFilterPad *srcpad AVFilterContext *dst AVFilterPad *dstpad - AVMediaType Type int w int h @@ -58,18 +55,46 @@ cdef extern from "libavfilter/avfilter.h" nogil: int format AVRational time_base - # custom - cdef set pyav_get_available_filters() - - int avfilter_process_command(AVFilterContext *filter, - const char *cmd, - const char *arg, - char *res, - int res_len, - int flags) - - cdef int AVFILTER_CMD_FLAG_FAST + cdef struct AVFilterGraph: + int nb_filters + AVFilterContext **filters + cdef struct AVFilterInOut: + char *name + AVFilterContext *filter_ctx + int pad_idx + AVFilterInOut *next + + cdef AVFilterGraph* avfilter_graph_alloc() + cdef void avfilter_graph_free(AVFilterGraph **ptr) + cdef AVFilterContext* avfilter_graph_alloc_filter( + AVFilterGraph *graph, + const AVFilter *filter, + const char *name + ) + cdef int avfilter_graph_create_filter( + AVFilterContext **filt_ctx, + AVFilter *filt, + const char *name, + const char *args, + void *opaque, + AVFilterGraph *graph_ctx + ) + cdef int avfilter_link( + AVFilterContext *src, + unsigned int srcpad, + AVFilterContext *dst, + unsigned int dstpad + ) + cdef int avfilter_graph_config(AVFilterGraph *graph, void *logctx) + int avfilter_process_command( + AVFilterContext *filter, const char *cmd, const char *arg, char *res, + int res_len, int flags, + ) cdef extern from "libavfilter/buffersink.h" nogil: cdef void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size) + int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) + +cdef extern from "libavfilter/buffersrc.h" nogil: + int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame) diff --git a/include/libavformat/avformat.pxd b/include/avformat.pxd similarity index 100% rename from include/libavformat/avformat.pxd rename to include/avformat.pxd diff --git a/include/libavutil/avutil.pxd b/include/avutil.pxd similarity index 100% rename from include/libavutil/avutil.pxd rename to include/avutil.pxd diff --git a/include/libav.pxd b/include/libav.pxd index a66626c3d..9157a8b33 100644 --- a/include/libav.pxd +++ b/include/libav.pxd @@ -1,19 +1,4 @@ -include "libavutil/avutil.pxd" -include "libavcodec/avcodec.pxd" -include "libavcodec/bsf.pxd" -include "libavcodec/hwaccel.pxd" - -include "libavdevice/avdevice.pxd" -include "libavformat/avformat.pxd" -include "libswresample/swresample.pxd" -include "libswscale/swscale.pxd" - -include "libavfilter/avfilter.pxd" -include "libavfilter/avfiltergraph.pxd" -include "libavfilter/buffersink.pxd" -include "libavfilter/buffersrc.pxd" - - -cdef extern from "stdio.h" nogil: - cdef int snprintf(char *output, int n, const char *format, ...) - cdef int vsnprintf(char *output, int n, const char *format, va_list args) +include "avutil.pxd" +include "avcodec.pxd" +include "avformat.pxd" +include "avfilter.pxd" diff --git a/include/libavcodec/bsf.pxd b/include/libavcodec/bsf.pxd deleted file mode 100644 index b4c41f7f4..000000000 --- a/include/libavcodec/bsf.pxd +++ /dev/null @@ -1,20 +0,0 @@ -cdef extern from "libavcodec/bsf.h" nogil: - cdef struct AVBitStreamFilter: - const char *name - AVCodecID *codec_ids - - cdef struct AVCodecParameters: - pass - - cdef struct AVBSFContext: - const AVBitStreamFilter *filter - const AVCodecParameters *par_in - const AVCodecParameters *par_out - - cdef int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf) - cdef int av_bsf_init(AVBSFContext *ctx) - cdef void av_bsf_free(AVBSFContext **ctx) - cdef AVBitStreamFilter* av_bsf_iterate(void **opaque) - cdef int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) - cdef int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt) - cdef void av_bsf_flush(AVBSFContext *ctx) diff --git a/include/libavcodec/hwaccel.pxd b/include/libavcodec/hwaccel.pxd deleted file mode 100644 index 2023efd64..000000000 --- a/include/libavcodec/hwaccel.pxd +++ /dev/null @@ -1,13 +0,0 @@ -cdef extern from "libavcodec/avcodec.h" nogil: - cdef enum: - AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX, - AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, - AV_CODEC_HW_CONFIG_METHOD_INTERNAL, - AV_CODEC_HW_CONFIG_METHOD_AD_HOC, - cdef struct AVCodecHWConfig: - AVPixelFormat pix_fmt - int methods - AVHWDeviceType device_type - cdef const AVCodecHWConfig* avcodec_get_hw_config(const AVCodec *codec, int index) - cdef struct AVHWAccel: - pass diff --git a/include/libavdevice/avdevice.pxd b/include/libavdevice/avdevice.pxd deleted file mode 100644 index 31c654b10..000000000 --- a/include/libavdevice/avdevice.pxd +++ /dev/null @@ -1,5 +0,0 @@ -cdef extern from "libavdevice/avdevice.h" nogil: - cdef int avdevice_version() - cdef char* avdevice_configuration() - cdef char* avdevice_license() - void avdevice_register_all() diff --git a/include/libavfilter/avfiltergraph.pxd b/include/libavfilter/avfiltergraph.pxd deleted file mode 100644 index f27dcbbcc..000000000 --- a/include/libavfilter/avfiltergraph.pxd +++ /dev/null @@ -1,37 +0,0 @@ -cdef extern from "libavfilter/avfilter.h" nogil: - cdef struct AVFilterGraph: - int nb_filters - AVFilterContext **filters - - cdef struct AVFilterInOut: - char *name - AVFilterContext *filter_ctx - int pad_idx - AVFilterInOut *next - - cdef AVFilterGraph* avfilter_graph_alloc() - cdef void avfilter_graph_free(AVFilterGraph **ptr) - - cdef AVFilterContext* avfilter_graph_alloc_filter( - AVFilterGraph *graph, - const AVFilter *filter, - const char *name - ) - - cdef int avfilter_graph_create_filter( - AVFilterContext **filt_ctx, - AVFilter *filt, - const char *name, - const char *args, - void *opaque, - AVFilterGraph *graph_ctx - ) - - cdef int avfilter_link( - AVFilterContext *src, - unsigned int srcpad, - AVFilterContext *dst, - unsigned int dstpad - ) - - cdef int avfilter_graph_config(AVFilterGraph *graph, void *logctx) diff --git a/include/libavfilter/buffersink.pxd b/include/libavfilter/buffersink.pxd deleted file mode 100644 index ef843cb7a..000000000 --- a/include/libavfilter/buffersink.pxd +++ /dev/null @@ -1,2 +0,0 @@ -cdef extern from "libavfilter/buffersink.h" nogil: - int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) diff --git a/include/libavfilter/buffersrc.pxd b/include/libavfilter/buffersrc.pxd deleted file mode 100644 index 1e0f70771..000000000 --- a/include/libavfilter/buffersrc.pxd +++ /dev/null @@ -1,2 +0,0 @@ -cdef extern from "libavfilter/buffersrc.h" nogil: - int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame) diff --git a/include/libswresample/swresample.pxd b/include/libswresample/swresample.pxd deleted file mode 100644 index 8e6f6649b..000000000 --- a/include/libswresample/swresample.pxd +++ /dev/null @@ -1,4 +0,0 @@ -cdef extern from "libswresample/swresample.h" nogil: - cdef int swresample_version() - cdef char* swresample_configuration() - cdef char* swresample_license() diff --git a/include/libswscale/swscale.pxd b/include/libswscale/swscale.pxd deleted file mode 100644 index ffc0eb6b0..000000000 --- a/include/libswscale/swscale.pxd +++ /dev/null @@ -1,78 +0,0 @@ -from libc.stdint cimport uint8_t - -cdef extern from "libswscale/swscale.h" nogil: - cdef int swscale_version() - cdef char* swscale_configuration() - cdef char* swscale_license() - - # See: http://ffmpeg.org/doxygen/trunk/structSwsContext.html - cdef struct SwsContext: - pass - - # See: http://ffmpeg.org/doxygen/trunk/structSwsFilter.html - cdef struct SwsFilter: - pass - - cdef int SWS_FAST_BILINEAR - cdef int SWS_BILINEAR - cdef int SWS_BICUBIC - cdef int SWS_X - cdef int SWS_POINT - cdef int SWS_AREA - cdef int SWS_BICUBLIN - cdef int SWS_GAUSS - cdef int SWS_SINC - cdef int SWS_LANCZOS - cdef int SWS_SPLINE - cdef int SWS_CS_ITU709 - cdef int SWS_CS_FCC - cdef int SWS_CS_ITU601 - cdef int SWS_CS_ITU624 - cdef int SWS_CS_SMPTE170M - cdef int SWS_CS_SMPTE240M - cdef int SWS_CS_DEFAULT - - cdef int sws_scale( - SwsContext *ctx, - const uint8_t *const *src_slice, - const int *src_stride, - int src_slice_y, - int src_slice_h, - unsigned char *const *dst_slice, - const int *dst_stride, - ) - cdef void sws_freeContext(SwsContext *ctx) - cdef SwsContext *sws_getCachedContext( - SwsContext *context, - int src_width, - int src_height, - AVPixelFormat src_format, - int dst_width, - int dst_height, - AVPixelFormat dst_format, - int flags, - SwsFilter *src_filter, - SwsFilter *dst_filter, - double *param, - ) - cdef const int* sws_getCoefficients(int colorspace) - cdef int sws_getColorspaceDetails( - SwsContext *context, - int **inv_table, - int *srcRange, - int **table, - int *dstRange, - int *brightness, - int *contrast, - int *saturation - ) - cdef int sws_setColorspaceDetails( - SwsContext *context, - const int inv_table[4], - int srcRange, - const int table[4], - int dstRange, - int brightness, - int contrast, - int saturation - )