fix bug about using LIBAVCODEC_VERSION_MAJOR version,leading to wrong pcm format for aac encoding
正在显示
4 个修改的文件
包含
10 行增加
和
7 行删除
| @@ -289,7 +289,7 @@ int CAVTranscoder::open_output_file(const char *filename) | @@ -289,7 +289,7 @@ int CAVTranscoder::open_output_file(const char *filename) | ||
| 289 | for (; it != decoders_got_frame.end(); it++) { | 289 | for (; it != decoders_got_frame.end(); it++) { |
| 290 | AVFrame * pFrame = (*it)->_cur_a_frame; | 290 | AVFrame * pFrame = (*it)->_cur_a_frame; |
| 291 | if (pFrame) { | 291 | if (pFrame) { |
| 292 | -#if LIBAVCODEC_VERSION_MAJOR < 58 | 292 | +#if LIBAVCODEC_VERSION_MAJOR < 57 |
| 293 | int16_t * psrc = (int16_t *)pFrame->extended_data[0]; | 293 | int16_t * psrc = (int16_t *)pFrame->extended_data[0]; |
| 294 | int16_t * pdst = (int16_t *)pDstFrame->extended_data[0]; | 294 | int16_t * pdst = (int16_t *)pDstFrame->extended_data[0]; |
| 295 | #else | 295 | #else |
| @@ -51,7 +51,9 @@ extern "C" { | @@ -51,7 +51,9 @@ extern "C" { | ||
| 51 | #include <libavutil/opt.h> | 51 | #include <libavutil/opt.h> |
| 52 | #include <libavutil/pixdesc.h> | 52 | #include <libavutil/pixdesc.h> |
| 53 | } | 53 | } |
| 54 | -#ifdef WIN32 | 54 | + |
| 55 | + | ||
| 56 | +#ifdef ADD_FFMPEG_LIB | ||
| 55 | #pragma comment(lib, "avcodec.lib") | 57 | #pragma comment(lib, "avcodec.lib") |
| 56 | #pragma comment(lib, "avdevice.lib") | 58 | #pragma comment(lib, "avdevice.lib") |
| 57 | #pragma comment(lib, "avfilter.lib") | 59 | #pragma comment(lib, "avfilter.lib") |
| @@ -60,9 +62,7 @@ extern "C" { | @@ -60,9 +62,7 @@ extern "C" { | ||
| 60 | #pragma comment(lib, "postproc.lib") | 62 | #pragma comment(lib, "postproc.lib") |
| 61 | #pragma comment(lib, "swresample.lib") | 63 | #pragma comment(lib, "swresample.lib") |
| 62 | #pragma comment(lib, "swscale.lib") | 64 | #pragma comment(lib, "swscale.lib") |
| 63 | -#endif | ||
| 64 | 65 | ||
| 65 | -#if _MSC_VER | ||
| 66 | #define snprintf _snprintf | 66 | #define snprintf _snprintf |
| 67 | #define PRIu64 "I64u" | 67 | #define PRIu64 "I64u" |
| 68 | #define PRId64 "I64d" | 68 | #define PRId64 "I64d" |
| @@ -70,6 +70,8 @@ extern "C" { | @@ -70,6 +70,8 @@ extern "C" { | ||
| 70 | #define PRIX64 "I64X" | 70 | #define PRIX64 "I64X" |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | + | ||
| 74 | + | ||
| 73 | typedef struct FilteringContext { | 75 | typedef struct FilteringContext { |
| 74 | AVFilterContext *buffersink_ctx; | 76 | AVFilterContext *buffersink_ctx; |
| 75 | AVFilterContext *buffersrc_ctx; | 77 | AVFilterContext *buffersrc_ctx; |
| @@ -80,7 +82,7 @@ typedef struct FilteringContext { | @@ -80,7 +82,7 @@ typedef struct FilteringContext { | ||
| 80 | #define AFRAME_DURATION_MS 21.333333 | 82 | #define AFRAME_DURATION_MS 21.333333 |
| 81 | #define VFRAME_DURATION_MS 50 | 83 | #define VFRAME_DURATION_MS 50 |
| 82 | 84 | ||
| 83 | -#if LIBAVCODEC_VERSION_MAJOR < 58 | 85 | +#if LIBAVCODEC_VERSION_MAJOR < 57 |
| 84 | #define PCM_FORMAT_FOR_AAC_ENCODE AV_SAMPLE_FMT_S16 | 86 | #define PCM_FORMAT_FOR_AAC_ENCODE AV_SAMPLE_FMT_S16 |
| 85 | #else | 87 | #else |
| 86 | #define PCM_FORMAT_FOR_AAC_ENCODE AV_SAMPLE_FMT_FLTP | 88 | #define PCM_FORMAT_FOR_AAC_ENCODE AV_SAMPLE_FMT_FLTP |
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | </PrecompiledHeader> | 52 | </PrecompiledHeader> |
| 53 | <WarningLevel>Level3</WarningLevel> | 53 | <WarningLevel>Level3</WarningLevel> |
| 54 | <Optimization>Disabled</Optimization> | 54 | <Optimization>Disabled</Optimization> |
| 55 | - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 55 | + <PreprocessorDefinitions>ADD_FFMPEG_LIB;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| 56 | <AdditionalIncludeDirectories>..\..\liveAssistant\third-lib\ffmpeg\include</AdditionalIncludeDirectories> | 56 | <AdditionalIncludeDirectories>..\..\liveAssistant\third-lib\ffmpeg\include</AdditionalIncludeDirectories> |
| 57 | </ClCompile> | 57 | </ClCompile> |
| 58 | <Link> | 58 | <Link> |
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | <Optimization>MaxSpeed</Optimization> | 69 | <Optimization>MaxSpeed</Optimization> |
| 70 | <FunctionLevelLinking>true</FunctionLevelLinking> | 70 | <FunctionLevelLinking>true</FunctionLevelLinking> |
| 71 | <IntrinsicFunctions>true</IntrinsicFunctions> | 71 | <IntrinsicFunctions>true</IntrinsicFunctions> |
| 72 | - <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 72 | + <PreprocessorDefinitions>ADD_FFMPEG_LIB;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| 73 | </ClCompile> | 73 | </ClCompile> |
| 74 | <Link> | 74 | <Link> |
| 75 | <SubSystem>Console</SubSystem> | 75 | <SubSystem>Console</SubSystem> |
-
请 注册 或 登录 后发表评论