Permalink
Browse files

build: add --disable-ffmpeg flag.

Clearly this is just to show what needs to happen to remove ffmpeg from build.
It is not clean or pretty, and is only meant to start the discussion.
In order to do this cleanly, a few things should happen:

- We need an internal image scaling/resampling class with swscale as one of
  the implementations. That will avoid the ifdefs for swscale all over.

- We need our own representation of codec id's. These could map to ffmpeg's
  if it's available, but stand alone if not.
  • Loading branch information...
theuni
theuni committed Feb 15, 2012
1 parent a2a5b69 commit d3799e6611af1d2a5717c5bd42265cbb654d0f16
Showing with 578 additions and 49 deletions.
  1. +3 −0 .gitignore
  2. +29 −2 configure.in
  3. +2 −2 lib/Makefile.in
  4. +6 −0 xbmc/ThumbLoader.cpp
  5. +2 −0 xbmc/cdrip/CDDARipper.cpp
  6. +4 −1 xbmc/cdrip/Makefile.in
  7. +23 −1 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
  8. +19 −2 xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
  9. +5 −3 xbmc/cores/dvdplayer/DVDAudio.h
  10. +4 −0 xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodec.h
  11. +10 −6 xbmc/cores/dvdplayer/DVDCodecs/Audio/Makefile.in
  12. +7 −0 xbmc/cores/dvdplayer/DVDCodecs/DVDCodecUtils.cpp
  13. +3 −3 xbmc/cores/dvdplayer/DVDCodecs/DVDCodecs.h
  14. +16 −4 xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
  15. +5 −1 xbmc/cores/dvdplayer/DVDCodecs/Overlay/Makefile.in
  16. +13 −3 xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp
  17. +7 −3 xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
  18. +5 −0 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h
  19. +3 −3 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxUtils.cpp
  20. +5 −0 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxVobsub.cpp
  21. +5 −1 xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
  22. +6 −2 xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in
  23. +11 −3 xbmc/cores/dvdplayer/DVDFileInfo.cpp
  24. +10 −2 xbmc/cores/dvdplayer/DVDPlayer.cpp
  25. +5 −1 xbmc/cores/dvdplayer/DVDPlayerTeletext.cpp
  26. +10 −2 xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
  27. +5 −3 xbmc/cores/dvdplayer/DVDStreamInfo.h
  28. +342 −0 xbmc/cores/dvdplayer/FFMpegInternals.h
  29. 0 xbmc/music/tags/{Makefile → Makefile.in}
  30. +8 −1 xbmc/pictures/Picture.cpp
  31. +5 −0 xbmc/system.h
