<p>Hi, I am creating a new ogg stream for theatrical/stage/disco lighting and am having trouble encoding my comment header with the following code in _tp_writelsbint function, it does not write the second byte to the ogg buffer. I am using windows and have created a new win32 library project with visual studio and added my code, what do i have to do to get the function working? Is there a project preset I have to change? or something else? I can manualy add to ogg buffer like&nbsp; oggpackB_write(opb, 55, 8) ok, so it&#39;s not the buffer that&#39;s the problem but the part where it&#39;s bit-shifting the second line in the function. I have taken the code from Theora library as it&#39;s closer to using libogg2 than vorbis library. Vorbis is working ok in my application but have yet to include theora. Is it my library or my application using my library that is the problem?</p>

<div>Thanks for your time.<br>Paul.<br><a href="http://www.avacodec.com">www.avacodec.com</a> - Audio Video Atmosphere</div>
<div><a href="http://www.ableton.com/forum/viewtopic.php?t=71817&amp;postdays=0&amp;postorder=asc&amp;start=75">http://www.ableton.com/forum/viewtopic.php?t=71817&amp;postdays=0&amp;postorder=asc&amp;start=75</a></div>
<p>static void _tp_writelsbint(oggpack_buffer *opb, long value)<br>{<br>&nbsp;&nbsp;&nbsp; oggpackB_write(opb, value&amp;0xFF, 8); // writes to ogg buffer ok<br>&nbsp;oggpackB_write(opb, value&gt;&gt;8&amp;0xFF, 8); // does not write to ogg buffer<br>
&nbsp;oggpackB_write(opb, value&gt;&gt;16&amp;0xFF, 8);<br>&nbsp;oggpackB_write(opb, value&gt;&gt;24&amp;0xFF, 8);<br>}</p>
<p>/* build the comment header packet from the passed metadata */<br>int libava_encode_comment(libava_state *t, libava_comment *tc, ogg_packet *op)<br>{<br>&nbsp;const char *vendor = libava_version_string();<br>&nbsp;const int vendor_length = strlen(vendor);<br>
&nbsp;CP_INSTANCE *cpi=(CP_INSTANCE *)(t-&gt;internal_encode);</p>
<p><br>#ifndef LIBOGG2<br>&nbsp;oggpackB_reset(cpi-&gt;oggbuffer);<br>#else<br>&nbsp;oggpackB_writeinit(cpi-&gt;oggbuffer, cpi-&gt;oggbufferstate);<br>#endif<br>&nbsp;oggpackB_write(cpi-&gt;oggbuffer, 0x81, 8);<br>&nbsp;_tp_writebuffer(cpi-&gt;oggbuffer, &quot;libava&quot;, 6);<br>
&nbsp;_tp_writelsbint(cpi-&gt;oggbuffer, vendor_length); </p>
<p>&nbsp;_tp_writebuffer(cpi-&gt;oggbuffer, vendor, vendor_length);</p>
<p>&nbsp;_tp_writelsbint(cpi-&gt;oggbuffer, tc-&gt;comments);<br>&nbsp;if(tc-&gt;comments){<br>&nbsp;&nbsp;int i;<br>&nbsp;&nbsp;for(i=0;i&lt;tc-&gt;comments;i++){<br>&nbsp;&nbsp;&nbsp;if(tc-&gt;user_comments[i]){<br>&nbsp;&nbsp;&nbsp;&nbsp;_tp_writelsbint(cpi-&gt;oggbuffer,tc-&gt;comment_lengths[i]);<br>
&nbsp;&nbsp;&nbsp;&nbsp;_tp_writebuffer(cpi-&gt;oggbuffer,tc-&gt;user_comments[i],tc-&gt;comment_lengths[i]);<br>&nbsp;&nbsp;&nbsp;}else{<br>&nbsp;&nbsp;&nbsp;&nbsp;oggpackB_write(cpi-&gt;oggbuffer,0,32);<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br>&nbsp;}<br>#ifndef LIBOGG2<br>&nbsp;&nbsp;op-&gt;packet=oggpackB_get_buffer(cpi-&gt;oggbuffer);<br>
#else<br>&nbsp;op-&gt;packet=oggpackB_writebuffer(cpi-&gt;oggbuffer);<br>#endif<br>&nbsp;op-&gt;bytes=oggpackB_bytes(cpi-&gt;oggbuffer);</p>
<p>&nbsp;op-&gt;b_o_s=0;<br>&nbsp;op-&gt;e_o_s=0;</p>
<p>&nbsp;op-&gt;packetno=0;<br>&nbsp;op-&gt;granulepos=0;</p>
<p>&nbsp;return (0);<br>}</p>