Chinaunix首页 | 论坛 | 博客
  • 博客访问: 121877
  • 博文数量: 1
  • 博客积分: 1910
  • 博客等级: 上尉
  • 技术积分: 520
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-31 22:24
文章分类

全部博文(1)

文章存档

2011年(1)

我的朋友

分类:

2011-01-13 17:11:43

I recently used libtheora 1.1.1, and tried to assemble a test function for both encode and decode. I got an error when using theora_decode_header(), just as the problem described in the article titled with "problem in using libtheora in vc++"(You can google this article).

After research, I found a solution for the problem. The problem is actually because the places for theora_decode_header() is not correct. The theora_decode_header() should be right after related theora_encode_xxx()(including theora_encode_header(), theora_encode_comment(), theora_encode_tables()). So if use the correct order for theora_decode_header(), it will execute successfully.

The order should be like this:
...
ogg_packet headerPacket, commentPacket, tablePacket;

theora_encode_header( &theoraState, &headerPacket );
theora_decode_header( &theoraInfo, &theoraComment, &headerPacket );
// COPY_WRITE_OR_TRANSMIT_PACKET( headerPacket );

theora_comment_init( &encoderComment );
theora_decode_header( &theoraInfo, &theoraComment, &commentPacket );
theora_encode_comment( &encoderComment, &commentPacket );
theora_comment_clear( &encoderComment );
// COPY_WRITE_OR_TRANSMIT_PACKET( commentPacket )

theora_encode_tables( &theoraState, &tablePacket );
theora_decode_header( &theoraInfo, &theoraComment, &tablePacket );
// COPY_WRITE_OR_TRANSMIT_PACKET( tablePacket )

theora_decode_init( &theoraStateDec, &theoraInfo );
...
阅读(672) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~