⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unavorbisapi.pas

📁 Voice Commnucation Components for Delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
function ogg_stream_packetin(const os: tOgg_stream_state; const op: tOgg_packet): int;
function ogg_stream_pageout(const os: tOgg_stream_state; const og: tOgg_page): int;
function ogg_stream_flush(const os: tOgg_stream_state; const og: tOgg_page): int;
function ogg_sync_init(var oy: tOgg_sync_state): int;
function ogg_sync_clear(const oy: tOgg_sync_state): int;
function ogg_sync_reset(const oy: tOgg_sync_state): int;
function ogg_sync_destroy(var oy: tOgg_sync_state): int;
function ogg_sync_buffer(const oy: tOgg_sync_state; size: long): pChar;
function ogg_sync_wrote(const oy: tOgg_sync_state; bytes: long): int;
function ogg_sync_pageseek(const oy: tOgg_sync_state; const og: tOgg_page): long;
function ogg_sync_pageout(const oy: tOgg_sync_state; const og: tOgg_page): int;
function ogg_stream_pagein(const os: tOgg_stream_state; const og: tOgg_page): int;
function ogg_stream_packetout(const os: tOgg_stream_state; const op: tOgg_packet): int;
function ogg_stream_packetpeek(const os: tOgg_stream_state; const op: tOgg_packet): int;
function ogg_stream_init(var os: tOgg_stream_state; serialno: int): int;
function ogg_stream_clear(const os: tOgg_stream_state): int;
function ogg_stream_reset(const os: tOgg_stream_state): int;
function ogg_stream_reset_serialno(const os: tOgg_stream_state; serialno: int): int;
function ogg_stream_destroy(const os: tOgg_stream_state): int;
function ogg_stream_eos(const os: tOgg_stream_state): int;
procedure ogg_page_checksum_set(const og: tOgg_page);
function ogg_page_version(const og: tOgg_page): int;
function ogg_page_continued(const og: tOgg_page): int;
function ogg_page_bos(const og: tOgg_page): int;
function ogg_page_eos(const og: tOgg_page): int;
function ogg_page_granulepos(const og: tOgg_page): ogg_int64_t;
function ogg_page_serialno(const og: tOgg_page): int;
function ogg_page_pageno(const og: tOgg_page): long;
function ogg_page_packets(const og: tOgg_page): int;
procedure ogg_packet_clear(const op: tOgg_packet);


(********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
 * by the XIPHOPHORUS Company http://www.xiph.org/                  *

 ********************************************************************

 function: libvorbis codec headers
 last mod: $Id: codec.h,v 1.40 2002/02/28 04:12:47 xiphmont Exp $

 ********************************************************************)

type

  // --  --
  pVorbis_info = ^tVorbis_info;
  tVorbis_info = packed record
    version: int;
    channels: int;
    rate: long;
    //
    //* The below bitrate declarations are *hints*.
    //   Combinations of the three values carry the following implications:

    //   all three set to the same value:
    //	   implies a fixed rate bitstream
    //   only nominal set:
    //	   implies a VBR stream that averages the nominal bitrate.  No hard upper/lower limit
    //   upper and or lower set:
    //	   implies a VBR bitstream that obeys the bitrate limits. nominal may also be set to give a nominal rate.
    //   none set:
    //	   the coder does not care to speculate.
    //*/
    bitrate_upper: long;
    bitrate_nominal: long;
    bitrate_lower: long;
    bitrate_window: long;
    //
    codec_setup: pointer;
    {+20}
  end;


type
  // --  --

  pSingleArray = ^tSingleArray;
  tSingleArray = array[0..maxInt div sizeOf(single) - 1] of single;	// individual samples

  pSingleSamples = ^tSingleSamples;
  tSingleSamples = array[byte] of pSingleArray;		// array of channels with samples

//  pSingleSamplesArray = ^tSingleSamplesArray;
//  tSingleSamplesArray = array[0..maxInt div sizeOf(pointer) - 1] of pSingleSamples;	// array of several PCM streams (?)


//* vorbis_dsp_state buffers the current vorbis audio
//   analysis/synthesis state.  The DSP state belongs to a specific
//   logical bitstream ****************************************************/

  pVorbis_dsp_state = ^tVorbis_dsp_state;
  tVorbis_dsp_state = packed record
    {+00}analysisp: int;
    {+04}vi: pVorbis_info;
    //
    {+08}pcm: pSingleSamples;	// float **
    {+0C}pcmret: pSingleSamples;	// float **
    //
    {+10}pcm_storage: int;
    {+14}pcm_current: int;
    {+18}pcm_returned: int;

    {+1C}preextrapolate: int;
    {+20}eofflag: int;

    {+24}lW: long;
    {+28}W: long;
    {+2C}nW: long;
    {+30}centerW: long;
    {+34}__align: long;	// for some reason next field must be aligned to $10 boundary (?)

    {+38}granulepos: ogg_int64_t;
    {+40}sequence: ogg_int64_t;

    {+48}glue_bits: ogg_int64_t;
    {+50}time_bits: ogg_int64_t;
    {+58}floor_bits: ogg_int64_t;
    {+60}res_bits: ogg_int64_t;

    {+68}backend_state: pointer;
    {+6C}_align2: int;
    {+70}
  end;

