Changeset 2723 for trunk


Ignore:
Timestamp:
Dec 9, 2011, 10:46:35 AM (13 years ago)
Author:
gah
Message:

Addition checks for ffmeg

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r2715 r2723  
    96889688
    96899689
     9690
    96909691HAVE_FFMPEG_LIBS=""
    96919692if test "${with_ffmpeg}" != "no"; then
     
    97039704
    97049705  fi
    9705 fi
    9706 
    9707 for ac_func in img_convert
     9706  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lavcodec" >&5
     9707$as_echo_n "checking for main in -lavcodec... " >&6; }
     9708if ${ac_cv_lib_avcodec_main+:} false; then :
     9709  $as_echo_n "(cached) " >&6
     9710else
     9711  ac_check_lib_save_LIBS=$LIBS
     9712LIBS="-lavcodec  $LIBS"
     9713cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     9714/* end confdefs.h.  */
     9715
     9716
     9717int
     9718main ()
     9719{
     9720return main ();
     9721  ;
     9722  return 0;
     9723}
     9724_ACEOF
     9725if ac_fn_cxx_try_link "$LINENO"; then :
     9726  ac_cv_lib_avcodec_main=yes
     9727else
     9728  ac_cv_lib_avcodec_main=no
     9729fi
     9730rm -f core conftest.err conftest.$ac_objext \
     9731    conftest$ac_exeext conftest.$ac_ext
     9732LIBS=$ac_check_lib_save_LIBS
     9733fi
     9734{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avcodec_main" >&5
     9735$as_echo "$ac_cv_lib_avcodec_main" >&6; }
     9736if test "x$ac_cv_lib_avcodec_main" = xyes; then :
     9737  cat >>confdefs.h <<_ACEOF
     9738#define HAVE_LIBAVCODEC 1
     9739_ACEOF
     9740
     9741  LIBS="-lavcodec $LIBS"
     9742
     9743else
     9744  as_fn_error $? "librappture requires libavcodec" "$LINENO" 5
     9745fi
     9746
     9747  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lavutil" >&5
     9748$as_echo_n "checking for main in -lavutil... " >&6; }
     9749if ${ac_cv_lib_avutil_main+:} false; then :
     9750  $as_echo_n "(cached) " >&6
     9751else
     9752  ac_check_lib_save_LIBS=$LIBS
     9753LIBS="-lavutil  $LIBS"
     9754cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     9755/* end confdefs.h.  */
     9756
     9757
     9758int
     9759main ()
     9760{
     9761return main ();
     9762  ;
     9763  return 0;
     9764}
     9765_ACEOF
     9766if ac_fn_cxx_try_link "$LINENO"; then :
     9767  ac_cv_lib_avutil_main=yes
     9768else
     9769  ac_cv_lib_avutil_main=no
     9770fi
     9771rm -f core conftest.err conftest.$ac_objext \
     9772    conftest$ac_exeext conftest.$ac_ext
     9773LIBS=$ac_check_lib_save_LIBS
     9774fi
     9775{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avutil_main" >&5
     9776$as_echo "$ac_cv_lib_avutil_main" >&6; }
     9777if test "x$ac_cv_lib_avutil_main" = xyes; then :
     9778  cat >>confdefs.h <<_ACEOF
     9779#define HAVE_LIBAVUTIL 1
     9780_ACEOF
     9781
     9782  LIBS="-lavutil $LIBS"
     9783
     9784else
     9785  as_fn_error $? "librappture requires libavutil" "$LINENO" 5
     9786fi
     9787
     9788  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lavformat" >&5
     9789$as_echo_n "checking for main in -lavformat... " >&6; }
     9790if ${ac_cv_lib_avformat_main+:} false; then :
     9791  $as_echo_n "(cached) " >&6
     9792else
     9793  ac_check_lib_save_LIBS=$LIBS
     9794LIBS="-lavformat  $LIBS"
     9795cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     9796/* end confdefs.h.  */
     9797
     9798
     9799int
     9800main ()
     9801{
     9802return main ();
     9803  ;
     9804  return 0;
     9805}
     9806_ACEOF
     9807if ac_fn_cxx_try_link "$LINENO"; then :
     9808  ac_cv_lib_avformat_main=yes
     9809else
     9810  ac_cv_lib_avformat_main=no
     9811fi
     9812rm -f core conftest.err conftest.$ac_objext \
     9813    conftest$ac_exeext conftest.$ac_ext
     9814LIBS=$ac_check_lib_save_LIBS
     9815fi
     9816{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_main" >&5
     9817$as_echo "$ac_cv_lib_avformat_main" >&6; }
     9818if test "x$ac_cv_lib_avformat_main" = xyes; then :
     9819  cat >>confdefs.h <<_ACEOF
     9820#define HAVE_LIBAVFORMAT 1
     9821_ACEOF
     9822
     9823  LIBS="-lavformat $LIBS"
     9824
     9825else
     9826  as_fn_error $? "librappture requires libavformat" "$LINENO" 5
     9827fi
     9828
     9829  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lswscale" >&5
     9830$as_echo_n "checking for main in -lswscale... " >&6; }
     9831if ${ac_cv_lib_swscale_main+:} false; then :
     9832  $as_echo_n "(cached) " >&6
     9833else
     9834  ac_check_lib_save_LIBS=$LIBS
     9835LIBS="-lswscale  $LIBS"
     9836cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     9837/* end confdefs.h.  */
     9838
     9839
     9840int
     9841main ()
     9842{
     9843return main ();
     9844  ;
     9845  return 0;
     9846}
     9847_ACEOF
     9848if ac_fn_cxx_try_link "$LINENO"; then :
     9849  ac_cv_lib_swscale_main=yes
     9850else
     9851  ac_cv_lib_swscale_main=no
     9852fi
     9853rm -f core conftest.err conftest.$ac_objext \
     9854    conftest$ac_exeext conftest.$ac_ext
     9855LIBS=$ac_check_lib_save_LIBS
     9856fi
     9857{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_swscale_main" >&5
     9858$as_echo "$ac_cv_lib_swscale_main" >&6; }
     9859if test "x$ac_cv_lib_swscale_main" = xyes; then :
     9860  cat >>confdefs.h <<_ACEOF
     9861#define HAVE_LIBSWSCALE 1
     9862_ACEOF
     9863
     9864  LIBS="-lswscale $LIBS"
     9865
     9866else
     9867  as_fn_error $? "librappture requires libswscale" "$LINENO" 5
     9868fi
     9869
     9870  for ac_func in avcodec_decode_video2
     9871do :
     9872  ac_fn_cxx_check_func "$LINENO" "avcodec_decode_video2" "ac_cv_func_avcodec_decode_video2"
     9873if test "x$ac_cv_func_avcodec_decode_video2" = xyes; then :
     9874  cat >>confdefs.h <<_ACEOF
     9875#define HAVE_AVCODEC_DECODE_VIDEO2 1
     9876_ACEOF
     9877
     9878fi
     9879done
     9880
     9881  for ac_func in avcodec_decode_video
     9882do :
     9883  ac_fn_cxx_check_func "$LINENO" "avcodec_decode_video" "ac_cv_func_avcodec_decode_video"
     9884if test "x$ac_cv_func_avcodec_decode_video" = xyes; then :
     9885  cat >>confdefs.h <<_ACEOF
     9886#define HAVE_AVCODEC_DECODE_VIDEO 1
     9887_ACEOF
     9888
     9889fi
     9890done
     9891
     9892  for ac_func in avformat_open_input
     9893do :
     9894  ac_fn_cxx_check_func "$LINENO" "avformat_open_input" "ac_cv_func_avformat_open_input"
     9895if test "x$ac_cv_func_avformat_open_input" = xyes; then :
     9896  cat >>confdefs.h <<_ACEOF
     9897#define HAVE_AVFORMAT_OPEN_INPUT 1
     9898_ACEOF
     9899
     9900fi
     9901done
     9902
     9903  for ac_func in av_open_input_file
     9904do :
     9905  ac_fn_cxx_check_func "$LINENO" "av_open_input_file" "ac_cv_func_av_open_input_file"
     9906if test "x$ac_cv_func_av_open_input_file" = xyes; then :
     9907  cat >>confdefs.h <<_ACEOF
     9908#define HAVE_AV_OPEN_INPUT_FILE 1
     9909_ACEOF
     9910
     9911fi
     9912done
     9913
     9914  for ac_func in avio_close
     9915do :
     9916  ac_fn_cxx_check_func "$LINENO" "avio_close" "ac_cv_func_avio_close"
     9917if test "x$ac_cv_func_avio_close" = xyes; then :
     9918  cat >>confdefs.h <<_ACEOF
     9919#define HAVE_AVIO_CLOSE 1
     9920_ACEOF
     9921
     9922fi
     9923done
     9924
     9925  for ac_func in url_close
     9926do :
     9927  ac_fn_cxx_check_func "$LINENO" "url_close" "ac_cv_func_url_close"
     9928if test "x$ac_cv_func_url_close" = xyes; then :
     9929  cat >>confdefs.h <<_ACEOF
     9930#define HAVE_URL_CLOSE 1
     9931_ACEOF
     9932
     9933fi
     9934done
     9935
     9936  ac_fn_cxx_check_func "$LINENO" "av_find_stream_info" "ac_cv_func_av_find_stream_info"
     9937if test "x$ac_cv_func_av_find_stream_info" = xyes; then :
     9938
     9939else
     9940  as_fn_error $? "oops! no av_find_stream_info?!?" "$LINENO" 5
     9941fi
     9942
     9943  ac_fn_cxx_check_func "$LINENO" "avcodec_find_decoder" "ac_cv_func_avcodec_find_decoder"
     9944if test "x$ac_cv_func_avcodec_find_decoder" = xyes; then :
     9945
     9946else
     9947  as_fn_error $? "oops! no av_codec_find_decoder ?!?" "$LINENO" 5
     9948fi
     9949
     9950  ac_fn_cxx_check_func "$LINENO" "avcodec_open" "ac_cv_func_avcodec_open"
     9951if test "x$ac_cv_func_avcodec_open" = xyes; then :
     9952
     9953else
     9954  as_fn_error $? "oops! avcodec_open ?!?" "$LINENO" 5
     9955fi
     9956
     9957  ac_fn_cxx_check_func "$LINENO" "avcodec_alloc_frame" "ac_cv_func_avcodec_alloc_frame"
     9958if test "x$ac_cv_func_avcodec_alloc_frame" = xyes; then :
     9959
     9960else
     9961  as_fn_error $? "oops! no avcode_alloc_frame ?!?" "$LINENO" 5
     9962fi
     9963
     9964  ac_fn_cxx_check_func "$LINENO" "av_rescale_q" "ac_cv_func_av_rescale_q"
     9965if test "x$ac_cv_func_av_rescale_q" = xyes; then :
     9966
     9967else
     9968  as_fn_error $? "oops! no av_rescale_q ?!?" "$LINENO" 5
     9969fi
     9970
     9971  ac_fn_cxx_check_func "$LINENO" "av_read_frame" "ac_cv_func_av_read_frame"
     9972if test "x$ac_cv_func_av_read_frame" = xyes; then :
     9973
     9974else
     9975  as_fn_error $? "oops! av_read_frame ?!?" "$LINENO" 5
     9976fi
     9977
     9978  ac_fn_cxx_check_func "$LINENO" "av_free" "ac_cv_func_av_free"
     9979if test "x$ac_cv_func_av_free" = xyes; then :
     9980
     9981else
     9982  as_fn_error $? "oops! no av_frame ?!?" "$LINENO" 5
     9983fi
     9984
     9985  ac_fn_cxx_check_func "$LINENO" "avcodec_default_release_buffer" "ac_cv_func_avcodec_default_release_buffer"
     9986if test "x$ac_cv_func_avcodec_default_release_buffer" = xyes; then :
     9987
     9988else
     9989  as_fn_error $? "oops! no avcode_default_release_buffer ?!?" "$LINENO" 5
     9990fi
     9991
     9992  ac_fn_cxx_check_func "$LINENO" "avpicture_get_size" "ac_cv_func_avpicture_get_size"
     9993if test "x$ac_cv_func_avpicture_get_size" = xyes; then :
     9994
     9995else
     9996  as_fn_error $? "oops! no avpicture_get_size ?!?" "$LINENO" 5
     9997fi
     9998
     9999  ac_fn_cxx_check_func "$LINENO" "avpicture_fill" "ac_cv_func_avpicture_fill"
     10000if test "x$ac_cv_func_avpicture_fill" = xyes; then :
     10001
     10002else
     10003  as_fn_error $? "oops! no avpicture_fill ?!?" "$LINENO" 5
     10004fi
     10005
     10006  ac_fn_cxx_check_func "$LINENO" "sws_getCachedContext" "ac_cv_func_sws_getCachedContext"
     10007if test "x$ac_cv_func_sws_getCachedContext" = xyes; then :
     10008
     10009else
     10010  as_fn_error $? "oops! no sws_getCachedContext ?!?" "$LINENO" 5
     10011fi
     10012
     10013  for ac_func in img_convert
    970810014do :
    970910015  ac_fn_cxx_check_func "$LINENO" "img_convert" "ac_cv_func_img_convert"
     
    971610022done
    971710023
    9718 for ac_func in sws_scale
     10024  for ac_func in sws_scale
    971910025do :
    972010026  ac_fn_cxx_check_func "$LINENO" "sws_scale" "ac_cv_func_sws_scale"
     
    972710033done
    972810034
     10035fi
    972910036
    973010037
  • trunk/configure.in

    r2715 r2723  
    338338]])
    339339
     340
    340341HAVE_FFMPEG_LIBS=""
    341342if test "${with_ffmpeg}" != "no"; then
     
    351352    AC_DEFINE(BUILD_with_ffmpeg, 1, [Build rappture with ffmpeg widgets])
    352353  fi
    353 fi
    354 
    355 AC_CHECK_FUNCS(img_convert)
    356 AC_CHECK_FUNCS(sws_scale)
     354  AC_CHECK_LIB(avcodec, main,,AC_MSG_ERROR(librappture requires libavcodec))
     355  AC_CHECK_LIB(avutil, main,,AC_MSG_ERROR(librappture requires libavutil))
     356  AC_CHECK_LIB(avformat, main,,AC_MSG_ERROR(librappture requires libavformat))
     357  AC_CHECK_LIB(swscale, main,,AC_MSG_ERROR(librappture requires libswscale))
     358  AC_CHECK_FUNCS(avcodec_decode_video2)
     359  AC_CHECK_FUNCS(avcodec_decode_video)
     360  AC_CHECK_FUNCS(avformat_open_input)
     361  AC_CHECK_FUNCS(av_open_input_file)
     362  AC_CHECK_FUNCS(avio_close)
     363  AC_CHECK_FUNCS(url_close)
     364  AC_CHECK_FUNC(av_find_stream_info,,
     365  AC_MSG_ERROR(oops! no av_find_stream_info?!?))
     366  AC_CHECK_FUNC(avcodec_find_decoder,,
     367    AC_MSG_ERROR(oops! no av_codec_find_decoder ?!?))
     368  AC_CHECK_FUNC(avcodec_open,,AC_MSG_ERROR(oops! avcodec_open ?!?))
     369  AC_CHECK_FUNC(avcodec_alloc_frame,,
     370    AC_MSG_ERROR(oops! no avcode_alloc_frame ?!?))
     371  AC_CHECK_FUNC(av_rescale_q,,AC_MSG_ERROR(oops! no av_rescale_q ?!?))
     372  AC_CHECK_FUNC(av_read_frame,,AC_MSG_ERROR(oops! av_read_frame ?!?))
     373  AC_CHECK_FUNC(av_free,,AC_MSG_ERROR(oops! no av_frame ?!?))
     374  AC_CHECK_FUNC(avcodec_default_release_buffer,,
     375    AC_MSG_ERROR(oops! no avcode_default_release_buffer ?!?))
     376  AC_CHECK_FUNC(avpicture_get_size,,
     377    AC_MSG_ERROR(oops! no avpicture_get_size ?!?))
     378  AC_CHECK_FUNC(avpicture_fill,,AC_MSG_ERROR(oops! no avpicture_fill ?!?))
     379  AC_CHECK_FUNC(sws_getCachedContext,,
     380    AC_MSG_ERROR(oops! no sws_getCachedContext ?!?))
     381  AC_CHECK_FUNCS(img_convert)
     382  AC_CHECK_FUNCS(sws_scale)
     383fi
    357384
    358385AC_SUBST(CFLAGS_DEBUG)
  • trunk/src/core/config.h.in

    r1873 r2723  
    1313#undef HAVE_ASSERT_H
    1414
     15/* Define to 1 if you have the `avcodec_decode_video' function. */
     16#undef HAVE_AVCODEC_DECODE_VIDEO
     17
     18/* Define to 1 if you have the `avcodec_decode_video2' function. */
     19#undef HAVE_AVCODEC_DECODE_VIDEO2
     20
     21/* Define to 1 if you have the `avformat_open_input' function. */
     22#undef HAVE_AVFORMAT_OPEN_INPUT
     23
     24/* Define to 1 if you have the `avio_close' function. */
     25#undef HAVE_AVIO_CLOSE
     26
     27/* Define to 1 if you have the `av_open_input_file' function. */
     28#undef HAVE_AV_OPEN_INPUT_FILE
     29
    1530/* Define to 1 if you have the <cctype> header file. */
    1631#undef HAVE_CCTYPE
     
    6782#undef HAVE_ITERATOR
    6883
     84/* Define to 1 if you have the `avcodec' library (-lavcodec). */
     85#undef HAVE_LIBAVCODEC
     86
    6987/* Define to 1 if you have the <libavcodec/avcodec.h> header file. */
    7088#undef HAVE_LIBAVCODEC_AVCODEC_H
    7189
     90/* Define to 1 if you have the `avformat' library (-lavformat). */
     91#undef HAVE_LIBAVFORMAT
     92
    7293/* Define to 1 if you have the <libavformat/avformat.h> header file. */
    7394#undef HAVE_LIBAVFORMAT_AVFORMAT_H
    7495
     96/* Define to 1 if you have the `avutil' library (-lavutil). */
     97#undef HAVE_LIBAVUTIL
     98
    7599/* Define to 1 if you have the <libavutil/avutil.h> header file. */
    76100#undef HAVE_LIBAVUTIL_AVUTIL_H
     
    82106#undef HAVE_LIBSTDC__
    83107
     108/* Define to 1 if you have the `swscale' library (-lswscale). */
     109#undef HAVE_LIBSWSCALE
     110
    84111/* Define to 1 if you have the <libswscale/swscale.h> header file. */
    85112#undef HAVE_LIBSWSCALE_SWSCALE_H
     
    100127#undef HAVE_MEMORY_H
    101128
     129/* Define to 1 if you have the <Python.h> header file. */
     130#undef HAVE_PYTHON_H
     131
    102132/* Define to 1 if you have the <sstream> header file. */
    103133#undef HAVE_SSTREAM
     
    141171/* Define to 1 if you have the <unistd.h> header file. */
    142172#undef HAVE_UNISTD_H
     173
     174/* Define to 1 if you have the `url_close' function. */
     175#undef HAVE_URL_CLOSE
    143176
    144177/* Define to 1 if you have the <vector> header file. */
  • trunk/src/objects/RpVideo.c

    r2720 r2723  
    5858#define AVMEDIA_TYPE_VIDEO      CODEC_TYPE_VIDEO
    5959#define AV_PKT_FLAG_KEY         PKT_FLAG_KEY           
     60#endif  /* LIBAVUTIL_VERSION_MAJOR */
     61
     62#ifndef HAVE_AVIO_CLOSE
    6063#define avio_close              url_fclose
    61 #define avformat_open_input     av_open_input_file
    62 #endif  /* LIBAVUTIL_VERSION_MAJOR */
    63 
     64#endif
    6465
    6566/*
     
    343344     * Open the video stream from that file.
    344345     */
    345 #if LIBAVUTIL_VERSION_MAJOR < 51
     346#ifdef HAVE_AVFORMAT_OPEN_INPUT
     347    if (avformat_open_input(&vidPtr->pFormatCtx, vidPtr->fileName, NULL,
     348        NULL) != 0) {
     349        return -3;
     350    }
     351#else
    346352    if (av_open_input_file(&vidPtr->pFormatCtx, vidPtr->fileName,
    347353            NULL, 0, NULL) != 0) {
    348354        return -3;
    349     }
    350 #else
    351     if (avformat_open_input(&vidPtr->pFormatCtx, vidPtr->fileName, NULL,
    352         NULL) != 0) {
    353         return -3;
    354355    }
    355356#endif
     
    715716                    global_video_pkt_pts = packet.pts;
    716717
    717 #ifdef FFMPEG_AVCODEC_H
     718#ifdef HAVE_AVCODEC_DECODE_VIDEO2
     719                    // new avcodec decode video function
     720                    avcodec_decode_video2(vcodecCtx, vidPtr->pFrameYUV,
     721                        &frameFinished, &packet);
     722#else
    718723                    // old avcodec decode video function
    719724                    avcodec_decode_video(vcodecCtx, vidPtr->pFrameYUV,
    720725                        &frameFinished, packet.data, packet.size);
    721 #else
    722                     // new avcodec decode video function
    723                     avcodec_decode_video2(vcodecCtx, vidPtr->pFrameYUV,
    724                         &frameFinished, &packet);
    725726#endif
    726 
    727727                    if (packet.dts == AV_NOPTS_VALUE
    728728                          && vidPtr->pFrameYUV->opaque
Note: See TracChangeset for help on using the changeset viewer.