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
其他类似错误,解决办法同理。