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
translit(dnm, m, l) AM_CONDITIONAL(USE_MSDK, true)
AG_GST_CHECK_FEATURE(MSDK, [Intel MediaSDK], msdk, [
AC_ARG_WITH([msdk-prefix],
AS_HELP_STRING([--with-msdk-prefix],
[Use the provided prefix for detecting the Intel MediaSDK]),
[AS_IF([test "x$with_msdk_prefix" != "x"],
[MSDK_PREFIX="$with_msdk_prefix"])],
[AS_IF([test "x$MFX_HOME" != "x"],
[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)
PKG_CHECK_MODULES(LIBMFX, libmfx,
[
AC_DEFINE(HAVE_LIBMFX, 1, [Define if mfx_dispatcher is available])
HAVE_MSDK="yes"
], [
AC_ARG_WITH([msdk-prefix],
AS_HELP_STRING([--with-msdk-prefix],
[Use the provided prefix for detecting the Intel MediaSDK]),
[AS_IF([test "x$with_msdk_prefix" != "x"],
[MSDK_PREFIX="$with_msdk_prefix"])],
[AS_IF([test "x$MFX_HOME" != "x"],
[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"
CPPFLAGS="$MSDK_CFLAGS $save_CPPFLAGS"
AC_CHECK_HEADER(mfxdefs.h, HAVE_MFXDEFS_H="yes", HAVE_MFXDEFS_H="no")
CPPFLAGS="$save_CPPFLAGS"
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$MSDK_CFLAGS $save_CPPFLAGS"
AC_CHECK_HEADER(mfxdefs.h, HAVE_MFXDEFS_H="yes", HAVE_MFXDEFS_H="no")
CPPFLAGS="$save_CPPFLAGS"
save_LIBS="$LIBS"
LIBS="$MSDK_LIBS $LIBS"
AC_LANG_PUSH([C++])
AC_CHECK_LIB(mfx,MFXInit,HAVE_MFX_LIB="yes",HAVE_MFX_LIB="no")
AC_LANG_POP([C++])
LIBS="$save_LIBS"
save_LIBS="$LIBS"
LIBS="$MSDK_LIBS $LIBS"
AC_LANG_PUSH([C++])
AC_CHECK_LIB(mfx,MFXInit,HAVE_MFX_LIB="yes",HAVE_MFX_LIB="no")
AC_LANG_POP([C++])
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")
if test "x$HAVE_MFXDEFS_H" = "xyes" \
-a "x$HAVE_MFX_LIB" = "xyes" \
if test "x$HAVE_MSDK" = "xyes" \
-a "x$HAVE_LIBVA_DRM" = "xyes"; then
HAVE_MSDK="yes"
else

View file

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

View file

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

View file

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

View file

@ -32,8 +32,14 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#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"

View file

@ -32,8 +32,14 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#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"

View file

@ -32,8 +32,14 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#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"

View file

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