msdk: Allow building against mfx_dispatcher

E.g. from https://github.com/lu-zero/mfx_dispatch
This commit is contained in:
Sebastian Dröge 2017-10-30 18:17:40 +02:00
parent dc6c4ea5c2
commit 62f04e801b
8 changed files with 86 additions and 35 deletions

View file

@ -2065,35 +2065,47 @@ AG_GST_CHECK_FEATURE(TINYALSA, [tinyalsa], tinyalsa, [
dnl check for intel mediasdk dnl check for intel mediasdk
translit(dnm, m, l) AM_CONDITIONAL(USE_MSDK, true) translit(dnm, m, l) AM_CONDITIONAL(USE_MSDK, true)
AG_GST_CHECK_FEATURE(MSDK, [Intel MediaSDK], msdk, [ AG_GST_CHECK_FEATURE(MSDK, [Intel MediaSDK], msdk, [
AC_ARG_WITH([msdk-prefix], PKG_CHECK_MODULES(LIBMFX, libmfx,
AS_HELP_STRING([--with-msdk-prefix], [
[Use the provided prefix for detecting the Intel MediaSDK]), AC_DEFINE(HAVE_LIBMFX, 1, [Define if mfx_dispatcher is available])
[AS_IF([test "x$with_msdk_prefix" != "x"], HAVE_MSDK="yes"
[MSDK_PREFIX="$with_msdk_prefix"])], ], [
[AS_IF([test "x$MFX_HOME" != "x"], AC_ARG_WITH([msdk-prefix],
[MSDK_PREFIX="$MFX_HOME"], AS_HELP_STRING([--with-msdk-prefix],
[MSDK_PREFIX="/opt/intel/media"])]) [Use the provided prefix for detecting the Intel MediaSDK]),
MSDK_CFLAGS="-I$MSDK_PREFIX/include" [AS_IF([test "x$with_msdk_prefix" != "x"],
MSDK_LIBS="-L$MSDK_PREFIX/lib/lin_x64 -lmfx -ldl" [MSDK_PREFIX="$with_msdk_prefix"])],
AC_SUBST(MSDK_CFLAGS) [AS_IF([test "x$MFX_HOME" != "x"],
AC_SUBST(MSDK_LIBS) [MSDK_PREFIX="$MFX_HOME"],
[MSDK_PREFIX="/opt/intel/media"])])
MSDK_CFLAGS="-I$MSDK_PREFIX/include"
MSDK_LIBS="-L$MSDK_PREFIX/lib/lin_x64 -lmfx -ldl"
AC_SUBST(MSDK_CFLAGS)
AC_SUBST(MSDK_LIBS)
save_CPPFLAGS="$CPPFLAGS" save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$MSDK_CFLAGS $save_CPPFLAGS" CPPFLAGS="$MSDK_CFLAGS $save_CPPFLAGS"
AC_CHECK_HEADER(mfxdefs.h, HAVE_MFXDEFS_H="yes", HAVE_MFXDEFS_H="no") AC_CHECK_HEADER(mfxdefs.h, HAVE_MFXDEFS_H="yes", HAVE_MFXDEFS_H="no")
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
save_LIBS="$LIBS" save_LIBS="$LIBS"
LIBS="$MSDK_LIBS $LIBS" LIBS="$MSDK_LIBS $LIBS"
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
AC_CHECK_LIB(mfx,MFXInit,HAVE_MFX_LIB="yes",HAVE_MFX_LIB="no") AC_CHECK_LIB(mfx,MFXInit,HAVE_MFX_LIB="yes",HAVE_MFX_LIB="no")
AC_LANG_POP([C++]) AC_LANG_POP([C++])
LIBS="$save_LIBS" LIBS="$save_LIBS"
if test "x$HAVE_MFXDEFS_H" = "xyes" \
-a "x$HAVE_MFX_LIB" = "xyes"; then
HAVE_MSDK="yes"
else
HAVE_MSDK="no"
fi
])
PKG_CHECK_MODULES(LIBVA_DRM, libva-drm, HAVE_LIBVA_DRM="yes", HAVE_LIBVA_DRM="no") PKG_CHECK_MODULES(LIBVA_DRM, libva-drm, HAVE_LIBVA_DRM="yes", HAVE_LIBVA_DRM="no")
if test "x$HAVE_MFXDEFS_H" = "xyes" \ if test "x$HAVE_MSDK" = "xyes" \
-a "x$HAVE_MFX_LIB" = "xyes" \
-a "x$HAVE_LIBVA_DRM" = "xyes"; then -a "x$HAVE_LIBVA_DRM" = "xyes"; then
HAVE_MSDK="yes" HAVE_MSDK="yes"
else else

View file

@ -33,13 +33,15 @@ libgstmsdk_la_CFLAGS = \
$(GST_CFLAGS) \ $(GST_CFLAGS) \
$(GST_PBUTILS_CFLAGS) \ $(GST_PBUTILS_CFLAGS) \
$(GST_VIDEO_CFLAGS) \ $(GST_VIDEO_CFLAGS) \
$(MSDK_CFLAGS) $(MSDK_CFLAGS) \
$(LIBMFX_CFLAGS)
libgstmsdk_la_LIBADD = \ libgstmsdk_la_LIBADD = \
$(GST_LIBS) \ $(GST_LIBS) \
$(GST_PBUTILS_LIBS) \ $(GST_PBUTILS_LIBS) \
$(GST_VIDEO_LIBS) \ $(GST_VIDEO_LIBS) \
$(MSDK_LIBS) $(MSDK_LIBS) \
$(LIBMFX_LIBS)
if USE_MSDK_LIBVA if USE_MSDK_LIBVA
libgstmsdk_la_SOURCES += \ libgstmsdk_la_SOURCES += \

View file

@ -32,7 +32,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <mfxplugin.h>
#ifdef HAVE_LIBMFX
# include <mfx/mfxplugin.h>
#else
# include "mfxplugin.h"
#endif
#include "gstmsdkh265dec.h" #include "gstmsdkh265dec.h"

View file

@ -32,7 +32,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <mfxplugin.h>
#ifdef HAVE_LIBMFX
# include <mfx/mfxplugin.h>
#else
# include "mfxplugin.h"
#endif
#include "gstmsdkh265enc.h" #include "gstmsdkh265enc.h"

View file

@ -32,8 +32,14 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <mfxstructures.h>
#include <mfxjpeg.h> #ifdef HAVE_LIBMFX
# include <mfx/mfxstructures.h>
# include <mfx/mfxjpeg.h>
#else
# include "mfxstructures.h"
# include "mfxjpeg.h"
#endif
#include "gstmsdkmjpegdec.h" #include "gstmsdkmjpegdec.h"

View file

@ -32,8 +32,14 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <mfxstructures.h>
#include <mfxjpeg.h> #ifdef HAVE_LIBMFX
# include <mfx/mfxstructures.h>
# include <mfx/mfxjpeg.h>
#else
# include "mfxstructures.h"
# include "mfxjpeg.h"
#endif
#include "gstmsdkmjpegenc.h" #include "gstmsdkmjpegenc.h"

View file

@ -32,8 +32,14 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <mfxplugin.h>
#include <mfxvp8.h> #ifdef HAVE_LIBMFX
# include <mfx/mfxplugin.h>
# include <mfx/mfxvp8.h>
#else
# include "mfxplugin.h"
# include "mfxvp8.h"
#endif
#include "gstmsdkvp8enc.h" #include "gstmsdkvp8enc.h"

View file

@ -32,11 +32,20 @@
#ifndef __MSDK_H__ #ifndef __MSDK_H__
#define __MSDK_H__ #define __MSDK_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h> #include <string.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include "mfxvideo.h"
#ifdef HAVE_LIBMFX
# include <mfx/mfxvideo.h>
#else
# include "mfxvideo.h"
#endif
G_BEGIN_DECLS G_BEGIN_DECLS