[Vorbis-dev] ogg only encoding

Stephen Whiters-Ridley s7ephen at gmail.com
Mon Jun 5 22:06:22 PDT 2006


Thanks for responding,
  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.
:-)

On 6/5/06, Daniel Holth <dholth at fastmail.fm> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Stephen Whiters-Ridley wrote:
>
> > So, I abandoned the hope of using the ogg python bindings to do
> > pure ogg container encoding. I started looking at the libogg in the
> > hopes of retooling the bindings to follow a better object model and
> > it actually looks like the problem is down in libogg, not the
> > bindings. Am I crazy or does libogg rely on libvorbis to return
> > ogg_packets, and that there are no functions that will build an
> > ogg_packet for you from your own data like an array of bytes? It
> > looks like API users are required to fill in all the meta fields of
> > the ogg_packet themselves? Is this correct?
>
> Yes, the low-level libraries are all very messy with an unclear
> separation of who owns which object. Structures invalidate when you
> call functions (that do not warn you that this is happenning). All
> very confusing. When I was looking at it I concluded that it needed a
> higher-level API to be memory safe (to not allow Python programmers to
> segfault). My boost.python based oggpy is not safe, but this is an
> example of putting non-vorbis into an ogg stream:
>
> import oggpy
> import sys
>
> granule  = 0
>
> os = oggpy.stream(0x00FF00FF)
> page = oggpy.page()
>
> pack = oggpy.userpacket("OGGText", granule, True, False)
> os.packetin(pack)
>
> os.flush(page)
> sys.stdout.write(page.header())
> sys.stdout.write(page.body())
>
> for data in sys.stdin.readlines():
>     if data[0] == chr(12):
>         while(os.flush(page) != 0):
>             sys.stdout.write(page.header())
>             sys.stdout.write(page.body())
>     granule += 1
>     pack = oggpy.userpacket(data, granule, False, False)
>     os.packetin(pack)
>
> pack = oggpy.userpacket("", granule, False, True)
> os.packetin(pack)
> os.pageout(page)
> sys.stdout.write(page.header())
> sys.stdout.write(page.body())
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (Darwin)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFEhOaAVh4W2pVfoMsRApcJAKC1ugOh/R6g93jbMJrZObtZ49VPWACgtC1B
> XUdRpnVF/sM8IvWOYWxoQ+4=
> =ss9O
> -----END PGP SIGNATURE-----
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20060606/d1d09f76/attachment.html


More information about the Vorbis-dev mailing list