//* vorbis_block is a single block of data to be processed as part of
//the analysis/synthesis stream; it belongs to a specific logical
//bitstream, but is independant from other vorbis_blocks belonging to
//that logical bitstream. *************************************************/

  pAlloc_chain = ^tAlloc_chain;
  tAlloc_chain = packed record
    ptr: pointer;
    next: pAlloc_chain;
  end;


  // --  --
  pVorbis_block = ^tVorbis_block;
  tVorbis_block = packed record
    //* necessary stream state for linking to the framing abstraction */
    {+00}pcm: pointer;	//float  **       /* this is a pointer into local storage */
    {+04}opb: tOggpack_buffer;
    //
    {+18}lW: long;
    {+1C}W: long;
    {+20}nW: long;
    {+24}pcmend: int;
    {+28}mode: int;
    //
    {+2A}eofflag: int;
    {+30}granulepos: ogg_int64_t;
    {+38}sequence: ogg_int64_t;
    {+40}vd: pVorbis_dsp_state; //* For read-only access of configuration */

    //* local storage to avoid remallocing; it's up to the mapping to
    //   structure it */
    {+44}localstore: pointer;
    {+48}localtop: long;
    {+4C}localalloc: long;
    {+50}totaluse: long;
    {+54}reap: pAlloc_chain;

    //* bitmetrics for the frame */
    {+58}glue_bits: long;
    {+5C}time_bits: long;
    {+60}floor_bits: long;
    {+64}res_bits: long;

    {+68}internal: pointer;
    {+6C}_align: int;
    {+70}
  end;

//* vorbis_info contains all the setup information specific to the
//   specific compression/decompression mode in progress (eg,
//   psychoacoustic settings, channel setup, options, codebook
//   etc). vorbis_info and substructures are in backends.h.
//*********************************************************************/

//* the comments are not part of vorbis_info so that vorbis_info can be
//   static storage */

  pVorbis_comment = ^tVorbis_comment;
  tVorbis_comment = packed record
    //* unlimited user comment fields.  libvorbis writes 'libvorbis'
    //   whatever vendor is set to in encode */
    user_comments: pointer;	// char **
    comment_lengths: ^int;
    comments: int;
    vendor: pChar;
    {+10}
  end;


(* libvorbis encodes in two abstraction layers; first we perform DSP
   and produce a packet (see docs/analysis.txt).  The packet is then
   coded into a framed OggSquish bitstream by the second layer (see
   docs/framing.txt).  Decode is the reverse process; we sync/frame
   the bitstream and extract individual packets, then decode the
   packet back into PCM audio.

   The extra framing/packetizing is used in streaming formats, such as
   files.  Over the net (such as with UDP), the framing and
   packetization aren't necessary as they're provided by the transport
   and the streaming layer is not used *)

//* Vorbis PRIMITIVES: general ***************************************/

//extern void     vorbis_info_init(vorbis_info *vi);
  tvorbis_info_init = procedure(var vi: tVorbis_info); cdecl;

//extern void     vorbis_info_clear(vorbis_info *vi);
  tvorbis_info_clear = procedure(const vi: tVorbis_info); cdecl;

//extern int      vorbis_info_blocksize(vorbis_info *vi,int zo);
  tvorbis_info_blocksize = function(const vi: tVorbis_info; zo: int): int; cdecl;

//extern void     vorbis_comment_init(vorbis_comment *vc);
  tvorbis_comment_init = procedure(const vc: tVorbis_comment); cdecl;

//extern void     vorbis_comment_add(vorbis_comment *vc, char *comment);
  tvorbis_comment_add = procedure(const vc: tVorbis_comment; comment: pChar); cdecl;

//extern void     vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents);
  tvorbis_comment_add_tag = procedure(var vc: tVorbis_comment; tag: pChar; contents: pChar); cdecl;

//extern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
  tvorbis_comment_query = function(const vc: tVorbis_comment; tag: pChar; count: int): pChar; cdecl;

//extern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);
  tvorbis_comment_query_count = function(const vc: tVorbis_comment; tag: pChar): int; cdecl;