View
@@ -992,6 +992,9 @@ lib/cmyth/Makefile
# /xbmc/music/karaoke/
/xbmc/music/karaoke/Makefile
+# /xbmc/music/tags/
+/xbmc/music/tags/Makefile
+
# /lib/libapetag/
/lib/libapetag/Makefile
/lib/libapetag/libtool
View
@@ -127,6 +127,7 @@ libusb_disabled_udev_found="== libusb disabled. =="
libcec_enabled="== libcec enabled. =="
libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
libcec_disabled_missing_libs="== libcec disabled because both libudev and libusb are not available. CEC adapter support will not be available. =="
+ffmpeg_disabled="== FFmpeg support manually disabled. =="
# External library message strings
external_libraries_enabled="== Use of all supported external libraries enabled. =="
@@ -319,6 +320,12 @@ AC_ARG_ENABLE([airtunes],
[use_airtunes=$enableval],
[use_airtunes=auto])
+AC_ARG_ENABLE([ffmpeg],
+ [AS_HELP_STRING([--enable-ffmpeg],
+ [enable internal FFmpeg libraries (default is yes)])],
+ [use_ffmpeg=$enableval],
+ [use_ffmpeg=yes])
+
AC_ARG_ENABLE([ffmpeg_libvorbis],
[AS_HELP_STRING([--enable-ffmpeg-libvorbis],
[enable FFmpeg vorbis encoding (default is no)])],
@@ -1218,6 +1225,7 @@ if test "$use_external_ffmpeg" = "yes"; then
[[#include <libavfilter/avfilter.h>]])
AC_MSG_NOTICE($external_ffmpeg_enabled)
+ SKIP_CONFIG_FFMPEG=1
USE_EXTERNAL_FFMPEG=1
AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.])
@@ -1244,6 +1252,7 @@ if test "$use_external_ffmpeg" = "yes"; then
else
AC_MSG_NOTICE($external_ffmpeg_disabled)
USE_EXTERNAL_FFMPEG=0
+ SKIP_CONFIG_FFMPEG=0
AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1], [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])
fi
@@ -1259,6 +1268,17 @@ else
AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
fi
+if test "x$use_ffmpeg" != "xno"; then
+ USE_FFMPEG=1
+ SKIP_CONFIG_FFMPEG=0
+ AC_DEFINE([HAVE_FFMPEG], [1], [Whether to use FFmpeg libraries.])
+else
+ use_vdpau=no
+ USE_FFMPEG=0
+ SKIP_CONFIG_FFMPEG=1
+ AC_MSG_NOTICE($ffmpeg_disabled)
+fi
+
# VDPAU
if test "x$use_vdpau" != "xno"; then
if test "$host_vendor" = "apple" ; then
@@ -1534,6 +1554,12 @@ else
final_message="$final_message\n DBUS:\t\tNo"
fi
+if test "x$use_ffmpeg" != "xno"; then
+ final_message="$final_message\n FFmpeg:\tYes"
+else
+ final_message="$final_message\n FFmpeg:\tNo"
+fi
+
if test "x$use_vdpau" != "xno"; then
final_message="$final_message\n VDPAU:\tYes"
else
@@ -1844,6 +1870,7 @@ OUTPUT_FILES="Makefile \
lib/snesapu/SNES/SNESAPU/Makefile \
lib/stsound/StSoundLibrary/Makefile \
xbmc/cores/playercorefactory/Makefile \
+ xbmc/music/tags/Makefile \
xbmc/music/karaoke/Makefile \
xbmc/osx/Makefile \
xbmc/guilib/Makefile \
@@ -1936,7 +1963,7 @@ AC_SUBST(USE_LIBUDEV)
AC_SUBST(USE_LIBUSB)
AC_SUBST(USE_LIBCEC)
AC_SUBST(USE_WEB_SERVER)
-
+AC_SUBST(USE_FFMPEG)
# pushd and popd are not available in other shells besides bash, so implement
# our own pushd/popd functions
@@ -2072,7 +2099,7 @@ XB_CONFIG_MODULE([lib/ffmpeg], [
sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h &&
sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h
fi
-], [$USE_EXTERNAL_FFMPEG])
+], [$SKIP_CONFIG_FFMPEG])
XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [
./configure \
View
@@ -15,12 +15,12 @@ POSTPROC_SO=postproc-52-$(ARCH).so
SWRESAMPLE_SO=swresample-0-$(ARCH).so
DIRS=
-ifneq (@USE_EXTERNAL_FFMPEG@,1)
+ifeq ($(or $(findstring 1,@USE_EXTERNAL_FFMPEG@),$(findstring 0,@USE_FFMPEG@)),)
DIRS+=ffmpeg
endif
LIBS=
-ifneq (@USE_EXTERNAL_FFMPEG@,1)
+ifeq ($(or $(findstring 1,@USE_EXTERNAL_FFMPEG@),$(findstring 0,@USE_FFMPEG@)),)
LIBS+=$(AVUTIL_SO) \
$(AVCODEC_SO) \
$(AVFORMAT_SO) \
View
@@ -36,7 +36,9 @@
#include "programs/Shortcut.h"
#include "video/VideoInfoTag.h"
#include "video/VideoDatabase.h"
+#if defined (HAS_FFMPEG)
#include "cores/dvdplayer/DVDFileInfo.h"
+#endif
using namespace XFILE;
using namespace std;
@@ -135,7 +137,9 @@ bool CThumbExtractor::DoWork()
if (m_thumb)
{
CLog::Log(LOGDEBUG,"%s - trying to extract thumb from video file %s", __FUNCTION__, m_path.c_str());
+#if defined (HAS_FFMPEG)
result = CDVDFileInfo::ExtractThumb(m_path, m_target, &m_item.GetVideoInfoTag()->m_streamDetails);
+#endif
if(result)
{
m_item.SetProperty("HasAutoThumb", true);
@@ -146,7 +150,9 @@ bool CThumbExtractor::DoWork()
else if (m_item.HasVideoInfoTag() && !m_item.GetVideoInfoTag()->HasStreamDetails())
{
CLog::Log(LOGDEBUG,"%s - trying to extract filestream details from video file %s", __FUNCTION__, m_path.c_str());
+#if defined (HAS_FFMPEG)
result = CDVDFileInfo::GetFileStreamDetails(&m_item);
+#endif
}
return result;
@@ -31,7 +31,9 @@
#include "EncoderLame.h"
#include "EncoderWav.h"
#include "EncoderVorbis.h"
+#if defined(HAS_FFMPEG)
#include "EncoderFFmpeg.h"
+#endif
#include "EncoderFlac.h"
#include "filesystem/CDDADirectory.h"
#include "music/tags/MusicInfoTagLoaderFactory.h"
View
@@ -1,12 +1,15 @@
SRCS=CDDARipper.cpp \
CDDAReader.cpp \
Encoder.cpp \
- EncoderFFmpeg.cpp \
EncoderFlac.cpp \
EncoderLame.cpp \
EncoderVorbis.cpp \
EncoderWav.cpp \
+ifeq (@USE_FFMPEG@,1)
+SRCS += EncoderFFmpeg.cpp
+endif
+
LIB=cdrip.a
include @abs_top_srcdir@/Makefile.include
@@ -39,10 +39,12 @@
#include "guilib/Texture.h"
#include "guilib/LocalizeStrings.h"
#include "threads/SingleLock.h"
-#include "DllSwScale.h"
#include "utils/log.h"
#include "utils/GLUtils.h"
#include "RenderCapture.h"
+#if defined(USE_FFMPEG)
+#include "lib/DllSwScale.h"
+#endif
#ifdef HAVE_LIBVDPAU
#include "cores/dvdplayer/DVDCodecs/Video/VDPAU.h"
@@ -159,7 +161,9 @@ CLinuxRendererGL::CLinuxRendererGL()
m_context = NULL;
m_rgbPbo = 0;
+#if defined(USE_FFMPEG)
m_dllSwScale = new DllSwScale;
+#endif
}
CLinuxRendererGL::~CLinuxRendererGL()
@@ -182,7 +186,9 @@ CLinuxRendererGL::~CLinuxRendererGL()
if (m_context)
{
+#if defined(USE_FFMPEG)
m_dllSwScale->sws_freeContext(m_context);
+#endif
m_context = NULL;
}
@@ -193,7 +199,9 @@ CLinuxRendererGL::~CLinuxRendererGL()
m_pYUVShader = NULL;
}
+#if defined(USE_FFMPEG)
delete m_dllSwScale;
+#endif
}
bool CLinuxRendererGL::ValidateRenderer()
@@ -744,7 +752,9 @@ unsigned int CLinuxRendererGL::PreInit()
// setup the background colour
m_clearColour = (float)(g_advancedSettings.m_videoBlackBarColour & 0xff) / 0xff;
+#if defined(USE_FFMPEG)
if (!m_dllSwScale->Load())
+#endif
CLog::Log(LOGERROR,"CLinuxRendererGL::PreInit - failed to load rescale libraries!");
return true;
@@ -1069,7 +1079,9 @@ void CLinuxRendererGL::UnInit()
if (m_context)
{
+#if defined(USE_FFMPEG)
m_dllSwScale->sws_freeContext(m_context);
+#endif
m_context = NULL;
}
@@ -2600,6 +2612,7 @@ bool CLinuxRendererGL::CreateYUV422PackedTexture(int index)
void CLinuxRendererGL::ToRGBFrame(YV12Image* im, unsigned flipIndexPlane, unsigned flipIndexBuf)
{
+#if defined(USE_FFMPEG)
if(m_rgbBufferSize != m_sourceWidth * m_sourceHeight * 4)
SetupRGBBuffer();
else if(flipIndexPlane == flipIndexBuf)
@@ -2665,10 +2678,15 @@ void CLinuxRendererGL::ToRGBFrame(YV12Image* im, unsigned flipIndexPlane, unsign
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
m_rgbBuffer = (BYTE*)PBO_OFFSET;
}
+#else
+ CLog::Log(LOGERROR, "CLinuxRendererGL::ToRGBFrame: called without libswscale available");
+ return;
+#endif
}
void CLinuxRendererGL::ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, unsigned flipIndexPlaneBot, unsigned flipIndexBuf)
{
+#if defined(USE_FFMPEG)
if(m_rgbBufferSize != m_sourceWidth * m_sourceHeight * 4)
SetupRGBBuffer();
else if(flipIndexPlaneTop == flipIndexBuf && flipIndexPlaneBot == flipIndexBuf)
@@ -2749,6 +2767,10 @@ void CLinuxRendererGL::ToRGBFields(YV12Image* im, unsigned flipIndexPlaneTop, un
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
m_rgbBuffer = (BYTE*)PBO_OFFSET;
}
+#else
+ CLog::Log(LOGERROR, "CLinuxRendererGL::ToRGBFields: called without libswscale available");
+ return;
+#endif
}
void CLinuxRendererGL::SetupRGBBuffer()
@@ -40,10 +40,10 @@
#include "windowing/WindowingFactory.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "guilib/Texture.h"
-#include "lib/DllSwScale.h"
#include "../dvdplayer/DVDCodecs/Video/OpenMaxVideo.h"
#include "threads/SingleLock.h"
#include "RenderCapture.h"
+#include "utils/log.h"
#if defined(__ARM_NEON__)
#include "yuv2rgb.neon.h"
#endif
@@ -54,6 +54,9 @@
#ifdef TARGET_DARWIN_IOS
#include "osx/DarwinUtils.h"
#endif
+#if defined(USE_FFMPEG)
+#include "lib/DllSwScale.h"
+#endif
using namespace Shaders;
@@ -103,7 +106,9 @@ CLinuxRendererGLES::CLinuxRendererGLES()
m_rgbBuffer = NULL;
m_rgbBufferSize = 0;
+#if defined(HAS_FFMPEG)
m_dllSwScale = new DllSwScale;
+#endif
m_sw_context = NULL;
}
@@ -125,7 +130,9 @@ CLinuxRendererGLES::~CLinuxRendererGLES()
m_pYUVShader = NULL;
}
+#if defined(HAS_FFMPEG)
delete m_dllSwScale;
+#endif
}
void CLinuxRendererGLES::ManageTextures()
@@ -503,8 +510,10 @@ unsigned int CLinuxRendererGLES::PreInit()
// setup the background colour
m_clearColour = (float)(g_advancedSettings.m_videoBlackBarColour & 0xff) / 0xff;
+#if defined(HAS_FFMPEG)
if (!m_dllSwScale->Load())
CLog::Log(LOGERROR,"CLinuxRendererGL::PreInit - failed to load rescale libraries!");
+#endif
return true;
}
@@ -697,11 +706,13 @@ void CLinuxRendererGLES::UnInit()
for (int i = 0; i < NUM_BUFFERS; ++i)
(this->*m_textureDelete)(i);
+#if defined(HAS_FFMPEG)
if (m_dllSwScale && m_sw_context)
{
m_dllSwScale->sws_freeContext(m_sw_context);
m_sw_context = NULL;
}
+#endif
// cleanup framebuffer object if it was in use
m_fbo.Cleanup();
m_bValidated = false;
@@ -761,8 +772,10 @@ void CLinuxRendererGLES::Render(DWORD flags, int index)
}
else
{
+#if defined(HAS_FFMPEG) || defined(__ARM_NEON__)
RenderSoftware(index, m_currentField);
VerifyGLState();
+#endif
}
}
@@ -1329,7 +1342,7 @@ void CLinuxRendererGLES::UploadYV12Texture(int source)
#if defined(__ARM_NEON__)
yuv420_2_rgb8888_neon(m_rgbBuffer, im->plane[0], im->plane[2], im->plane[1],
m_sourceWidth, m_sourceHeight, im->stride[0], im->stride[1], m_sourceWidth * 4);
-#else
+#elif defined(HAS_FFMPEG)
m_sw_context = m_dllSwScale->sws_getCachedContext(m_sw_context,
im->width, im->height, PIX_FMT_YUV420P,
im->width, im->height, PIX_FMT_RGBA,
@@ -1339,7 +1352,11 @@ void CLinuxRendererGLES::UploadYV12Texture(int source)
int srcStride[] = { im->stride[0], im->stride[1], im->stride[2], 0 };
uint8_t *dst[] = { m_rgbBuffer, 0, 0, 0 };
int dstStride[] = { m_sourceWidth*4, 0, 0, 0 };
+
m_dllSwScale->sws_scale(m_sw_context, src, srcStride, 0, im->height, dst, dstStride);
+#else
+ //We should add our own sw implementation here.
+ CLog::Log(LOGDEBUG, "No YUV->RGB implementation available.");
#endif
}
Oops, something went wrong.

0 comments on commit d3799e6

Please sign in to comment.