[Vorbis] Problem creating ogg comment header for theatrical/stage/disco lighting stream
paul griffiths
avalightingstudio at googlemail.com
Mon Mar 31 04:08:35 PDT 2008
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 oggpackB_write(opb, 55, 8) ok, so it's
not the buffer that's the problem but the part where it's bit-shifting the
second line in the function. I have taken the code from Theora library as
it'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?
Thanks for your time.
Paul.
www.avacodec.com - Audio Video Atmosphere
http://www.ableton.com/forum/viewtopic.php?t=71817&postdays=0&postorder=asc&start=75
static void _tp_writelsbint(oggpack_buffer *opb, long value)
{
oggpackB_write(opb, value&0xFF, 8); // writes to ogg buffer ok
oggpackB_write(opb, value>>8&0xFF, 8); // does not write to ogg buffer
oggpackB_write(opb, value>>16&0xFF, 8);
oggpackB_write(opb, value>>24&0xFF, 8);
}
/* build the comment header packet from the passed metadata */
int libava_encode_comment(libava_state *t, libava_comment *tc, ogg_packet
*op)
{
const char *vendor = libava_version_string();
const int vendor_length = strlen(vendor);
CP_INSTANCE *cpi=(CP_INSTANCE *)(t->internal_encode);
#ifndef LIBOGG2
oggpackB_reset(cpi->oggbuffer);
#else
oggpackB_writeinit(cpi->oggbuffer, cpi->oggbufferstate);
#endif
oggpackB_write(cpi->oggbuffer, 0x81, 8);
_tp_writebuffer(cpi->oggbuffer, "libava", 6);
_tp_writelsbint(cpi->oggbuffer, vendor_length);
_tp_writebuffer(cpi->oggbuffer, vendor, vendor_length);
_tp_writelsbint(cpi->oggbuffer, tc->comments);
if(tc->comments){
int i;
for(i=0;i<tc->comments;i++){
if(tc->user_comments[i]){
_tp_writelsbint(cpi->oggbuffer,tc->comment_lengths[i]);
_tp_writebuffer(cpi->oggbuffer,tc->user_comments[i],tc->comment_lengths[i]);
}else{
oggpackB_write(cpi->oggbuffer,0,32);
}
}
}
#ifndef LIBOGG2
op->packet=oggpackB_get_buffer(cpi->oggbuffer);
#else
op->packet=oggpackB_writebuffer(cpi->oggbuffer);
#endif
op->bytes=oggpackB_bytes(cpi->oggbuffer);
op->b_o_s=0;
op->e_o_s=0;
op->packetno=0;
op->granulepos=0;
return (0);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis/attachments/20080331/480d42c9/attachment.htm
More information about the Vorbis
mailing list