diff options
author | Monty <xiphmont@xiph.org> | 2000-10-10 05:42:34 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2000-10-10 05:42:34 +0000 |
commit | 7e1955da2283fe678722f4c4d6b95dc513fa3020 (patch) | |
tree | 3d9199f41b10ebe32306011b7797145a395a94ee /src/framing.c | |
parent | fed0cad60d06c6913d07a8b6e54011014bf80ad8 (diff) | |
download | ogg-git-7e1955da2283fe678722f4c4d6b95dc513fa3020.tar.gz |
Added 'ogg_page_packets()' call. See source for comment documentation.
Monty
svn path=/trunk/ogg/; revision=721
Diffstat (limited to 'src/framing.c')
-rw-r--r-- | src/framing.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/framing.c b/src/framing.c index c0dc7e4..b7a6193 100644 --- a/src/framing.c +++ b/src/framing.c @@ -13,7 +13,7 @@ function: code raw [Vorbis] packets into framed OggSquish stream and decode Ogg streams back into raw packets - last mod: $Id: framing.c,v 1.4 2000/09/28 05:01:56 jack Exp $ + last mod: $Id: framing.c,v 1.5 2000/10/10 05:42:34 xiphmont Exp $ note: The CRC code is directly derived from public domain code by Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html @@ -35,6 +35,10 @@ int ogg_page_continued(ogg_page *og){ return((int)(og->header[5]&0x01)); } +int ogg_page_continued(ogg_page *og){ + return((int)(og->header[5]&0x01)); +} + int ogg_page_bos(ogg_page *og){ return((int)(og->header[5]&0x02)); } @@ -70,6 +74,33 @@ int ogg_page_pageno(ogg_page *og){ (og->header[21]<<24)); } + + +/* returns the number of packets that are completed on this page (if + the leading packet is begun on a previous page, but ends on this + page, it's counted */ + +/* NOTE: +If a page consists of a packet begun on a previous page, and a new +packet begun (but not completed) on this page, the return will be: + ogg_page_packets(page) ==1, + ogg_page_continued(page) !=0 + +If a page happens to be a single packet that was begun on a +previous page, and spans to the next page (in the case of a three or +more page packet), the return will be: + ogg_page_packets(page) ==0, + ogg_page_continued(page) !=0 +*/ + +int ogg_page_packets(ogg_page *og){ + int i,n=og->header[26],count=0; + for(i=0;i<n;i++) + if(og->header[27+i]==0)count++; + return(count); +} + + /* helper to initialize lookup for direct-table CRC */ static ogg_uint32_t crc_lookup[256]; |