📄 unavorbisapi.pas
字号:
(*
----------------------------------------------
unaVorbisAPI.pas
API for Vorbis and Ogg libraries
----------------------------------------------
Delphi conversion: Aleksandr "Lake" Shamray
Public domain. No warranty.
http://lakeofsoft.com/
Copyright (c) 2002 Lake of Soft, Ltd
All rights reserved
----------------------------------------------
created by:
Lake, 02 Nov 2002
modified by:
Lake, Nov 2002
----------------------------------------------
*)
{$I unaDef.inc }
unit
unaVorbisAPI;
interface
(********************************************************************
* *
* 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-2002 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: toplevel libogg include
last mod: $Id: ogg.h,v 1.18 2002/07/13 10:28:33 giles Exp $
********************************************************************)
//#include <ogg/os_types.h>
type
pogg_int64_t = ^ogg_int64_t;
ogg_int64_t = int64;
//
ogg_int32_t = longInt;
ogg_uint32_t = longWord;
ogg_int16_t = smallInt;
{$EXTERNALSYM ulong }
ulong = ogg_uint32_t;
{$EXTERNALSYM long }
long = ogg_int32_t;
{$EXTERNALSYM int }
int = ogg_int32_t;
// -- --
pOggpack_buffer = ^tOggpack_buffer;
tOggpack_buffer = packed record
{+00}endbyte: long;
{+04}endbit: int;
//
{+08}buffer: pointer;
{+0C}ptr: pointer;
{+10}storage: long;
{+14}
end;
//* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
// -- --
pOgg_page = ^tOgg_page;
tOgg_page = packed record
{+00}header: pointer;
{+04}header_len: long;
{+08}body: pointer;
{+0C}body_len: long;
{+10}
end;
//* ogg_stream_state contains the current encode/decode state of a logical
// Ogg bitstream **********************************************************/
// -- --
pOgg_stream_state = ^tOgg_stream_state;
tOgg_stream_state = packed record
{+00}body_data: pointer; //* bytes from packet bodies */
{+04}body_storage: long; //* storage elements allocated */
{+08}body_fill: long; //* elements stored; fill mark */
{+0C}body_returned: long; //* elements of fill returned */
{+10}lacing_vals: ^int; //* The values that will go to the segment table */
{+14}granule_vals: pogg_int64_t; //* granulepos values for headers. Not compact
// this way, but it is simple coupled to the
// lacing fifo */
{+18}lacing_storage: long;
{+1C}lacing_fill: long;
{+20}lacing_packet: long;
{+24}lacing_returned: long;
{+28}header: array [0..284 - 1] of byte; //* working space for header encode */
{+144}header_fill: int;
{+148}e_o_s: int; //* set when we have buffered the last packet in the
// logical bitstream */
{+14C}b_o_s: int; //* set after we've written the initial page
// of a logical bitstream */
{+150}serialno: long;
{+154}pageno: long;
{+158}packetno: ogg_int64_t; //* sequence number for decode; the framing
//knows where there's a hole in the data,
//but we need coupling so that the codec
//(which is in a seperate abstraction
//layer) also knows about the gap */
{+160}granulepos: ogg_int64_t;
{+168}
end;
//* ogg_packet is used to encapsulate the data and metadata belonging
// to a single raw Ogg/Vorbis packet *************************************/
// -- --
pOgg_packet = ^tOgg_packet;
tOgg_packet = packed record
packet: pointer;
bytes: long;
b_o_s: long;
e_o_s: long;
//
granulepos: ogg_int64_t;
packetno: ogg_int64_t; ///* sequence number for decode; the framing
// knows where there's a hole in the data,
// but we need coupling so that the codec
// (which is in a seperate abstraction
// layer) also knows about the gap */
{+20}
end;
// -- --
pOgg_sync_state = ^tOgg_sync_state;
tOgg_sync_state = packed record
data: pointer;
storage: int;
fill: int;
returned: int;
//
unsynced: int;
headerbytes: int;
bodybytes: int;
end;
//* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
//extern void oggpack_writeinit(oggpack_buffer *b);
toggpack_writeinit = procedure(const b: tOggpack_buffer); cdecl;
//extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
toggpack_writetrunc = procedure(const b: tOggpack_buffer; bits: long); cdecl;
//extern void oggpack_writealign(oggpack_buffer *b);
toggpack_writealign = procedure(const b: tOggpack_buffer); cdecl;
//extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
toggpack_writecopy = procedure(const b: tOggpack_buffer; source: pointer; bits: long); cdecl;
//extern void oggpack_reset(oggpack_buffer *b);
toggpack_reset = procedure(const b: tOggpack_buffer); cdecl;
//extern void oggpack_writeclear(oggpack_buffer *b);
toggpack_writeclear = procedure(const b: tOggpack_buffer); cdecl;
//extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
toggpack_readinit = procedure(const b: tOggpack_buffer; buf: pointer; bytes: int); cdecl;
//extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
toggpack_write = procedure(const b: tOggpack_buffer; value: ulong; bits: int); cdecl;
//extern long oggpack_look(oggpack_buffer *b,int bits);
toggpack_look = function(const b: tOggpack_buffer; bits: int): long; cdecl;
//extern long oggpack_look1(oggpack_buffer *b);
toggpack_look1 = function(const b: tOggpack_buffer; bits: int): long; cdecl;
//extern void oggpack_adv(oggpack_buffer *b,int bits);
toggpack_adv = procedure(const b: tOggpack_buffer; bits: int); cdecl;
//extern void oggpack_adv1(oggpack_buffer *b);
toggpack_adv1 = procedure(const b: tOggpack_buffer); cdecl;
//extern long oggpack_read(oggpack_buffer *b,int bits);
toggpack_read = function(const b: tOggpack_buffer; bits: int): long; cdecl;
//extern long oggpack_read1(oggpack_buffer *b);
toggpack_read1 = function(const b: tOggpack_buffer): long; cdecl;
//extern long oggpack_bytes(oggpack_buffer *b);
toggpack_bytes = function(const b: tOggpack_buffer): long; cdecl;
//extern long oggpack_bits(oggpack_buffer *b);
toggpack_bits = function(const b: tOggpack_buffer): long; cdecl;
//extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
toggpack_get_buffer = function(const b: tOggpack_buffer): pointer; cdecl;
///* Ogg BITSTREAM PRIMITIVES: encoding **************************/
//extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
togg_stream_packetin = function(const os: tOgg_stream_state; const op: tOgg_packet): int; cdecl;
//extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
togg_stream_pageout = function(const os: tOgg_stream_state; const og: tOgg_page): int; cdecl;
//extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
togg_stream_flush = function(const os: tOgg_stream_state; const og: tOgg_page): int; cdecl;
///* Ogg BITSTREAM PRIMITIVES: decoding **************************/
//extern int ogg_sync_init(ogg_sync_state *oy);
togg_sync_init = function(var oy: tOgg_sync_state): int; cdecl;
//extern int ogg_sync_clear(ogg_sync_state *oy);
togg_sync_clear = function(const oy: tOgg_sync_state): int; cdecl;
//extern int ogg_sync_reset(ogg_sync_state *oy);
togg_sync_reset = function(const oy: tOgg_sync_state): int; cdecl;
//extern int ogg_sync_destroy(ogg_sync_state *oy);
togg_sync_destroy = function(var oy: tOgg_sync_state): int; cdecl;
//extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
togg_sync_buffer = function(const oy: tOgg_sync_state; size: long): pChar; cdecl;
//extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
togg_sync_wrote = function(const oy: tOgg_sync_state; bytes: long): int; cdecl;
//extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
togg_sync_pageseek = function(const oy: tOgg_sync_state; const og: tOgg_page): long; cdecl;
//extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
togg_sync_pageout = function(const oy: tOgg_sync_state; const og: tOgg_page): int; cdecl;
//extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
togg_stream_pagein = function(const os: tOgg_stream_state; const og: tOgg_page): int; cdecl;
//extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
togg_stream_packetout = function(const os: tOgg_stream_state; const op: tOgg_packet): int; cdecl;
//extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
togg_stream_packetpeek = function(const os: tOgg_stream_state; const op: tOgg_packet): int; cdecl;
//* Ogg BITSTREAM PRIMITIVES: general ***************************/
//extern int ogg_stream_init(ogg_stream_state *os,int serialno);
togg_stream_init = function(var os: tOgg_stream_state; serialno: int): int; cdecl;
//extern int ogg_stream_clear(ogg_stream_state *os);
togg_stream_clear = function(const os: tOgg_stream_state): int; cdecl;
//extern int ogg_stream_reset(ogg_stream_state *os);
togg_stream_reset = function(const os: tOgg_stream_state): int; cdecl;
//extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
togg_stream_reset_serialno = function(const os: tOgg_stream_state; serialno: int): int; cdecl;
//extern int ogg_stream_destroy(ogg_stream_state *os);
togg_stream_destroy = function(const os: tOgg_stream_state): int; cdecl;
//extern int ogg_stream_eos(ogg_stream_state *os);
togg_stream_eos = function(const os: tOgg_stream_state): int; cdecl;
//extern void ogg_page_checksum_set(ogg_page *og);
togg_page_checksum_set = procedure(const og: tOgg_page); cdecl;
//extern int ogg_page_version(ogg_page *og);
togg_page_version = function(const og: tOgg_page): int; cdecl;
//extern int ogg_page_continued(ogg_page *og);
togg_page_continued = function(const og: tOgg_page): int; cdecl;
//extern int ogg_page_bos(ogg_page *og);
togg_page_bos = function(const og: tOgg_page): int; cdecl;
//extern int ogg_page_eos(ogg_page *og);
togg_page_eos = function(const og: tOgg_page): int; cdecl;
//extern ogg_int64_t ogg_page_granulepos(ogg_page *og);
togg_page_granulepos = function(const og: tOgg_page): ogg_int64_t; cdecl;
//extern int ogg_page_serialno(ogg_page *og);
togg_page_serialno = function(const og: tOgg_page): int; cdecl;
//extern long ogg_page_pageno(ogg_page *og);
togg_page_pageno = function(const og: tOgg_page): long; cdecl;
//extern int ogg_page_packets(ogg_page *og);
togg_page_packets = function(const og: tOgg_page): int; cdecl;
//extern void ogg_packet_clear(ogg_packet *op);
togg_packet_clear = procedure(const op: tOgg_packet); cdecl;
//-----------------------------------------
procedure oggpack_writeinit(const b: tOggpack_buffer);
procedure oggpack_writetrunc(const b: tOggpack_buffer; bits: long);
procedure oggpack_writealign(const b: tOggpack_buffer);
procedure oggpack_writecopy(const b: tOggpack_buffer; source: pointer; bits: long);
procedure oggpack_reset(const b: tOggpack_buffer);
procedure oggpack_writeclear(const b: tOggpack_buffer);
procedure oggpack_readinit(const b: tOggpack_buffer; buf: pointer; bytes: int);
procedure oggpack_write(const b: tOggpack_buffer; value: ulong; bits: int);
function oggpack_look(const b: tOggpack_buffer; bits: int): long;
function oggpack_look1(const b: tOggpack_buffer; bits: int): long;
procedure oggpack_adv(const b: tOggpack_buffer; bits: int);
procedure oggpack_adv1(const b: tOggpack_buffer);
function oggpack_read(const b: tOggpack_buffer; bits: int): long;
function oggpack_read1(const b: tOggpack_buffer): long;
function oggpack_bytes(const b: tOggpack_buffer): long;
function oggpack_bits(const b: tOggpack_buffer): long;
function oggpack_get_buffer(const b: tOggpack_buffer): pointer;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -