theora_info info; theora_comment comment; theora_info_init(&info); theora_comment_init(&comment);
int i; for (i = 0; i < 3; i++) { (get a theora packet "op" from the Ogg stream) theora_decode_header(&info, &comment, op); }
theora_state state; theora_decode_init(&state, &info);
yuf_buffer buffer; while (last packet was not e_o_s) { (get a theora packet "op" from the Ogg stream) theora_decode_packetin(&state, op); theora_decode_YUVout(&state, &buffer); }
Note that you cannot use theora_packet_isheader() to determine if a packet is a theora packet or not, as this function does not perform any checking beyond whether a header bit is present. Instead, use the theora_decode_header() function and check the return value; or examine the header bytes at the beginning of the Ogg page.