Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions av/logging.pxd
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
cdef extern from "Python.h" nogil:
void PyErr_PrintEx(int set_sys_last_vars)
int Py_IsInitialized()
void PyErr_Display(object, object, object)

cpdef get_last_error()
6 changes: 3 additions & 3 deletions av/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def log_callback(
format: cython.p_const_char,
args: lib.va_list,
) -> cython.void:
inited: cython.bint = lib.Py_IsInitialized()
inited: cython.bint = Py_IsInitialized()
if not inited:
return

Expand Down Expand Up @@ -361,9 +361,9 @@ def log_callback(
level,
message,
)
# For some reason lib.PyErr_PrintEx(0) won't work.
# For some reason PyErr_PrintEx(0) won't work.
exc, type_, tb = sys.exc_info()
lib.PyErr_Display(exc, type_, tb)
PyErr_Display(exc, type_, tb)


@cython.cfunc
Expand Down
28 changes: 4 additions & 24 deletions include/libavcodec/bsf.pxd
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

cdef extern from "libavcodec/bsf.h" nogil:

cdef struct AVBitStreamFilter:
const char *name
AVCodecID *codec_ids
Expand All @@ -13,28 +11,10 @@ cdef extern from "libavcodec/bsf.h" nogil:
const AVCodecParameters *par_in
const AVCodecParameters *par_out

cdef const AVBitStreamFilter* av_bsf_get_by_name(const char *name)

cdef int av_bsf_list_parse_str(
const char *str,
AVBSFContext **bsf
)

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 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)
54 changes: 2 additions & 52 deletions include/libavutil/avutil.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from libc.stdint cimport int64_t, uint8_t, uint64_t, int32_t


cdef extern from "libavutil/mathematics.h" nogil:
pass

cdef extern from "libavutil/display.h" nogil:
cdef double av_display_rotation_get(const int32_t matrix[9])

Expand All @@ -12,7 +9,7 @@ cdef extern from "libavutil/rational.h" nogil:

cdef extern from "libavutil/avutil.h" nogil:
cdef const char* av_version_info()
cdef int avutil_version()
cdef int avutil_version()
cdef char* avutil_configuration()
cdef char* avutil_license()

Expand All @@ -34,15 +31,6 @@ cdef extern from "libavutil/avutil.h" nogil:
PIX_FMT_RGB24
PIX_FMT_RGBA

cdef enum AVRounding:
AV_ROUND_ZERO
AV_ROUND_INF
AV_ROUND_DOWN
AV_ROUND_UP
AV_ROUND_NEAR_INF
# This is nice, but only in FFMpeg:
# AV_ROUND_PASS_MINMAX

cdef enum AVColorSpace:
AVCOL_SPC_RGB
AVCOL_SPC_BT709
Expand Down Expand Up @@ -83,37 +71,14 @@ cdef extern from "libavutil/avutil.h" nogil:
AVCOL_PRI_NB

cdef enum AVColorTransferCharacteristic:
AVCOL_TRC_RESERVED0
AVCOL_TRC_BT709
AVCOL_TRC_UNSPECIFIED
AVCOL_TRC_RESERVED
AVCOL_TRC_GAMMA22
AVCOL_TRC_GAMMA28
AVCOL_TRC_SMPTE170M
AVCOL_TRC_SMPTE240M
AVCOL_TRC_LINEAR
AVCOL_TRC_LOG
AVCOL_TRC_LOG_SQRT
AVCOL_TRC_IEC61966_2_4
AVCOL_TRC_BT1361_ECG
AVCOL_TRC_IEC61966_2_1
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_NB
pass

cdef void* av_malloc(size_t size)
cdef void* av_mallocz(size_t size)
cdef void* av_realloc(void *ptr, size_t size)
cdef void av_free(void *ptr)
cdef void av_freep(void *ptr)

cdef int av_get_bytes_per_sample(AVSampleFormat sample_fmt)

cdef int av_samples_get_buffer_size(
int *linesize,
int nb_channels,
Expand All @@ -124,7 +89,6 @@ cdef extern from "libavutil/avutil.h" nogil:
ctypedef struct AVRational:
int num
int den
cdef AVRational AV_TIME_BASE_Q
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)
Expand All @@ -142,13 +106,9 @@ cdef extern from "libavutil/pixdesc.h" nogil:
AV_PIX_FMT_FLAG_BE
AV_PIX_FMT_FLAG_PAL
AV_PIX_FMT_FLAG_BITSTREAM
AV_PIX_FMT_FLAG_HWACCEL
AV_PIX_FMT_FLAG_PLANAR
AV_PIX_FMT_FLAG_RGB
AV_PIX_FMT_FLAG_PSEUDOPAL
AV_PIX_FMT_FLAG_ALPHA
AV_PIX_FMT_FLAG_BAYER
AV_PIX_FMT_FLAG_FLOAT

# See: http://ffmpeg.org/doxygen/trunk/structAVPixFmtDescriptor.html
cdef struct AVPixFmtDescriptor:
Expand All @@ -161,10 +121,8 @@ cdef extern from "libavutil/pixdesc.h" nogil:

cdef AVPixFmtDescriptor* av_pix_fmt_desc_get(AVPixelFormat pix_fmt)
cdef AVPixFmtDescriptor* av_pix_fmt_desc_next(AVPixFmtDescriptor *prev)

cdef char * av_get_pix_fmt_name(AVPixelFormat pix_fmt)
cdef AVPixelFormat av_get_pix_fmt(char* name)

