This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| libav_or_ffmpeg() | |
| { | |
| compile_check_libav_or_ffmpeg() | |
| { | |
| _CFLAGS=$(pkg-config --cflags libavcodec) | |
| CC=cc | |
| ${CC} -x c $_CFLAGS - -o /dev/null <<- EOF | |
| #include <libavcodec/avcodec.h> | |
| #include <libswscale/swscale.h> | |
| int main() | |
| { | |
| #if LIBAVCODEC_VERSION_MICRO >= 100 | |
| #error ffmpeg | |
| #elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 47, 100) | |
| (void)CODEC_ID_G2M; /* not declared, it is libav */ | |
| #error ffmpeg | |
| #else | |
| #error libav | |
| #endif | |
| } | |
| EOF | |
| } | |
| cc_output=$(compile_check_libav_or_ffmpeg 2>&1) | |
| if [ "$(echo "$cc_output" | grep "error: libavcodec/avcodec.h")" ]; then | |
| exit 1 # libavcodec header file not found | |
| elif [ "$(echo "$cc_output" | grep "CODEC_ID_G2M")" ]; then | |
| echo libav | |
| else | |
| #echo "$cc_output" | |
| echo "$cc_output" | grep -o "ffmpeg\|libav" | |
| fi | |
| } | |
| libav_or_ffmpeg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment