当前位置: 技术问答>linux和unix
继续问用xvid解码后在fb/3显示,为什么没有任何图像.有代码.请帮忙看一下.
来源: 互联网 发布时间:2016-06-22
本文导语: //以下是初始化xvid结构 int init_decode() { int ret; xvid_gbl_init_t xvid_gbl_init; xvid_dec_create_t xvid_dec_create; memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t)); memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t)); CSP = XVID_CSP_UYVY|XVID_CSP_VF...
//以下是初始化xvid结构
int init_decode()
{
int ret;
xvid_gbl_init_t xvid_gbl_init;
xvid_dec_create_t xvid_dec_create;
memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t));
memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t));
CSP = XVID_CSP_UYVY|XVID_CSP_VFLIP;
xvid_gbl_init.version = XVID_VERSION;
xvid_gbl_init.cpu_flags = 0;
xvid_gbl_init.debug = 0;
xvid_global(NULL, 0, &xvid_gbl_init, NULL);
xvid_dec_create.version = XVID_VERSION;
xvid_dec_create.width = 0;
xvid_dec_create.height = 0;
ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvid_dec_create, NULL);
dec_handle = xvid_dec_create.handle;
return ret;
}
//以下是正式解码video.
void decode_video()
{
xvid_dec_stats_t xvid_dec_stats;
unsigned char *mp4_ptr = NULL, *m_data = NULL;
long used_bytes = 0;
mp4_ptr = buffer;
do
{
m_data = (unsigned char*)malloc(352*288*4);
used_bytes = DecodeVideo(mp4_ptr, m_data, useful_bytes, &xvid_dec_stats);
mp4_ptr += used_bytes;
useful_bytes -= used_bytes;
showOneFrame(fbmem, fb_width, fb_height, m_data);
free(m_data);
sleep(1);
}while(useful_bytes > 10 || used_bytes version = XVID_VERSION;
xvid_dec_frame.general = 0;
xvid_dec_frame.bitstream = istream;
xvid_dec_frame.length = istream_size;
xvid_dec_frame.output.plane[0] = ostream;
xvid_dec_frame.output.stride[0] = 352;
xvid_dec_frame.output.csp = CSP;
ret = xvid_decore(dec_handle, XVID_DEC_DECODE, &xvid_dec_frame, xvid_dec_stats);
printf("DecodeVideo ok.n");
return ret;
}
//showOneFrame fun:
int showOneFrame(void *fbmem, int width, int height, unsigned char *m_data)
{
int i = 0, j = 0;
unsigned char *dst;
for(i = 0; i
int init_decode()
{
int ret;
xvid_gbl_init_t xvid_gbl_init;
xvid_dec_create_t xvid_dec_create;
memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t));
memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t));
CSP = XVID_CSP_UYVY|XVID_CSP_VFLIP;
xvid_gbl_init.version = XVID_VERSION;
xvid_gbl_init.cpu_flags = 0;
xvid_gbl_init.debug = 0;
xvid_global(NULL, 0, &xvid_gbl_init, NULL);
xvid_dec_create.version = XVID_VERSION;
xvid_dec_create.width = 0;
xvid_dec_create.height = 0;
ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvid_dec_create, NULL);
dec_handle = xvid_dec_create.handle;
return ret;
}
//以下是正式解码video.
void decode_video()
{
xvid_dec_stats_t xvid_dec_stats;
unsigned char *mp4_ptr = NULL, *m_data = NULL;
long used_bytes = 0;
mp4_ptr = buffer;
do
{
m_data = (unsigned char*)malloc(352*288*4);
used_bytes = DecodeVideo(mp4_ptr, m_data, useful_bytes, &xvid_dec_stats);
mp4_ptr += used_bytes;
useful_bytes -= used_bytes;
showOneFrame(fbmem, fb_width, fb_height, m_data);
free(m_data);
sleep(1);
}while(useful_bytes > 10 || used_bytes version = XVID_VERSION;
xvid_dec_frame.general = 0;
xvid_dec_frame.bitstream = istream;
xvid_dec_frame.length = istream_size;
xvid_dec_frame.output.plane[0] = ostream;
xvid_dec_frame.output.stride[0] = 352;
xvid_dec_frame.output.csp = CSP;
ret = xvid_decore(dec_handle, XVID_DEC_DECODE, &xvid_dec_frame, xvid_dec_stats);
printf("DecodeVideo ok.n");
return ret;
}
//showOneFrame fun:
int showOneFrame(void *fbmem, int width, int height, unsigned char *m_data)
{
int i = 0, j = 0;
unsigned char *dst;
for(i = 0; i
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。