四、同步线程

输入:gcc -o tutorial04 tutorial04.c -lavutil -lavformat -lavcodec -lz -lm -lswscale `sdl-config --cflags --libs`

SDL的库文件就大概三个,都由`sdl-config --libs --cflags`自动列出

一、错误:tutorial04.c:(.text+0xb2b): undefined reference to `img_convert'
/tmp/ccAdsxiA.o: In function `main':
tutorial04.c:(.text+0x1265): undefined reference to `pstrcpy'
collect2: ld returned 1 exit status

解决办法:将img_convert(&pict, dst_pix_fmt,
  (AVPicture *)pFrame, is->video_st->codec->pix_fmt, 
  is->video_st->codec->width, is->video_st->codec->height);

全部换为 img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, 
  pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, 
  PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); 
 // other codes 
 // Convert the image from its native format to RGB 
    sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 
   0, pCodecCtx->height, pict.data, pict.linesize);

这是因为新版的ffmpeg中对图片格式转换的处理全部换了,加上了libswscale这个库。

二、错误:/usr/local/include/libavformat/avio.h:446:26: note: expected ‘struct AVIOContext *’ but argument is of type ‘struct AVIOContext **’

    这可能是因为版本不匹配导致的。

    

posted @ 2012-11-13 17:52  little_star  阅读(144)  评论(0编辑  收藏  举报