FFMPEG 庫移植到 VC 需要的步驟
在VC下使用FFMPEG編譯好的庫,不僅僅是把.h,.lib,.dll拷貝到工程中就行了,還需要做以下幾步。(此方法適用于自己使用MinGW編譯的庫,也同樣適用于從網上下載的編譯好的庫,例如http://ffmpeg.zeranoe.com/builds/)。
(1)像其他額外庫一樣,設置VC的Include路徑為你c:\msys\local\include,設置VClib路徑為次c:\msys\local\bin,增加操作系統的一個Path c:\msys\local\bin(這一步好像不是必須的)。
(2)將mingw安裝目錄下的include的inttypes.h,stdint.h,_mingw.h三個文件拷到你ffmpeg庫的目錄下的include
(3)在_mingw.h文件的結尾處(在#endif 一行之前)添加了一行:
#define __restrict__
(4)把所有long long改成了__int64,如果是直接在vs2008下編譯,則這個修改應該是不需要的(這步我沒有遇到)
(5)
#ifdef __cplusplus
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "SDL/SDL.h"
//#include "windows.h"
extern "C"
{
#include "ffmpeg/avutil.h"
#include "ffmpeg/avcodec.h"
#include "ffmpeg/avformat.h"
}
#endif
#pragma comment(lib,"avutil.lib")
#pragma comment(lib,"avcodec.lib")
#pragma comment(lib,"avformat.lib")
(6)如果遇到error C3861: 'UINT64_C': identifier not found
在common.h里加入定義如下:
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
原文地址:http://blog.sina.com.cn/s/blog_6bcde18101011v2h.html
RFID管理系統集成商 RFID中間件 條碼系統中間層 物聯網軟件集成