summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libtremor/framing.c27
-rw-r--r--apps/codecs/libtremor/ogg.h22
2 files changed, 32 insertions, 17 deletions
diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c
index a40e8dec65..d67708f87a 100644
--- a/apps/codecs/libtremor/framing.c
+++ b/apps/codecs/libtremor/framing.c
@@ -26,7 +26,7 @@
26 26
27/* A complete description of Ogg framing exists in docs/framing.html */ 27/* A complete description of Ogg framing exists in docs/framing.html */
28 28
29int ogg_page_version(const ogg_page *og){ 29static int ogg_page_version(const ogg_page *og){
30 return((int)(og->header[4])); 30 return((int)(og->header[4]));
31} 31}
32 32
@@ -62,7 +62,7 @@ ogg_uint32_t ogg_page_serialno(const ogg_page *og){
62 (og->header[17]<<24)); 62 (og->header[17]<<24));
63} 63}
64 64
65long ogg_page_pageno(const ogg_page *og){ 65static long ogg_page_pageno(const ogg_page *og){
66 return(og->header[18] | 66 return(og->header[18] |
67 (og->header[19]<<8) | 67 (og->header[19]<<8) |
68 (og->header[20]<<16) | 68 (og->header[20]<<16) |
@@ -87,14 +87,14 @@ more page packet), the return will be:
87 ogg_page_packets(page) ==0, 87 ogg_page_packets(page) ==0,
88 ogg_page_continued(page) !=0 88 ogg_page_continued(page) !=0
89*/ 89*/
90 90/*
91int ogg_page_packets(const ogg_page *og){ 91int ogg_page_packets(const ogg_page *og){
92 int i,n=og->header[26],count=0; 92 int i,n=og->header[26],count=0;
93 for(i=0;i<n;i++) 93 for(i=0;i<n;i++)
94 if(og->header[27+i]<255)count++; 94 if(og->header[27+i]<255)count++;
95 return(count); 95 return(count);
96} 96}
97 97*/
98 98
99#if 0 99#if 0
100/* helper to initialize lookup for direct-table CRC (illustrative; we 100/* helper to initialize lookup for direct-table CRC (illustrative; we
@@ -208,7 +208,7 @@ int ogg_stream_init(ogg_stream_state *os,int serialno){
208} 208}
209 209
210/* async/delayed error detection for the ogg_stream_state */ 210/* async/delayed error detection for the ogg_stream_state */
211int ogg_stream_check(ogg_stream_state *os){ 211static int ogg_stream_check(ogg_stream_state *os){
212 if(!os || !os->body_data) return -1; 212 if(!os || !os->body_data) return -1;
213 return 0; 213 return 0;
214} 214}
@@ -224,7 +224,7 @@ int ogg_stream_clear(ogg_stream_state *os){
224 } 224 }
225 return(0); 225 return(0);
226} 226}
227 227/*
228int ogg_stream_destroy(ogg_stream_state *os){ 228int ogg_stream_destroy(ogg_stream_state *os){
229 if(os){ 229 if(os){
230 ogg_stream_clear(os); 230 ogg_stream_clear(os);
@@ -232,7 +232,7 @@ int ogg_stream_destroy(ogg_stream_state *os){
232 } 232 }
233 return(0); 233 return(0);
234} 234}
235 235*/
236/* Helpers for ogg_stream_encode; this keeps the structure and 236/* Helpers for ogg_stream_encode; this keeps the structure and
237 what's happening fairly clear */ 237 what's happening fairly clear */
238 238
@@ -277,7 +277,7 @@ static int _os_lacing_expand(ogg_stream_state *os,int needed){
277/* Direct table CRC; note that this will be faster in the future if we 277/* Direct table CRC; note that this will be faster in the future if we
278 perform the checksum simultaneously with other copies */ 278 perform the checksum simultaneously with other copies */
279 279
280void ogg_page_checksum_set(ogg_page *og){ 280static void ogg_page_checksum_set(ogg_page *og){
281 if(og){ 281 if(og){
282 ogg_uint32_t crc_reg=0; 282 ogg_uint32_t crc_reg=0;
283 int i; 283 int i;
@@ -588,6 +588,7 @@ int ogg_sync_clear(ogg_sync_state *oy){
588 return(0); 588 return(0);
589} 589}
590 590
591/*
591int ogg_sync_destroy(ogg_sync_state *oy){ 592int ogg_sync_destroy(ogg_sync_state *oy){
592 if(oy){ 593 if(oy){
593 ogg_sync_clear(oy); 594 ogg_sync_clear(oy);
@@ -595,8 +596,8 @@ int ogg_sync_destroy(ogg_sync_state *oy){
595 } 596 }
596 return(0); 597 return(0);
597} 598}
598 599*/
599int ogg_sync_check(ogg_sync_state *oy){ 600static int ogg_sync_check(ogg_sync_state *oy){
600 if(oy->storage<0) return -1; 601 if(oy->storage<0) return -1;
601 return 0; 602 return 0;
602} 603}
@@ -748,6 +749,7 @@ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
748 Returns pointers into buffered data; invalidated by next call to 749 Returns pointers into buffered data; invalidated by next call to
749 _stream, _clear, _init, or _buffer */ 750 _stream, _clear, _init, or _buffer */
750 751
752#if 0
751int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){ 753int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
752 754
753 if(ogg_sync_check(oy))return 0; 755 if(ogg_sync_check(oy))return 0;
@@ -777,7 +779,7 @@ int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
777 779
778 } 780 }
779} 781}
780 782#endif
781/* add the incoming page to the stream state; we decompose the page 783/* add the incoming page to the stream state; we decompose the page
782 into packet segments here as well. */ 784 into packet segments here as well. */
783 785
@@ -1019,11 +1021,12 @@ int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
1019 return _packetout(os,op,0); 1021 return _packetout(os,op,0);
1020} 1022}
1021 1023
1024/*
1022void ogg_packet_clear(ogg_packet *op) { 1025void ogg_packet_clear(ogg_packet *op) {
1023 _ogg_free(op->packet); 1026 _ogg_free(op->packet);
1024 memset(op, 0, sizeof(*op)); 1027 memset(op, 0, sizeof(*op));
1025} 1028}
1026 1029*/
1027#ifdef _V_SELFTEST 1030#ifdef _V_SELFTEST
1028#include <stdio.h> 1031#include <stdio.h>
1029 1032
diff --git a/apps/codecs/libtremor/ogg.h b/apps/codecs/libtremor/ogg.h
index 1ed08a5387..dcac0c22dd 100644
--- a/apps/codecs/libtremor/ogg.h
+++ b/apps/codecs/libtremor/ogg.h
@@ -126,9 +126,11 @@ extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
126extern void oggpack_reset(oggpack_buffer *b); 126extern void oggpack_reset(oggpack_buffer *b);
127extern void oggpack_writeclear(oggpack_buffer *b); */ 127extern void oggpack_writeclear(oggpack_buffer *b); */
128extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); 128extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
129/* extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); */ 129/*
130extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
131extern long oggpack_look(oggpack_buffer *b,int bits);
132*/
130 133
131/* extern long oggpack_look(oggpack_buffer *b,int bits); */
132static inline long oggpack_look(oggpack_buffer *b,int bits){ 134static inline long oggpack_look(oggpack_buffer *b,int bits){
133 unsigned long ret; 135 unsigned long ret;
134 unsigned long m; 136 unsigned long m;
@@ -182,7 +184,9 @@ static inline void oggpack_adv(oggpack_buffer *b,int bits){
182extern void oggpack_adv1(oggpack_buffer *b); 184extern void oggpack_adv1(oggpack_buffer *b);
183extern long oggpack_read(oggpack_buffer *b,int bits); 185extern long oggpack_read(oggpack_buffer *b,int bits);
184extern long oggpack_read1(oggpack_buffer *b); 186extern long oggpack_read1(oggpack_buffer *b);
185/* extern long oggpack_bytes(oggpack_buffer *b); */ 187/*
188extern long oggpack_bytes(oggpack_buffer *b);
189*/
186static inline long oggpack_bytes(oggpack_buffer *b){ 190static inline long oggpack_bytes(oggpack_buffer *b){
187 return(b->endbyte+(b->endbit+7)/8); 191 return(b->endbyte+(b->endbit+7)/8);
188} 192}
@@ -223,13 +227,17 @@ extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
223extern int ogg_sync_init(ogg_sync_state *oy); 227extern int ogg_sync_init(ogg_sync_state *oy);
224extern int ogg_sync_clear(ogg_sync_state *oy); 228extern int ogg_sync_clear(ogg_sync_state *oy);
225extern int ogg_sync_reset(ogg_sync_state *oy); 229extern int ogg_sync_reset(ogg_sync_state *oy);
230/*
226extern int ogg_sync_destroy(ogg_sync_state *oy); 231extern int ogg_sync_destroy(ogg_sync_state *oy);
227extern int ogg_sync_check(ogg_sync_state *oy); 232extern int ogg_sync_check(ogg_sync_state *oy);
233*/
228 234
229extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); 235extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
230extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); 236extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
231extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); 237extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
238/*
232extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); 239extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
240*/
233extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); 241extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
234extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); 242extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
235extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); 243extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
@@ -240,23 +248,27 @@ extern int ogg_stream_init(ogg_stream_state *os,int serialno);
240extern int ogg_stream_clear(ogg_stream_state *os); 248extern int ogg_stream_clear(ogg_stream_state *os);
241extern int ogg_stream_reset(ogg_stream_state *os); 249extern int ogg_stream_reset(ogg_stream_state *os);
242extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); 250extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
251/*
243extern int ogg_stream_destroy(ogg_stream_state *os); 252extern int ogg_stream_destroy(ogg_stream_state *os);
244extern int ogg_stream_check(ogg_stream_state *os); 253extern int ogg_stream_check(ogg_stream_state *os);
254*/
245extern int ogg_stream_eos(ogg_stream_state *os); 255extern int ogg_stream_eos(ogg_stream_state *os);
246 256
257/*
247extern void ogg_page_checksum_set(ogg_page *og); 258extern void ogg_page_checksum_set(ogg_page *og);
248
249extern int ogg_page_version(const ogg_page *og); 259extern int ogg_page_version(const ogg_page *og);
260*/
250extern int ogg_page_continued(const ogg_page *og); 261extern int ogg_page_continued(const ogg_page *og);
251extern int ogg_page_bos(const ogg_page *og); 262extern int ogg_page_bos(const ogg_page *og);
252extern int ogg_page_eos(const ogg_page *og); 263extern int ogg_page_eos(const ogg_page *og);
253extern ogg_int64_t ogg_page_granulepos(const ogg_page *og); 264extern ogg_int64_t ogg_page_granulepos(const ogg_page *og);
254extern ogg_uint32_t ogg_page_serialno(const ogg_page *og); 265extern ogg_uint32_t ogg_page_serialno(const ogg_page *og);
266/*
255extern long ogg_page_pageno(const ogg_page *og); 267extern long ogg_page_pageno(const ogg_page *og);
256extern int ogg_page_packets(const ogg_page *og); 268extern int ogg_page_packets(const ogg_page *og);
257 269
258extern void ogg_packet_clear(ogg_packet *op); 270extern void ogg_packet_clear(ogg_packet *op);
259 271*/
260 272
261#ifdef __cplusplus 273#ifdef __cplusplus
262} 274}