mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Merge from OGG upstream.
This commit is contained in:
parent
be32ba5cda
commit
35ba123e15
@ -1,3 +1,8 @@
|
||||
2007-07-31 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/OGG
|
||||
Merge from OGG upstream sources.
|
||||
|
||||
2007-07-25 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/FLAC
|
||||
|
@ -5,14 +5,14 @@
|
||||
* 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 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: code raw [Vorbis] packets into framed OggSquish stream and
|
||||
decode Ogg streams back into raw packets
|
||||
last mod: $Id: framing.c 9601 2005-07-23 00:19:14Z giles $
|
||||
last mod: $Id: framing.c 12446 2007-02-08 22:22:43Z xiphmont $
|
||||
|
||||
note: The CRC code is directly derived from public domain code by
|
||||
Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
|
||||
@ -268,8 +268,12 @@ void ogg_page_checksum_set(ogg_page *og){
|
||||
}
|
||||
|
||||
/* submit data to the internal buffer of the framing engine */
|
||||
int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
|
||||
int lacing_vals=op->bytes/255+1,i;
|
||||
int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
|
||||
long e_o_s, ogg_int64_t granulepos){
|
||||
|
||||
int bytes = 0, lacing_vals, i;
|
||||
for (i = 0; i < count; ++i) bytes += (int)iov[i].iov_len;
|
||||
lacing_vals=bytes/255+1;
|
||||
|
||||
if(os->body_returned){
|
||||
/* advance packet data according to the body_returned pointer. We
|
||||
@ -284,7 +288,7 @@ int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
|
||||
}
|
||||
|
||||
/* make sure we have the buffer storage */
|
||||
_os_body_expand(os,op->bytes);
|
||||
_os_body_expand(os,bytes);
|
||||
_os_lacing_expand(os,lacing_vals);
|
||||
|
||||
/* Copy in the submitted packet. Yes, the copy is a waste; this is
|
||||
@ -292,16 +296,18 @@ int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
|
||||
will actually be fairly easy to eliminate the extra copy in the
|
||||
future */
|
||||
|
||||
memcpy(os->body_data+os->body_fill,op->packet,op->bytes);
|
||||
os->body_fill+=op->bytes;
|
||||
for (i = 0; i < count; ++i) {
|
||||
memcpy(os->body_data+os->body_fill, iov[i].iov_base, iov[i].iov_len);
|
||||
os->body_fill += (int)iov[i].iov_len;
|
||||
}
|
||||
|
||||
/* Store lacing vals for this packet */
|
||||
for(i=0;i<lacing_vals-1;i++){
|
||||
os->lacing_vals[os->lacing_fill+i]=255;
|
||||
os->granule_vals[os->lacing_fill+i]=os->granulepos;
|
||||
}
|
||||
os->lacing_vals[os->lacing_fill+i]=(op->bytes)%255;
|
||||
os->granulepos=os->granule_vals[os->lacing_fill+i]=op->granulepos;
|
||||
os->lacing_vals[os->lacing_fill+i]=bytes%255;
|
||||
os->granulepos=os->granule_vals[os->lacing_fill+i]=granulepos;
|
||||
|
||||
/* flag the first segment as the beginning of the packet */
|
||||
os->lacing_vals[os->lacing_fill]|= 0x100;
|
||||
@ -311,11 +317,18 @@ int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
|
||||
/* for the sake of completeness */
|
||||
os->packetno++;
|
||||
|
||||
if(op->e_o_s)os->e_o_s=1;
|
||||
if(e_o_s)os->e_o_s=1;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
|
||||
ogg_iovec_t iov;
|
||||
iov.iov_base = op->packet;
|
||||
iov.iov_len = op->bytes;
|
||||
return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos);
|
||||
}
|
||||
|
||||
/* This will flush remaining packets into a page (returning nonzero),
|
||||
even if there is not enough data to trigger a flush normally
|
||||
(undersized page). If there are no packets or partial packets to
|
||||
@ -624,7 +637,7 @@ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
|
||||
if(!next)
|
||||
next=oy->data+oy->fill;
|
||||
|
||||
oy->returned=next-oy->data;
|
||||
oy->returned=(int)(next-oy->data);
|
||||
return(-(next-outerpage));
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
* 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 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: toplevel libogg include
|
||||
last mod: $Id: ogg.h 7188 2004-07-20 07:26:04Z xiphmont $
|
||||
last mod: $Id: ogg.h 12446 2007-02-08 22:22:43Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OGG_H
|
||||
@ -23,6 +23,11 @@ extern "C" {
|
||||
|
||||
#include <ogg/os_types.h>
|
||||
|
||||
typedef struct {
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
} ogg_iovec_t;
|
||||
|
||||
typedef struct {
|
||||
long endbyte;
|
||||
int endbit;
|
||||
@ -148,6 +153,8 @@ extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
|
||||
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
|
||||
|
||||
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
|
||||
extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
|
||||
int count, long e_o_s, ogg_int64_t granulepos);
|
||||
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
|
||||
last mod: $Id: os_types.h 11511 2006-06-03 22:30:13Z giles $
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OS_TYPES_H
|
||||
@ -27,19 +27,20 @@
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(__CYGWIN__)
|
||||
# include <_G_config.h>
|
||||
typedef _G_int64_t ogg_int64_t;
|
||||
typedef _G_int32_t ogg_int32_t;
|
||||
typedef _G_uint32_t ogg_uint32_t;
|
||||
typedef _G_int16_t ogg_int16_t;
|
||||
typedef _G_uint16_t ogg_uint16_t;
|
||||
# include <stdint.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
typedef uint64_t ogg_uint64_t;
|
||||
# elif defined(__MINGW32__)
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
typedef unsigned long long ogg_uint64_t;
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
typedef unsigned long long ogg_uint64_t;
|
||||
# elif defined(__MWERKS__)
|
||||
typedef long long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
|
Loading…
Reference in New Issue
Block a user