diff --git a/av/error.pyx b/av/error.pyx index cde4fec7f..e6257731e 100644 --- a/av/error.pyx +++ b/av/error.pyx @@ -200,23 +200,20 @@ for enum in ErrorType: # Mimick the builtin exception types. # See https://www.python.org/dev/peps/pep-3151/#new-exception-classes # Use the named ones we have, otherwise default to OSError for anything in errno. -r''' -See this command for the count of POSIX codes used: - - egrep -IR 'AVERROR\(E[A-Z]+\)' vendor/ffmpeg-4.2 |\ - sed -E 's/.*AVERROR\((E[A-Z]+)\).*/\1/' | \ - sort | uniq -c - -The biggest ones that don't map to PEP 3151 builtins: - - 2106 EINVAL -> ValueError - 649 EIO -> IOError (if it is distinct from OSError) - 4080 ENOMEM -> MemoryError - 340 ENOSYS -> NotImplementedError - 35 ERANGE -> OverflowError - -''' +# See this command for the count of POSIX codes used: +# +# egrep -IR 'AVERROR\(E[A-Z]+\)' vendor/ffmpeg-4.2 |\ +# sed -E 's/.*AVERROR\((E[A-Z]+)\).*/\1/' | \ +# sort | uniq -c +# +# The biggest ones that don't map to PEP 3151 builtins: +# +# 2106 EINVAL -> ValueError +# 649 EIO -> IOError (if it is distinct from OSError) +# 4080 ENOMEM -> MemoryError +# 340 ENOSYS -> NotImplementedError +# 35 ERANGE -> OverflowError classes = {} diff --git a/include/libavcodec/avcodec.pxd b/include/libavcodec/avcodec.pxd index 11d968b1a..e11e9c115 100644 --- a/include/libavcodec/avcodec.pxd +++ b/include/libavcodec/avcodec.pxd @@ -30,7 +30,7 @@ cdef extern from "libavcodec/avcodec.h" nogil: AV_CODEC_PROP_BITMAP_SUB AV_CODEC_PROP_TEXT_SUB - #AVCodec.capabilities + # AVCodec.capabilities cdef enum: AV_CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DR1 @@ -131,7 +131,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: AVClass *priv_class - cdef int av_codec_is_encoder(AVCodec*) cdef int av_codec_is_decoder(AVCodec*) @@ -144,7 +143,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: AVCodecDescriptor* avcodec_descriptor_get(AVCodecID) - cdef struct AVCodecContext: AVClass *av_class @@ -203,7 +201,7 @@ cdef extern from "libavcodec/avcodec.h" nogil: AVPixelFormat pix_fmt AVRational sample_aspect_ratio - int gop_size # The number of pictures in a group of pictures, or 0 for intra_only. + int gop_size # The number of pictures in a group of pictures, or 0 for intra_only. int max_b_frames int has_b_frames @@ -288,15 +286,15 @@ cdef extern from "libavcodec/avcodec.h" nogil: # See: http://ffmpeg.org/doxygen/trunk/structAVFrame.html cdef struct AVFrame: - uint8_t *data[4]; - int linesize[4]; + uint8_t *data[4] + int linesize[4] uint8_t **extended_data - int format # Should be AVPixelFormat or AVSampleFormat - int key_frame # 0 or 1. + int format # Should be AVPixelFormat or AVSampleFormat + int key_frame # 0 or 1. AVPictureType pict_type - int interlaced_frame # 0 or 1. + int interlaced_frame # 0 or 1. int width int height @@ -304,10 +302,10 @@ cdef extern from "libavcodec/avcodec.h" nogil: int nb_side_data AVFrameSideData **side_data - int nb_samples # Audio samples - int sample_rate # Audio Sample rate - int channels # Number of audio channels - int channel_layout # Audio channel_layout + int nb_samples # Audio samples + int sample_rate # Audio Sample rate + int channels # Number of audio channels + int channel_layout # Audio channel_layout int64_t pts int64_t pkt_dts @@ -320,7 +318,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: int flags int decode_error_flags - cdef AVFrame* avcodec_alloc_frame() cdef struct AVPacket: @@ -337,7 +334,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: int64_t pos - cdef int avcodec_fill_audio_frame( AVFrame *frame, int nb_channels, @@ -367,8 +363,8 @@ cdef extern from "libavcodec/avcodec.h" nogil: int w int h int nb_colors - uint8_t *data[4]; - int linesize[4]; + uint8_t *data[4] + int linesize[4] AVSubtitleType type char *text char *ass @@ -402,7 +398,7 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef void avcodec_flush_buffers(AVCodecContext *ctx) - # TODO: avcodec_default_get_buffer is deprecated for avcodec_default_get_buffer2 in newer versions of FFmpeg + # TODO: avcodec_default_get_buffer is deprecated for avcodec_default_get_buffer2 in newer versions of FFmpeg cdef int avcodec_default_get_buffer(AVCodecContext *ctx, AVFrame *frame) cdef void avcodec_default_release_buffer(AVCodecContext *ctx, AVFrame *frame) @@ -440,7 +436,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: ) cdef void av_parser_close(AVCodecParserContext *s) - cdef struct AVCodecParameters: AVMediaType codec_type AVCodecID codec_id diff --git a/include/libavfilter/avfilter.pxd b/include/libavfilter/avfilter.pxd index e1fd42f45..dd3e91ddf 100644 --- a/include/libavfilter/avfilter.pxd +++ b/include/libavfilter/avfilter.pxd @@ -45,7 +45,7 @@ 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 AVFilterLink # Defined later. cdef struct AVFilterContext: diff --git a/include/libavfilter/avfiltergraph.pxd b/include/libavfilter/avfiltergraph.pxd index db9717a50..b773063f9 100644 --- a/include/libavfilter/avfiltergraph.pxd +++ b/include/libavfilter/avfiltergraph.pxd @@ -11,7 +11,6 @@ cdef extern from "libavfilter/avfilter.h" nogil: int pad_idx AVFilterInOut *next - cdef AVFilterGraph* avfilter_graph_alloc() cdef void avfilter_graph_free(AVFilterGraph **ptr) diff --git a/include/libavformat/avformat.pxd b/include/libavformat/avformat.pxd index 06029d9f9..a4d5991d8 100644 --- a/include/libavformat/avformat.pxd +++ b/include/libavformat/avformat.pxd @@ -16,7 +16,6 @@ cdef extern from "libavformat/avformat.h" nogil: cdef int AVSEEK_FLAG_ANY cdef int AVSEEK_FLAG_FRAME - cdef int AVIO_FLAG_WRITE cdef enum AVMediaType: @@ -207,10 +206,10 @@ cdef extern from "libavformat/avformat.h" nogil: # .. seealso:: FFmpeg's docs: :ffmpeg:`avformat_open_input` # cdef int avformat_open_input( - AVFormatContext **ctx, # NULL will allocate for you. + AVFormatContext **ctx, # NULL will allocate for you. char *filename, - AVInputFormat *format, # Can be NULL. - AVDictionary **options # Can be NULL. + AVInputFormat *format, # Can be NULL. + AVDictionary **options # Can be NULL. ) cdef int avformat_close_input(AVFormatContext **ctx) @@ -224,7 +223,7 @@ cdef extern from "libavformat/avformat.h" nogil: # cdef int avformat_write_header( AVFormatContext *ctx, - AVDictionary **options # Can be NULL + AVDictionary **options # Can be NULL ) cdef int av_write_trailer(AVFormatContext *ctx) @@ -269,7 +268,7 @@ cdef extern from "libavformat/avformat.h" nogil: cdef int avformat_find_stream_info( AVFormatContext *ctx, - AVDictionary **options, # Can be NULL. + AVDictionary **options, # Can be NULL. ) cdef AVStream* avformat_new_stream( diff --git a/include/libavutil/avutil.pxd b/include/libavutil/avutil.pxd index 50e6bfffd..d93016d3b 100644 --- a/include/libavutil/avutil.pxd +++ b/include/libavutil/avutil.pxd @@ -39,7 +39,6 @@ cdef extern from "libavutil/avutil.h" nogil: # This is nice, but only in FFMpeg: # AV_ROUND_PASS_MINMAX - cdef double M_PI cdef void* av_malloc(size_t size) @@ -67,9 +66,9 @@ cdef extern from "libavutil/avutil.h" nogil: # Rescales from one time base to another cdef int64_t av_rescale_q( - int64_t a, # time stamp - AVRational bq, # source time base - AVRational cq # target time base + int64_t a, # time stamp + AVRational bq, # source time base + AVRational cq # target time base ) # Rescale a 64-bit integer with specified rounding. @@ -78,14 +77,14 @@ cdef extern from "libavutil/avutil.h" nogil: int64_t a, int64_t b, int64_t c, - int r # should be AVRounding, but then we can't use bitwise logic. + int r # should be AVRounding, but then we can't use bitwise logic. ) cdef int64_t av_rescale_q_rnd( int64_t a, AVRational bq, AVRational cq, - int r # should be AVRounding, but then we can't use bitwise logic. + int r # should be AVRounding, but then we can't use bitwise logic. ) cdef int64_t av_rescale( @@ -146,7 +145,6 @@ cdef extern from "libavutil/pixdesc.h" nogil: int av_get_padded_bits_per_pixel(AVPixFmtDescriptor *pixdesc) - cdef extern from "libavutil/channel_layout.h" nogil: # Layouts. @@ -166,8 +164,6 @@ cdef extern from "libavutil/channel_layout.h" nogil: cdef char* av_get_channel_description(uint64_t channel) - - cdef extern from "libavutil/audio_fifo.h" nogil: cdef struct AVAudioFifo: diff --git a/include/libavutil/error.pxd b/include/libavutil/error.pxd index 8919c54b7..2122772e3 100644 --- a/include/libavutil/error.pxd +++ b/include/libavutil/error.pxd @@ -4,7 +4,6 @@ cdef extern from "libavutil/error.h" nogil: cdef int ENOMEM cdef int EAGAIN - cdef int AVERROR_BSF_NOT_FOUND cdef int AVERROR_BUG cdef int AVERROR_BUFFER_TOO_SMALL diff --git a/include/libavutil/samplefmt.pxd b/include/libavutil/samplefmt.pxd index 867367ee1..a26c6ecfd 100644 --- a/include/libavutil/samplefmt.pxd +++ b/include/libavutil/samplefmt.pxd @@ -12,7 +12,7 @@ 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 # Number. # Find by name. cdef AVSampleFormat av_get_sample_fmt(char* name) @@ -43,7 +43,6 @@ cdef extern from "libavutil/samplefmt.h" nogil: int align ) - cdef int av_samples_fill_arrays( uint8_t **audio_data, int *linesize, diff --git a/include/libswresample/swresample.pxd b/include/libswresample/swresample.pxd index d76b777a3..65b8314df 100644 --- a/include/libswresample/swresample.pxd +++ b/include/libswresample/swresample.pxd @@ -7,7 +7,6 @@ cdef extern from "libswresample/swresample.h" nogil: cdef char* swresample_configuration() cdef char* swresample_license() - cdef struct SwrContext: pass @@ -20,7 +19,7 @@ cdef extern from "libswresample/swresample.h" nogil: AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, - void *log_ctx #logging context, can be NULL + void *log_ctx # logging context, can be NULL ) cdef int swr_convert(