//extern void     vorbis_comment_clear(vorbis_comment *vc);
  tvorbis_comment_clear = procedure(const vc: tVorbis_comment); cdecl;


//extern int      vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
  tvorbis_block_init = function(const v: tVorbis_dsp_state; var vb: tVorbis_block): int; cdecl;

//extern int      vorbis_block_clear(vorbis_block *vb);
  tvorbis_block_clear = function(const vb: tVorbis_block): int; cdecl;

//extern void     vorbis_dsp_clear(vorbis_dsp_state *v);
  tvorbis_dsp_clear = procedure(const v: tVorbis_dsp_state); cdecl;

//* Vorbis PRIMITIVES: analysis/DSP layer ****************************/

//extern int      vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
  tvorbis_analysis_init = function(var v: tVorbis_dsp_state; const vi: tVorbis_info): int; cdecl;

//extern int      vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
  tvorbis_commentheader_out = function(const vc: tVorbis_comment; const op: tOgg_packet): int; cdecl;

//extern int      vorbis_analysis_headerout(vorbis_dsp_state *v, vorbis_comment *vc, ogg_packet *op, ogg_packet *op_comm, ogg_packet *op_code);
  tvorbis_analysis_headerout = function(const v: tVorbis_dsp_state; const vc: tVorbis_comment; const op: tOgg_packet; const op_comm: tOgg_packet; const op_code: tOgg_packet): int; cdecl;

//extern float  **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
  tvorbis_analysis_buffer = function(const v: tVorbis_dsp_state; vals: int): pSingleSamples; cdecl;	// float **

//extern int      vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
  tvorbis_analysis_wrote = function(const v: tVorbis_dsp_state; vals: int): int; cdecl;

//extern int      vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
  tvorbis_analysis_blockout = function(const v: tVorbis_dsp_state; const vb: tVorbis_block): int; cdecl;

//extern int      vorbis_analysis(vorbis_block *vb,ogg_packet *op);
  tvorbis_analysis = function(const vb: tVorbis_block; op: pOgg_packet): int; cdecl;

//extern int      vorbis_bitrate_addblock(vorbis_block *vb);
  tvorbis_bitrate_addblock = function(const vb: tVorbis_block): int; cdecl;

//extern int      vorbis_bitrate_flushpacket = function(vorbis_dsp_state *vd, ogg_packet *op);
  tvorbis_bitrate_flushpacket = function(const vd: tVorbis_dsp_state; const op: tOgg_packet): int; cdecl;

//* Vorbis PRIMITIVES: synthesis layer *******************************/
//extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, ogg_packet *op);
  tvorbis_synthesis_headerin = function(const vi: tVorbis_info; const vc: tVorbis_comment; const op: tOgg_packet): int; cdecl;

//extern int      vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
  tvorbis_synthesis_init = function(const v: tVorbis_dsp_state; const vi: tVorbis_info): int; cdecl;

//extern int      vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
  tvorbis_synthesis = function(const vb: tVorbis_block; const op: tOgg_packet): int; cdecl;

//extern int      vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
  tvorbis_synthesis_trackonly = function(const vb: tVorbis_block; const op: tOgg_packet): int; cdecl;

//extern int      vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
  tvorbis_synthesis_blockin = function(const v: tVorbis_dsp_state; const vb: tVorbis_block): int; cdecl;

//extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
  tvorbis_synthesis_pcmout = function(const v: tVorbis_dsp_state; var pcm: pSingleSamples {float **}): int; cdecl;

//extern int      vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
  tvorbis_synthesis_read = function(const v: tVorbis_dsp_state; const samples: int): int; cdecl;

//extern long     vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
  tvorbis_packet_blocksize = function(const vi: tVorbis_info; const op: tOgg_packet): long; cdecl;

//* Vorbis ERRORS and return codes ***********************************/

const
  OV_FALSE      = -1;
  OV_EOF        = -2;
  OV_HOLE       = -3;

  OV_EREAD      = -128;
  OV_EFAULT     = -129;
  OV_EIMPL      = -130;
  OV_EINVAL     = -131;
  OV_ENOTVORBIS = -132;
  OV_EBADHEADER = -133;
  OV_EVERSION   = -134;
  OV_ENOTAUDIO  = -135;
  OV_EBADPACKET = -136;
  OV_EBADLINK   = -137;
  OV_ENOSEEK    = -138;


//------------------------------------------

procedure vorbis_info_init(var vi: tVorbis_info);
procedure vorbis_info_clear(const vi: tVorbis_info);
function vorbis_info_blocksize(const vi: tVorbis_info; zo: int): int;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -