File ssr-0.3.3-ffmpeg-pkgconfig.diff of Package simplescreenrecorder

diff --git a/Makefile.in b/Makefile.in
index 59d2f9d..99f2e14 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -239,6 +239,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
 FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
diff --git a/configure b/configure
index 455707b..caf099b 100755
--- a/configure
+++ b/configure
@@ -636,6 +636,8 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+FFMPEG_LIBS
+FFMPEG_CFLAGS
 QT4_LIBS
 QT4_CFLAGS
 LRELEASE
@@ -645,9 +647,6 @@ RCC
 MOC
 QT5_LIBS
 QT5_CFLAGS
-PKG_CONFIG_LIBDIR
-PKG_CONFIG_PATH
-PKG_CONFIG
 WITH_JACK_FALSE
 WITH_JACK_TRUE
 WITH_PULSEAUDIO_FALSE
@@ -664,6 +663,9 @@ ENABLE_GLINJECTLIB_FALSE
 ENABLE_GLINJECTLIB_TRUE
 ENABLE_SSRPROGRAM_FALSE
 ENABLE_SSRPROGRAM_TRUE
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
 CXXCPP
 am__fastdepCXX_FALSE
 am__fastdepCXX_TRUE
@@ -831,7 +833,9 @@ PKG_CONFIG_LIBDIR
 QT5_CFLAGS
 QT5_LIBS
 QT4_CFLAGS
-QT4_LIBS'
+QT4_LIBS
+FFMPEG_CFLAGS
+FFMPEG_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1511,6 +1515,9 @@ Some influential environment variables:
   QT5_LIBS    linker flags for QT5, overriding pkg-config
   QT4_CFLAGS  C compiler flags for QT4, overriding pkg-config
   QT4_LIBS    linker flags for QT4, overriding pkg-config
+  FFMPEG_CFLAGS
+              C compiler flags for FFMPEG, overriding pkg-config
+  FFMPEG_LIBS linker flags for FFMPEG, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -16834,6 +16841,126 @@ $as_echo "$ac_cv_path_SED" >&6; }
 
 
 
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		PKG_CONFIG=""
+	fi
+fi
+
 # Check whether --enable-ssrprogram was given.
 if test "${enable_ssrprogram+set}" = set; then :
   enableval=$enable_ssrprogram;
@@ -17021,126 +17148,6 @@ if test -z "$ENABLE_SSRPROGRAM_TRUE"; then :
 	if test -z "$WITH_QT5_TRUE"; then :
 
 
-
-
-
-
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-	if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
-  ac_pt_PKG_CONFIG=$PKG_CONFIG
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ac_pt_PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_pt_PKG_CONFIG" = x; then
-    PKG_CONFIG=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    PKG_CONFIG=$ac_pt_PKG_CONFIG
-  fi
-else
-  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
-	_pkg_min_version=0.9.0
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
-	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	else
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		PKG_CONFIG=""
-	fi
-fi
-
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT5" >&5
 $as_echo_n "checking for QT5... " >&6; }
@@ -17457,129 +17464,9 @@ fi
 else
 
 
-
-
-
-
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-	if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
-  ac_pt_PKG_CONFIG=$PKG_CONFIG
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ac_pt_PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_pt_PKG_CONFIG" = x; then
-    PKG_CONFIG=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    PKG_CONFIG=$ac_pt_PKG_CONFIG
-  fi
-else
-  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
-	_pkg_min_version=0.9.0
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
-	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	else
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-		PKG_CONFIG=""
-	fi
-fi
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT4" >&5
-$as_echo_n "checking for QT4... " >&6; }
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT4" >&5
+$as_echo_n "checking for QT4... " >&6; }
 
 if test -n "$QT4_CFLAGS"; then
     pkg_cv_QT4_CFLAGS="$QT4_CFLAGS"
@@ -17995,215 +17882,98 @@ fi
 
 if test -z "$ENABLE_SSRPROGRAM_TRUE"; then :
 
-	ac_fn_c_check_header_mongrel "$LINENO" "libavformat/avformat.h" "ac_cv_header_libavformat_avformat_h" "$ac_includes_default"
-if test "x$ac_cv_header_libavformat_avformat_h" = xyes; then :
 
-else
-  as_fn_error $? "required header missing" "$LINENO" 5
-fi
-
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_guess_format in -lavformat" >&5
-$as_echo_n "checking for av_guess_format in -lavformat... " >&6; }
-if ${ac_cv_lib_avformat_av_guess_format+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lavformat  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char av_guess_format ();
-int
-main ()
-{
-return av_guess_format ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_avformat_av_guess_format=yes
-else
-  ac_cv_lib_avformat_av_guess_format=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_guess_format" >&5
-$as_echo "$ac_cv_lib_avformat_av_guess_format" >&6; }
-if test "x$ac_cv_lib_avformat_av_guess_format" = xyes; then :
-
-else
-  as_fn_error $? "required library missing" "$LINENO" 5
-fi
-
-	ac_fn_c_check_header_mongrel "$LINENO" "libavcodec/avcodec.h" "ac_cv_header_libavcodec_avcodec_h" "$ac_includes_default"
-if test "x$ac_cv_header_libavcodec_avcodec_h" = xyes; then :
-
-else
-  as_fn_error $? "required header missing" "$LINENO" 5
-fi
-
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for avcodec_find_encoder_by_name in -lavcodec" >&5
-$as_echo_n "checking for avcodec_find_encoder_by_name in -lavcodec... " >&6; }
-if ${ac_cv_lib_avcodec_avcodec_find_encoder_by_name+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lavcodec  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFMPEG" >&5
+$as_echo_n "checking for FFMPEG... " >&6; }
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char avcodec_find_encoder_by_name ();
-int
-main ()
-{
-return avcodec_find_encoder_by_name ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_avcodec_avcodec_find_encoder_by_name=yes
+if test -n "$FFMPEG_CFLAGS"; then
+    pkg_cv_FFMPEG_CFLAGS="$FFMPEG_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_FFMPEG_CFLAGS=`$PKG_CONFIG --cflags "libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
-  ac_cv_lib_avcodec_avcodec_find_encoder_by_name=no
+  pkg_failed=yes
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ else
+    pkg_failed=untried
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avcodec_avcodec_find_encoder_by_name" >&5
-$as_echo "$ac_cv_lib_avcodec_avcodec_find_encoder_by_name" >&6; }
-if test "x$ac_cv_lib_avcodec_avcodec_find_encoder_by_name" = xyes; then :
-
+if test -n "$FFMPEG_LIBS"; then
+    pkg_cv_FFMPEG_LIBS="$FFMPEG_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_FFMPEG_LIBS=`$PKG_CONFIG --libs "libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
-  as_fn_error $? "required library missing" "$LINENO" 5
+  pkg_failed=yes
 fi
-
-	ac_fn_c_check_header_mongrel "$LINENO" "libavutil/avutil.h" "ac_cv_header_libavutil_avutil_h" "$ac_includes_default"
-if test "x$ac_cv_header_libavutil_avutil_h" = xyes; then :
-
-else
-  as_fn_error $? "required header missing" "$LINENO" 5
+ else
+    pkg_failed=untried
 fi
 
 
-	ac_fn_c_check_header_mongrel "$LINENO" "libavutil/mathematics.h" "ac_cv_header_libavutil_mathematics_h" "$ac_includes_default"
-if test "x$ac_cv_header_libavutil_mathematics_h" = xyes; then :
 
