Skip to content

Commit

Permalink
register devices before searching in ffpmeg
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Rosten committed Jul 17, 2017
1 parent 4a08ac3 commit ad1870b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
48 changes: 48 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -7988,6 +7988,7 @@ $as_echo_n "checking for ffmpeg headers... " >&6; }
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
int main(){}
_ACEOF
Expand Down Expand Up @@ -8219,6 +8220,53 @@ _ACEOF

LIBS="-lswscale $LIBS"

else
a=1
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for avdevice_register_all in -lavdevice" >&5
$as_echo_n "checking for avdevice_register_all in -lavdevice... " >&6; }
if ${ac_cv_lib_avdevice_avdevice_register_all+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lavdevice $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 avdevice_register_all ();
int
main ()
{
return avdevice_register_all ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_lib_avdevice_avdevice_register_all=yes
else
ac_cv_lib_avdevice_avdevice_register_all=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_avdevice_avdevice_register_all" >&5
$as_echo "$ac_cv_lib_avdevice_avdevice_register_all" >&6; }
if test "x$ac_cv_lib_avdevice_avdevice_register_all" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBAVDEVICE 1
_ACEOF

LIBS="-lavdevice $LIBS"

else
a=1
fi
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ CHECK_FOR_OPTION(ffmpeg, [
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
int main(){}
])], [ ffmpeg_new_headers=1], [])
Expand All @@ -701,6 +702,7 @@ CHECK_FOR_OPTION(ffmpeg, [
AC_CHECK_LIB(avformat, av_read_frame, [ffmpeg_recent=yes], [a=1]) #only in >= 0.4.9
AC_CHECK_LIB(avcodec, avcodec_open2, [], [a=1])
AC_CHECK_LIB(swscale, sws_getContext, [], [a=1])
AC_CHECK_LIB(avdevice, avdevice_register_all, [], [a=1])
else
a=1
fi
Expand Down
2 changes: 2 additions & 0 deletions cvd_src/videofilebuffer2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
}

#include <string>
Expand Down Expand Up @@ -217,6 +218,7 @@ class RawVideoFileBufferPIMPL
{
av_register_all();
avcodec_register_all();
avdevice_register_all();
DS("starting");

int r;
Expand Down

0 comments on commit ad1870b

Please sign in to comment.