Johnslion Woo
2013-Apr-08 11:34 UTC
[ogg-dev] Does ogg segments include more than one Vorbis frame
Hi, Guys: Does anybody know is it allowed for the OGG segment including more than one Vorbis frame? Or should I consider about that? I am working on OGG+Vorbis player now, but met some cases that OGG segment includes some garbage bytes after one Vorbis frame, I want to know whether it's safe if I just drop the left bytes after decoding one Vorbis frame? I read the page http://xiph.org/ogg/doc/framing.html, but it only describe the case that one frame is bigger than one segment (255) and I didn't find any words on storing several small frames into one segment. So I just want to make sure of whether it's allowed. Thanks & Best Regards, Johnslion -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/ogg-dev/attachments/20130408/1055c7c2/attachment.htm
Ralph Giles
2013-Apr-08 16:18 UTC
[ogg-dev] Does ogg segments include more than one Vorbis frame
On 13-04-08 4:34 AM, Johnslion Woo wrote:> Does anybody know is it allowed for the OGG segment including more > than one Vorbis frame? Or should I consider about that?Vorbis frames (packets) are split into ogg segments, not the other way around. If the packet is < 255 bytes, it just goes in a single segment by itself. So if you have a sequence of packets with lengths of 24, 156, 720 and 203 bytes, those would be divided and packed into segments of length: 24, 156, 255,255,210, 203 You know where the boundaries between the packets are because they're where the segment length values in the lacing table are less than 255. The point of segmentation is it provides a sort of unary encoding of the packet boundaries. You can pack up to 255 segments into an ogg page, and use the lacing table to find the boundaries. This design gives a good tradeoff between header overhead and read complexity. Does that answer your question? -r
Johnslion Woo
2013-Apr-09 02:34 UTC
[ogg-dev] Does ogg segments include more than one Vorbis frame
Hi, Ralph: That's really helpful, thank you very much! Best Regards, Johnslion On Tue, Apr 9, 2013 at 12:18 AM, Ralph Giles <giles at thaumas.net> wrote:> On 13-04-08 4:34 AM, Johnslion Woo wrote: > > > Does anybody know is it allowed for the OGG segment including more > > than one Vorbis frame? Or should I consider about that? > > Vorbis frames (packets) are split into ogg segments, not the other way > around. If the packet is < 255 bytes, it just goes in a single segment > by itself. > > So if you have a sequence of packets with lengths of 24, 156, 720 and > 203 bytes, those would be divided and packed into segments of length: > > 24, 156, 255,255,210, 203 > > You know where the boundaries between the packets are because they're > where the segment length values in the lacing table are less than 255. > > The point of segmentation is it provides a sort of unary encoding of the > packet boundaries. You can pack up to 255 segments into an ogg page, and > use the lacing table to find the boundaries. This design gives a good > tradeoff between header overhead and read complexity. > > Does that answer your question? > > -r > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/ogg-dev/attachments/20130409/706bc1b0/attachment.htm