-else
-  as_fn_error $? "required header missing" "$LINENO" 5
-fi
-
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_rescale_q in -lavutil" >&5
-$as_echo_n "checking for av_rescale_q in -lavutil... " >&6; }
-if ${ac_cv_lib_avutil_av_rescale_q+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lavutil  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char av_rescale_q ();
-int
-main ()
-{
-return av_rescale_q ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_avutil_av_rescale_q=yes
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-  ac_cv_lib_avutil_av_rescale_q=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+        _pkg_short_errors_supported=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avutil_av_rescale_q" >&5
-$as_echo "$ac_cv_lib_avutil_av_rescale_q" >&6; }
-if test "x$ac_cv_lib_avutil_av_rescale_q" = xyes; then :
+        if test $_pkg_short_errors_supported = yes; then
+	        FFMPEG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2" 2>&1`
+        else
+	        FFMPEG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$FFMPEG_PKG_ERRORS" >&5
 
-else
-  as_fn_error $? "required library missing" "$LINENO" 5
-fi
+	as_fn_error $? "Package requirements (libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2) were not met:
 
-	ac_fn_c_check_header_mongrel "$LINENO" "libswscale/swscale.h" "ac_cv_header_libswscale_swscale_h" "$ac_includes_default"
-if test "x$ac_cv_header_libswscale_swscale_h" = xyes; then :
+$FFMPEG_PKG_ERRORS
 
-else
-  as_fn_error $? "required header missing" "$LINENO" 5
-fi
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
+Alternatively, you may set the environment variables FFMPEG_CFLAGS
+and FFMPEG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sws_scale in -lswscale" >&5
-$as_echo_n "checking for sws_scale in -lswscale... " >&6; }
-if ${ac_cv_lib_swscale_sws_scale+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lswscale  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+Alternatively, you may set the environment variables FFMPEG_CFLAGS
+and FFMPEG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char sws_scale ();
-int
-main ()
-{
-return sws_scale ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_swscale_sws_scale=yes
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
 else
-  ac_cv_lib_swscale_sws_scale=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_swscale_sws_scale" >&5
-$as_echo "$ac_cv_lib_swscale_sws_scale" >&6; }
-if test "x$ac_cv_lib_swscale_sws_scale" = xyes; then :
+	FFMPEG_CFLAGS=$pkg_cv_FFMPEG_CFLAGS
+	FFMPEG_LIBS=$pkg_cv_FFMPEG_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-else
-  as_fn_error $? "required library missing" "$LINENO" 5
 fi
 
-
 fi
 
 ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
diff --git a/configure.ac b/configure.ac
index 50426fe..e862481 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,7 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_SED
 AC_PROG_INSTALL
+PKG_PROG_PKG_CONFIG
 
 AC_ARG_ENABLE([ssrprogram], AS_HELP_STRING([--disable-ssrprogram], [don't build the SimpleScreenRecorder program]))
 AC_ARG_ENABLE([glinjectlib], AS_HELP_STRING([--disable-glinjectlib], [don't build the GLInject library]))
@@ -53,7 +54,6 @@ SSR_CONDITIONAL_DEFINE([WITH_JACK], [SSR_USE_JACK], [Use JACK.])
 
 AM_COND_IF([ENABLE_SSRPROGRAM], [
 	AM_COND_IF([WITH_QT5], [
-		PKG_PROG_PKG_CONFIG
 		PKG_CHECK_MODULES([QT5], [Qt5Core >= 5.1.0 Qt5Gui Qt5Widgets Qt5X11Extras], [
 			QT_PATH1="$( eval $PKG_CONFIG --variable=libdir Qt5Core )/qt5/bin"
 			QT_PATH2="$( eval $PKG_CONFIG --variable=exec_prefix Qt5Core )/bin"
@@ -66,7 +66,6 @@ AM_COND_IF([ENABLE_SSRPROGRAM], [
 			AC_MSG_ERROR([Qt5 not found])
 		])
 	], [
-		PKG_PROG_PKG_CONFIG
 		PKG_CHECK_MODULES([QT4], [QtCore >= 4.8.0 QtGui], [
 			QT_PATH1="$( eval $PKG_CONFIG --variable=libdir QtCore )/qt4/bin"
 			QT_PATH2="$( eval $PKG_CONFIG --variable=exec_prefix QtCore )/bin"
@@ -91,15 +90,7 @@ AM_COND_IF([ENABLE_GLINJECTLIB], [
 ])
 
 AM_COND_IF([ENABLE_SSRPROGRAM], [
-	AC_CHECK_HEADER([libavformat/avformat.h], [ ], [AC_MSG_ERROR([required header missing])])
-	AC_CHECK_LIB([avformat], [av_guess_format], [ ], [AC_MSG_ERROR([required library missing])])
-	AC_CHECK_HEADER([libavcodec/avcodec.h], [ ], [AC_MSG_ERROR([required header missing])])
-	AC_CHECK_LIB([avcodec], [avcodec_find_encoder_by_name], [ ], [AC_MSG_ERROR([required library missing])])
-	AC_CHECK_HEADER([libavutil/avutil.h], [ ], [AC_MSG_ERROR([required header missing])])
-	AC_CHECK_HEADER([libavutil/mathematics.h], [ ], [AC_MSG_ERROR([required header missing])])
-	AC_CHECK_LIB([avutil], [av_rescale_q], [ ], [AC_MSG_ERROR([required library missing])])
-	AC_CHECK_HEADER([libswscale/swscale.h], [ ], [AC_MSG_ERROR([required header missing])])
-	AC_CHECK_LIB([swscale], [sws_scale], [ ], [AC_MSG_ERROR([required library missing])])
+	PKG_CHECK_MODULES([FFMPEG], [libavformat >= 53 libavcodec >= 53 libavutil >= 51 libswscale >= 2])
 ])
 
 AC_CHECK_HEADER([X11/Xlib.h], [ ], [AC_MSG_ERROR([required header missing])])
diff --git a/data/Makefile.in b/data/Makefile.in
index 7dca6e7..d195700 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -242,6 +242,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
 FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
diff --git a/glinject/Makefile.in b/glinject/Makefile.in
index 84df12e..737e4a9 100644
--- a/glinject/Makefile.in
+++ b/glinject/Makefile.in
@@ -262,6 +262,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
 FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index a134b15..6f424aa 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -182,6 +182,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
 FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
diff --git a/simple-build-and-install b/simple-build-and-install
index e55ad89..508ddd4 100755
--- a/simple-build-and-install
+++ b/simple-build-and-install
@@ -54,8 +54,9 @@ export CFLAGS="-Wall -O2 -pipe"
 export CXXFLAGS="-Wall -O2 -pipe"
 export LDFLAGS=""
 
-export CPPFLAGS="$CPPFLAGS `pkg-config --cflags-only-I libavformat libavcodec libavutil libswscale`"
-export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L libavformat libavcodec libavutil libswscale`"
+# This shouldn't be needed anymore now that configure uses pkg-config for FFmpeg.
+#export CPPFLAGS="$CPPFLAGS `pkg-config --cflags-only-I libavformat libavcodec libavutil libswscale`"
+#export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L libavformat libavcodec libavutil libswscale`"
 
 mkdir -p build
 cd build
diff --git a/src/Makefile.am b/src/Makefile.am
index 98e6466..dd0e57d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,10 +8,13 @@ simplescreenrecorder_CPPFLAGS = \
 	-I$(srcdir)/AV/Output \
 	-I$(srcdir)/AV \
 	-I$(srcdir)/common \
-	-I$(srcdir)/GUI
+	-I$(srcdir)/GUI \
+	$(FFMPEG_CFLAGS)
 simplescreenrecorder_CFLAGS = -pthread
 simplescreenrecorder_CXXFLAGS = -pthread -std=c++0x
-simplescreenrecorder_LDFLAGS = -pthread -lrt -lavformat -lavcodec -lavutil -lswscale -lX11 -lXext -lXfixes -lXi -lasound
+simplescreenrecorder_LDFLAGS = -pthread \
+	-lrt -lX11 -lXext -lXfixes -lXi -lasound \
+	$(FFMPEG_LIBS)
 
 if WITH_QT5
 simplescreenrecorder_CPPFLAGS += $(QT5_CFLAGS)
diff --git a/src/Makefile.in b/src/Makefile.in
index e46d040..742e111 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -399,6 +399,8 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
+FFMPEG_LIBS = @FFMPEG_LIBS@
 FGREP = @FGREP@
 GREP = @GREP@
 INSTALL = @INSTALL@
@@ -510,14 +512,14 @@ top_srcdir = @top_srcdir@
 @ENABLE_SSRPROGRAM_TRUE@	-I$(srcdir)/AV/Input \
 @ENABLE_SSRPROGRAM_TRUE@	-I$(srcdir)/AV/Output -I$(srcdir)/AV \
 @ENABLE_SSRPROGRAM_TRUE@	-I$(srcdir)/common -I$(srcdir)/GUI \
-@ENABLE_SSRPROGRAM_TRUE@	$(am__append_1) $(am__append_3) \
+@ENABLE_SSRPROGRAM_TRUE@	$(FFMPEG_CFLAGS) $(am__append_1) \
+@ENABLE_SSRPROGRAM_TRUE@	$(am__append_3) \
 @ENABLE_SSRPROGRAM_TRUE@	-DSSR_SYSTEM_DIR=\"$(pkgdatadir)\"
 @ENABLE_SSRPROGRAM_TRUE@simplescreenrecorder_CFLAGS = -pthread
 @ENABLE_SSRPROGRAM_TRUE@simplescreenrecorder_CXXFLAGS = -pthread -std=c++0x
 @ENABLE_SSRPROGRAM_TRUE@simplescreenrecorder_LDFLAGS = -pthread -lrt \
-@ENABLE_SSRPROGRAM_TRUE@	-lavformat -lavcodec -lavutil \
-@ENABLE_SSRPROGRAM_TRUE@	-lswscale -lX11 -lXext -lXfixes -lXi \
-@ENABLE_SSRPROGRAM_TRUE@	-lasound $(am__append_2) \
+@ENABLE_SSRPROGRAM_TRUE@	-lX11 -lXext -lXfixes -lXi -lasound \
+@ENABLE_SSRPROGRAM_TRUE@	$(FFMPEG_LIBS) $(am__append_2) \
 @ENABLE_SSRPROGRAM_TRUE@	$(am__append_4) $(am__append_5) \
 @ENABLE_SSRPROGRAM_TRUE@	$(am__append_6)
 @ENABLE_SSRPROGRAM_TRUE@simplescreenrecorder_SOURCES = \
openSUSE Build Service is sponsored by