int av_get_bits_per_pixel(AVPixFmtDescriptor *pixdesc)
int av_get_padded_bits_per_pixel(AVPixFmtDescriptor *pixdesc)

Expand All @@ -186,14 +144,6 @@ cdef extern from "stdarg.h" nogil:
ctypedef struct va_list:
pass


cdef extern from "Python.h" nogil:
cdef int Py_AddPendingCall(void *, void *)
void PyErr_PrintEx(int set_sys_last_vars)
int Py_IsInitialized()
void PyErr_Display(object, object, object)


cdef extern from "libavutil/opt.h" nogil:
cdef enum AVOptionType:
AV_OPT_TYPE_FLAGS
Expand Down
30 changes: 5 additions & 25 deletions include/libavutil/dict.pxd
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
cdef extern from "libavutil/dict.h" nogil:

# See: http://ffmpeg.org/doxygen/trunk/structAVDictionary.html
ctypedef struct AVDictionary:
pass

cdef void av_dict_free(AVDictionary **)

# See: http://ffmpeg.org/doxygen/trunk/structAVDictionaryEntry.html
ctypedef struct AVDictionaryEntry:
char *key
char *value

cdef int AV_DICT_IGNORE_SUFFIX

cdef void av_dict_free(AVDictionary **)
cdef AVDictionaryEntry* av_dict_get(
AVDictionary *dict,
char *key,
AVDictionaryEntry *prev,
int flags,
AVDictionary *dict, char *key, AVDictionaryEntry *prev, int flags
)

cdef int av_dict_set(
AVDictionary **pm,
const char *key,
const char *value,
int flags
)

cdef int av_dict_count(
AVDictionary *m
)

cdef int av_dict_copy(
AVDictionary **dst,
AVDictionary *src,
int flags
AVDictionary **pm, const char *key, const char *value, int flags
)
cdef int av_dict_count(AVDictionary *m)
cdef int av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
13 changes: 0 additions & 13 deletions include/libavutil/error.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
cdef extern from "libavutil/error.h" nogil:

# Not actually from here, but whatever.
cdef int ENOMEM
cdef int EAGAIN

cdef int AVERROR_BSF_NOT_FOUND
cdef int AVERROR_BUG
cdef int AVERROR_BUFFER_TOO_SMALL
Expand All @@ -23,21 +18,13 @@ cdef extern from "libavutil/error.h" nogil:
cdef int AVERROR_EXPERIMENTAL
cdef int AVERROR_INPUT_CHANGED
cdef int AVERROR_OUTPUT_CHANGED

cdef int AVERROR_HTTP_BAD_REQUEST
cdef int AVERROR_HTTP_UNAUTHORIZED
cdef int AVERROR_HTTP_FORBIDDEN
cdef int AVERROR_HTTP_NOT_FOUND
cdef int AVERROR_HTTP_OTHER_4XX
cdef int AVERROR_HTTP_SERVER_ERROR

cdef int AVERROR_NOMEM "AVERROR(ENOMEM)"

# cdef int FFERRTAG(int, int, int, int)

cdef int AVERROR(int error)

cdef int AV_ERROR_MAX_STRING_SIZE

cdef int av_strerror(int errno, char *output, size_t output_size)
cdef char* av_err2str(int errnum)
1 change: 0 additions & 1 deletion include/libavutil/hwcontext.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cdef extern from "libavutil/hwcontext.h" nogil:

enum AVHWDeviceType:
AV_HWDEVICE_TYPE_NONE
AV_HWDEVICE_TYPE_VDPAU
Expand Down
1 change: 0 additions & 1 deletion include/libavutil/motion_vector.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ from libc.stdint cimport int16_t, int32_t, uint8_t, uint16_t, uint64_t


cdef extern from "libavutil/motion_vector.h" nogil:

cdef struct AVMotionVector:
int32_t source
uint8_t w
Expand Down
15 changes: 4 additions & 11 deletions include/libavutil/samplefmt.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cdef extern from "libavutil/samplefmt.h" nogil:

cdef enum AVSampleFormat:
AV_SAMPLE_FMT_NONE
AV_SAMPLE_FMT_U8
Expand All @@ -12,20 +11,14 @@ cdef extern from "libavutil/samplefmt.h" nogil:
AV_SAMPLE_FMT_S32P
AV_SAMPLE_FMT_FLTP
AV_SAMPLE_FMT_DBLP
AV_SAMPLE_FMT_NB # Number.
AV_SAMPLE_FMT_NB

# Find by name.
cdef AVSampleFormat av_get_sample_fmt(char* name)

# Inspection.
cdef char * av_get_sample_fmt_name(AVSampleFormat sample_fmt)
cdef int av_get_bytes_per_sample(AVSampleFormat sample_fmt)
cdef int av_sample_fmt_is_planar(AVSampleFormat sample_fmt)

# Alternative forms.
cdef char *av_get_sample_fmt_name(AVSampleFormat sample_fmt)
cdef int av_get_bytes_per_sample(AVSampleFormat sample_fmt)
cdef int av_sample_fmt_is_planar(AVSampleFormat sample_fmt)
cdef AVSampleFormat av_get_packed_sample_fmt(AVSampleFormat sample_fmt)
cdef AVSampleFormat av_get_planar_sample_fmt(AVSampleFormat sample_fmt)

cdef int av_samples_get_buffer_size(
int *linesize,
int nb_channels,
Expand Down
Loading