demuxing_decoding.cpp 在VS下调试错误总结

include\libavutil\common.h(30): fatal error C1189: #error :  missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS

解决:在demuxing_decoding.cpp前面加上#define __STDC_CONSTANT_MACROS  


include\libavutil/timestamp.h(30): fatal error C1189: #error :  missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS

解决:在demuxing_decoding.cpp前面加上#define __STDC_FORMAT_MACROS


#define av_err2str(errnum) \
    av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)

解决:VS不支持C99,改为

char av_error[AV_ERROR_MAX_STRING_SIZE] = { 0 };
#define av_err2str(errnum) \
    av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, errnum)


#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) 

解决:VS不支持C99,改为

char av_ts[AV_TS_MAX_STRING_SIZE] = { 0 };   
#define av_ts2timestr(ts, tb) av_ts_make_time_string(av_ts, ts, tb)


error C2664: 'int av_get_bytes_per_sample(AVSampleFormat)' : cannot convert argument 1 from 'int' to 'AVSampleFormat'
1>          Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)

解决:(enum AVSampleFormat)frame->format


1>demuxing_decoding.cpp(295): error C4996: 'avcodec_alloc_frame': was declared deprecated
1>          F:\5FFmpeg\FFmpeg_test2013\FFmpeg_test\include\libavcodec/avcodec.h(3587) : see declaration of 'avcodec_alloc_frame'

解决:把static int api_mode = API_MODE_OLD;改为static int api_mode = API_MODE_NEW_API_REF_COUNT;此外,我注释掉了

if (api_mode == API_MODE_OLD)
frame = avcodec_alloc_frame();
else

其他类似错误,解决办法同理。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值