summaryrefslogtreecommitdiff
path: root/apps/codecs/libspeex/oggframing.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libspeex/oggframing.c')
-rw-r--r--apps/codecs/libspeex/oggframing.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/apps/codecs/libspeex/oggframing.c b/apps/codecs/libspeex/oggframing.c
index 6a0ee21412..42d29502a8 100644
--- a/apps/codecs/libspeex/oggframing.c
+++ b/apps/codecs/libspeex/oggframing.c
@@ -58,16 +58,16 @@ spx_ogg_int64_t spx_ogg_page_granulepos(spx_ogg_page *og){
58 58
59int spx_ogg_page_serialno(spx_ogg_page *og){ 59int spx_ogg_page_serialno(spx_ogg_page *og){
60 return(og->header[14] | 60 return(og->header[14] |
61 (og->header[15]<<8) | 61 (og->header[15]<<8) |
62 (og->header[16]<<16) | 62 (og->header[16]<<16) |
63 (og->header[17]<<24)); 63 (og->header[17]<<24));
64} 64}
65 65
66long spx_ogg_page_pageno(spx_ogg_page *og){ 66long spx_ogg_page_pageno(spx_ogg_page *og){
67 return(og->header[18] | 67 return(og->header[18] |
68 (og->header[19]<<8) | 68 (og->header[19]<<8) |
69 (og->header[20]<<16) | 69 (og->header[20]<<16) |
70 (og->header[21]<<24)); 70 (og->header[21]<<24));
71} 71}
72 72
73 73
@@ -109,9 +109,9 @@ static spx_ogg_uint32_t _spx_ogg_crc_entry(unsigned long index){
109 for (i=0; i<8; i++) 109 for (i=0; i<8; i++)
110 if (r & 0x80000000UL) 110 if (r & 0x80000000UL)
111 r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator 111 r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
112 polynomial, although we use an 112 polynomial, although we use an
113 unreflected alg and an init/final 113 unreflected alg and an init/final
114 of 0, not 0xffffffff */ 114 of 0, not 0xffffffff */
115 else 115 else
116 r<<=1; 116 r<<=1;
117 return (r & 0xffffffffUL); 117 return (r & 0xffffffffUL);
@@ -280,7 +280,7 @@ int spx_ogg_stream_packetin(spx_ogg_stream_state *os,spx_ogg_packet *op){
280 os->body_fill-=os->body_returned; 280 os->body_fill-=os->body_returned;
281 if(os->body_fill) 281 if(os->body_fill)
282 memmove(os->body_data,os->body_data+os->body_returned, 282 memmove(os->body_data,os->body_data+os->body_returned,
283 os->body_fill); 283 os->body_fill);
284 os->body_returned=0; 284 os->body_returned=0;
285 } 285 }
286 286
@@ -350,8 +350,8 @@ int spx_ogg_stream_flush(spx_ogg_stream_state *os,spx_ogg_page *og){
350 granule_pos=0; 350 granule_pos=0;
351 for(vals=0;vals<maxvals;vals++){ 351 for(vals=0;vals<maxvals;vals++){
352 if((os->lacing_vals[vals]&0x0ff)<255){ 352 if((os->lacing_vals[vals]&0x0ff)<255){
353 vals++; 353 vals++;
354 break; 354 break;
355 } 355 }
356 } 356 }
357 }else{ 357 }else{
@@ -396,10 +396,10 @@ int spx_ogg_stream_flush(spx_ogg_stream_state *os,spx_ogg_page *og){
396 /* 32 bits of page counter (we have both counter and page header 396 /* 32 bits of page counter (we have both counter and page header
397 because this val can roll over) */ 397 because this val can roll over) */
398 if(os->pageno==-1)os->pageno=0; /* because someone called 398 if(os->pageno==-1)os->pageno=0; /* because someone called
399 stream_reset; this would be a 399 stream_reset; this would be a
400 strange thing to do in an 400 strange thing to do in an
401 encode stream, but it has 401 encode stream, but it has
402 plausible uses */ 402 plausible uses */
403 { 403 {
404 long pageno=os->pageno++; 404 long pageno=os->pageno++;
405 for(i=18;i<22;i++){ 405 for(i=18;i<22;i++){
@@ -595,7 +595,7 @@ long spx_ogg_sync_pageseek(spx_ogg_sync_state *oy,spx_ogg_page *og){
595 /* Compare */ 595 /* Compare */
596 if(memcmp(chksum,page+22,4)){ 596 if(memcmp(chksum,page+22,4)){
597 /* D'oh. Mismatch! Corrupt page (or miscapture and not a page 597 /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
598 at all) */ 598 at all) */
599 /* replace the computed checksum with the one actually read in */ 599 /* replace the computed checksum with the one actually read in */
600 memcpy(page+22,chksum,4); 600 memcpy(page+22,chksum,4);
601 601
@@ -703,17 +703,17 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){
703 if(br){ 703 if(br){
704 os->body_fill-=br; 704 os->body_fill-=br;
705 if(os->body_fill) 705 if(os->body_fill)
706 memmove(os->body_data,os->body_data+br,os->body_fill); 706 memmove(os->body_data,os->body_data+br,os->body_fill);
707 os->body_returned=0; 707 os->body_returned=0;
708 } 708 }
709 709
710 if(lr){ 710 if(lr){
711 /* segment table */ 711 /* segment table */
712 if(os->lacing_fill-lr){ 712 if(os->lacing_fill-lr){
713 memmove(os->lacing_vals,os->lacing_vals+lr, 713 memmove(os->lacing_vals,os->lacing_vals+lr,
714 (os->lacing_fill-lr)*sizeof(*os->lacing_vals)); 714 (os->lacing_fill-lr)*sizeof(*os->lacing_vals));
715 memmove(os->granule_vals,os->granule_vals+lr, 715 memmove(os->granule_vals,os->granule_vals+lr,
716 (os->lacing_fill-lr)*sizeof(*os->granule_vals)); 716 (os->lacing_fill-lr)*sizeof(*os->granule_vals));
717 } 717 }
718 os->lacing_fill-=lr; 718 os->lacing_fill-=lr;
719 os->lacing_packet-=lr; 719 os->lacing_packet-=lr;
@@ -750,13 +750,13 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){
750 os->lacing_vals[os->lacing_fill-1]==0x400){ 750 os->lacing_vals[os->lacing_fill-1]==0x400){
751 bos=0; 751 bos=0;
752 for(;segptr<segments;segptr++){ 752 for(;segptr<segments;segptr++){
753 int val=header[27+segptr]; 753 int val=header[27+segptr];
754 body+=val; 754 body+=val;
755 bodysize-=val; 755 bodysize-=val;
756 if(val<255){ 756 if(val<255){
757 segptr++; 757 segptr++;
758 break; 758 break;
759 } 759 }
760 } 760 }
761 } 761 }
762 } 762 }
@@ -775,8 +775,8 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){
775 os->granule_vals[os->lacing_fill]=-1; 775 os->granule_vals[os->lacing_fill]=-1;
776 776
777 if(bos){ 777 if(bos){
778 os->lacing_vals[os->lacing_fill]|=0x100; 778 os->lacing_vals[os->lacing_fill]|=0x100;
779 bos=0; 779 bos=0;
780 } 780 }
781 781
782 if(val<255)saved=os->lacing_fill; 782 if(val<255)saved=os->lacing_fill;