Bob Ingraham
2013-May-20 16:28 UTC
[ogg-dev] libfishsound/liboggz: How to properly set e_o_s marker when encoding?
Perhaps I am really dense, but after writing an app to encode multi-stream audio files using libfishsound and liboggz, I cannot figure out a way to reliably determine the which packet is the FINAL packet output from the encoder, so I can set the e_o_s flag on it. What is the magic for determining WHEN to set the e_o_s marker on a packet in the FishSoundEncoded callback function? Even though I know when I write the last audio buffer with fish_sound_encode_float(), I don't know how many packets my FishSoundEncoded callback will receive as a result. Therefore, how can I know which packet is indeed the last and therefore set the e_o_s flag appropriately? There seems to me no mechanism within FishSound to do this. After thinking about it, I decided a good approach might be: a. fish_sound_flush() b. Let the callback queue all remaining packets via oggz_write_feed() c. Manually set the e_o_s packet on the final packet in each oggz internal stream queue. d. Call oggz_run() to flush the queues to the output file. Of course, this requires creating my own oggz function in order to gain access to the internal per-stream queues. But before I go that route: a. Is this the best way to accomplish e_o_s handling? b. Is the un-exported oggz_set_eos() function supposed to be used for this purpose? It's there along with oggz_get_eos(), but is undocumented and un-exported. Any helpful insights will be much appreciated. Regards, Bob Ingraham