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

📄 unavorbisapi.pas

📁 Voice Communicator (VC) 一套处理音频压缩的的控件包
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  {$IFDEF DEBUG }
  c_dllName_ogg		= 'ogg_d.dll';
  c_dllName_vorbis	= 'vorbis_d.dll';
  c_dllName_vorbisenc	= 'vorbisenc_d.dll';
  c_dllName_vorbisfile	= 'vorbisfile_d.dll';
  {$ELSE }
  c_dllName_ogg		= 'ogg.dll';
  c_dllName_vorbis	= 'vorbis.dll';
  c_dllName_vorbisenc	= 'vorbisenc.dll';
  c_dllName_vorbisfile	= 'vorbisfile.dll';
  {$ENDIF }

//
  OV_ERR_NO_DLL_LOADED  = -4001;
  OV_ERR_NOT_SUPPORED	= -4002;

  cunav_dll_ogg		= 1;
  cunav_dll_vorbis    	= 2;
  cunav_dll_vorbisenc 	= 3;
  cunav_dll_vorbisfile	= 4;

function vorbis_load_library(libraryToLoad: int {see cunav_dll_XXX}; const libraryName: string = ''): boolean;
procedure vorbis_unload_library(libraryToUnload: int {see cunav_dll_XXX});


implementation


uses
  Windows;

