Changeset 5271


Ignore:
Timestamp:
Mar 24, 2016 1:16:25 PM (5 years ago)
Author:
nanang
Message:

Re #1897: Updated ffmpeg_util.h/.c to support older ffmpeg.

Location:
pjproject/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure

    r5270 r5271  
    20112011 
    20122012} # ac_fn_c_check_func 
     2013 
     2014# ac_fn_c_check_type LINENO TYPE VAR INCLUDES 
     2015# ------------------------------------------- 
     2016# Tests whether TYPE exists after having included INCLUDES, setting cache 
     2017# variable VAR accordingly. 
     2018ac_fn_c_check_type () 
     2019{ 
     2020  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 
     2021  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 
     2022$as_echo_n "checking for $2... " >&6; } 
     2023if eval \${$3+:} false; then : 
     2024  $as_echo_n "(cached) " >&6 
     2025else 
     2026  eval "$3=no" 
     2027  cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2028/* end confdefs.h.  */ 
     2029$4 
     2030int 
     2031main () 
     2032{ 
     2033if (sizeof ($2)) 
     2034         return 0; 
     2035  ; 
     2036  return 0; 
     2037} 
     2038_ACEOF 
     2039if ac_fn_c_try_compile "$LINENO"; then : 
     2040  cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2041/* end confdefs.h.  */ 
     2042$4 
     2043int 
     2044main () 
     2045{ 
     2046if (sizeof (($2))) 
     2047            return 0; 
     2048  ; 
     2049  return 0; 
     2050} 
     2051_ACEOF 
     2052if ac_fn_c_try_compile "$LINENO"; then : 
     2053 
     2054else 
     2055  eval "$3=yes" 
     2056fi 
     2057rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2058fi 
     2059rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2060fi 
     2061eval ac_res=\$$3 
     2062               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 
     2063$as_echo "$ac_res" >&6; } 
     2064  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno 
     2065 
     2066} # ac_fn_c_check_type 
    20132067cat >config.log <<_ACEOF 
    20142068This file contains any messages produced by compilers while 
     
    22742328$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    22752329as_fn_error $? "failed to load site script $ac_site_file 
    2276 See \`config.log' for more details" "$LINENO" 5; } 
     2330See \`config.log' for more details" "$LINENO" 5 ; } 
    22772331  fi 
    22782332done 
     
    24172471case $ac_cv_build in 
    24182472*-*-*) ;; 
    2419 *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; 
     2473*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; 
    24202474esac 
    24212475build=$ac_cv_build 
     
    24502504case $ac_cv_host in 
    24512505*-*-*) ;; 
    2452 *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; 
     2506*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; 
    24532507esac 
    24542508host=$ac_cv_host 
     
    24832537case $ac_cv_target in 
    24842538*-*-*) ;; 
    2485 *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; 
     2539*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; 
    24862540esac 
    24872541target=$ac_cv_target 
     
    28202874$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    28212875as_fn_error $? "no acceptable C compiler found in \$PATH 
    2822 See \`config.log' for more details" "$LINENO" 5; } 
     2876See \`config.log' for more details" "$LINENO" 5 ; } 
    28232877 
    28242878# Provide some information about the compiler. 
     
    29352989$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    29362990as_fn_error 77 "C compiler cannot create executables 
    2937 See \`config.log' for more details" "$LINENO" 5; } 
     2991See \`config.log' for more details" "$LINENO" 5 ; } 
    29382992else 
    29392993  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 
     
    29783032$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    29793033as_fn_error $? "cannot compute suffix of executables: cannot compile and link 
    2980 See \`config.log' for more details" "$LINENO" 5; } 
     3034See \`config.log' for more details" "$LINENO" 5 ; } 
    29813035fi 
    29823036rm -f conftest conftest$ac_cv_exeext 
     
    30373091as_fn_error $? "cannot run C compiled programs. 
    30383092If you meant to cross compile, use \`--host'. 
    3039 See \`config.log' for more details" "$LINENO" 5; } 
     3093See \`config.log' for more details" "$LINENO" 5 ; } 
    30403094    fi 
    30413095  fi 
     
    30893143$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    30903144as_fn_error $? "cannot compute suffix of object files: cannot compile 
    3091 See \`config.log' for more details" "$LINENO" 5; } 
     3145See \`config.log' for more details" "$LINENO" 5 ; } 
    30923146fi 
    30933147rm -f conftest.$ac_cv_objext conftest.$ac_ext 
     
    44834537$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    44844538as_fn_error $? "C preprocessor \"$CPP\" fails sanity check 
    4485 See \`config.log' for more details" "$LINENO" 5; } 
     4539See \`config.log' for more details" "$LINENO" 5 ; } 
    44864540fi 
    44874541 
     
    49735027   *) 
    49745028     as_fn_error $? "unknown endianness 
    4975  presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; 
     5029 presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5  ;; 
    49765030 esac 
    49775031 
     
    70777131                fi 
    70787132 
     7133                ac_fn_c_check_type "$LINENO" "enum AVPixelFormat" "ac_cv_type_enum_AVPixelFormat" "#include <libavformat/avformat.h> 
     7134 
     7135" 
     7136if test "x$ac_cv_type_enum_AVPixelFormat" = xyes; then : 
     7137 
     7138cat >>confdefs.h <<_ACEOF 
     7139#define HAVE_ENUM_AVPIXELFORMAT 1 
     7140_ACEOF 
     7141 
     7142 
     7143else 
     7144  ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_USE_OLD_FFMPEG=1" 
     7145fi 
     7146 
     7147 
    70797148                LIBS="$LIBS $ac_ffmpeg_ldflags" 
    70807149                export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH 
     
    76147683$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76157684as_fn_error $? "Error: unable to recognize your IPP installation. Make sure the paths and ARCH suffix are set correctly, run with --help for more info 
    7616 See \`config.log' for more details" "$LINENO" 5; } 
     7685See \`config.log' for more details" "$LINENO" 5 ; } 
    76177686fi 
    76187687rm -f core conftest.err conftest.$ac_objext \ 
     
    76707739$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76717740as_fn_error $? "Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples? 
    7672 See \`config.log' for more details" "$LINENO" 5; } 
     7741See \`config.log' for more details" "$LINENO" 5 ; } 
    76737742            fi 
    76747743        else 
     
    76767745$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76777746as_fn_error $? "unable to find $IPPSAMPLES/speech-codecs/bin/*gcc*/lib or $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib directory. Have you built the samples? 
    7678 See \`config.log' for more details" "$LINENO" 5; } 
     7747See \`config.log' for more details" "$LINENO" 5 ; } 
    76797748        fi 
    76807749 
     
    76847753$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76857754as_fn_error $? "There's something wrong with this script, directory $IPPSAMP_DIR does not exist 
    7686 See \`config.log' for more details" "$LINENO" 5; } 
     7755See \`config.log' for more details" "$LINENO" 5 ; } 
    76877756            exit 1; 
    76887757        fi 
     
    76987767$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    76997768as_fn_error $? "bug in this script: unsupported IPP version 
    7700 See \`config.log' for more details" "$LINENO" 5; } 
     7769See \`config.log' for more details" "$LINENO" 5 ; } 
    77017770        fi 
    77027771 
     
    77057774$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    77067775as_fn_error $? "$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR 
    7707 See \`config.log' for more details" "$LINENO" 5; } 
     7776See \`config.log' for more details" "$LINENO" 5 ; } 
    77087777        fi 
    77097778 
     
    77417810$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
    77427811as_fn_error $? "no 
    7743 See \`config.log' for more details" "$LINENO" 5; } 
     7812See \`config.log' for more details" "$LINENO" 5 ; } 
    77447813fi 
    77457814rm -f core conftest.err conftest.$ac_objext \ 
     
    91399208    "third_party/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES third_party/build/os-auto.mak" ;; 
    91409209 
    9141   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 
     9210  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; 
    91429211  esac 
    91439212done 
     
    94569525  case $ac_mode$ac_tag in 
    94579526  :[FHL]*:*);; 
    9458   :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; 
     9527  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; 
    94599528  :[FH]-) ac_tag=-:-;; 
    94609529  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; 
     
    94849553           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; 
    94859554           esac || 
    9486            as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; 
     9555           as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; 
    94879556      esac 
    94889557      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac 
     
    95119580    case $ac_tag in 
    95129581    *:-:* | *:-) cat >"$ac_tmp/stdin" \ 
    9513       || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; 
     9582      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;; 
    95149583    esac 
    95159584    ;; 
  • pjproject/trunk/aconfigure.ac

    r5270 r5271  
    10981098                fi 
    10991099                 
     1100                AC_CHECK_TYPES(enum AVPixelFormat, 
     1101                               [], 
     1102                               [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_USE_OLD_FFMPEG=1"], 
     1103                               [[#include <libavformat/avformat.h>]] 
     1104                             ) 
     1105                                      
    11001106                LIBS="$LIBS $ac_ffmpeg_ldflags" 
    11011107                export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH 
  • pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c

    r5198 r5271  
    3434} ffmpeg_fmt_table[] = 
    3535{ 
    36     { PJMEDIA_FORMAT_RGBA, AV_PIX_FMT_RGBA}, 
    37     { PJMEDIA_FORMAT_RGB24,AV_PIX_FMT_BGR24}, 
    38     { PJMEDIA_FORMAT_BGRA, AV_PIX_FMT_BGRA}, 
    39     { PJMEDIA_FORMAT_GBRP, AV_PIX_FMT_GBRP}, 
     36    { PJMEDIA_FORMAT_RGBA, AV(PIX_FMT_RGBA)}, 
     37    { PJMEDIA_FORMAT_RGB24,AV(PIX_FMT_BGR24)}, 
     38    { PJMEDIA_FORMAT_BGRA, AV(PIX_FMT_BGRA)}, 
     39    { PJMEDIA_FORMAT_GBRP, AV(PIX_FMT_GBRP)}, 
    4040 
    41     { PJMEDIA_FORMAT_AYUV, AV_PIX_FMT_NONE}, 
    42     { PJMEDIA_FORMAT_YUY2, AV_PIX_FMT_YUYV422}, 
    43     { PJMEDIA_FORMAT_UYVY, AV_PIX_FMT_UYVY422}, 
    44     { PJMEDIA_FORMAT_I420, AV_PIX_FMT_YUV420P}, 
    45     //{ PJMEDIA_FORMAT_YV12, AV_PIX_FMT_YUV420P}, 
    46     { PJMEDIA_FORMAT_I422, AV_PIX_FMT_YUV422P}, 
    47     { PJMEDIA_FORMAT_I420JPEG, AV_PIX_FMT_YUVJ420P}, 
    48     { PJMEDIA_FORMAT_I422JPEG, AV_PIX_FMT_YUVJ422P}, 
     41    { PJMEDIA_FORMAT_AYUV, AV(PIX_FMT_NONE)}, 
     42    { PJMEDIA_FORMAT_YUY2, AV(PIX_FMT_YUYV422)}, 
     43    { PJMEDIA_FORMAT_UYVY, AV(PIX_FMT_UYVY422)}, 
     44    { PJMEDIA_FORMAT_I420, AV(PIX_FMT_YUV420P)}, 
     45    //{ PJMEDIA_FORMAT_YV12, AV(PIX_FMT_YUV420P)}, 
     46    { PJMEDIA_FORMAT_I422, AV(PIX_FMT_YUV422P)}, 
     47    { PJMEDIA_FORMAT_I420JPEG, AV(PIX_FMT_YUVJ420P)}, 
     48    { PJMEDIA_FORMAT_I422JPEG, AV(PIX_FMT_YUVJ422P)}, 
    4949}; 
    5050 
     
    5656} ffmpeg_codec_table[] = 
    5757{ 
    58     {PJMEDIA_FORMAT_H261,       AV_CODEC_ID_H261}, 
    59     {PJMEDIA_FORMAT_H263,       AV_CODEC_ID_H263}, 
    60     {PJMEDIA_FORMAT_H263P,      AV_CODEC_ID_H263P}, 
    61     {PJMEDIA_FORMAT_H264,       AV_CODEC_ID_H264}, 
    62     {PJMEDIA_FORMAT_MPEG1VIDEO, AV_CODEC_ID_MPEG1VIDEO}, 
    63     {PJMEDIA_FORMAT_MPEG2VIDEO, AV_CODEC_ID_MPEG2VIDEO}, 
    64     {PJMEDIA_FORMAT_MPEG4,      AV_CODEC_ID_MPEG4}, 
    65     {PJMEDIA_FORMAT_MJPEG,      AV_CODEC_ID_MJPEG} 
     58    {PJMEDIA_FORMAT_H261,       AV(CODEC_ID_H261)}, 
     59    {PJMEDIA_FORMAT_H263,       AV(CODEC_ID_H263)}, 
     60    {PJMEDIA_FORMAT_H263P,      AV(CODEC_ID_H263P)}, 
     61    {PJMEDIA_FORMAT_H264,       AV(CODEC_ID_H264)}, 
     62    {PJMEDIA_FORMAT_MPEG1VIDEO, AV(CODEC_ID_MPEG1VIDEO)}, 
     63    {PJMEDIA_FORMAT_MPEG2VIDEO, AV(CODEC_ID_MPEG2VIDEO)}, 
     64    {PJMEDIA_FORMAT_MPEG4,      AV(CODEC_ID_MPEG4)}, 
     65    {PJMEDIA_FORMAT_MJPEG,      AV(CODEC_ID_MJPEG)} 
    6666}; 
    6767 
     
    132132    for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_fmt_table); ++i) { 
    133133        const struct ffmpeg_fmt_table_t *t = &ffmpeg_fmt_table[i]; 
    134         if (t->id==fmt_id && t->pf != AV_PIX_FMT_NONE) { 
     134        if (t->id==fmt_id && t->pf != AV(PIX_FMT_NONE)) { 
    135135            *pixel_format = t->pf; 
    136136            return PJ_SUCCESS; 
     
    138138    } 
    139139 
    140     *pixel_format = AV_PIX_FMT_NONE; 
     140    *pixel_format = AV(PIX_FMT_NONE); 
    141141    return PJ_ENOTFOUND; 
    142142} 
     
    163163    for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_codec_table); ++i) { 
    164164        const struct ffmpeg_codec_table_t *t = &ffmpeg_codec_table[i]; 
    165         if (t->id==fmt_id && t->codec_id != AV_PIX_FMT_NONE) { 
     165        if (t->id==fmt_id && t->codec_id != AV(PIX_FMT_NONE)) { 
    166166            *codec_id = t->codec_id; 
    167167            return PJ_SUCCESS; 
     
    169169    } 
    170170 
    171     *codec_id = (unsigned)AV_PIX_FMT_NONE; 
     171    *codec_id = (unsigned)AV(PIX_FMT_NONE); 
    172172    return PJ_ENOTFOUND; 
    173173} 
  • pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.h

    r5198 r5271  
    3838#include <libavcodec/avcodec.h> 
    3939 
     40 
     41#ifdef PJMEDIA_USE_OLD_FFMPEG 
     42#   define AVPixelFormat        PixelFormat 
     43#   define AV(str)              str 
     44#   define PIX_FMT_GBRP         PIX_FMT_GBR24P 
     45#else 
     46#   define AV(str)              AV_ ## str 
     47#endif 
     48                                          
     49 
    4050void pjmedia_ffmpeg_add_ref(); 
    4151void pjmedia_ffmpeg_dec_ref(); 
Note: See TracChangeset for help on using the changeset viewer.