Permalink
Browse files

Support compiling and running XBMC with libav.

  • Loading branch information...
1 parent 1d975a0 commit 667fd9ff9c6a45be2b1e10782573ca5cb02c7763 @amejia1 amejia1 committed Apr 11, 2012
Showing with 52 additions and 11 deletions.
  1. +22 −1 configure.in
  2. +22 −10 lib/DllAvFilter.h
  3. +4 −0 lib/DllAvUtil.h
  4. +4 −0 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
View
@@ -1248,14 +1248,35 @@ if test "$use_external_ffmpeg" = "yes"; then
AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.])
# Disable vdpau support if external libavcodec doesn't have it
- AC_CHECK_LIB([avcodec], [ff_vdpau_vc1_decode_picture],,
+ AC_RUN_IFELSE(
+ AC_LANG_PROGRAM([[#include <libavcodec/avcodec.h>]],
+ [[avcodec_register_all();
+ AVCodec *codec = avcodec_find_decoder_by_name("vc1_vdpau");
+ return (codec) ? 0 : 1;]]),,
[if test "x$use_vdpau" = "xyes"; then
AC_MSG_ERROR($ffmpeg_vdpau_not_supported)
else
use_vdpau=no
AC_MSG_RESULT($ffmpeg_vdpau_not_supported)
fi])
+ # Other headers to include if available.
+ AC_CHECK_HEADERS([libavutil/mathematics.h],,)
+
+ # Check if <libavfilter/vsrc_buffer.h> exists and defines old
+ # av_vsrc_buffer_add_frame() from SoC. This avoids multiple declarations of
+ # av_vsrc_buffer_add_frame().
+ AC_COMPILE_IFELSE(
+ AC_LANG_SOURCE([[
+ #include <libavfilter/vsrc_buffer.h>
+ void foo(void)
+ {
+ AVRational a;
+ av_vsrc_buffer_add_frame(NULL, NULL, 0, a);
+ }
+ ]]), AC_DEFINE([USE_OLD_AV_VSRC_BUFFER_ADD_FRAME],
+ [1], [Check if SoC av_vsrc_buffer_add_frame() is defined in libavfilter/vsrc_buffer.h.]),)
+
# Check for 'PIX_FMT_VDPAU_MPEG4' from libavutil
if test "x$use_vdpau" != "xno"; then
AC_LANG_PUSH([C++])
View
@@ -47,17 +47,21 @@ extern "C" {
#include <ffmpeg/avfiltergraph.h>
#endif
/* for av_vsrc_buffer_add_frame */
- #if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,8,0)
- #include <libavfilter/avcodec.h>
- #elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
- int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
- AVFrame *frame);
- #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
- int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
- AVFrame *frame, int64_t pts);
+ #if (defined USE_OLD_AV_VSRC_BUFFER_ADD_FRAME)
+ #include <libavfilter/vsrc_buffer.h>
#else
- int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
- AVFrame *frame, int64_t pts, AVRational pixel_aspect);
+ #if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,8,0)
+ #include <libavfilter/avcodec.h>
+ #elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
+ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
+ AVFrame *frame);
+ #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
+ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
+ AVFrame *frame, int64_t pts);
+ #else
+ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
+ AVFrame *frame, int64_t pts, AVRational pixel_aspect);
+ #endif
#endif
#else
#include "libavfilter/avfiltergraph.h"
@@ -82,6 +86,9 @@ class DllAvFilterInterface
virtual int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)=0;
virtual int avfilter_poll_frame(AVFilterLink *link)=0;
virtual int avfilter_request_frame(AVFilterLink *link)=0;
+#if (defined USE_OLD_AV_VSRC_BUFFER_ADD_FRAME)
+ virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect)=0;
+#else
#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0;
#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
@@ -91,6 +98,7 @@ class DllAvFilterInterface
#else
virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect)=0;
#endif
+#endif
virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)=0;
virtual void avfilter_unref_buffer(AVFilterBufferRef *ref)=0;
virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)=0;
@@ -171,6 +179,9 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface
}
virtual int avfilter_poll_frame(AVFilterLink *link) { return ::avfilter_poll_frame(link); }
virtual int avfilter_request_frame(AVFilterLink *link) { return ::avfilter_request_frame(link); }
+#if (defined USE_OLD_AV_VSRC_BUFFER_ADD_FRAME)
+ virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, pts, pixel_aspect); }
+#else
#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, flags); }
#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
@@ -180,6 +191,7 @@ class DllAvFilter : public DllDynamic, DllAvFilterInterface
#else
virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, pts, pixel_aspect); }
#endif
+#endif
virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return ::avfilter_get_video_buffer(link, perms, w, h); }
virtual void avfilter_unref_buffer(AVFilterBufferRef *ref) { ::avfilter_unref_buffer(ref); }
virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { return ::avfilter_link(src, srcpad, dst, dstpad); }
View
@@ -59,6 +59,10 @@ extern "C" {
#else
#include <ffmpeg/mem.h>
#endif
+ /* For AVRounding */
+ #if (defined HAVE_LIBAVUTIL_MATHEMATICS_H)
+ #include <libavutil/mathematics.h>
+ #endif
#else
#include "libavutil/avutil.h"
#include "libavutil/crc.h"
@@ -813,6 +813,9 @@ int CDVDVideoCodecFFmpeg::FilterProcess(AVFrame* frame)
if (frame)
{
+#if (defined USE_OLD_AV_VSRC_BUFFER_ADD_FRAME)
+ result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, frame->pts, m_pCodecContext->sample_aspect_ratio);
+#else
#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, 0);
#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
@@ -822,6 +825,7 @@ int CDVDVideoCodecFFmpeg::FilterProcess(AVFrame* frame)
#else
result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, frame->pts, m_pCodecContext->sample_aspect_ratio);
#endif
+#endif
if (result < 0)
{

7 comments on commit 667fd9f

@EricV
EricV commented on 667fd9f Apr 13, 2012

Why the hell don't you educate debian to use ffmpeg. Not only you use an external code but one that is obsolete...

@EricV
EricV commented on 667fd9f Apr 13, 2012

And what are the supposed advantages compared to ffmpeg?

@EricV
EricV commented on 667fd9f Apr 13, 2012

apparently (reading the patch), the APIs, include files are no more equivalent so it just complexify and already complex situation.

@EricV
EricV commented on 667fd9f Apr 13, 2012

XBMC for debian was already available using standard external ffmpeg in the debian-multimedia repository with a lot more options...
There you find also dvdcsa library that is needed to play DVD so you have to add the repository anyway if you want to read dvd...

@amejia1
Member

debian-multimedia.org is not affiliated with Debian. Furthermore, I do not recommend anyone to simply add the repository (especially new users). If you just need dvdcss, just download the libdvdcss2 package from there and install it via dpkg.

@EricV
EricV commented on 667fd9f Apr 13, 2012

Who care if its official if packages works better than debian ones? Been using it for years without problems. Do you think new user find simpler to download a package and install it manually?

@amejia1
Member

If you mean the missing RAR support, work in progress. If it's afp support, I will look into getting a patch backported to eden so that xbmc works well with the version of libafpclient found in the repos.

As for ffmpeg v libav or debian v dmo, this isn't the place for debating this.

Please sign in to comment.