Skip to content

Commit

Permalink
fix issue tony2001#1
Browse files Browse the repository at this point in the history
build with newer ffmpeg versions was broken because of newly added
non-standard time.h file
  • Loading branch information
tony2001 committed Feb 2, 2013
1 parent ee8211c commit 24f0b38
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 46 deletions.
41 changes: 16 additions & 25 deletions config.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PHP_ARG_WITH(ffmpeg,for ffmpeg support,
PHP_ARG_WITH(ffmpeg,for ffmpeg support,
[ --with-ffmpeg[=DIR] Include ffmpeg support (requires ffmpeg >= 0.5).])

PHP_ARG_ENABLE(skip-gd-check, whether to force gd support in ffmpeg-php, [ --enable-skip-gd-check skip checks for gd libs and assume they are present.], no, no)
Expand All @@ -14,43 +14,34 @@ if test "$PHP_FFMPEG" != "no"; then
INC_CHECK_DIRS="/usr/local /usr"

dnl User has specified using --with=ffmpeg=[dir] a directory where we should
dnl look for ffmpeg headers. Prepend this directory to the default dirs so it
dnl gets checked first.
dnl look for ffmpeg headers.
if test "$PHP_FFMPEG" != "yes"; then
INC_CHECK_DIRS="$PHP_FFMPEG $INC_CHECK_DIRS"
INC_CHECK_DIRS="$PHP_FFMPEG"
fi

AC_MSG_CHECKING(for ffmpeg headers)
for i in $INC_CHECK_DIRS ; do
if test -f $i/include/ffmpeg/avcodec.h; then
PHP_ADD_INCLUDE($i/include/ffmpeg)
FFMPEG_INC_FOUND=$i/include/ffmpeg
break
elif test -f $i/include/avcodec.h; then
PHP_ADD_INCLUDE($i/include)
FFMPEG_INC_FOUND=$i/include
break
elif test -f $i/include/libavcodec/avcodec.h; then
test -f $i/include/libavcodec/avcodec.h; then
dnl ffmpeg svn revision 12194 and newer put each header in its own dir
dnl so we have to include them all.
PHP_ADD_INCLUDE($i/include/libavcodec/)
PHP_ADD_INCLUDE($i/include/libavformat/)
PHP_ADD_INCLUDE($i/include/libavutil/)
PHP_ADD_INCLUDE($i/include/libswscale/)
PHP_ADD_INCLUDE($i/include/libavfilter/)
PHP_ADD_INCLUDE($i/include/libavdevice/)
FFMPEG_INC_FOUND=$i/include/libavcodec
dnl PHP_ADD_INCLUDE($i/include/libavcodec/)
dnl PHP_ADD_INCLUDE($i/include/libavformat/)
dnl PHP_ADD_INCLUDE($i/include/libavutil/)
dnl PHP_ADD_INCLUDE($i/include/libswscale/)
dnl PHP_ADD_INCLUDE($i/include/libavfilter/)
dnl PHP_ADD_INCLUDE($i/include/libavdevice/)
FFMPEG_INC_FOUND=$i/include
break
fi
done

if test -z "$FFMPEG_INC_FOUND"; then
if test -z "$FFMPEG_INC_FOUND"; then
AC_MSG_RESULT()
AC_MSG_ERROR([ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option])
else
AC_MSG_RESULT(...found in $FFMPEG_INC_FOUND)
fi


AC_MSG_CHECKING(for ffmpeg libavcodec.so)
for i in $PHP_FFMPEG /usr/local /usr ; do
Expand Down Expand Up @@ -104,13 +95,13 @@ if test "$PHP_FFMPEG" != "no"; then
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
fi

CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
dnl CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"

PHP_NEW_EXTENSION(ffmpeg, ffmpeg-php.c ffmpeg_movie.c ffmpeg_frame.c ffmpeg_errorhandler.c ffmpeg_tools.c, $ext_shared,, \\$(GDLIB_CFLAGS))
PHP_NEW_EXTENSION(ffmpeg, ffmpeg-php.c ffmpeg_movie.c ffmpeg_frame.c ffmpeg_errorhandler.c ffmpeg_tools.c, $ext_shared)
dnl PHP_ADD_EXTENSION_DEP(ffmpeg, gd)

PHP_SUBST(FFMPEG_SHARED_LIBADD)
AC_DEFINE(HAVE_FFMPEG_PHP,1,[ ])

dnl PHP_DEBUG_MACRO(test.dbg)
fi
6 changes: 3 additions & 3 deletions ffmpeg-php.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@

#include "php.h"

#include <avcodec.h>
#include <avformat.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

#if HAVE_SWSCALER
#include <swscale.h>
#include <libswscale/swscale.h>
#endif

#include "php_ini.h"
Expand Down
6 changes: 5 additions & 1 deletion ffmpeg_errorhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include <avcodec.h>
#include <libavcodec/avcodec.h>

/* {{{ ffmpeg_errorhandler()
*/
Expand Down
4 changes: 4 additions & 0 deletions ffmpeg_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "php_globals.h"
Expand Down
12 changes: 6 additions & 6 deletions ffmpeg_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
#ifndef FFMPEG_FRAME_H
#define FFMPEG_FRAME_H

#include "php_version.h"

#include <avcodec.h>
#include <avformat.h>
#include <avutil.h>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php_version.h"

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>

/* object can't be created from user space so no PHP constructor */
//FFMPEG_PHP_CONSTRUCTOR(ffmpeg_frame, __construct);

Expand Down
16 changes: 8 additions & 8 deletions ffmpeg_movie.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "php_globals.h"
#include "ext/standard/info.h"

#include <avcodec.h>
#include <avformat.h>
#include <pixfmt.h>
#include <pixdesc.h>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/pixfmt.h>
#include <libavutil/pixdesc.h>

#include "php_ffmpeg.h"

Expand Down
2 changes: 1 addition & 1 deletion ffmpeg_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "ffmpeg_tools.h"

#if LIBAVCODEC_VERSION_MAJOR >= 52
#include <swscale.h>
#include <libswscale/swscale.h>

/* {{{ ffmpeg_img_convert()
* wrapper around ffmpeg image conversion routines
Expand Down
4 changes: 2 additions & 2 deletions ffmpeg_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
#ifndef FFMPEG_TOOLS_H
#define FFMPEG_TOOLS_H

#include <avcodec.h>
#include <libavcodec/avcodec.h>

#if LIBAVCODEC_VERSION_MAJOR >= 52

#include <swscale.h>
#include <libswscale/swscale.h>

// Starting from this version, ImgReSampleContext doesn't exist anymore.
// This code implements the previous functions with a similar interface
Expand Down

0 comments on commit 24f0b38

Please sign in to comment.