#includeusing namespace std;extern "C" {#include // required headers#include }int main(int argc, char**argv) { av_register_all(); // offending library call return 0;}
ffmpeg 默认是用C文件来编译的,如果某个CPP文件想引用ffmpeg中的某些函数或者头文件,有可能出现
‘UINT64_C’ was not declared in this scope的错误
情形大概如下
The same issue i'm getting here when compiling chromium with ffmpeg from svn:
In file included from /usr/include/libavutil/avutil.h:81:0,
from /usr/include/libavcodec/avcodec.h:30,
from out/Release/obj.target/geni/ffmpeg_stubs.cc:16:
/usr/include/libavutil/common.h: In function 'int32_t av_clipl_int32(int64_t)':
/usr/include/libavutil/common.h:154:47: error: 'UINT64_C' was not declared in this scope
make: *** [out/Release/obj.target/geni/ffmpeg_stubs.o] Error 1
可以 在cpp文件中加入
extern "C"{
#ifdef __cplusplus
#define __STDC_CONSTANT_MACROS #ifdef _STDINT_H #undef _STDINT_H #endif # include <stdint.h>#endif}
来解决
如果在android下用编译。在Android.mk加入
LOCAL_CFLAGS := -D__STDC_CONSTANT_MACROS即可
#ifdef __cplusplus extern "C" { #endif void AfterSessionDone(); void openURL(UsageEnvironment& env, char const* progName, char const* rtspURL,Authenticator *authDB,const int Channel); char* h264_decode_buf_prepare(char *sps,int sps_len,char* pps,int pps_len,char* buf_in, char* buf_pre_for_h264_decode,int framesize,const int Channel); #ifdef __cplusplus } #endif
编译为动态库时的问题:
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet' can not be used when making a shared object; recompile with -fPIC修改方法:
./configure --enable-pic && make
如果使用的是虚拟机进行开发live555.需要加入路由表:
route add default gw xxx.xxx.xxx.xxx eth0
编译ffmpeg后,直接编译示例不能通过显示库不能找到问题解决。
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
live555在windows环境编译vs2010:
Ⅲ 编译步骤
方法一(Win7下命令方式)
0 综述:利用genWindowsMakefiles.cmd生成VS可用的makefile
1 修改win32config。打开live\win32config文件,修改如下
TOOLS32 = c:\Program Files\DevStudio\Vc | TOOLS32 = E:\Program Files\Microsoft Visual Studio 10.0\VC | 将TOOLS32修改为你的VS2010路径 |
LINK_OPTS_0 = $(linkdebug) msvcirt.lib | LINK_OPTS_0 = $(linkdebug) msvcrt.lib | 编译器索要的LINK运行库不同,原本以为可以改为msvcrt100.lib,但没找着 |
2 新增Makefile设定。打开live\groupsock\Makefile.head,修改如下
INCLUDES = -Iinclude -I../UsageEnvironment/include | INCLUDES = -Iinclude -I../UsageEnvironment/include -DNO_STRSTREAM |
3 建立makefile
方法:运行live\genWindowsMakefiles.cmd,生成VS能够编译的*.mak文件
4 建立build.bat命令
新建live\complie.bat,并添加内容如下:
call "E:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"cd liveMedianmake /B -f liveMedia.makcd ../groupsocknmake /B -f groupsock.makcd ../UsageEnvironmentnmake /B -f UsageEnvironment.makcd ../BasicUsageEnvironmentnmake /B -f BasicUsageEnvironment.makcd ../testProgsnmake /B -f testProgs.makcd ../mediaServernmake /B -f mediaServer.mak
5 开始编译:(命令行下)执行complie.bat
参考地址:
参考文章:
live555虚拟机下不能获取数据问题:
识别I帧P帧B帧。
解码流程经典教程:
ffmpeg时间戳问题汇总
ffmpeg开发SDK介绍
含有B帧时的疑惑
ffmpeg解码花屏,码流丢失问题
FFMPEG重要学习官方资料: