将FFmpeg移植到VS2010中

来源:互联网 发布:电脑椅 知乎 编辑:程序博客网 时间:2024/05/19 22:44

一、概述

本文旨在介绍如何在VS 2010下使用FFmpeg编译好的库。

二、操作步骤

1、把编译好的FFmpeg中的.h,.lib,.dll拷贝到工程中去,如图所示:


2、将mingw安装目录下的include的inttypes.h,stdint.h,_mingw.h三个文件拷到你工程目录下的include文件夹中去。

3、在_mingw.h文件的结尾处(在#endif 一行之前)添加了一行:#define __restrict__(解决inttypes.h有问题的错误)

4、在程序中添加如下代码:

#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


0 0