Lines Matching refs:oy
557 int ogg_sync_init(ogg_sync_state *oy){ in ogg_sync_init() argument
558 if(oy){ in ogg_sync_init()
559 oy->storage = -1; /* used as a readiness flag */ in ogg_sync_init()
560 memset(oy,0,sizeof(*oy)); in ogg_sync_init()
566 int ogg_sync_clear(ogg_sync_state *oy){ in ogg_sync_clear() argument
567 if(oy){ in ogg_sync_clear()
568 if(oy->data)_ogg_free(oy->data); in ogg_sync_clear()
569 memset(oy,0,sizeof(*oy)); in ogg_sync_clear()
574 int ogg_sync_destroy(ogg_sync_state *oy){ in ogg_sync_destroy() argument
575 if(oy){ in ogg_sync_destroy()
576 ogg_sync_clear(oy); in ogg_sync_destroy()
577 _ogg_free(oy); in ogg_sync_destroy()
582 int ogg_sync_check(ogg_sync_state *oy){ in ogg_sync_check() argument
583 if(oy->storage<0) return -1; in ogg_sync_check()
587 char *ogg_sync_buffer(ogg_sync_state *oy, long size){ in ogg_sync_buffer() argument
588 if(ogg_sync_check(oy)) return NULL; in ogg_sync_buffer()
591 if(oy->returned){ in ogg_sync_buffer()
592 oy->fill-=oy->returned; in ogg_sync_buffer()
593 if(oy->fill>0) in ogg_sync_buffer()
594 memmove(oy->data,oy->data+oy->returned,oy->fill); in ogg_sync_buffer()
595 oy->returned=0; in ogg_sync_buffer()
598 if(size>oy->storage-oy->fill){ in ogg_sync_buffer()
600 long newsize=size+oy->fill+4096; /* an extra page to be nice */ in ogg_sync_buffer()
603 if(oy->data) in ogg_sync_buffer()
604 ret=_ogg_realloc(oy->data,newsize); in ogg_sync_buffer()
608 ogg_sync_clear(oy); in ogg_sync_buffer()
611 oy->data=ret; in ogg_sync_buffer()
612 oy->storage=newsize; in ogg_sync_buffer()
616 return((char *)oy->data+oy->fill); in ogg_sync_buffer()
619 int ogg_sync_wrote(ogg_sync_state *oy, long bytes){ in ogg_sync_wrote() argument
620 if(ogg_sync_check(oy))return -1; in ogg_sync_wrote()
621 if(oy->fill+bytes>oy->storage)return -1; in ogg_sync_wrote()
622 oy->fill+=bytes; in ogg_sync_wrote()
636 long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){ in ogg_sync_pageseek() argument
637 unsigned char *page=oy->data+oy->returned; in ogg_sync_pageseek()
639 long bytes=oy->fill-oy->returned; in ogg_sync_pageseek()
641 if(ogg_sync_check(oy))return 0; in ogg_sync_pageseek()
643 if(oy->headerbytes==0){ in ogg_sync_pageseek()
656 oy->bodybytes+=page[27+i]; in ogg_sync_pageseek()
657 oy->headerbytes=headerbytes; in ogg_sync_pageseek()
660 if(oy->bodybytes+oy->headerbytes>bytes)return(0); in ogg_sync_pageseek()
673 log.header_len=oy->headerbytes; in ogg_sync_pageseek()
674 log.body=page+oy->headerbytes; in ogg_sync_pageseek()
675 log.body_len=oy->bodybytes; in ogg_sync_pageseek()
692 unsigned char *page=oy->data+oy->returned; in ogg_sync_pageseek()
697 og->header_len=oy->headerbytes; in ogg_sync_pageseek()
698 og->body=page+oy->headerbytes; in ogg_sync_pageseek()
699 og->body_len=oy->bodybytes; in ogg_sync_pageseek()
702 oy->unsynced=0; in ogg_sync_pageseek()
703 oy->returned+=(bytes=oy->headerbytes+oy->bodybytes); in ogg_sync_pageseek()
704 oy->headerbytes=0; in ogg_sync_pageseek()
705 oy->bodybytes=0; in ogg_sync_pageseek()
711 oy->headerbytes=0; in ogg_sync_pageseek()
712 oy->bodybytes=0; in ogg_sync_pageseek()
717 next=oy->data+oy->fill; in ogg_sync_pageseek()
719 oy->returned=(int)(next-oy->data); in ogg_sync_pageseek()
734 int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){ in ogg_sync_pageout() argument
736 if(ogg_sync_check(oy))return 0; in ogg_sync_pageout()
743 long ret=ogg_sync_pageseek(oy,og); in ogg_sync_pageout()
754 if(!oy->unsynced){ in ogg_sync_pageout()
755 oy->unsynced=1; in ogg_sync_pageout()
896 int ogg_sync_reset(ogg_sync_state *oy){ in ogg_sync_reset() argument
897 if(ogg_sync_check(oy))return -1; in ogg_sync_reset()
899 oy->fill=0; in ogg_sync_reset()
900 oy->returned=0; in ogg_sync_reset()
901 oy->unsynced=0; in ogg_sync_reset()
902 oy->headerbytes=0; in ogg_sync_reset()
903 oy->bodybytes=0; in ogg_sync_reset()
1008 ogg_sync_state oy; variable
1470 ogg_sync_reset(&oy); in test_pack()
1523 char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len); in test_pack()
1539 ogg_sync_wrote(&oy,next-buf); in test_pack()
1542 int ret=ogg_sync_pageout(&oy,&og_de); in test_pack()
1637 ogg_sync_init(&oy); in main()
1808 ogg_sync_reset(&oy); in main()
1811 memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header, in main()
1813 ogg_sync_wrote(&oy,og[i].header_len); in main()
1814 memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len); in main()
1815 ogg_sync_wrote(&oy,og[i].body_len); in main()
1818 ogg_sync_pageout(&oy,&temp); in main()
1820 ogg_sync_pageout(&oy,&temp); in main()
1822 ogg_sync_pageout(&oy,&temp); in main()
1824 ogg_sync_pageout(&oy,&temp); in main()
1857 ogg_sync_reset(&oy); in main()
1860 memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header, in main()
1862 ogg_sync_wrote(&oy,og[i].header_len); in main()
1863 memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len); in main()
1864 ogg_sync_wrote(&oy,og[i].body_len); in main()
1867 ogg_sync_pageout(&oy,&temp); in main()
1869 ogg_sync_pageout(&oy,&temp); in main()
1871 ogg_sync_pageout(&oy,&temp); in main()
1873 ogg_sync_pageout(&oy,&temp); in main()
1875 ogg_sync_pageout(&oy,&temp); in main()
1912 ogg_sync_reset(&oy); in main()
1913 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, in main()
1915 ogg_sync_wrote(&oy,3); in main()
1916 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
1919 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3, in main()
1921 ogg_sync_wrote(&oy,20); in main()
1922 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
1925 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23, in main()
1927 ogg_sync_wrote(&oy,5); in main()
1928 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
1932 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28, in main()
1934 ogg_sync_wrote(&oy,og[1].header_len-28); in main()
1935 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
1937 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000); in main()
1938 ogg_sync_wrote(&oy,1000); in main()
1939 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
1941 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000, in main()
1943 ogg_sync_wrote(&oy,og[1].body_len-1000); in main()
1944 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()
1953 ogg_sync_reset(&oy); in main()
1955 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, in main()
1957 ogg_sync_wrote(&oy,og[1].header_len); in main()
1959 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, in main()
1961 ogg_sync_wrote(&oy,og[1].body_len); in main()
1963 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, in main()
1965 ogg_sync_wrote(&oy,20); in main()
1966 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()
1967 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
1969 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20, in main()
1971 ogg_sync_wrote(&oy,og[1].header_len-20); in main()
1972 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, in main()
1974 ogg_sync_wrote(&oy,og[1].body_len); in main()
1975 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()
1984 ogg_sync_reset(&oy); in main()
1987 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, in main()
1989 ogg_sync_wrote(&oy,og[1].body_len); in main()
1991 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, in main()
1993 ogg_sync_wrote(&oy,og[1].header_len); in main()
1995 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, in main()
1997 ogg_sync_wrote(&oy,og[1].body_len); in main()
1999 memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, in main()
2001 ogg_sync_wrote(&oy,20); in main()
2002 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
2003 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()
2004 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
2006 memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20, in main()
2008 ogg_sync_wrote(&oy,og[2].header_len-20); in main()
2009 memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, in main()
2011 ogg_sync_wrote(&oy,og[2].body_len); in main()
2012 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()
2021 ogg_sync_reset(&oy); in main()
2023 memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, in main()
2025 ogg_sync_wrote(&oy,og[1].header_len); in main()
2027 memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, in main()
2029 ogg_sync_wrote(&oy,og[1].body_len); in main()
2031 memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, in main()
2033 ogg_sync_wrote(&oy,og[2].header_len); in main()
2035 memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, in main()
2037 ogg_sync_wrote(&oy,og[2].header_len); in main()
2039 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()
2041 memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, in main()
2043 ogg_sync_wrote(&oy,og[2].body_len-5); in main()
2045 memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header, in main()
2047 ogg_sync_wrote(&oy,og[3].header_len); in main()
2049 memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body, in main()
2051 ogg_sync_wrote(&oy,og[3].body_len); in main()
2053 if(ogg_sync_pageout(&oy,&og_de)>0)error(); in main()
2054 if(ogg_sync_pageout(&oy,&og_de)<=0)error(); in main()