首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > 多媒体 >

会ffmpeg 的请进!该怎么解决

2012-04-07 
会ffmpeg 的请进!!C/C++ codewhile(av_read_frame(pDlg-pFormatCtx, &pDlg-packet) 0){// Is this a

会ffmpeg 的请进!!

C/C++ code
while(av_read_frame(pDlg->pFormatCtx, &pDlg->packet) >= 0)     {        // Is this a packet from the video stream?        if(pDlg->packet.stream_index == pDlg->videoStream)         {            // Decode video frame            avcodec_decode_video(pDlg->pCodecCtx, pDlg->pFrame, &pDlg->frameFinished,                pDlg->packet.data, pDlg->packet.size);            // Did we get a video frame?            if(pDlg->frameFinished)             {                AVPicture pict;                // Convert the image from its native format to RGB                struct SwsContext *img_convert_ctx;                img_convert_ctx = sws_getContext(pDlg->pCodecCtx->width,pDlg->pCodecCtx->height, pDlg->pCodecCtx->pix_fmt,                    pDlg->pCodecCtx->width,pDlg->pCodecCtx->height,PIX_FMT_YUVJ420P,SWS_BICUBIC, NULL,NULL,NULL);                      if(img_convert_ctx == NULL)                {                    fprintf(stderr, "Cannot initialize the conversion context!\n");                    getchar();                }                // 将图片转换为RGB格式                sws_scale(img_convert_ctx,pDlg->pFrame->data,pDlg->pFrame->linesize,0,                    pDlg->pCodecCtx->height,pict.data,pict.linesize);                //pDlg->ShowVido(RGBbuf);                                Sleep(50);            }        }        // Free the packet that was allocated by av_read_frame        av_free_packet(&pDlg->packet);    }


高手指教!!!

[解决办法]
在这个版块很难找到这方面专业的高手的。建议楼主换个版块 换到 多媒体/流媒体开发 版块试试。

热点排行