[theora] encoding image from a webcam

xiphmont at xiph.org xiphmont at xiph.org
Tue Dec 1 09:52:06 PST 2009

On Thu, Nov 26, 2009 at 2:02 PM, Mircea Gliga <mgliga at integrasoft.ro> wrote:
> I've created a test class with an encoder and decoder. I'm creating the
> theora headers and immediately
> add them to the decoder. For the first 2 packets th_decode_headerin returns
> positive nr,
> at the 3rd packet returns TH_EBADHEADER.
> Am I aloud to do that? I'm not using ogg_stream_packetin. I just want to
> encode a picture, resulting an
> ogg_packet, then decode it on the client side...
>     ogg_packet    op;
>     th_enc_ctx    *td;
>     th_comment    tc,tc1;
>     th_info        theoraInfo,theoraInfo1;
>     th_setup_info    *ts1;
> for(;;)
>     {
>         int ret = th_encode_flushheader(td,&tc,&op);
>        int ret2 = th_decode_headerin(&theoraInfo1,&tc1,&ts1,&op);
>         if(0==ret)  break;
>     }
> What am i doing wrong here ?

I assume we're not seeing all the code, as I don't see the td
allocation or the comment initialization...

The encoder example uses this pattern, so the concept should work.
Are you sure it's the third header triggering this?  You're only
breaking out of the loop after submitting the NULL result from a
fourth pass through to th_decode_headerin.  The if (0==ret)break; test
should be before the th_decode_headerin line.


More information about the theora mailing list