[vorbis] Ogg in MP4 file, Unexpected result from _vorbis_unpack_books

Michael Smith msmith at labyrinth.net.au
Thu Mar 14 05:24:17 PST 2002



>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 ?

Yes.

>In my case I continously adds data in thread one by calling
>
>  a) vorbis_analysis_buffer
>  b) vorbis_analysis_wrote
>
>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

It isn't clear how you have an ogg_packet at this point - you've submitted
it to the stream using ogg_stream_packetin() - are you now using the same
ogg_packet structure, or are you extracting it from the stream again?
If the former, then that's probably the problem - you'll need to do all
sorts of stuff to make this work as you want across threads - doing so
is not recommended (because it shouldn't be needed, it'll just be more 
complexity), though it's certainly possible.

>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
>be valid.

False.

If you've written them to the stream, then it's safe and valid to use
the data produced from the stream (using ogg_stream_pageout(), etc.)
It is NOT safe or valid to use the ogg_packet structure you've submitted
to the stream elsewhere, if you call vorbis_analysis_wrote() (and possibly
some other analysis functions) again before doing so (which is likely, 
since that's happening in another thread).

>
>Assumed the described procedure above is correct, then am I doing the right
>thing in the player if I do this
<snip>
>Can't really see why vorbis_synthesis_headerin using the third packet
>fails as described in my first mail.

What does "adjust packet pointer" mean, exactly, in this case? It's not
clear. However, your problem remains, as I suggested before, the use
of invalidated packets.

Michael

<p><p>--- >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 mailing list