var
  proc_ogg_packet_clear               : togg_packet_clear;
  proc_ogg_page_bos                   : togg_page_bos;
  proc_ogg_page_continued             : togg_page_continued;
  proc_ogg_page_eos                   : togg_page_eos;
  proc_ogg_page_granulepos            : togg_page_granulepos;
  proc_ogg_page_packets               : togg_page_packets;
  proc_ogg_page_pageno                : togg_page_pageno;
  proc_ogg_page_serialno              : togg_page_serialno;
  proc_ogg_page_version               : togg_page_version;
  proc_ogg_stream_clear               : togg_stream_clear;
  proc_ogg_stream_destroy             : togg_stream_destroy;
  proc_ogg_stream_eos                 : togg_stream_eos;
  proc_ogg_stream_flush               : togg_stream_flush;
  proc_ogg_stream_init                : togg_stream_init;
  proc_ogg_stream_packetin            : togg_stream_packetin;
  proc_ogg_stream_packetout           : togg_stream_packetout;
  proc_ogg_stream_packetpeek          : togg_stream_packetpeek;
  proc_ogg_stream_pagein              : togg_stream_pagein;
  proc_ogg_stream_pageout             : togg_stream_pageout;
  proc_ogg_stream_reset               : togg_stream_reset;
  proc_ogg_stream_reset_serialno      : togg_stream_reset_serialno;
  proc_ogg_sync_buffer                : togg_sync_buffer;
  proc_ogg_sync_clear                 : togg_sync_clear;
  proc_ogg_sync_destroy               : togg_sync_destroy;
  proc_ogg_sync_init                  : togg_sync_init;
  proc_ogg_sync_pageout               : togg_sync_pageout;
  proc_ogg_sync_pageseek              : togg_sync_pageseek;
  proc_ogg_sync_reset                 : togg_sync_reset;
  proc_ogg_sync_wrote                 : togg_sync_wrote;
  proc_oggpack_adv                    : toggpack_adv;
  proc_oggpack_adv1                   : toggpack_adv1;
  proc_oggpack_bits                   : toggpack_bits;
  proc_oggpack_bytes                  : toggpack_bytes;
  proc_oggpack_get_buffer             : toggpack_get_buffer;
  proc_oggpack_look                   : toggpack_look;
  proc_oggpack_look1                  : toggpack_look1;
  proc_oggpack_read                   : toggpack_read;
  proc_oggpack_read1                  : toggpack_read1;
  proc_oggpack_readinit               : toggpack_readinit;
  proc_oggpack_reset                  : toggpack_reset;
  proc_oggpack_write                  : toggpack_write;
  proc_oggpack_writealign             : toggpack_writealign;
  proc_oggpack_writeclear             : toggpack_writeclear;
  proc_oggpack_writeinit              : toggpack_writeinit;
  proc_oggpack_writetrunc             : toggpack_writetrunc;
  proc_oggpack_writecopy              : toggpack_writecopy;
  proc_ogg_page_checksum_set          : togg_page_checksum_set;
  //------------------           //------------------
  proc_vorbis_analysis                : tvorbis_analysis;
  proc_vorbis_analysis_blockout       : tvorbis_analysis_blockout;
  proc_vorbis_analysis_buffer         : tvorbis_analysis_buffer;
  proc_vorbis_analysis_headerout      : tvorbis_analysis_headerout;
  proc_vorbis_analysis_init           : tvorbis_analysis_init;
  proc_vorbis_analysis_wrote          : tvorbis_analysis_wrote;
  proc_vorbis_bitrate_addblock        : tvorbis_bitrate_addblock;
  proc_vorbis_bitrate_flushpacket     : tvorbis_bitrate_flushpacket;
  proc_vorbis_block_clear             : tvorbis_block_clear;
  proc_vorbis_block_init              : tvorbis_block_init;
  proc_vorbis_comment_add             : tvorbis_comment_add;
  proc_vorbis_comment_add_tag         : tvorbis_comment_add_tag;
  proc_vorbis_comment_clear           : tvorbis_comment_clear;
  proc_vorbis_comment_init            : tvorbis_comment_init;
  proc_vorbis_comment_query           : tvorbis_comment_query;
  proc_vorbis_comment_query_count     : tvorbis_comment_query_count;
  proc_vorbis_commentheader_out       : tvorbis_commentheader_out;
  proc_vorbis_dsp_clear               : tvorbis_dsp_clear;
  proc_vorbis_encode_setup_init       : tvorbis_encode_setup_init;
  proc_vorbis_encode_setup_managed    : tvorbis_encode_setup_managed;
  proc_vorbis_encode_setup_vbr        : tvorbis_encode_setup_vbr;
  proc_vorbis_info_blocksize          : tvorbis_info_blocksize;
  proc_vorbis_info_clear              : tvorbis_info_clear;
  proc_vorbis_info_init               : tvorbis_info_init;
  proc_vorbis_packet_blocksize        : tvorbis_packet_blocksize;
  proc_vorbis_synthesis               : tvorbis_synthesis;
  proc_vorbis_synthesis_blockin       : tvorbis_synthesis_blockin;
  proc_vorbis_synthesis_headerin      : tvorbis_synthesis_headerin;
  proc_vorbis_synthesis_init          : tvorbis_synthesis_init;
  proc_vorbis_synthesis_pcmout        : tvorbis_synthesis_pcmout;
  proc_vorbis_synthesis_read          : tvorbis_synthesis_read;
  proc_vorbis_synthesis_trackonly     : tvorbis_synthesis_trackonly;
  //-----------------------------//---------------------------------
  proc_vorbis_encode_init             : tvorbis_encode_init;
  proc_vorbis_encode_init_vbr         : tvorbis_encode_init_vbr;
  proc_vorbis_encode_ctl              : tvorbis_encode_ctl;
  //-----------------------------//-----------------------------------
  proc_ov_bitrate                     : tov_bitrate;
  proc_ov_bitrate_instant             : tov_bitrate_instant;
  proc_ov_clear                       : tov_clear;
  proc_ov_comment                     : tov_comment;
  proc_ov_info                        : tov_info;
  proc_ov_open                        : tov_open;
  proc_ov_open_callbacks              : tov_open_callbacks;
  proc_ov_pcm_seek                    : tov_pcm_seek;
  proc_ov_pcm_seek_page               : tov_pcm_seek_page;
  proc_ov_pcm_tell                    : tov_pcm_tell;
  proc_ov_pcm_total                   : tov_pcm_total;
  proc_ov_raw_seek                    : tov_raw_seek;
  proc_ov_raw_tell                    : tov_raw_tell;
  proc_ov_raw_total                   : tov_raw_total;
  proc_ov_read                        : tov_read;
  proc_ov_seekable                    : tov_seekable;
  proc_ov_serialnumber                : tov_serialnumber;
  proc_ov_streams                     : tov_streams;
  proc_ov_test                        : tov_test;
  proc_ov_test_callbacks              : tov_test_callbacks;
  proc_ov_test_open                   : tov_test_open;
  proc_ov_time_seek                   : tov_time_seek;
  proc_ov_time_seek_page              : tov_time_seek_page;
  proc_ov_time_tell                   : tov_time_tell;
  proc_ov_time_total                  : tov_time_total;
  proc_ov_read_float                  : tov_read_float;

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

var
  g_dllLoad_ogg_refCount	: integer	= 0;
  g_dllLoad_vorbis_refCount	: integer	= 0;
  g_dllLoad_vorbisenc_refCount	: integer	= 0;
  g_dllLoad_vorbisfile_refCount	: integer	= 0;
  //
  g_dllLoad_ogg	: hModule;
  g_dllLoad_vorbis: hModule;
  g_dllLoad_vorbisenc: hModule;
  g_dllLoad_vorbisfile: hModule;

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

procedure ogg_packet_clear(const op: tOgg_packet);	// ogg.dll #1
begin
  if (0 < g_dllLoad_ogg_refCount) then
    proc_ogg_packet_clear(op);
end;

function ogg_page_bos(const og: tOgg_page): int;	// ogg.dll #2
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_bos(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_continued(const og: tOgg_page): int;	// ogg.dll #3
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_continued(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_eos(const og: tOgg_page): int;	// ogg.dll #4
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_eos(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_granulepos(const og: tOgg_page): ogg_int64_t;	// ogg.dll #5
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_granulepos(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_packets(const og: tOgg_page): int;	// ogg.dll #6
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_packets(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_pageno(const og: tOgg_page): long;	// ogg.dll #7
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_pageno(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_serialno(const og: tOgg_page): int;	// ogg.dll #8
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_serialno(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_page_version(const og: tOgg_page): int;	// ogg.dll #9
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_page_version(og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_clear(const os: tOgg_stream_state): int;	// ogg.dll #10
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_clear(os)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_destroy(const os: tOgg_stream_state): int;	// ogg.dll #11
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_destroy(os)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_eos(const os: tOgg_stream_state): int;	// ogg.dll #12
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_eos(os)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_flush(const os: tOgg_stream_state; const og: tOgg_page): int;	// ogg.dll #13
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_flush(os, og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_init(var os: tOgg_stream_state; serialno: int): int;		// ogg.dll #14
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_init(os, serialno)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_packetin(const os: tOgg_stream_state; const op: tOgg_packet): int;	// ogg.dll #15
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_packetin(os, op)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_packetout(const os: tOgg_stream_state; const op: tOgg_packet): int;	// ogg.dll #16
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_packetout(os, op)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_packetpeek(const os: tOgg_stream_state; const op: tOgg_packet): int;	// ogg.dll #17
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_packetpeek(os, op)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_pagein(const os: tOgg_stream_state; const og: tOgg_page): int;	// ogg.dll #18
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_pagein(os, og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_pageout(const os: tOgg_stream_state; const og: tOgg_page): int;	// ogg.dll #19
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_pageout(os, og)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_reset(const os: tOgg_stream_state): int;	// ogg.dll #20
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_reset(os)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_stream_reset_serialno(const os: tOgg_stream_state; serialno: int): int;	// ogg.dll #21
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_stream_reset_serialno(os, serialno)
  else
    result := OV_ERR_NO_DLL_LOADED;
end;

function ogg_sync_buffer(const oy: tOgg_sync_state; size: long): pChar;	// ogg.dll #22
begin
  if (0 < g_dllLoad_ogg_refCount) then
    result := proc_ogg_sync_buffer(oy, size)
  else
    result := nil;

⌨️ 快捷键说明

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