7a64d32002-07-18Honza Petrous AC_INIT(ffmpeg.c) AC_CONFIG_HEADER(config.h)
ec33b02002-07-24Martin Stjernholm PIKE_FEATURE_WITHOUT(FFmpeg)
1f7f6b2005-06-09Henrik Grubbström (Grubba)  incdirs="$with_root/usr/local/include $with_root/usr/local/include/libffmpeg $with_root/usr/local/include/libavcodec $with_root/usr/include $with_root/usr/include/libffmpeg $with_root/usr/include/libavcodec $with_root/opt/ffmpeg/include $with_root/opt/libffmpeg/include $with_root/opt/libavcodec/include no"
fa96162002-09-11Honza Petrous 
ec33b02002-07-24Martin Stjernholm AC_ARG_WITH(ffmpeg, [ --without-ffmpeg no support for FFmpeg],[],[with_ffmpeg=yes])
7a64d32002-07-18Honza Petrous  AC_MODULE_INIT() if test x$with_ffmpeg = xyes ; then
ec33b02002-07-24Martin Stjernholm  PIKE_FEATURE_NODEP(FFmpeg)
d629172002-08-05Xavier Beaudouin 
fa96162002-09-11Honza Petrous  AC_MSG_CHECKING(for Ffmpeg include-directory) AC_CACHE_VAL(pike_cv_ffmpeg_include_dir, [ for pike_cv_ffmpeg_include_dir in $incdirs; do
56af1b2002-12-06Mirar (Pontus Hagland)  if test -d $pike_cv_ffmpeg_include_dir/avcodec.h; then
fa96162002-09-11Honza Petrous  break
1f7f6b2005-06-09Henrik Grubbström (Grubba)  elif test -d $pike_cv_ffmpeg_include_dir/ffmpeg/avcodec.h; then break
1c0dc92011-10-30Henrik Grubbström (Grubba)  elif test -d $pike_cv_ffmpeg_include_dir/libffmpeg/avcodec.h; then break elif test -d $pike_cv_ffmpeg_include_dir/libavcodec/avcodec.h; then break
fa96162002-09-11Honza Petrous  else : fi done ]) AC_MSG_RESULT($pike_cv_ffmpeg_include_dir) if test x$pike_cv_ffmpeg_include_dir = xno; then :; else
56af1b2002-12-06Mirar (Pontus Hagland)  echo Adding $pike_cv_ffmpeg_include_dir to the include search path.
fa96162002-09-11Honza Petrous  CPPFLAGS="${CPPFLAGS} -I$pike_cv_ffmpeg_include_dir" fi
1c0dc92011-10-30Henrik Grubbström (Grubba)  AC_CHECK_HEADERS([avcodec.h ffmpeg/avcodec.h libffmpeg/avcodec.h \
5d43a72012-02-11Marcus Comstedt  libavcodec/avcodec.h libavutil/avutil.h])
56af1b2002-12-06Mirar (Pontus Hagland) 
d629172002-08-05Xavier Beaudouin dnl ffmpeg and avcodec are the same libs... with 2 differents.. dnl don't ask me why.
fa96162002-09-11Honza Petrous dnl hop: libavcodec is Ffmpeg's native name, libffmpeg should dnl be libavcode + libav libraries together
56af1b2002-12-06Mirar (Pontus Hagland)  dnl my libavcodec needs libmp3lame that needs libm /Mirar AC_CHECK_LIB( m, pow, [
13670c2015-05-25Martin Nilsson  LIBS="${LIBS-} -lm"
56af1b2002-12-06Mirar (Pontus Hagland)  ]) AC_CHECK_LIB( mp3lame, lame_get_copyright, [ AC_DEFINE(HAVE_LIBMP3LAME)
13670c2015-05-25Martin Nilsson  LIBS="${LIBS-} -lmp3lame"
56af1b2002-12-06Mirar (Pontus Hagland)  ])
d629172002-08-05Xavier Beaudouin  AC_CHECK_LIB( avcodec, avcodec_init, [
56af1b2002-12-06Mirar (Pontus Hagland)  AC_DEFINE(HAVE_LIBAVCODEC)
d629172002-08-05Xavier Beaudouin  LIBS="${LIBS-} -lavcodec"
56af1b2002-12-06Mirar (Pontus Hagland)  got_lib=yes
d629172002-08-05Xavier Beaudouin  PIKE_FEATURE(FFmpeg,[yes (using libavcodec)])
56af1b2002-12-06Mirar (Pontus Hagland)  AC_CHECK_LIB( avformat, first_oformat, [ AC_DEFINE(HAVE_LIBAVFORMAT) LIBS="${LIBS-} -lavformat -lavcodec" dnl both (again) PIKE_FEATURE(FFmpeg,[yes (using libavcodec and libavformat)])
d629172002-08-05Xavier Beaudouin  ])
56af1b2002-12-06Mirar (Pontus Hagland)  ])
fa96162002-09-11Honza Petrous  AC_CHECK_LIB( ffmpeg, avcodec_init, [ AC_DEFINE(HAVE_LIBFFMPEG) LIBS="${LIBS-} -lffmpeg"
56af1b2002-12-06Mirar (Pontus Hagland)  got_lib=yes
fa96162002-09-11Honza Petrous  PIKE_FEATURE(FFmpeg,[yes (using libffmpeg)]) ])
9d769d2002-12-07Henrik Grubbström (Grubba)  if test x"$got_lib" = x"yes"; then
56af1b2002-12-06Mirar (Pontus Hagland)  AC_MSG_CHECKING([if library is really working]) AC_CACHE_VAL(pike_cv_ffmpeg_working, [ AC_TRY_COMPILE([
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBAVCODEC_AVCODEC_H #include <libavcodec/avcodec.h> #else
56af1b2002-12-06Mirar (Pontus Hagland) #ifdef HAVE_FFMPEG_AVCODEC_H #include <ffmpeg/avcodec.h> #else
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBFFMPEG_AVCODEC_H #include <libffmpeg/avcodec.h> #else
d22b8f2002-08-06Xavier Beaudouin #ifdef HAVE_AVCODEC_H #include <avcodec.h> #endif
56af1b2002-12-06Mirar (Pontus Hagland) #endif
1c0dc92011-10-30Henrik Grubbström (Grubba) #endif #endif
aad8c62008-09-15Henrik Grubbström (Grubba)  ], [
56af1b2002-12-06Mirar (Pontus Hagland)  extern AVCodec *thecodec;
13670c2015-05-25Martin Nilsson 
56af1b2002-12-06Mirar (Pontus Hagland)  thecodec->type = 0;
aad8c62008-09-15Henrik Grubbström (Grubba)  ], [ pike_cv_ffmpeg_working=yes ], [ pike_cv_ffmpeg_working=no
d22b8f2002-08-06Xavier Beaudouin  ])
aad8c62008-09-15Henrik Grubbström (Grubba)  ]) AC_MSG_RESULT($pike_cv_ffmpeg_working) if test "x$pike_cv_ffmpeg_working" = "xyes"; then AC_DEFINE(HAVE_WORKING_LIBFFMPEG) dnl PIKE_FEATURE(FFmpeg)
1c0dc92011-10-30Henrik Grubbström (Grubba) 
e5925f2013-07-03Henrik Grubbström (Grubba)  AC_CHECK_FUNCS([avcodec_decode_audio avcodec_decode_audio2 \ avcodec_decode_audio3 avcodec_decode_audio4 \ av_codec_next avcodec_open avcodec_open2 ])
13670c2015-05-25Martin Nilsson  else
aad8c62008-09-15Henrik Grubbström (Grubba)  PIKE_FEATURE(FFmpeg,[no (not working)]) fi
0dbe502003-12-24Mirar (Pontus Hagland)  AC_MSG_CHECKING([if UINT8 et al are redefined]) AC_CACHE_VAL(pike_cv_ffmpeg_UINT8, [ AC_TRY_COMPILE([ #define UINT8 "hepp"
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBAVCODEC_AVCODEC_H #include <libavcodec/avcodec.h> #else
0dbe502003-12-24Mirar (Pontus Hagland) #ifdef HAVE_FFMPEG_AVCODEC_H #include <ffmpeg/avcodec.h> #else
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBFFMPEG_AVCODEC_H #include <libffmpeg/avcodec.h> #else
0dbe502003-12-24Mirar (Pontus Hagland) #ifdef HAVE_AVCODEC_H #include <avcodec.h> #endif #endif
1c0dc92011-10-30Henrik Grubbström (Grubba) #endif #endif
0dbe502003-12-24Mirar (Pontus Hagland)  ], [ char *v=UINT8; return v[0]=='h'; /* not run anyway, but... */ ], [ pike_cv_ffmpeg_UINT8=no ], [ pike_cv_ffmpeg_UINT8=yes ]) ]) AC_MSG_RESULT($pike_cv_ffmpeg_UINT8) if test "x$pike_cv_ffmpeg_UINT8" = "xyes"; then AC_DEFINE(FFMPEG_REDEFINES_UINT8) fi AC_MSG_CHECKING([if uint8_t is defined]) AC_CACHE_VAL(pike_cv_ffmpeg_uint8_t, [ AC_TRY_COMPILE([
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBAVCODEC_AVCODEC_H #include <libavcodec/avcodec.h> #else
0dbe502003-12-24Mirar (Pontus Hagland) #ifdef HAVE_FFMPEG_AVCODEC_H #include <ffmpeg/avcodec.h> #else
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBAVCODEC_AVCODEC_H #include <libffmpeg/avcodec.h> #else
0dbe502003-12-24Mirar (Pontus Hagland) #ifdef HAVE_AVCODEC_H #include <avcodec.h> #endif #endif
1c0dc92011-10-30Henrik Grubbström (Grubba) #endif #endif
80c1e22005-06-14Henrik Grubbström (Grubba)  ], [
0dbe502003-12-24Mirar (Pontus Hagland)  uint8_t s[20];
80c1e22005-06-14Henrik Grubbström (Grubba)  ], [ pike_cv_ffmpeg_uint8_t=yes ], [ pike_cv_ffmpeg_uint8_t=no
0dbe502003-12-24Mirar (Pontus Hagland)  ])
80c1e22005-06-14Henrik Grubbström (Grubba)  ]) AC_MSG_RESULT($pike_cv_ffmpeg_uint8_t) if test "x$pike_cv_ffmpeg_uint8_t" = "xyes"; then AC_DEFINE(HAVE_UINT8_T) fi
0dbe502003-12-24Mirar (Pontus Hagland) 
80c1e22005-06-14Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if AVCodecContext has frame_rate) AC_CACHE_VAL(pike_cv_AVCodecContext_has_frame_rate, [ AC_TRY_COMPILE([
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_LIBAVCODEC_AVCODEC_H #include <libavcodec/avcodec.h> #else
80c1e22005-06-14Henrik Grubbström (Grubba) #ifdef HAVE_FFMPEG_AVCODEC_H #include <ffmpeg/avcodec.h> #else
1c0dc92011-10-30Henrik Grubbström (Grubba) #ifdef HAVE_FFMPEG_AVCODEC_H #include <libffmpeg/avcodec.h> #else
80c1e22005-06-14Henrik Grubbström (Grubba) #ifdef HAVE_AVCODEC_H #include <avcodec.h> #endif #endif
1c0dc92011-10-30Henrik Grubbström (Grubba) #endif #endif
80c1e22005-06-14Henrik Grubbström (Grubba)  ], [ AVCodecContext context; context.frame_rate = 0; ], pike_cv_AVCodecContext_has_frame_rate=yes, pike_cv_AVCodecContext_has_frame_rate=no) ]) AC_MSG_RESULT($pike_cv_AVCodecContext_has_frame_rate) if test "x$pike_cv_AVCodecContext_has_frame_rate" = "xyes"; then AC_DEFINE(HAVE_AVCODECCONTEXT_FRAME_RATE) fi
6951522013-07-01Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if AVCodec has encode2) AC_CACHE_VAL(pike_cv_AVCodec_has_encode2, [ AC_TRY_COMPILE([ #ifdef HAVE_LIBAVCODEC_AVCODEC_H #include <libavcodec/avcodec.h> #else #ifdef HAVE_FFMPEG_AVCODEC_H #include <ffmpeg/avcodec.h> #else #ifdef HAVE_FFMPEG_AVCODEC_H #include <libffmpeg/avcodec.h> #else #ifdef HAVE_AVCODEC_H #include <avcodec.h> #endif #endif #endif #endif ], [ AVCodec codec; codec.encode2 = 0; ], pike_cv_AVCodec_has_encode2=yes, pike_cv_AVCodec_has_encode2=no) ]) AC_MSG_RESULT($pike_cv_AVCodec_has_encode2) if test "x$pike_cv_AVCodec_has_encode2" = "xyes"; then AC_DEFINE(HAVE_AVCODEC_ENCODE2) fi
56af1b2002-12-06Mirar (Pontus Hagland)  fi
7a64d32002-07-18Honza Petrous fi AC_OUTPUT(Makefile,echo FOO >stamp-h )