Using libvorbis (1.3.5) I wish to extract the raw vorbis packets. I've built some simple code on the excellent libvorbis API overview on the xiph.org site, but the example relies on the ogg_packet struct for final output and input to decoder, and shows now examples on how to do without it. Taking a look at the vorbis_bitstream_flush() function, which in the overview is the last step before output, it seems that there is an oggpack_buffer in an array of buffers internal to vorbis_block: (*vorbis_block.internal)(vorbis_block.internal)->packetblob[PACKETBLOBS / 2] (PACKETBLOBS = 15, the macro is not commented, so don't know what this is). This is the output of a encoder pass from gdb: (gdb) p *vbi $3 = {pcmdelay = 0x647140, ampmax = -58.0271301, blocktype = 0, packetblob = {0x6473c0, 0x647500, 0x647640, 0x647780, 0x6478c0, 0x647a00, 0x647b40, 0x7fffffffdeb8, 0x647d90, 0x647ed0, 0x648010, 0x648150, 0x648290, 0x6483d0, 0x648510}} The stack address is the "oggpack_buffer index" in question. I can't find this address anywhere else (on the surface): vorbis_block: (gdb) p vblk $4 = {pcm = 0x643770, opb = {endbyte = 117, endbit = 0, buffer = 0x647c80 "\354*\020\003QQi~\352\306\061\356TޮSD\271\235g\257\267է\273_/;\255\231 \232Xk^;2- \352\352X{\275\246\365\f\a\255W6\371f_=a~\302\337\365\343׆?Jj\210\262\3 71\245\367u\266z\257\325\334T\355\365\200\327T\346\a%\255r\313\361PF\23 1\016\311\323\353\032U\177\247W9\344ĴU\262\tc\321\360\234)ǔ_z)", ptr 0x647cf5 "", storage = 256}, lW = 0, W = 0, nW = 0, pcmend = 512, mode = 0, eofflag = 0, granulepos = 0, sequence = 3, vd = 0x7fffffffde20, localstore = 0x64a380, localtop = 64, localalloc = 64, totaluse = 7376, reap = 0x64a360, glue_bits = 0, time_bits = 0, floor_bits = 0, res_bits = 0, internal = 0x647330} vorbis_dsp_state: (gdb) p vdsps $10 = {analysisp = 1, vi = 0x7fffffffdde0, pcm = 0x642750, pcmret 0x642770, pcm_storage = 221012, pcm_current = 55376, pcm_returned = 0, preextrapolate = 1, eofflag = 0, lW = 0, W = 0, nW = 0, centerW = 512, granulepos = 256, sequence = 4, glue_bits = 0, time_bits = 0, floor_bits = 0, res_bits = 0, backend_state = 0x608790} ==== oggpack_buffer comes from ogg/ogg.h, so I guess it may add some things not native to "pure" vorbis. Am I to understand that I am dependent on the ogg library to get data in and out? And if not, where can I get the data along with the minimal metadata I need? (bytes, granulepos?)
.... although I see now that the address of vorbis_block.buffer is 0x647c80, which at least fits between 0x647b40 and 0x647d90 in the vorbis_block_internal packetblob array, which is occupied by the "stack address" for the aformentioned oggpack_buffer, and whose addresses otherwise are pretty contiguous. Maybe that has some significance? -------------- next part -------------- An embedded message was scrubbed... From: Miscellaneous <accounts-misc at holbrook.no> Subject: [Vorbis-dev] libvorbis without encapulsation Date: Mon, 06 Feb 2017 09:37:29 +0100 Size: 5054 URL: <http://lists.xiph.org/pipermail/vorbis-dev/attachments/20170206/bda57b60/attachment.mht>
L'octidi 18 pluviôse, an CCXXV, Miscellaneous a écrit :> I've built some simple code on the excellent libvorbis API overview on > the xiph.org site, but the example relies on the ogg_packet struct for > final output and input to decoder, and shows now examples on how to do > without it.Why do you not want it? It is just a simple C struct to carry the packet's metadata.> oggpack_buffer comes from ogg/ogg.h, so I guess it may add some things > not native to "pure" vorbis.That looks like speculation.> Am I to understand that I am dependent on the ogg library to get data > in and out? And if not, where can I get the data along with the minimal > metadata I need? (bytes, granulepos?)libvorbis depends on libogg for some tasks, but that is its internal workings. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: Digital signature URL: <http://lists.xiph.org/pipermail/vorbis-dev/attachments/20170206/e5d9abde/attachment.sig>
On Mon, 2017-02-06 at 09:58 +0100, Nicolas George wrote:> L'octidi 18 pluviôse, an CCXXV, Miscellaneous a écrit : > > > > I've built some simple code on the excellent libvorbis API overview > > on > > the xiph.org site, but the example relies on the ogg_packet struct > > for > > final output and input to decoder, and shows now examples on how to > > do > > without it. > Why do you not want it? It is just a simple C struct to carry the > packet's metadata.Ok. The RLP draft mentioned on the libvorbis docs page, are there sample implementations (in C) of this yet anywhere? And would such an implementation then also use this ogg struct as an intermediary?> > > > > oggpack_buffer comes from ogg/ogg.h, so I guess it may add some > > things > > not native to "pure" vorbis. > That looks like speculation. >I didn't say it does, I said it "may" ;) Cheers> > > > Am I to understand that I am dependent on the ogg library to get > > data > > in and out? And if not, where can I get the data along with the > > minimal > > metadata I need? (bytes, granulepos?) > libvorbis depends on libogg for some tasks, but that is its internal > workings. > > Regards, >