[Theora-dev] problem in using libtheora in vc++
CP Lau
pongpong.lau at gmail.com
Sun Apr 23 04:29:53 PDT 2006
Dear Sir/Madam,
I am trying to use Theora in VC++ as i think Theora is a very good
codec. However, when i implement the encoding and decoding parts, i get an
unexpected error when i call:
1) theora_info_clear( &encoderInfo ); after theora_encode_init(
&theoraState, &encoderInfo );
2) theora_decode_init( &theoraStateDec, &theoraInfo );
For problem 2, i find that all the calls to theora_decode_header are
failed and it returns either -21 or -20.
The following is the code that i am trying. Would you please have a
look and see what is going wrong with me?
Thanks a lot
Pong
theora_info_init( &encoderInfo );
encoderInfo.frame_width = nFrameW; //INPUT_FRAME_WIDTH; // Must
be multiple of 16
encoderInfo.frame_height = nFrameH; //INPUT_FRAME_HEIGHT; // Must
be multiple of 16
encoderInfo.width = encoderInfo.frame_width;
encoderInfo.height = encoderInfo.frame_height;
encoderInfo.offset_x = 0;
encoderInfo.offset_y = 0;
encoderInfo.fps_numerator = 15;//INPUT_FRAMES_PER_SECOND;
encoderInfo.fps_denominator = 1;
encoderInfo.aspect_numerator = encoderInfo.width; // Aspect =
width/height
encoderInfo.aspect_denominator = encoderInfo.height; //
encoderInfo.colorspace = OC_CS_UNSPECIFIED;
// encoderInfo.target_bitrate = 90000; //45000; // Anywhere between
45kbps and 2000kbps
// encoderInfo.target_bitrate = 45000; //45000; // Anywhere between
45kbps and 2000kbps
encoderInfo.target_bitrate = 45000; //45000; // Anywhere between
45kbps and 2000kbps
encoderInfo.quality = 10;
encoderInfo.dropframes_p = 0;
encoderInfo.quick_p = 1;
encoderInfo.keyframe_auto_p = 1;
encoderInfo.keyframe_frequency = 64;
encoderInfo.keyframe_frequency_force = 64;
encoderInfo.keyframe_data_target_bitrate = encoderInfo.target_bitrate * 3
/ 2;
encoderInfo.keyframe_auto_threshold = 80;
encoderInfo.keyframe_mindistance = 8;
encoderInfo.noise_sensitivity = 1;
theora_encode_init( &theoraState, &encoderInfo );
theora_info_clear( &encoderInfo ); // i get a error here
//
ogg_packet headerPacket, commentPacket, tablePacket;
theora_encode_header( &theoraState, &headerPacket );
// COPY_WRITE_OR_TRANSMIT_PACKET( headerPacket );
theora_comment_init( &encoderComment );
theora_encode_comment( &encoderComment, &commentPacket );
// COPY_WRITE_OR_TRANSMIT_PACKET( commentPacket )
theora_comment_clear( &encoderComment );
theora_encode_tables( &theoraState, &tablePacket );
// COPY_WRITE_OR_TRANSMIT_PACKET( tablePacket )
yuv.y_width = encoderInfo.width;
yuv.y_height = encoderInfo.height;
yuv.y_stride = encoderInfo.width;
yuv.y = pYBuff; // yBuffer;
yuv.uv_width = nFrameW / 2; // INPUT_FRAME_WIDTH / 2;
yuv.uv_height = nFrameH / 2; // INPUT_FRAME_HEIGHT / 2;
yuv.uv_stride = yuv.uv_width;
yuv.u = pUBuff; // uBuffer;
yuv.v = pVBuff; // vBuffer;
// DECODER INIT
theora_info_init( &theoraInfo );
theora_comment_init( &theoraComment );
theora_decode_header( &theoraInfo, &theoraComment, &headerPacket );
theora_decode_header( &theoraInfo, &theoraComment, &commentPacket );
theora_decode_header( &theoraInfo, &theoraComment, &tablePacket );
theora_decode_init( &theoraStateDec, &theoraInfo ); // i get an error here
as the calls to theora_decode_header are all failed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/theora-dev/attachments/20060423/079f760a/attachment.html
More information about the Theora-dev
mailing list