- Timestamp:
- Apr 24, 2012 1:06:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c
r4056 r4081 53 53 #endif 54 54 55 /* Various compatibility */ 56 #if LIBAVCODEC_VER_AT_LEAST(53,20) 57 # define AV_OPT_SET(obj,name,val,opt) av_opt_set(obj,name,val,opt) 58 # define AV_OPT_SET_INT(obj,name,val) av_opt_set_int(obj,name,val,0) 59 # define AVCODEC_OPEN(ctx,c) avcodec_open2(ctx,c,NULL) 60 #else 61 # define AV_OPT_SET(obj,name,val,opt) av_set_string3(obj,name,val,opt,NULL) 62 # define AV_OPT_SET_INT(obj,name,val) av_set_int(obj,name,val) 63 # define AVCODEC_OPEN(ctx,c) avcodec_open(ctx,c) 64 #endif 65 55 66 56 67 /* Prototypes for FFMPEG codecs factory */ … … 379 390 } 380 391 if (profile && 381 av_set_string3(ctx->priv_data, "profile", profile, 0, NULL))392 AV_OPT_SET(ctx->priv_data, "profile", profile, 0)) 382 393 { 383 394 PJ_LOG(3, (THIS_FILE, "Failed to set H264 profile")); … … 396 407 397 408 /* Limit NAL unit size as we prefer single NAL unit packetization */ 398 if (! av_set_int(ctx->priv_data, "slice-max-size", ff->param.enc_mtu))409 if (!AV_OPT_SET_INT(ctx->priv_data, "slice-max-size", ff->param.enc_mtu)) 399 410 { 400 411 PJ_LOG(3, (THIS_FILE, "Failed to set H264 max NAL size to %d", … … 403 414 404 415 /* Apply intra-refresh */ 405 if (! av_set_int(ctx->priv_data, "intra-refresh", 1))416 if (!AV_OPT_SET_INT(ctx->priv_data, "intra-refresh", 1)) 406 417 { 407 418 PJ_LOG(3, (THIS_FILE, "Failed to set x264 intra-refresh")); … … 411 422 * Let's just use the x264 predefined preset & tune. 412 423 */ 413 if (av_set_string3(ctx->priv_data, "preset", "veryfast", 0, NULL)) 414 { 424 if (AV_OPT_SET(ctx->priv_data, "preset", "veryfast", 0)) { 415 425 PJ_LOG(3, (THIS_FILE, "Failed to set x264 preset 'veryfast'")); 416 426 } 417 if (av_set_string3(ctx->priv_data, "tune", "animation+zerolatency", 418 0, NULL)) 419 { 427 if (AV_OPT_SET(ctx->priv_data, "tune", "animation+zerolatency", 0)) { 420 428 PJ_LOG(3, (THIS_FILE, "Failed to set x264 tune 'zerolatency'")); 421 429 } … … 595 603 596 604 pjmedia_ffmpeg_add_ref(); 605 #if !LIBAVCODEC_VER_AT_LEAST(53,20) 606 /* avcodec_init() dissappeared between version 53.20 and 54.15, not sure 607 * exactly when 608 */ 597 609 avcodec_init(); 610 #endif 598 611 avcodec_register_all(); 599 612 … … 1120 1133 * not working (e.g: rate control). 1121 1134 */ 1122 #if LIBAVCODEC_VER_AT_LEAST(52,113) 1135 #if LIBAVCODEC_VER_AT_LEAST(52,113) && !LIBAVCODEC_VER_AT_LEAST(53,20) 1123 1136 ctx->rc_lookahead = 0; 1124 1137 #endif … … 1151 1164 1152 1165 pj_mutex_lock(ff_mutex); 1153 err = avcodec_open(ff->enc_ctx, ff->enc);1166 err = AVCODEC_OPEN(ff->enc_ctx, ff->enc); 1154 1167 pj_mutex_unlock(ff_mutex); 1155 1168 if (err < 0) { … … 1166 1179 1167 1180 pj_mutex_lock(ff_mutex); 1168 err = avcodec_open(ff->dec_ctx, ff->dec);1181 err = AVCODEC_OPEN(ff->dec_ctx, ff->dec); 1169 1182 pj_mutex_unlock(ff_mutex); 1170 1183 if (err < 0) {
Note: See TracChangeset
for help on using the changeset viewer.