# Ogg Declarations # # Copyright (C) 2006,2007,2008 PySoy Group # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program; if not, see http://www.gnu.org/licenses # # $Id$ cdef extern from "ogg/ogg.h" nogil : ctypedef short ogg_int16_t ctypedef unsigned short ogg_uint16_t ctypedef int ogg_int32_t ctypedef unsigned int ogg_uint32_t ctypedef long ogg_int64_t ctypedef struct oggpack_buffer : long endbyte int endbit unsigned char *buffer unsigned char *ptr long storage ctypedef struct ogg_page : unsigned char *header long header_len unsigned char *body long body_len ctypedef struct ogg_stream_state : unsigned char *body_data long body_storage long body_fill long body_returned int *lacing_vals ogg_int64_t *granule_vals long lacing_storage long lacing_fill long lacing_packet long lacing_returned unsigned char header[282] int header_fill int e_o_s int b_o_s long serialno long pageno ogg_int64_t packetno ogg_int64_t granulepos ctypedef struct ogg_packet : unsigned char *packet long bytes long b_o_s long e_o_s ogg_int64_t granulepos ogg_int64_t packetno ctypedef struct ogg_sync_state : unsigned char *data int storage int fill int returned int unsynced int header int body cdef void oggpack_writeinit ( oggpack_buffer* ) cdef void oggpack_writetrunc ( oggpack_buffer*, long ) cdef void oggpack_writealign ( oggpack_buffer* ) cdef void oggpack_writecopy ( oggpack_buffer*, void*, long ) cdef void oggpack_reset ( oggpack_buffer* ) cdef void oggpack_writeclear ( oggpack_buffer* ) cdef void oggpack_readinit ( oggpack_buffer*, unsigned char*, int ) cdef void oggpack_write ( oggpack_buffer*, unsigned long, int ) cdef long oggpack_look ( oggpack_buffer*, int ) cdef long oggpack_look1 ( oggpack_buffer* ) cdef void oggpack_adv ( oggpack_buffer*, int ) cdef void oggpack_adv1 ( oggpack_buffer* ) cdef long oggpack_read ( oggpack_buffer*, int ) cdef long oggpack_read1 ( oggpack_buffer* ) cdef long oggpack_bytes ( oggpack_buffer* ) cdef long oggpack_bits ( oggpack_buffer* ) cdef unsigned char *oggpack_get_buffer ( oggpack_buffer* ) cdef void oggpackB_writeinit ( oggpack_buffer* ) cdef void oggpackB_writetrunc ( oggpack_buffer*, long ) cdef void oggpackB_writealign ( oggpack_buffer* ) cdef void oggpackB_writecopy ( oggpack_buffer*, void*, long ) cdef void oggpackB_reset ( oggpack_buffer* ) cdef void oggpackB_writeclear ( oggpack_buffer* ) cdef void oggpackB_readinit ( oggpack_buffer*, unsigned char*, int ) cdef void oggpackB_write ( oggpack_buffer*, unsigned long, int ) cdef long oggpackB_look ( oggpack_buffer*, int ) cdef long oggpackB_look1 ( oggpack_buffer* ) cdef void oggpackB_adv ( oggpack_buffer*, int ) cdef void oggpackB_adv1 ( oggpack_buffer* ) cdef long oggpackB_read ( oggpack_buffer*, int ) cdef long oggpackB_read1 ( oggpack_buffer* ) cdef long oggpackB_bytes ( oggpack_buffer* ) cdef long oggpackB_bits ( oggpack_buffer* ) cdef unsigned char *oggpackB_get_buffer ( oggpack_buffer* ) cdef int ogg_stream_packetin ( ogg_stream_state*, ogg_packet* ) cdef int ogg_stream_pageout ( ogg_stream_state*, ogg_page* ) cdef int ogg_stream_flush ( ogg_stream_state*, ogg_page* ) cdef int ogg_sync_init ( ogg_sync_state* ) cdef int ogg_sync_clear ( ogg_sync_state* ) cdef int ogg_sync_reset ( ogg_sync_state* ) cdef int ogg_sync_destroy ( ogg_sync_state* ) cdef char *ogg_sync_buffer ( ogg_sync_state*, long ) cdef int ogg_sync_wrote ( ogg_sync_state*, long ) cdef long ogg_sync_pageseek ( ogg_sync_state*, ogg_page* ) cdef int ogg_sync_pageout ( ogg_sync_state*, ogg_page* ) cdef int ogg_stream_pagein ( ogg_stream_state*, ogg_page* ) cdef int ogg_stream_packetout ( ogg_stream_state*, ogg_packet* ) cdef int ogg_stream_packetpeek ( ogg_stream_state*, ogg_packet* ) cdef int ogg_stream_init ( ogg_stream_state*, int ) cdef int ogg_stream_clear ( ogg_stream_state* ) cdef int ogg_stream_reset ( ogg_stream_state* ) cdef int ogg_stream_reset_serialno ( ogg_stream_state*, int ) cdef int ogg_stream_destroy ( ogg_stream_state* ) cdef int ogg_stream_eos ( ogg_stream_state* ) cdef void ogg_page_checksum_set ( ogg_page* ) cdef int ogg_page_version ( ogg_page* ) cdef int ogg_page_continued ( ogg_page* ) cdef int ogg_page_bos ( ogg_page* ) cdef int ogg_page_eos ( ogg_page* ) cdef int ogg_page_serialno ( ogg_page* ) cdef long ogg_page_pageno ( ogg_page* ) cdef int ogg_page_packets ( ogg_page* ) cdef ogg_int64_t ogg_page_granulepos ( ogg_page* ) cdef void ogg_packet_clear ( ogg_packet* ) cdef extern from "vorbis/codec.h" nogil : ctypedef enum : OV_FALSE OV_EOF OV_HOLE OV_EREAD OV_EFAULT OV_EIMPL OV_EINVAL OV_ENOTVORBIS OV_EBADHEADER OV_EVERSION OV_ENOTAUDIO OV_EBADPACKET OV_EBADLINK OV_ENOSEEK cdef struct vorbis_info : int version int channels long rate long bitrate_upper long bitrate_nominal long bitrate_lower long bitrate_window void *codec_setup cdef struct vorbis_dsp_state : int analysisp vorbis_info *vi float **pcm float **pcmret int pcm_storage int pcm_current int pcm_returned int preextrapolate int eofflag long lW long W long nW long centerW ogg_int64_t granulepos ogg_int64_t sequence ogg_int64_t glue_bits ogg_int64_t time_bits ogg_int64_t floor_bits ogg_int64_t res_bits void *backend_state cdef struct alloc_chain : void *ptr alloc_chain *next cdef struct vorbis_block : float **pcm oggpack_buffer opb long lW long W long nW int pcmend int mode int eofflag ogg_int64_t granulepos ogg_int64_t sequence vorbis_dsp_state *vd void *localstore long localtop long localalloc long totaluse alloc_chain *reap long glue_bits long time_bits long floor_bits long res_bits void *internal cdef struct vorbis_comment : char **user_comments int *comment_lengths int comments char *vendor cdef void vorbis_info_init ( vorbis_info* ) cdef void vorbis_info_clear ( vorbis_info* ) cdef int vorbis_info_blocksize ( vorbis_info*, int ) cdef void vorbis_comment_init ( vorbis_comment* ) cdef void vorbis_comment_add ( vorbis_comment*, char* ) cdef void vorbis_comment_add_tag ( vorbis_comment*, char*, char* ) cdef char *vorbis_comment_query ( vorbis_comment*, char*, int ) cdef int vorbis_comment_query_count ( vorbis_comment*, char* ) cdef void vorbis_comment_clear ( vorbis_comment* ) cdef int vorbis_block_init ( vorbis_dsp_state*, vorbis_block* ) cdef int vorbis_block_clear ( vorbis_block* ) cdef void vorbis_dsp_clear ( vorbis_dsp_state* ) cdef double vorbis_granule_time ( vorbis_dsp_state*, ogg_int64_t ) cdef int vorbis_analysis_init ( vorbis_dsp_state*, vorbis_info* ) cdef int vorbis_commentheader_out ( vorbis_comment*, ogg_packet* ) cdef int vorbis_analysis_headerout ( vorbis_dsp_state*, vorbis_comment*, ogg_packet*, ogg_packet*, ogg_packet* ) cdef float **vorbis_analysis_buffer ( vorbis_dsp_state*, int ) cdef int vorbis_analysis_wrote ( vorbis_dsp_state*, int ) cdef int vorbis_analysis_blockout ( vorbis_dsp_state*, vorbis_block* ) cdef int vorbis_analysis ( vorbis_block*, ogg_packet* ) cdef int vorbis_bitrate_addblock ( vorbis_block* ) cdef int vorbis_bitrate_flushpacket ( vorbis_dsp_state*, ogg_packet* ) cdef int vorbis_synthesis_headerin ( vorbis_info*, vorbis_comment*, ogg_packet* ) cdef int vorbis_synthesis_init ( vorbis_dsp_state*, vorbis_info* ) cdef int vorbis_synthesis_restart ( vorbis_dsp_state* ) cdef int vorbis_synthesis ( vorbis_block*, ogg_packet* ) cdef int vorbis_synthesis_trackonly ( vorbis_block*, ogg_packet* ) cdef int vorbis_synthesis_blockin ( vorbis_dsp_state*, vorbis_block* ) cdef int vorbis_synthesis_pcmout ( vorbis_dsp_state*, float*** ) cdef int vorbis_synthesis_lapout ( vorbis_dsp_state*, float*** ) cdef int vorbis_synthesis_read ( vorbis_dsp_state*, int ) cdef long vorbis_packet_blocksize ( vorbis_info*, ogg_packet* ) cdef int vorbis_synthesis_halfrate ( vorbis_info*, int ) cdef int vorbis_synthesis_halfrate_p( vorbis_info *v ) cdef extern from "theora/theora.h" nogil : ctypedef enum : OC_FAULT OC_EINVAL OC_DISABLED OC_BADHEADER OC_NOTFORMAT OC_VERSION OC_IMPL OC_BADPACKET OC_NEWPACKET OC_DUPFRAME ctypedef enum theora_colorspace : OC_CS_UNSPECIFIED, OC_CS_ITU_REC_470M, OC_CS_ITU_REC_470BG, OC_CS_NSPACES ctypedef enum theora_pixelformat : OC_PF_420, OC_PF_RSVD, OC_PF_422, OC_PF_444, ctypedef struct yuv_buffer : int y_width int y_height int y_stride int uv_width int uv_height int uv_stride unsigned char *y unsigned char *u unsigned char *v ctypedef struct theora_info : ogg_uint32_t width ogg_uint32_t height ogg_uint32_t frame_width ogg_uint32_t frame_height ogg_uint32_t offset_x ogg_uint32_t offset_y ogg_uint32_t fps_numerator ogg_uint32_t fps_denominator ogg_uint32_t aspect_numerator ogg_uint32_t aspect_denominator theora_colorspace colorspace int target_bitrate int quality int quick_p unsigned char version_major unsigned char version_minor unsigned char version_subminor void *codec_setup int dropframes_p int keyframe_auto_p ogg_uint32_t keyframe_frequency ogg_uint32_t keyframe_frequency_force ogg_uint32_t keyframe_data_target_bitrate ogg_int32_t keyframe_auto_threshold ogg_uint32_t keyframe_mindistance ogg_int32_t noise_sensitivity ogg_int32_t sharpness theora_pixelformat pixelformat ctypedef struct theora_state : theora_info *i ogg_int64_t granulepos void *internal_encode void *internal_decode cdef struct theora_comment : char **user_comments int *_lengths int comments char *vendor cdef char *theora_version_string ( ) cdef ogg_uint32_t theora_version_number( ) cdef int theora_encode_init ( theora_state*, theora_info* ) cdef int theora_encode_YUVin ( theora_state*, yuv_buffer* ) cdef int theora_encode_packetout ( theora_state*, int, ogg_packet* ) cdef int theora_encode_header ( theora_state*, ogg_packet* ) cdef int theora_encode_comment ( theora_comment*, ogg_packet* ) cdef int theora_encode_tables ( theora_state*, ogg_packet* ) cdef int theora_decode_header ( theora_info*, theora_comment*, ogg_packet* ) cdef int theora_decode_init ( theora_state*, theora_info* ) cdef int theora_decode_packetin ( theora_state*, ogg_packet* ) cdef int theora_decode_YUVout ( theora_state*, yuv_buffer* ) cdef int theora_packet_isheader ( ogg_packet* ) cdef int theora_packet_iskeyframe ( ogg_packet* ) cdef int theora_granule_shift ( theora_info* ) cdef ogg_int64_t theora_granule_frame ( theora_state*, ogg_int64_t ) cdef double theora_granule_time ( theora_state*, ogg_int64_t ) cdef void theora_info_init ( theora_info* ) cdef void theora_info_clear ( theora_info* ) cdef void theora_clear ( theora_state* ) cdef void theora_comment_init ( theora_comment* ) cdef void theora_comment_add ( theora_comment*, char* ) cdef void theora_comment_add_tag ( theora_comment*, char*, char* ) cdef char *theora_comment_query ( theora_comment*, char*, int ) cdef int theora_comment_query_count ( theora_comment*, char* ) cdef void theora_comment_clear ( theora_comment* )