diff --git a/include/libav.pxd b/include/libav.pxd index 15e086f93..a66626c3d 100644 --- a/include/libav.pxd +++ b/include/libav.pxd @@ -1,13 +1,4 @@ include "libavutil/avutil.pxd" -include "libavutil/buffer.pxd" -include "libavutil/dict.pxd" -include "libavutil/error.pxd" -include "libavutil/frame.pxd" -include "libavutil/hwcontext.pxd" -include "libavutil/samplefmt.pxd" -include "libavutil/motion_vector.pxd" -include "libavutil/video_enc_params.pxd" - include "libavcodec/avcodec.pxd" include "libavcodec/bsf.pxd" include "libavcodec/hwaccel.pxd" diff --git a/include/libavcodec/avcodec.pxd b/include/libavcodec/avcodec.pxd index d74906b98..b75769945 100644 --- a/include/libavcodec/avcodec.pxd +++ b/include/libavcodec/avcodec.pxd @@ -1,31 +1,25 @@ from libc.stdint cimport int64_t, uint16_t, uint32_t, uint8_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 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": ctypedef enum AVChannelOrder: - AV_CHANNEL_ORDER_UNSPEC - AV_CHANNEL_ORDER_NATIVE - AV_CHANNEL_ORDER_CUSTOM - AV_CHANNEL_ORDER_AMBISONIC - + pass ctypedef enum AVChannel: AV_CHAN_NONE = -1 AV_CHAN_FRONT_LEFT AV_CHAN_FRONT_RIGHT AV_CHAN_FRONT_CENTER - ctypedef struct AVChannelLayout: AVChannelOrder order int nb_channels @@ -36,10 +30,7 @@ cdef extern from "libavutil/channel_layout.h": void *opaque int av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels) - int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask) int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str) - void av_channel_layout_uninit(AVChannelLayout *channel_layout) - int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src) int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size) int av_channel_name(char *buf, size_t buf_size, AVChannel channel_id) int av_channel_description(char *buf, size_t buf_size, AVChannel channel_id) @@ -48,8 +39,7 @@ cdef extern from "libavutil/channel_layout.h": cdef extern from "libavcodec/avcodec.h" nogil: cdef set pyav_get_available_codecs() - - cdef int avcodec_version() + cdef int avcodec_version() cdef char* avcodec_configuration() cdef char* avcodec_license() @@ -293,72 +283,24 @@ cdef extern from "libavcodec/avcodec.h" nogil: int subtitle_header_size uint8_t *subtitle_header - cdef AVCodecContext* avcodec_alloc_context3(AVCodec *codec) cdef void avcodec_free_context(AVCodecContext **ctx) - cdef AVClass* avcodec_get_class() - cdef AVCodec* avcodec_find_decoder(AVCodecID id) cdef AVCodec* avcodec_find_encoder(AVCodecID id) - cdef AVCodec* avcodec_find_decoder_by_name(char *name) cdef AVCodec* avcodec_find_encoder_by_name(char *name) - cdef const AVCodec* av_codec_iterate(void **opaque) - - cdef AVCodecDescriptor* avcodec_descriptor_get (AVCodecID id) - cdef AVCodecDescriptor* avcodec_descriptor_get_by_name (char *name) - + cdef AVCodecDescriptor* avcodec_descriptor_get(AVCodecID id) + cdef AVCodecDescriptor* avcodec_descriptor_get_by_name(char *name) cdef char* avcodec_get_name(AVCodecID id) - - cdef int avcodec_open2( - AVCodecContext *ctx, - AVCodec *codec, - AVDictionary **options, - ) - - cdef int AV_NUM_DATA_POINTERS - + cdef int avcodec_open2(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options) cdef enum AVPacketSideDataType: - AV_PKT_DATA_PALETTE - AV_PKT_DATA_NEW_EXTRADATA - AV_PKT_DATA_PARAM_CHANGE - AV_PKT_DATA_H263_MB_INFO - AV_PKT_DATA_REPLAYGAIN - AV_PKT_DATA_DISPLAYMATRIX - AV_PKT_DATA_STEREO3D - AV_PKT_DATA_AUDIO_SERVICE_TYPE - AV_PKT_DATA_QUALITY_STATS - AV_PKT_DATA_FALLBACK_TRACK - AV_PKT_DATA_CPB_PROPERTIES - AV_PKT_DATA_SKIP_SAMPLES - AV_PKT_DATA_JP_DUALMONO - AV_PKT_DATA_STRINGS_METADATA - AV_PKT_DATA_SUBTITLE_POSITION - AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL - AV_PKT_DATA_WEBVTT_IDENTIFIER - AV_PKT_DATA_WEBVTT_SETTINGS - AV_PKT_DATA_METADATA_UPDATE - AV_PKT_DATA_MPEGTS_STREAM_ID - AV_PKT_DATA_MASTERING_DISPLAY_METADATA - AV_PKT_DATA_SPHERICAL - AV_PKT_DATA_CONTENT_LIGHT_LEVEL - AV_PKT_DATA_A53_CC - AV_PKT_DATA_ENCRYPTION_INIT_INFO - AV_PKT_DATA_ENCRYPTION_INFO - AV_PKT_DATA_AFD - AV_PKT_DATA_PRFT - AV_PKT_DATA_ICC_PROFILE - AV_PKT_DATA_DOVI_CONF - AV_PKT_DATA_S12M_TIMECODE - AV_PKT_DATA_DYNAMIC_HDR10_PLUS - AV_PKT_DATA_NB - + pass cdef struct AVPacketSideData: - uint8_t *data; - size_t size; - AVPacketSideDataType type; + uint8_t *data + size_t size + AVPacketSideDataType type cdef enum AVFrameSideDataType: AV_FRAME_DATA_PANSCAN @@ -427,7 +369,7 @@ cdef extern from "libavcodec/avcodec.h" nogil: int64_t duration cdef struct AVPacket: - void *buf # ptr[AVBufferRef] + void *buf int64_t pts int64_t dts uint8_t *data @@ -450,7 +392,6 @@ cdef extern from "libavcodec/avcodec.h" nogil: int buf_size, int align ) - cdef AVPacket* av_packet_alloc() cdef void av_packet_free(AVPacket **) cdef int av_new_packet(AVPacket*, int) @@ -485,30 +426,18 @@ cdef extern from "libavcodec/avcodec.h" nogil: int64_t pts cdef int avcodec_decode_subtitle2( - AVCodecContext *ctx, - AVSubtitle *sub, - int *done, - AVPacket *pkt, + AVCodecContext *ctx, AVSubtitle *sub, int *done, AVPacket *pkt, ) - cdef int avcodec_encode_subtitle( - AVCodecContext *avctx, - uint8_t *buf, - int buf_size, - AVSubtitle *sub + AVCodecContext *avctx, uint8_t *buf, int buf_size, AVSubtitle *sub ) - cdef void avsubtitle_free(AVSubtitle*) cdef void avcodec_flush_buffers(AVCodecContext *ctx) - - # === New-style Transcoding cdef int avcodec_send_packet(AVCodecContext *avctx, AVPacket *packet) cdef int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) cdef int avcodec_send_frame(AVCodecContext *avctx, AVFrame *frame) cdef int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) - # === Parsers - cdef struct AVCodecParser: int codec_ids[5] @@ -529,20 +458,15 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef struct AVCodecParameters: AVMediaType codec_type AVCodecID codec_id - AVPacketSideData *coded_side_data - int nb_coded_side_data uint8_t *extradata int extradata_size cdef int avcodec_parameters_copy( - AVCodecParameters *dst, - const AVCodecParameters *src + AVCodecParameters *dst, const AVCodecParameters *src ) cdef int avcodec_parameters_from_context( - AVCodecParameters *par, - const AVCodecContext *codec, + AVCodecParameters *par, const AVCodecContext *codec ) cdef int avcodec_parameters_to_context( - AVCodecContext *codec, - const AVCodecParameters *par + AVCodecContext *codec, const AVCodecParameters *par ) diff --git a/include/libavfilter/avfilter.pxd b/include/libavfilter/avfilter.pxd index 8d4c05f6f..db67507b4 100644 --- a/include/libavfilter/avfilter.pxd +++ b/include/libavfilter/avfilter.pxd @@ -1,10 +1,9 @@ cdef extern from "libavfilter/avfilter.h" nogil: - cdef int avfilter_version() + cdef int avfilter_version() cdef char* avfilter_configuration() cdef char* avfilter_license() cdef struct AVFilterPad: - # This struct is opaque. pass const char* avfilter_pad_get_name(const AVFilterPad *pads, int index) diff --git a/include/libavfilter/buffersrc.pxd b/include/libavfilter/buffersrc.pxd index db057662a..1e0f70771 100644 --- a/include/libavfilter/buffersrc.pxd +++ b/include/libavfilter/buffersrc.pxd @@ -1,6 +1,2 @@ cdef extern from "libavfilter/buffersrc.h" nogil: - - int av_buffersrc_write_frame( - AVFilterContext *ctx, - const AVFrame *frame - ) + int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame) diff --git a/include/libavformat/avformat.pxd b/include/libavformat/avformat.pxd index 1fda271f8..89e63af2f 100644 --- a/include/libavformat/avformat.pxd +++ b/include/libavformat/avformat.pxd @@ -2,19 +2,15 @@ from libc.stdint cimport int64_t, uint64_t cdef extern from "libavformat/avformat.h" nogil: - - cdef int avformat_version() + cdef int avformat_version() cdef char* avformat_configuration() cdef char* avformat_license() - cdef int64_t INT64_MIN - cdef int AV_TIME_BASE cdef int AVSEEK_FLAG_BACKWARD cdef int AVSEEK_FLAG_BYTE cdef int AVSEEK_FLAG_ANY cdef int AVSEEK_FLAG_FRAME - cdef int AVIO_FLAG_WRITE cdef enum AVMediaType: @@ -24,16 +20,13 @@ cdef extern from "libavformat/avformat.h" nogil: AVMEDIA_TYPE_DATA AVMEDIA_TYPE_SUBTITLE AVMEDIA_TYPE_ATTACHMENT - AVMEDIA_TYPE_NB cdef struct AVStream: int index int id int disposition - AVCodecParameters *codecpar AVRational time_base - int64_t start_time int64_t duration int64_t nb_frames @@ -50,7 +43,6 @@ cdef extern from "libavformat/avformat.h" nogil: AVRational time_base AVDictionary *metadata - # http://ffmpeg.org/doxygen/trunk/structAVIOContext.html cdef struct AVIOContext: unsigned char* buffer @@ -66,12 +58,7 @@ cdef extern from "libavformat/avformat.h" nogil: int (*callback)(void*) void *opaque - cdef int AVIO_FLAG_DIRECT cdef int AVIO_SEEKABLE_NORMAL - - cdef int SEEK_SET - cdef int SEEK_CUR - cdef int SEEK_END cdef int AVSEEK_SIZE cdef AVIOContext* avio_alloc_context( @@ -90,7 +77,6 @@ cdef extern from "libavformat/avformat.h" nogil: const char *long_name const char *extensions int flags - # const AVCodecTag* const *codec_tag const AVClass *priv_class # http://ffmpeg.org/doxygen/trunk/structAVOutputFormat.html @@ -102,7 +88,6 @@ cdef extern from "libavformat/avformat.h" nogil: AVCodecID audio_codec AVCodecID subtitle_codec int flags - # const AVCodecTag* const *codec_tag const AVClass *priv_class int avformat_query_codec(const AVOutputFormat *oformat, AVCodecID codec_id, int std_compliance) @@ -156,33 +141,22 @@ cdef extern from "libavformat/avformat.h" nogil: # http://ffmpeg.org/doxygen/trunk/structAVFormatContext.html cdef struct AVFormatContext: - - # Streams. unsigned int nb_streams AVStream **streams - unsigned int nb_chapters AVChapter **chapters - AVInputFormat *iformat AVOutputFormat *oformat - AVIOContext *pb AVIOInterruptCB interrupt_callback - AVDictionary *metadata - char filename int64_t start_time int64_t duration int bit_rate - int flags - int64_t max_analyze_duration - AVCodecID audio_codec_id void *opaque - int (*io_open)( AVFormatContext *s, AVIOContext **pb, @@ -190,120 +164,47 @@ cdef extern from "libavformat/avformat.h" nogil: int flags, AVDictionary **options ) - int (*io_close2)( - AVFormatContext *s, - AVIOContext *pb - ) + int (*io_close2)(AVFormatContext *s, AVIOContext *pb) cdef AVFormatContext* avformat_alloc_context() - - # .. c:function:: avformat_open_input(...) - # - # Options are passed via :func:`av.open`. - # - # .. seealso:: FFmpeg's docs: :ffmpeg:`avformat_open_input` - # cdef int avformat_open_input( - AVFormatContext **ctx, # NULL will allocate for you. + AVFormatContext **ctx, char *filename, - AVInputFormat *format, # Can be NULL. - AVDictionary **options # Can be NULL. + AVInputFormat *format, + AVDictionary **options ) cdef int avformat_close_input(AVFormatContext **ctx) - - # .. c:function:: avformat_write_header(...) - # - # Options are passed via :func:`av.open`; called in - # :meth:`av.container.OutputContainer.start_encoding`. - # - # .. seealso:: FFmpeg's docs: :ffmpeg:`avformat_write_header` - # - cdef int avformat_write_header( - AVFormatContext *ctx, - AVDictionary **options # Can be NULL - ) - + cdef int avformat_write_header(AVFormatContext *ctx, AVDictionary **options) cdef int av_write_trailer(AVFormatContext *ctx) - - cdef int av_interleaved_write_frame( - AVFormatContext *ctx, - AVPacket *pkt - ) - - cdef int av_write_frame( - AVFormatContext *ctx, - AVPacket *pkt - ) - - cdef int avio_open( - AVIOContext **s, - char *url, - int flags - ) - - cdef int64_t avio_size( - AVIOContext *s - ) - + cdef int av_interleaved_write_frame(AVFormatContext *ctx, AVPacket *pkt) + cdef int av_write_frame(AVFormatContext *ctx, AVPacket *pkt) + cdef int avio_open(AVIOContext **s, char *url, int flags) + cdef int64_t avio_size(AVIOContext *s) cdef AVOutputFormat* av_guess_format( - char *short_name, - char *filename, - char *mime_type + char *short_name, char *filename, char *mime_type ) - cdef int avformat_query_codec( - AVOutputFormat *ofmt, - AVCodecID codec_id, - int std_compliance + AVOutputFormat *ofmt, AVCodecID codec_id, int std_compliance ) - cdef void avio_flush(AVIOContext *s) - cdef int avio_close(AVIOContext *s) - cdef int avio_closep(AVIOContext **s) - - cdef int avformat_find_stream_info( - AVFormatContext *ctx, - AVDictionary **options, # Can be NULL. - ) - - cdef AVStream* avformat_new_stream( - AVFormatContext *ctx, - AVCodec *c - ) - + cdef int avformat_find_stream_info(AVFormatContext *ctx, AVDictionary **options) + cdef AVStream* avformat_new_stream(AVFormatContext *ctx, AVCodec *c) cdef int avformat_alloc_output_context2( AVFormatContext **ctx, AVOutputFormat *oformat, char *format_name, char *filename ) - cdef int avformat_free_context(AVFormatContext *ctx) - cdef AVClass* avformat_get_class() - - cdef void av_dump_format( - AVFormatContext *ctx, - int index, - char *url, - int is_output, - ) - - cdef int av_read_frame( - AVFormatContext *ctx, - AVPacket *packet, - ) - + cdef void av_dump_format(AVFormatContext *ctx, int index, char *url, int is_output) + cdef int av_read_frame(AVFormatContext *ctx, AVPacket *packet) cdef int av_seek_frame( - AVFormatContext *ctx, - int stream_index, - int64_t timestamp, - int flags + AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags ) - cdef int avformat_seek_file( AVFormatContext *ctx, int stream_index, @@ -312,24 +213,15 @@ cdef extern from "libavformat/avformat.h" nogil: int64_t max_ts, int flags ) - cdef AVRational av_guess_frame_rate( - AVFormatContext *ctx, - AVStream *stream, - AVFrame *frame + AVFormatContext *ctx, AVStream *stream, AVFrame *frame ) - cdef AVRational av_guess_sample_aspect_ratio( - AVFormatContext *ctx, - AVStream *stream, - AVFrame *frame + AVFormatContext *ctx, AVStream *stream, AVFrame *frame ) - cdef const AVInputFormat* av_demuxer_iterate(void **opaque) cdef const AVOutputFormat* av_muxer_iterate(void **opaque) - # custom - cdef set pyav_get_available_formats() cdef struct AVIndexEntry: diff --git a/include/libavutil/avutil.pxd b/include/libavutil/avutil.pxd index 23b4fa6fc..9d8486e1a 100644 --- a/include/libavutil/avutil.pxd +++ b/include/libavutil/avutil.pxd @@ -1,11 +1,16 @@ -from libc.stdint cimport int64_t, uint8_t, uint64_t, int32_t +from libc.stdint cimport int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t -cdef extern from "libavutil/display.h" nogil: - cdef double av_display_rotation_get(const int32_t matrix[9]) - -cdef extern from "libavutil/rational.h" nogil: - cdef int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) +cdef extern from "libavutil/audio_fifo.h" nogil: + cdef struct AVAudioFifo: + pass + cdef void av_audio_fifo_free(AVAudioFifo *af) + cdef AVAudioFifo* av_audio_fifo_alloc( + AVSampleFormat sample_fmt, int channels, int nb_samples + ) + cdef int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples) + cdef int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples) + cdef int av_audio_fifo_size(AVAudioFifo *af) cdef extern from "libavutil/avutil.h" nogil: cdef const char* av_version_info() @@ -26,10 +31,6 @@ cdef extern from "libavutil/avutil.h" nogil: cdef enum AVPixelFormat: AV_PIX_FMT_NONE AV_PIX_FMT_YUV420P - AV_PIX_FMT_RGBA - AV_PIX_FMT_RGB24 - PIX_FMT_RGB24 - PIX_FMT_RGBA cdef enum AVColorSpace: AVCOL_SPC_RGB @@ -93,56 +94,156 @@ cdef extern from "libavutil/avutil.h" nogil: 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/pixdesc.h" nogil: - # See: http://ffmpeg.org/doxygen/trunk/structAVComponentDescriptor.html - cdef struct AVComponentDescriptor: - unsigned int plane - unsigned int step - unsigned int offset - unsigned int shift - unsigned int depth +cdef extern from "libavutil/buffer.h" nogil: + AVBufferRef *av_buffer_create(uint8_t *data, size_t size, void (*free)(void *opaque, uint8_t *data), void *opaque, int flags) + AVBufferRef* av_buffer_ref(AVBufferRef *buf) + void av_buffer_unref(AVBufferRef **buf) + cdef struct AVBuffer: + uint8_t *data + int size + void (*free)(void *opaque, uint8_t *data) + void *opaque + int flags + cdef struct AVBufferRef: + AVBuffer *buffer + uint8_t *data + int size - cdef enum AVPixFmtFlags: - AV_PIX_FMT_FLAG_BE - AV_PIX_FMT_FLAG_PAL - AV_PIX_FMT_FLAG_BITSTREAM - AV_PIX_FMT_FLAG_PLANAR - AV_PIX_FMT_FLAG_RGB - AV_PIX_FMT_FLAG_BAYER +cdef extern from "libavutil/dict.h" nogil: + # See: http://ffmpeg.org/doxygen/trunk/structAVDictionary.html + ctypedef struct AVDictionary: + pass + # 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 + ) + 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) - # See: http://ffmpeg.org/doxygen/trunk/structAVPixFmtDescriptor.html - cdef struct AVPixFmtDescriptor: - const char *name - uint8_t nb_components - uint8_t log2_chroma_w - uint8_t log2_chroma_h - uint8_t flags - AVComponentDescriptor comp[4] +cdef extern from "libavutil/display.h" nogil: + cdef double av_display_rotation_get(const int32_t matrix[9]) - 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) +cdef extern from "libavutil/error.h" nogil: + cdef int AVERROR_BSF_NOT_FOUND + cdef int AVERROR_BUG + cdef int AVERROR_BUFFER_TOO_SMALL + cdef int AVERROR_DECODER_NOT_FOUND + cdef int AVERROR_DEMUXER_NOT_FOUND + cdef int AVERROR_ENCODER_NOT_FOUND + cdef int AVERROR_EOF + cdef int AVERROR_EXIT + cdef int AVERROR_EXTERNAL + cdef int AVERROR_FILTER_NOT_FOUND + cdef int AVERROR_INVALIDDATA + cdef int AVERROR_MUXER_NOT_FOUND + cdef int AVERROR_OPTION_NOT_FOUND + cdef int AVERROR_PATCHWELCOME + cdef int AVERROR_PROTOCOL_NOT_FOUND + cdef int AVERROR_UNKNOWN + 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 AV_ERROR_MAX_STRING_SIZE + cdef int av_strerror(int errno, char *output, size_t output_size) + cdef char* av_err2str(int errnum) +cdef extern from "libavutil/frame.h" nogil: + cdef AVFrame* av_frame_alloc() + cdef void av_frame_free(AVFrame**) + cdef void av_frame_unref(AVFrame *frame) + 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(AVFrame *frame, AVFrameSideDataType type) -cdef extern from "libavutil/audio_fifo.h" nogil: - cdef struct AVAudioFifo: - pass +cdef extern from "libavutil/hwcontext.h" nogil: + enum AVHWDeviceType: + AV_HWDEVICE_TYPE_NONE + AV_HWDEVICE_TYPE_VDPAU + AV_HWDEVICE_TYPE_CUDA + AV_HWDEVICE_TYPE_VAAPI + AV_HWDEVICE_TYPE_DXVA2 + AV_HWDEVICE_TYPE_QSV + AV_HWDEVICE_TYPE_VIDEOTOOLBOX + AV_HWDEVICE_TYPE_D3D11VA + AV_HWDEVICE_TYPE_DRM + AV_HWDEVICE_TYPE_OPENCL + AV_HWDEVICE_TYPE_MEDIACODEC + AV_HWDEVICE_TYPE_VULKAN + AV_HWDEVICE_TYPE_D3D12VA - cdef void av_audio_fifo_free(AVAudioFifo *af) - cdef AVAudioFifo* av_audio_fifo_alloc( - AVSampleFormat sample_fmt, int channels, int nb_samples + cdef int av_hwdevice_ctx_create(AVBufferRef **device_ctx, AVHWDeviceType type, const char *device, AVDictionary *opts, int flags) + cdef AVHWDeviceType av_hwdevice_find_type_by_name(const char *name) + cdef const char *av_hwdevice_get_type_name(AVHWDeviceType type) + cdef AVHWDeviceType av_hwdevice_iterate_types(AVHWDeviceType prev) + cdef int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags) + +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, + int height, + uint8_t *ptr, + const int linesizes[4] ) - cdef int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples) - cdef int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples) - cdef int av_audio_fifo_size(AVAudioFifo *af) +cdef extern from "libavutil/log.h" nogil: + cdef struct AVClass: + const char *class_name + const char *(*item_name)(void*) nogil + const AVOption *option -cdef extern from "stdarg.h" nogil: - ctypedef struct va_list: - pass + cdef enum: + AV_LOG_QUIET + AV_LOG_PANIC + AV_LOG_FATAL + AV_LOG_ERROR + AV_LOG_WARNING + AV_LOG_INFO + AV_LOG_VERBOSE + AV_LOG_DEBUG + AV_LOG_TRACE + + void av_log(void *ptr, int level, const char *fmt, ...) + ctypedef void(*av_log_callback)(void *, int, const char *, va_list) + void av_log_default_callback(void *, int, const char *, va_list) + void av_log_set_callback (av_log_callback callback) + void av_log_set_level(int level) + +cdef extern from "libavutil/motion_vector.h" nogil: + cdef struct AVMotionVector: + int32_t source + uint8_t w + uint8_t h + int16_t src_x + int16_t src_y + int16_t dst_x + int16_t dst_y + uint64_t flags + int32_t motion_x + int32_t motion_y + uint16_t motion_scale cdef extern from "libavutil/opt.h" nogil: cdef enum AVOptionType: @@ -187,53 +288,92 @@ 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 const char *unit +cdef extern from "libavutil/pixdesc.h" nogil: + # See: http://ffmpeg.org/doxygen/trunk/structAVComponentDescriptor.html + cdef struct AVComponentDescriptor: + unsigned int plane + unsigned int step + unsigned int offset + unsigned int shift + unsigned int depth -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, + cdef enum AVPixFmtFlags: + AV_PIX_FMT_FLAG_BE + AV_PIX_FMT_FLAG_PAL + AV_PIX_FMT_FLAG_BITSTREAM + AV_PIX_FMT_FLAG_PLANAR + AV_PIX_FMT_FLAG_RGB + AV_PIX_FMT_FLAG_BAYER + + # See: http://ffmpeg.org/doxygen/trunk/structAVPixFmtDescriptor.html + cdef struct AVPixFmtDescriptor: + const char *name + uint8_t nb_components + uint8_t log2_chroma_w + uint8_t log2_chroma_h + uint8_t flags + AVComponentDescriptor comp[4] + + 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) + +cdef extern from "libavutil/rational.h" nogil: + cdef int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) + +cdef extern from "libavutil/samplefmt.h" nogil: + cdef enum AVSampleFormat: + AV_SAMPLE_FMT_U8 + AV_SAMPLE_FMT_S16 + AV_SAMPLE_FMT_S32 + AV_SAMPLE_FMT_FLT + AV_SAMPLE_FMT_DBL + + cdef AVSampleFormat av_get_sample_fmt(char* name) + 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, + int nb_samples, + AVSampleFormat sample_fmt, int align ) - cdef int av_image_fill_pointers( - uint8_t *pointers[4], - AVPixelFormat pix_fmt, - int height, - uint8_t *ptr, - const int linesizes[4] - ) -cdef extern from "libavutil/log.h" nogil: - cdef struct AVClass: - const char *class_name - const char *(*item_name)(void*) nogil - int parent_log_context_offset - const AVOption *option +cdef extern from "libavutil/video_enc_params.h" nogil: + cdef enum AVVideoEncParamsType: + AV_VIDEO_ENC_PARAMS_NONE + AV_VIDEO_ENC_PARAMS_VP9 + AV_VIDEO_ENC_PARAMS_H264 + AV_VIDEO_ENC_PARAMS_MPEG2 - cdef enum: - AV_LOG_QUIET - AV_LOG_PANIC - AV_LOG_FATAL - AV_LOG_ERROR - AV_LOG_WARNING - AV_LOG_INFO - AV_LOG_VERBOSE - AV_LOG_DEBUG - AV_LOG_TRACE - AV_LOG_MAX_OFFSET + cdef struct AVVideoEncParams: + uint32_t nb_blocks + size_t blocks_offset + size_t block_size + AVVideoEncParamsType type + int32_t qp + int32_t delta_qp[4][2] - void av_log(void *ptr, int level, const char *fmt, ...) - ctypedef void(*av_log_callback)(void *, int, const char *, va_list) - void av_log_default_callback(void *, int, const char *, va_list) - void av_log_set_callback (av_log_callback callback) - void av_log_set_level(int level) + cdef struct AVVideoBlockParams: + int32_t src_x + int32_t src_y + int32_t w + int32_t h + int32_t delta_qp + +cdef extern from "stdarg.h" nogil: + ctypedef struct va_list: + pass diff --git a/include/libavutil/buffer.pxd b/include/libavutil/buffer.pxd deleted file mode 100644 index d4ff4cd17..000000000 --- a/include/libavutil/buffer.pxd +++ /dev/null @@ -1,18 +0,0 @@ -from libc.stdint cimport intptr_t, uint8_t - -cdef extern from "libavutil/buffer.h" nogil: - AVBufferRef *av_buffer_create(uint8_t *data, size_t size, void (*free)(void *opaque, uint8_t *data), void *opaque, int flags) - AVBufferRef* av_buffer_ref(AVBufferRef *buf) - void av_buffer_unref(AVBufferRef **buf) - - cdef struct AVBuffer: - uint8_t *data - int size - intptr_t refcount - void (*free)(void *opaque, uint8_t *data) - void *opaque - int flags - cdef struct AVBufferRef: - AVBuffer *buffer - uint8_t *data - int size diff --git a/include/libavutil/dict.pxd b/include/libavutil/dict.pxd deleted file mode 100644 index 19b0d9086..000000000 --- a/include/libavutil/dict.pxd +++ /dev/null @@ -1,18 +0,0 @@ -cdef extern from "libavutil/dict.h" nogil: - # See: http://ffmpeg.org/doxygen/trunk/structAVDictionary.html - ctypedef struct AVDictionary: - pass - # 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 - ) - 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) diff --git a/include/libavutil/error.pxd b/include/libavutil/error.pxd deleted file mode 100644 index 17aad3fd9..000000000 --- a/include/libavutil/error.pxd +++ /dev/null @@ -1,30 +0,0 @@ -cdef extern from "libavutil/error.h" nogil: - cdef int AVERROR_BSF_NOT_FOUND - cdef int AVERROR_BUG - cdef int AVERROR_BUFFER_TOO_SMALL - cdef int AVERROR_DECODER_NOT_FOUND - cdef int AVERROR_DEMUXER_NOT_FOUND - cdef int AVERROR_ENCODER_NOT_FOUND - cdef int AVERROR_EOF - cdef int AVERROR_EXIT - cdef int AVERROR_EXTERNAL - cdef int AVERROR_FILTER_NOT_FOUND - cdef int AVERROR_INVALIDDATA - cdef int AVERROR_MUXER_NOT_FOUND - cdef int AVERROR_OPTION_NOT_FOUND - cdef int AVERROR_PATCHWELCOME - cdef int AVERROR_PROTOCOL_NOT_FOUND - cdef int AVERROR_UNKNOWN - 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(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) diff --git a/include/libavutil/frame.pxd b/include/libavutil/frame.pxd deleted file mode 100644 index c7f60e93c..000000000 --- a/include/libavutil/frame.pxd +++ /dev/null @@ -1,7 +0,0 @@ -cdef extern from "libavutil/frame.h" nogil: - cdef AVFrame* av_frame_alloc() - cdef void av_frame_free(AVFrame**) - cdef void av_frame_unref(AVFrame *frame) - 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(AVFrame *frame, AVFrameSideDataType type) diff --git a/include/libavutil/hwcontext.pxd b/include/libavutil/hwcontext.pxd deleted file mode 100644 index dc6402a6d..000000000 --- a/include/libavutil/hwcontext.pxd +++ /dev/null @@ -1,23 +0,0 @@ -cdef extern from "libavutil/hwcontext.h" nogil: - enum AVHWDeviceType: - AV_HWDEVICE_TYPE_NONE - AV_HWDEVICE_TYPE_VDPAU - AV_HWDEVICE_TYPE_CUDA - AV_HWDEVICE_TYPE_VAAPI - AV_HWDEVICE_TYPE_DXVA2 - AV_HWDEVICE_TYPE_QSV - AV_HWDEVICE_TYPE_VIDEOTOOLBOX - AV_HWDEVICE_TYPE_D3D11VA - AV_HWDEVICE_TYPE_DRM - AV_HWDEVICE_TYPE_OPENCL - AV_HWDEVICE_TYPE_MEDIACODEC - AV_HWDEVICE_TYPE_VULKAN - AV_HWDEVICE_TYPE_D3D12VA - - cdef int av_hwdevice_ctx_create(AVBufferRef **device_ctx, AVHWDeviceType type, const char *device, AVDictionary *opts, int flags) - - cdef AVHWDeviceType av_hwdevice_find_type_by_name(const char *name) - cdef const char *av_hwdevice_get_type_name(AVHWDeviceType type) - cdef AVHWDeviceType av_hwdevice_iterate_types(AVHWDeviceType prev) - - cdef int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags) diff --git a/include/libavutil/motion_vector.pxd b/include/libavutil/motion_vector.pxd deleted file mode 100644 index 4938a5dff..000000000 --- a/include/libavutil/motion_vector.pxd +++ /dev/null @@ -1,16 +0,0 @@ -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 - uint8_t h - int16_t src_x - int16_t src_y - int16_t dst_x - int16_t dst_y - uint64_t flags - int32_t motion_x - int32_t motion_y - uint16_t motion_scale diff --git a/include/libavutil/samplefmt.pxd b/include/libavutil/samplefmt.pxd deleted file mode 100644 index 5ee25dafd..000000000 --- a/include/libavutil/samplefmt.pxd +++ /dev/null @@ -1,28 +0,0 @@ -cdef extern from "libavutil/samplefmt.h" nogil: - cdef enum AVSampleFormat: - AV_SAMPLE_FMT_NONE - AV_SAMPLE_FMT_U8 - AV_SAMPLE_FMT_S16 - AV_SAMPLE_FMT_S32 - AV_SAMPLE_FMT_FLT - AV_SAMPLE_FMT_DBL - AV_SAMPLE_FMT_U8P - AV_SAMPLE_FMT_S16P - AV_SAMPLE_FMT_S32P - AV_SAMPLE_FMT_FLTP - AV_SAMPLE_FMT_DBLP - AV_SAMPLE_FMT_NB - - cdef AVSampleFormat av_get_sample_fmt(char* name) - 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, - int nb_samples, - AVSampleFormat sample_fmt, - int align - ) diff --git a/include/libavutil/video_enc_params.pxd b/include/libavutil/video_enc_params.pxd deleted file mode 100644 index aec452666..000000000 --- a/include/libavutil/video_enc_params.pxd +++ /dev/null @@ -1,25 +0,0 @@ -from libc.stdint cimport uint32_t, int32_t -from libc.stddef cimport size_t - - -cdef extern from "libavutil/video_enc_params.h" nogil: - cdef enum AVVideoEncParamsType: - AV_VIDEO_ENC_PARAMS_NONE - AV_VIDEO_ENC_PARAMS_VP9 - AV_VIDEO_ENC_PARAMS_H264 - AV_VIDEO_ENC_PARAMS_MPEG2 - - cdef struct AVVideoEncParams: - uint32_t nb_blocks - size_t blocks_offset - size_t block_size - AVVideoEncParamsType type - int32_t qp - int32_t delta_qp[4][2] - - cdef struct AVVideoBlockParams: - int32_t src_x - int32_t src_y - int32_t w - int32_t h - int32_t delta_qp \ No newline at end of file diff --git a/include/libswresample/swresample.pxd b/include/libswresample/swresample.pxd index 5bd8a8629..8e6f6649b 100644 --- a/include/libswresample/swresample.pxd +++ b/include/libswresample/swresample.pxd @@ -1,4 +1,4 @@ cdef extern from "libswresample/swresample.h" nogil: - cdef int swresample_version() + cdef int swresample_version() cdef char* swresample_configuration() cdef char* swresample_license()