本文旨在介绍如何在VS 2010下使用FFmpeg编译好的库。
1、把编译好的FFmpeg中的.h,.lib,.dll拷贝到工程中去,如图所示:
#ifdef __cplusplus #include "stdio.h" #include "stdlib.h" #include "string.h" <span style="color:#006600;">#include "SDL2/SDL.h"</span> extern "C" { #include "include/libavutil/avutil.h"-----为工程的include目录,我的是"include/libavutil/avutil.h" #include "include/libavcodec/avcodec.h" #include "include/libavformat/avformat.h" #include "include/libswscale/swscale.h" } #endif #pragma comment(lib,"lib/avutil.lib") #pragma comment(lib,"lib/avcodec.lib") #pragma comment(lib,"lib/avformat.lib") #pragma comment(lib,"lib/swscale.lib") <span style="color:#006600;">#pragma comment(lib,"lib/SDL2.lib") #pragma comment(lib,"lib/SDL2main.lib")</span> #include <stdio.h>
如果要使用sdl的话,还需要将sdl的.h,.lib ,.dll文件拷贝到相应的目录中去,然后添加:
#include "SDL2/SDL.h"
#pragma comment(lib,"SDL.lib")
#pragma comment(lib,"SDL2main.lib")
这就是我移植时所做的操作。还可以参考以下博客的内容:
http://blog.csdn.net/leixiaohua1020/article/details/12747899