[vorbis] Ogg in MP4 file, Unexpected result from _vorbis_unpack_books
Peter.Maersk-Moller at ebone.net
Thu Mar 14 04:56:38 PST 2002
<p>Thanks for the fast response.
> >Can anybody tell me if I'm using the libs in a way they are not suppose to ?
> >Is it invalid to hand over the raw ogg_packets the way I do it ?
> You may certainly hand over ogg_packets as they are as long as they remain
> valid. There are various things you can do to make an existing packet
> become invalid, though (because the libraries are managing their memory
> internally rather than forcing the application to do it). You probably
> need to make a copy of the packet (i.e. create a new ogg_packet structure,
> and make a copy of the data in it).
> You're most likely hitting this: calling vorbis_analysis_buffer (which is
> called from vorbis_analysis_wrote()) will invalidate the header packets
> (it frees the memory associated with the headers).
Not sure i completely understand. Are you saying, that my 3 ogg packets
(header, header_comment and header_code) becomes invalid (or the data
that the pointer packet within the ogg_packet points to) when I submit
sampled audio using vorbis_analysis_wrote ?
> Similarly, a non-header packet will become invalidated on a call to one
> of the analysis functions (not sure which offhand, but as a general rule:
> finish with one packet before you ask libvorbis to produce the next - then
> you'll be safe).
In my case I continously adds data in thread one by calling
In thread two I do this
a) ogg packet header (previously submitted to ogg_stream_packet in) is saved in
a MP4 file.
b) ogg packet header_comment (previously submitted to ogg_stream_packet in) is
added to the MP4 file.
c) ogg packet header_code (previously submitted to ogg_stream_packet in) is
added to the MP4 file.
d) as long as ogg_stream_flush produces a page, then save header and body
of the produced page in an .ogg file
In principle, the rest of the code in thread two (which extract blocks, extracts
packets from blocks and submit packets to the MP4 file and then submits packets
to stream and then extracts pages to save in .ogg file) ought not matter, because
while trying to decode the saved data in MP4 file I get an error trying to install
the code book
Question #1) Adding data in thread one ought not invalidate the ogg packets
header, header_comment and header_code. True or false ?
Remark: Since writing the ogg packets (header, header_comment and header_code)
to MP4 file before submitting them to the stream (packetin), then they ought to
Assumed the described procedure above is correct, then am I doing the right
thing in the player if I do this
a) get the first ogg packet (the header) from the MP4 file, adjust the
a1) call vorbis_info_init
a2) call vorbis_comment_init
a3) call vorbis_synthesis_headerin using the first packet
b) get the second packet (the header_comment), adjust the packet pointer
b1) call vorbis_synthesis_headerin using the second packet
c) get the third packet (the code book), adjust the packet pointer
b1) call vorbis_synthesis_headerin using the third packet
Can't really see why vorbis_synthesis_headerin using the third packet
fails as described in my first mail.
Suggestions are welcome
> Making copies of the packets isn't terribly efficient, but it's the easy
> way to get this stuff working, if this is your problem (it probably is).
I will try this, but as described above, I can't really see why it should fail.
> Feel free to ask again if this doesn't explain the problems you're having.
Thanks. See questions above.
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis