Changeset 4089 for pjproject/trunk


Ignore:
Timestamp:
Apr 26, 2012 7:27:06 AM (13 years ago)
Author:
nanang
Message:

Misc (re #1446): Updated ffmpeg compatibility issues, e.g: av_set_int() return code not match to av_opt_set_int(), update libavcodec version to at least 53.61 for av_opt_set*() usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c

    r4083 r4089  
    5353#endif 
    5454 
     55 
    5556/* Various compatibility */ 
     57 
    5658#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) 
    5959#  define AVCODEC_OPEN(ctx,c)           avcodec_open2(ctx,c,NULL) 
    6060#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) 
    6361#  define AVCODEC_OPEN(ctx,c)           avcodec_open(ctx,c) 
    6462#endif 
     
    7068 */ 
    7169#  define AVCODEC_HAS_ENCODE(c)         (c->encode || c->encode2) 
     70#  define AV_OPT_SET(obj,name,val,opt)  (av_opt_set(obj,name,val,opt)==0) 
     71#  define AV_OPT_SET_INT(obj,name,val)  (av_opt_set_int(obj,name,val,0)==0) 
    7272#else 
    7373#  define AVCODEC_HAS_ENCODE(c)         (c->encode) 
     74#  define AV_OPT_SET(obj,name,val,opt)  (av_set_string3(obj,name,val,opt,NULL)==0) 
     75#  define AV_OPT_SET_INT(obj,name,val)  (av_set_int(obj,name,val)!=NULL) 
    7476#endif 
    7577#define AVCODEC_HAS_DECODE(c)           (c->decode) 
     
    400402            break; 
    401403        } 
    402         if (profile && 
    403             AV_OPT_SET(ctx->priv_data, "profile", profile, 0)) 
     404        if (profile && !AV_OPT_SET(ctx->priv_data, "profile", profile, 0)) 
    404405        { 
    405             PJ_LOG(3, (THIS_FILE, "Failed to set H264 profile")); 
     406            PJ_LOG(3, (THIS_FILE, "Failed to set H264 profile to '%s'", 
     407                       profile)); 
    406408        } 
    407409 
     
    433435         * Let's just use the x264 predefined preset & tune. 
    434436         */ 
    435         if (AV_OPT_SET(ctx->priv_data, "preset", "veryfast", 0)) { 
     437        if (!AV_OPT_SET(ctx->priv_data, "preset", "veryfast", 0)) { 
    436438            PJ_LOG(3, (THIS_FILE, "Failed to set x264 preset 'veryfast'")); 
    437439        } 
    438         if (AV_OPT_SET(ctx->priv_data, "tune", "animation+zerolatency", 0)) { 
     440        if (!AV_OPT_SET(ctx->priv_data, "tune", "animation+zerolatency", 0)) { 
    439441            PJ_LOG(3, (THIS_FILE, "Failed to set x264 tune 'zerolatency'")); 
    440442        } 
Note: See TracChangeset for help on using the changeset viewer.