<div dir="ltr"><div><div><div><div><div><div><div><div><div>It appears as though liboggz could be useful, as I think I only need to perform...<br><br></div><div>// rough code, some details and error checking removed brevity<br></div><div><br>oggz = oggz_open (outputFilename, OGGZ_WRITE);<br>serialno = oggz_serialno_new (oggz);<br><br></div>// build/write Opus header 'frame' here...<br><br></div>// TODO: not quite sure how to do this yet, but I <br></div>// TODO: should be able to use openenc's code for help<br><br></div><div>// now write the opus frames to ogg file...<br><br></div><div>ogg_packet op;<br><br></div>while (GetNextOpusFrame(&myData, ...))<br>{<br></div> op.packet = myData;<br></div> op.bytes = myDataLength;<br></div> op.granulepos = ???; // TODO: need to investigate this one a bit more<br></div> op.packetno = packetno++;<br><br></div> // TODO: add code to set op.b_o_s or op.e_o_s as needed<br><div><br><div><div><div><div> oggz_write_feed (oggz, &op, serialno, OGGZ_FLUSH_AFTER, NULL);<br><br></div><div> while ((n = oggz_write (oggz, /* TODO: add code to determine length */ length)) > 0);<br></div><div>}<br><br>oggz_close (oggz);<br><div><div><div><div><div><br><br></div><div>FWIW, in my scenario it might make a bit more sense to use the 'hungry mode' (callbacks) of liboggz rather than the brute force method shown above.<br></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 23, 2015 at 3:05 PM, Ralph Giles <span dir="ltr"><<a href="mailto:giles@thaumas.net" target="_blank">giles@thaumas.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 23/02/15 10:30 AM, Tony wrote:<br>
<br>
> I __think__ opus-tools' opusenc has code which can be used as a<br>
> template/sample for how to create an .Ogg file with Opus content. As<br>
> expected, it makes use of libopus and libogg.<br>
<br>
</span>Sadly that's the best option currently. As you say it's a bit<br>
complicated, although oggenc has a lot of extra support for controlling<br>
encoder options you wouldn't need if you've already got compressed frames.<br>
<br>
I keep hoping someone will contribute write support to libopusfile, but<br>
until then copying that code is your best bet. You might also check<br>
<a href="https://tools.ietf.org/html/draft-ietf-codec-oggopus" target="_blank">https://tools.ietf.org/html/draft-ietf-codec-oggopus</a> which describes the<br>
file format. Feedback on the draft from implementors is welcome.<br>
<span class="HOEnZb"><font color="#888888"><br>
-r<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Tony</div>
</div>