Changeset 3824
- Timestamp:
- Oct 18, 2011 6:46:49 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
r3819 r3824 40 40 #define THIS_FILE "ffmpeg_codecs.c" 41 41 42 #define LIBAVCODEC_VER_AT_LEAST(major,minor) (LIBAVCODEC_VERSION_MAJOR > major || \ 43 (LIBAVCODEC_VERSION_MAJOR == major && \ 44 LIBAVCODEC_VERSION_MINOR >= minor)) 45 42 46 #include "../pjmedia/ffmpeg_util.h" 43 47 #include <libavcodec/avcodec.h> 44 48 #include <libavformat/avformat.h> 45 #include <libavutil/opt.h> 49 #if LIBAVCODEC_VER_AT_LEAST(53,20) 50 /* Needed by 264 so far, on libavcodec 53.20 */ 51 # include <libavutil/opt.h> 52 #endif 46 53 47 54 … … 220 227 221 228 222 #if PJMEDIA_HAS_FFMPEG_CODEC_H264 && \ 223 (LIBAVCODEC_VERSION_MAJOR < 53 || LIBAVCODEC_VERSION_MINOR < 20) 229 #if PJMEDIA_HAS_FFMPEG_CODEC_H264 && !LIBAVCODEC_VER_AT_LEAST(53,20) 224 230 # error "Must use libavcodec version 53.20 or later to enable FFMPEG H264" 225 231 #endif … … 230 236 231 237 /* Codec specific functions */ 238 #if PJMEDIA_HAS_FFMPEG_CODEC_H264 232 239 static pj_status_t h264_preopen(ffmpeg_private *ff); 233 240 static pj_status_t h264_postopen(ffmpeg_private *ff); 234 241 static FUNC_PACKETIZE(h264_packetize); 235 242 static FUNC_UNPACKETIZE(h264_unpacketize); 243 #endif 236 244 237 245 static pj_status_t h263_preopen(ffmpeg_private *ff); … … 990 998 static void print_ffmpeg_err(int err) 991 999 { 992 #if LIBAVCODEC_VERSION_MAJOR > 52 || \ 993 (LIBAVCODEC_VERSION_MAJOR >= 52 && LIBAVCODEC_VERSION_MINOR >= 72) 1000 #if LIBAVCODEC_VER_AT_LEAST(52,72) 994 1001 char errbuf[512]; 995 1002 if (av_strerror(err, errbuf, sizeof(errbuf)) >= 0) … … 1022 1029 /* Allocate ffmpeg codec context */ 1023 1030 if (ff->param.dir & PJMEDIA_DIR_ENCODING) { 1031 #if LIBAVCODEC_VER_AT_LEAST(53,20) 1024 1032 ff->enc_ctx = avcodec_alloc_context3(ff->enc); 1033 #else 1034 ff->enc_ctx = avcodec_alloc_context(); 1035 #endif 1025 1036 if (ff->enc_ctx == NULL) 1026 1037 goto on_error; 1027 1038 } 1028 1039 if (ff->param.dir & PJMEDIA_DIR_DECODING) { 1040 #if LIBAVCODEC_VER_AT_LEAST(53,20) 1029 1041 ff->dec_ctx = avcodec_alloc_context3(ff->dec); 1042 #else 1043 ff->dec_ctx = avcodec_alloc_context(); 1044 #endif 1030 1045 if (ff->dec_ctx == NULL) 1031 1046 goto on_error; … … 1053 1068 * not working (e.g: rate control). 1054 1069 */ 1055 #if LIBAVCODEC_VERSION_MAJOR > 52 || \ 1056 (LIBAVCODEC_VERSION_MAJOR >= 52 && LIBAVCODEC_VERSION_MINOR >= 113) 1070 #if LIBAVCODEC_VER_AT_LEAST(52,113) 1057 1071 ctx->rc_lookahead = 0; 1058 1072 #endif … … 1484 1498 output->timestamp = input->timestamp; 1485 1499 1486 #if LIBAVCODEC_VERSION_MAJOR > 52 || \ 1487 (LIBAVCODEC_VERSION_MAJOR >= 52 && LIBAVCODEC_VERSION_MINOR >= 72) 1500 #if LIBAVCODEC_VER_AT_LEAST(52,72) 1488 1501 //avpacket.flags = AV_PKT_FLAG_KEY; 1489 1502 #else … … 1491 1504 #endif 1492 1505 1493 #if LIBAVCODEC_VERSION_MAJOR > 52 || \ 1494 (LIBAVCODEC_VERSION_MAJOR >= 52 && LIBAVCODEC_VERSION_MINOR >= 72) 1506 #if LIBAVCODEC_VER_AT_LEAST(52,72) 1495 1507 err = avcodec_decode_video2(ff->dec_ctx, &avframe, 1496 1508 &got_picture, &avpacket);
Note: See TracChangeset
for help on using the changeset viewer.