Home | History | Annotate | Download | only in Tremolo

Lines Matching refs:oy

580 void ogg_sync_init(ogg_sync_state *oy){
581 memset(oy,0,sizeof(*oy));
582 oy->bufferpool=ogg_buffer_create();
586 ogg_sync_state *oy=_ogg_calloc(1,sizeof(*oy));
587 memset(oy,0,sizeof(*oy));
588 oy->bufferpool=ogg_buffer_create();
589 return oy;
592 int ogg_sync_clear(ogg_sync_state *oy){
593 if(oy){
594 ogg_sync_reset(oy);
595 ogg_buffer_destroy(oy->bufferpool);
596 memset(oy,0,sizeof(*oy));
601 int ogg_sync_destroy(ogg_sync_state *oy){
602 if(oy){
603 ogg_sync_reset(oy);
604 ogg_buffer_destroy(oy->bufferpool);
605 memset(oy,0,sizeof(*oy));
606 _ogg_free(oy);
611 unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long bytes){
628 if(!oy->fifo_head){
629 oy->fifo_head=oy->fifo_tail=ogg_buffer_alloc(oy->bufferpool,bytes);
630 return oy->fifo_head->buffer->data;
634 if(oy->fifo_head->buffer->size-
635 oy->fifo_head->length-
636 oy->fifo_head->begin >= bytes)
637 return oy->fifo_head->buffer->data+
638 oy->fifo_head->length+oy->fifo_head->begin;
641 if(!oy->fifo_head->length){
642 ogg_buffer_realloc(oy->fifo_head,bytes);
643 return oy->fifo_head->buffer->data+oy->fifo_head->begin;
648 ogg_reference *new=ogg_buffer_alloc(oy->bufferpool,bytes);
649 oy->fifo_head->next=new;
650 oy->fifo_head=new;
652 return oy->fifo_head->buffer->data;
655 int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
656 if(!oy->fifo_head)return OGG_EINVAL;
657 if(oy->fifo_head->buffer->size-oy->fifo_head->length-oy->fifo_head->begin <
659 oy->fifo_head->length+=bytes;
660 oy->fifo_fill+=bytes;
694 long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
700 bytes=oy->fifo_fill;
701 oggbyte_init(&page,oy->fifo_tail);
703 if(oy->headerbytes==0){
712 oy->headerbytes=oggbyte_read1(&page,26)+27;
714 if(bytes<oy->headerbytes)goto sync_out; /* not enough for header +
716 if(oy->bodybytes==0){
719 for(i=0;i<oy->headerbytes-27;i++)
720 oy->bodybytes+=oggbyte_read1(&page,27+i);
723 if(oy->bodybytes+oy->headerbytes>bytes)goto sync_out;
732 if(chksum!=_checksum(oy->fifo_tail,oy->bodybytes+oy->headerbytes)){
747 og->header=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->headerbytes);
748 og->header_len=oy->headerbytes;
749 og->body=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->bodybytes);
750 og->body_len=oy->bodybytes;
753 oy->fifo_tail=
754 ogg_buffer_pretruncate(oy->fifo_tail,oy->headerbytes+oy->bodybytes);
755 if(!oy->fifo_tail)oy->fifo_head=0;
758 ret=oy->headerbytes+oy->bodybytes;
759 oy->unsynced=0;
760 oy->headerbytes=0;
761 oy->bodybytes=0;
762 oy->fifo_fill-=ret;
768 oy->headerbytes=0;
769 oy->bodybytes=0;
770 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,1);
774 while(oy->fifo_tail){
776 unsigned char *now=oy->fifo_tail->buffer->data+oy->fifo_tail->begin;
777 unsigned char *next=memchr(now, 'O', oy->fifo_tail->length);
782 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
787 long bytes=oy->fifo_tail->length;
789 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
792 if(!oy->fifo_tail)oy->fifo_head=0;
793 oy->fifo_fill+=ret;
810 int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
817 long ret=ogg_sync_pageseek(oy,og);
828 if(!oy->unsynced){
829 oy->unsynced=1;
839 int ogg_sync_reset(ogg_sync_state *oy){
841 ogg_buffer_release(oy->fifo_tail);
842 oy->fifo_tail=0;
843 oy->fifo_head=0;
844 oy->fifo_fill=0;
846 oy->unsynced=0;
847 oy->headerbytes=0;
848 oy->bodybytes=0;