Thanks for responding,<br> So yea I was mostly getting hung up on the context switching between python and C. I see now in C how the developer needs the flexibility to packetize as he sees fit otherwise it defeats the purpose of exposing it to people writing codecs! I had to go back and read the specification, it makes more sense now...thanks for not completely flaming me.
<br>:-)<br><br><div><span class="gmail_quote">On 6/5/06, <b class="gmail_sendername">Daniel Holth</b> <<a href="mailto:dholth@fastmail.fm">dholth@fastmail.fm</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>Stephen Whiters-Ridley wrote:<br><br>> So, I abandoned the hope of using the ogg python bindings to do<br>> pure ogg container encoding. I started looking at the libogg in the
<br>> hopes of retooling the bindings to follow a better object model and<br>> it actually looks like the problem is down in libogg, not the<br>> bindings. Am I crazy or does libogg rely on libvorbis to return<br>
> ogg_packets, and that there are no functions that will build an<br>> ogg_packet for you from your own data like an array of bytes? It<br>> looks like API users are required to fill in all the meta fields of<br>
> the ogg_packet themselves? Is this correct?<br><br>Yes, the low-level libraries are all very messy with an unclear<br>separation of who owns which object. Structures invalidate when you<br>call functions (that do not warn you that this is happenning). All
<br>very confusing. When I was looking at it I concluded that it needed a<br>higher-level API to be memory safe (to not allow Python programmers to<br>segfault). My boost.python based oggpy is not safe, but this is an<br>
example of putting non-vorbis into an ogg stream:<br><br>import oggpy<br>import sys<br><br>granule = 0<br><br>os = oggpy.stream(0x00FF00FF)<br>page = oggpy.page()<br><br>pack = oggpy.userpacket("OGGText", granule, True, False)
<br>os.packetin(pack)<br><br>os.flush(page)<br>sys.stdout.write(page.header())<br>sys.stdout.write(page.body())<br><br>for data in sys.stdin.readlines():<br> if data[0] == chr(12):<br> while(os.flush(page) != 0):
<br> sys.stdout.write(page.header())<br> sys.stdout.write(page.body())<br> granule += 1<br> pack = oggpy.userpacket(data, granule, False, False)<br> os.packetin(pack)<br><br>pack = oggpy.userpacket
("", granule, False, True)<br>os.packetin(pack)<br>os.pageout(page)<br>sys.stdout.write(page.header())<br>sys.stdout.write(page.body())<br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.2.4 (Darwin)<br>Comment: Using GnuPG with Thunderbird -
<a href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a><br><br>iD8DBQFEhOaAVh4W2pVfoMsRApcJAKC1ugOh/R6g93jbMJrZObtZ49VPWACgtC1B<br>XUdRpnVF/sM8IvWOYWxoQ+4=<br>=ss9O<br>-----END PGP SIGNATURE-----<br><br></blockquote>
</div><br>