ffmpeg-php-0.6.0, PHP support for ffmpeg
This commit is contained in:
parent
4c138a9ba8
commit
9e0a62d0fe
50
multimedia/ffmpeg-php/Makefile
Normal file
50
multimedia/ffmpeg-php/Makefile
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# $OpenBSD: Makefile,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
|
||||||
|
SHARED_ONLY= Yes
|
||||||
|
|
||||||
|
COMMENT= PHP support for ffmpeg
|
||||||
|
DISTNAME= ffmpeg-php-0.6.0
|
||||||
|
EXTRACT_SUFX= .tbz2
|
||||||
|
CATEGORIES= multimedia www
|
||||||
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ffmpeg-php/}
|
||||||
|
|
||||||
|
HOMEPAGE= http://ffmpeg-php.sourceforge.net/
|
||||||
|
|
||||||
|
MAINTAINER= Jolan Luff <jolan@openbsd.org>
|
||||||
|
|
||||||
|
# GPL
|
||||||
|
PERMIT_DISTFILES_CDROM= Yes
|
||||||
|
PERMIT_DISTFILES_FTP= Yes
|
||||||
|
PERMIT_PACKAGE_CDROM= Yes
|
||||||
|
PERMIT_PACKAGE_FTP= Yes
|
||||||
|
|
||||||
|
AUTOCONF_VERSION=2.62
|
||||||
|
AUTOMAKE_VERSION=1.9
|
||||||
|
FAKE_FLAGS= INSTALL_ROOT=${WRKINST}
|
||||||
|
PREFIX= /var/www
|
||||||
|
NO_REGRESS= Yes
|
||||||
|
USE_LIBTOOL= Yes
|
||||||
|
LIBTOOL_FLAGS= --tag=disable-static
|
||||||
|
|
||||||
|
BUILD_DEPENDS= :pear-*:www/pear \
|
||||||
|
${MODGNU_AUTOCONF_DEPENDS} \
|
||||||
|
${MODGNU_AUTOMAKE_DEPENDS}
|
||||||
|
LIB_DEPENDS= avcodec,avformat,swscale::graphics/ffmpeg \
|
||||||
|
gd::graphics/gd
|
||||||
|
RUN_DEPENDS= :php5-core-*:www/php5/core \
|
||||||
|
:php5-mbstring-*:www/php5/extensions,-gd
|
||||||
|
WANTLIB= expat fontconfig freetype iconv jpeg m png z
|
||||||
|
|
||||||
|
CONFIGURE_ARGS+=--enable-skip-gd-check
|
||||||
|
# force link to gd so $frame->toGDImage() works properly
|
||||||
|
CONFIGURE_ENV+= LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib -lgd -lfreetype" \
|
||||||
|
CPPFLAGS="-I${LOCALBASE}/include -I${LOCALBASE}/include/libavcodec -I${LOCALBASE}/include/libavformat" \
|
||||||
|
FFMPEG_LIBDIR="-L${LOCALBASE}/lib" \
|
||||||
|
AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
|
||||||
|
AUTOCONF_VERSION=${AUTOCONF_VERSION}
|
||||||
|
CONFIGURE_STYLE=gnu
|
||||||
|
|
||||||
|
pre-configure:
|
||||||
|
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${LOCALBASE}/bin/phpize
|
||||||
|
|
||||||
|
.include <bsd.port.mk>
|
5
multimedia/ffmpeg-php/distinfo
Normal file
5
multimedia/ffmpeg-php/distinfo
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
MD5 (ffmpeg-php-0.6.0.tbz2) = 93nA2//anaxUcp1gwOBMBQ==
|
||||||
|
RMD160 (ffmpeg-php-0.6.0.tbz2) = p3mwbwn84/88gya7ENtKuKrfQl4=
|
||||||
|
SHA1 (ffmpeg-php-0.6.0.tbz2) = KXi1r1GvPtoGOYQGNCl+tYSzlME=
|
||||||
|
SHA256 (ffmpeg-php-0.6.0.tbz2) = 7IqYR+D01RAaWv7bfawxjpoT8JmGUhWumdCNVq3ZsUE=
|
||||||
|
SIZE (ffmpeg-php-0.6.0.tbz2) = 275557
|
11
multimedia/ffmpeg-php/patches/patch-config_m4
Normal file
11
multimedia/ffmpeg-php/patches/patch-config_m4
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
$OpenBSD: patch-config_m4,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- config.m4.orig Mon Oct 13 21:47:18 2008
|
||||||
|
+++ config.m4 Fri Nov 21 14:54:32 2008
|
||||||
|
@@ -33,6 +33,7 @@ if test "$PHP_FFMPEG" != "no"; then
|
||||||
|
elif 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/)
|
||||||
|
PHP_ADD_INCLUDE($i/include/libavcodec/)
|
||||||
|
PHP_ADD_INCLUDE($i/include/libavformat/)
|
||||||
|
PHP_ADD_INCLUDE($i/include/libavutil/)
|
55
multimedia/ffmpeg-php/patches/patch-ffmpeg-php_c
Normal file
55
multimedia/ffmpeg-php/patches/patch-ffmpeg-php_c
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg-php_c,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg-php.c.orig Mon Oct 13 14:00:08 2008
|
||||||
|
+++ ffmpeg-php.c Sun Aug 16 05:33:41 2009
|
||||||
|
@@ -51,8 +51,9 @@
|
||||||
|
#include "ext/standard/info.h"
|
||||||
|
|
||||||
|
#include "php_ffmpeg.h"
|
||||||
|
+#include "ffmpeg_errorhandler.h"
|
||||||
|
|
||||||
|
-#define FFMPEG_PHP_VERSION "0.6.0-svn"
|
||||||
|
+#define FFMPEG_PHP_VERSION "0.6.0+patches"
|
||||||
|
|
||||||
|
zend_module_entry ffmpeg_module_entry = {
|
||||||
|
#if ZEND_MODULE_API_NO >= 20010901
|
||||||
|
@@ -78,7 +79,6 @@ ZEND_GET_MODULE(ffmpeg);
|
||||||
|
|
||||||
|
extern void register_ffmpeg_movie_class(int);
|
||||||
|
extern void register_ffmpeg_frame_class(int);
|
||||||
|
-extern void ffmpeg_errorhandler(void *ptr, int level, const char *msg, va_list args);
|
||||||
|
|
||||||
|
PHP_INI_BEGIN()
|
||||||
|
PHP_INI_ENTRY("ffmpeg.allow_persistent", "0", PHP_INI_ALL, NULL)
|
||||||
|
@@ -100,7 +100,9 @@ PHP_MINIT_FUNCTION(ffmpeg)
|
||||||
|
|
||||||
|
if (INI_BOOL("ffmpeg.show_warnings")) {
|
||||||
|
av_log_set_callback(ffmpeg_errorhandler);
|
||||||
|
- }
|
||||||
|
+ } else {
|
||||||
|
+ av_log_set_callback(ffmpeg_hide_errors);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
register_ffmpeg_movie_class(module_number);
|
||||||
|
register_ffmpeg_frame_class(module_number);
|
||||||
|
@@ -119,6 +121,12 @@ PHP_MINIT_FUNCTION(ffmpeg)
|
||||||
|
avcodec_build(), CONST_CS | CONST_PERSISTENT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if HAVE_LIBGD20
|
||||||
|
+ REGISTER_LONG_CONSTANT("FFMPEG_PHP_GD_ENABLED", 1, CONST_CS | CONST_PERSISTENT);
|
||||||
|
+#else
|
||||||
|
+ REGISTER_LONG_CONSTANT("FFMPEG_PHP_GD_ENABLED", 0, CONST_CS | CONST_PERSISTENT);
|
||||||
|
+#endif // HAVE_LIBGD20
|
||||||
|
+
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
@@ -138,7 +146,7 @@ PHP_MSHUTDOWN_FUNCTION(ffmpeg)
|
||||||
|
|
||||||
|
|
||||||
|
/* {{{ php info function
|
||||||
|
- Add an entry for ffmpeg support in phpinfo() */
|
||||||
|
+ Add an entry for ffmpeg-php support in phpinfo() */
|
||||||
|
PHP_MINFO_FUNCTION(ffmpeg)
|
||||||
|
{
|
||||||
|
php_info_print_table_start();
|
20
multimedia/ffmpeg-php/patches/patch-ffmpeg_errorhandler_c
Normal file
20
multimedia/ffmpeg-php/patches/patch-ffmpeg_errorhandler_c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg_errorhandler_c,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg_errorhandler.c.orig Wed Oct 8 12:22:39 2008
|
||||||
|
+++ ffmpeg_errorhandler.c Fri Nov 21 14:54:38 2008
|
||||||
|
@@ -59,6 +59,16 @@ void ffmpeg_errorhandler(void *ptr, int level, const c
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
+
|
||||||
|
+/* {{{ ffmpeg_hide_errors()
|
||||||
|
+ */
|
||||||
|
+void ffmpeg_hide_errors(void *ptr, int level, const char *msg, va_list args)
|
||||||
|
+{
|
||||||
|
+ // NO OP
|
||||||
|
+}
|
||||||
|
+/* }}} */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Local variables:
|
||||||
|
* tab-width: 4
|
42
multimedia/ffmpeg-php/patches/patch-ffmpeg_errorhandler_h
Normal file
42
multimedia/ffmpeg-php/patches/patch-ffmpeg_errorhandler_h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg_errorhandler_h,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg_errorhandler.h.orig Fri Nov 21 14:57:21 2008
|
||||||
|
+++ ffmpeg_errorhandler.h Fri Nov 21 14:57:40 2008
|
||||||
|
@@ -0,0 +1,38 @@
|
||||||
|
+/*
|
||||||
|
+ This file is part of ffmpeg-php
|
||||||
|
+
|
||||||
|
+ Copyright (C) 2004-2008 Alexey Zakhlestin <indeyets@gmail.com>
|
||||||
|
+
|
||||||
|
+ This program is free software; you can redistribute it and/or modify
|
||||||
|
+ it under the terms of the GNU General Public License as published by
|
||||||
|
+ the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+ (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ This program is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+ GNU General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU General Public License
|
||||||
|
+ along with this program; if not, write to the Free Software
|
||||||
|
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
+
|
||||||
|
+ In addition, as a special exception, the copyright holders of ffmpeg-php
|
||||||
|
+ give you permission to combine ffmpeg-php with code included in the
|
||||||
|
+ standard release of PHP under the PHP license (or modified versions of
|
||||||
|
+ such code, with unchanged license). You may copy and distribute such a
|
||||||
|
+ system following the terms of the GNU GPL for ffmpeg-php and the licenses
|
||||||
|
+ of the other code concerned, provided that you include the source code of
|
||||||
|
+ that other code when and as the GNU GPL requires distribution of source code.
|
||||||
|
+
|
||||||
|
+ You must obey the GNU General Public License in all respects for all of the
|
||||||
|
+ code used other than standard release of PHP. If you modify this file, you
|
||||||
|
+ may extend this exception to your version of the file, but you are not
|
||||||
|
+ obligated to do so. If you do not wish to do so, delete this exception
|
||||||
|
+ statement from your version.
|
||||||
|
+
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void ffmpeg_errorhandler(void *ptr, int level, const char *msg, va_list args);
|
||||||
|
+void ffmpeg_hide_errors(void *ptr, int level, const char *msg, va_list args);
|
206
multimedia/ffmpeg-php/patches/patch-ffmpeg_frame_c
Normal file
206
multimedia/ffmpeg-php/patches/patch-ffmpeg_frame_c
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg_frame_c,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg_frame.c.orig Mon Oct 13 18:02:01 2008
|
||||||
|
+++ ffmpeg_frame.c Fri Nov 21 15:05:16 2008
|
||||||
|
@@ -47,11 +47,6 @@
|
||||||
|
#include "ffmpeg_frame.h"
|
||||||
|
#include "ffmpeg_tools.h"
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- include gd header from local include dir. This is a copy of gd.h that is
|
||||||
|
- distributed with php-5.2.5. It is distributed along with ffmpeg-php to
|
||||||
|
- allow ffmpeg-php to be built without access to the php sources
|
||||||
|
- */
|
||||||
|
#if HAVE_LIBGD20
|
||||||
|
#include "gd.h"
|
||||||
|
|
||||||
|
@@ -60,14 +55,23 @@
|
||||||
|
ZEND_FETCH_RESOURCE(gd_img, gdImagePtr, ret, -1, "Image", le_gd); \
|
||||||
|
}
|
||||||
|
|
||||||
|
-// Borrowed from gd.c
|
||||||
|
-#define gdImageBoundsSafeMacro(im, x, y) (!((((y) < (im)->cy1) || ((y) > (im)->cy2)) || (((x) < (im)->cx1) || ((x) > (im)->cx2))))
|
||||||
|
-
|
||||||
|
static int le_gd; // this is only valid after calling
|
||||||
|
- // FFMPEG_PHP_FETCH_IMAGE_RESOURCE()
|
||||||
|
+ // FFMPEG_PHP_FETCH_IMAGE_RESOURCE() macro
|
||||||
|
|
||||||
|
#endif // HAVE_LIBGD20
|
||||||
|
|
||||||
|
+#define GET_FRAME_RESOURCE(ffmpeg_frame_object, ffmpeg_frame) {\
|
||||||
|
+ zval **_tmp_zval;\
|
||||||
|
+ if (zend_hash_find(Z_OBJPROP_P(ffmpeg_frame_object), "ffmpeg_frame",\
|
||||||
|
+ sizeof("ffmpeg_frame"), (void **)&_tmp_zval) == FAILURE) {\
|
||||||
|
+ zend_error(E_ERROR, "Unable to locate ffmpeg_frame resource in this object.");\
|
||||||
|
+ RETURN_FALSE;\
|
||||||
|
+ }\
|
||||||
|
+\
|
||||||
|
+ ZEND_FETCH_RESOURCE(ffmpeg_frame, ff_frame_context*, _tmp_zval, -1,\
|
||||||
|
+ "ffmpeg_frame", le_ffmpeg_frame);\
|
||||||
|
+}\
|
||||||
|
+
|
||||||
|
int le_ffmpeg_frame; // not static since it is used in ffmpeg_output_movie
|
||||||
|
|
||||||
|
static zend_class_entry *ffmpeg_frame_class_entry_ptr;
|
||||||
|
@@ -83,16 +87,16 @@ zend_function_entry ffmpeg_frame_class_methods[] = {
|
||||||
|
|
||||||
|
#if HAVE_LIBGD20
|
||||||
|
/* gd methods */
|
||||||
|
- PHP_MALIAS(ffmpeg_frame, togdimage, toGDImage, NULL, 0)
|
||||||
|
+ FFMPEG_PHP_MALIAS(ffmpeg_frame, togdimage, toGDImage, NULL, 0)
|
||||||
|
#endif // HAVE_LIBGD20
|
||||||
|
|
||||||
|
/* methods */
|
||||||
|
- PHP_MALIAS(ffmpeg_frame, getwidth, getWidth, NULL, 0)
|
||||||
|
- PHP_MALIAS(ffmpeg_frame, getheight, getHeight, NULL, 0)
|
||||||
|
- PHP_MALIAS(ffmpeg_frame, iskeyframe, isKeyFrame, NULL, 0)
|
||||||
|
- PHP_MALIAS(ffmpeg_frame, getpresentationtimestamp, getPresentationTimestamp, NULL, 0)
|
||||||
|
- PHP_MALIAS(ffmpeg_frame, getpts, getPresentationTimestamp, NULL, 0)
|
||||||
|
- {NULL, NULL, NULL}
|
||||||
|
+ FFMPEG_PHP_MALIAS(ffmpeg_frame, getwidth, getWidth, NULL, 0)
|
||||||
|
+ FFMPEG_PHP_MALIAS(ffmpeg_frame, getheight, getHeight, NULL, 0)
|
||||||
|
+ FFMPEG_PHP_MALIAS(ffmpeg_frame, iskeyframe, isKeyFrame, NULL, 0)
|
||||||
|
+ FFMPEG_PHP_MALIAS(ffmpeg_frame, getpresentationtimestamp, getPresentationTimestamp, NULL, 0)
|
||||||
|
+ FFMPEG_PHP_MALIAS(ffmpeg_frame, getpts, getPresentationTimestamp, NULL, 0)
|
||||||
|
+ FFMPEG_PHP_END_METHODS
|
||||||
|
};
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
@@ -286,13 +290,7 @@ static int _php_avframe_to_gd_image(AVFrame *frame, gd
|
||||||
|
|
||||||
|
for (y = 0; y < height; y++) {
|
||||||
|
for (x = 0; x < width; x++) {
|
||||||
|
-
|
||||||
|
- if (gdImageBoundsSafeMacro(dest, x, y)) {
|
||||||
|
- /* copy pixel to gdimage buffer zeroing the alpha channel */
|
||||||
|
- dest->tpixels[y][x] = src[x] & 0x00ffffff;
|
||||||
|
- } else {
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
+ gdImageSetPixel(dest, x, y, src[x]);
|
||||||
|
}
|
||||||
|
src += width;
|
||||||
|
}
|
||||||
|
@@ -301,29 +299,6 @@ static int _php_avframe_to_gd_image(AVFrame *frame, gd
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
-/* {{{ _php_gd_image_to_avframe()
|
||||||
|
- */
|
||||||
|
-static int _php_gd_image_to_avframe(gdImage *src, AVFrame *frame, int width,
|
||||||
|
- int height)
|
||||||
|
-{
|
||||||
|
- int x, y;
|
||||||
|
- int *dest = (int*)frame->data[0];
|
||||||
|
-
|
||||||
|
- for (y = 0; y < height; y++) {
|
||||||
|
- for (x = 0; x < width; x++) {
|
||||||
|
- if (gdImageBoundsSafeMacro(src, x, y)) {
|
||||||
|
- dest[x] = src->tpixels[y][x];
|
||||||
|
- } else {
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- dest += width;
|
||||||
|
- }
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-/* }}} */
|
||||||
|
-
|
||||||
|
-
|
||||||
|
/* {{{ proto resource toGDImage()
|
||||||
|
*/
|
||||||
|
FFMPEG_PHP_METHOD(ffmpeg_frame, toGDImage)
|
||||||
|
@@ -349,93 +324,6 @@ FFMPEG_PHP_METHOD(ffmpeg_frame, toGDImage)
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
-
|
||||||
|
-/* {{{ proto object _php_read_frame_from_file(mixed)
|
||||||
|
- */
|
||||||
|
-/*_php_read_frame_from_file(ff_frame_context *ff_frame, char* filename)
|
||||||
|
-{
|
||||||
|
- AVFrame *frame = NULL;
|
||||||
|
- AVFormatContext *ic;
|
||||||
|
- AVFormatParameters *ap;
|
||||||
|
- int err;
|
||||||
|
-
|
||||||
|
- // open the input file with generic libav function
|
||||||
|
- err = av_open_input_file(&ic, filename, NULL, 0, ap);
|
||||||
|
- if (err < 0) {
|
||||||
|
- zend_error(E_ERROR, "Can't open image file %d, %d", err,
|
||||||
|
- AVERROR_NOFMT);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-}*/
|
||||||
|
-/* }}} */
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-/* {{{ proto object ffmpeg_frame(mixed)
|
||||||
|
- */
|
||||||
|
-FFMPEG_PHP_METHOD(ffmpeg_frame, ffmpeg_frame)
|
||||||
|
-{
|
||||||
|
- zval **argv[1];
|
||||||
|
- AVFrame *frame;
|
||||||
|
- gdImage *gd_img;
|
||||||
|
- ff_frame_context *ff_frame;
|
||||||
|
- int width, height, ret;
|
||||||
|
-
|
||||||
|
- if (ZEND_NUM_ARGS() != 1) {
|
||||||
|
- WRONG_PARAM_COUNT;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* retrieve argument */
|
||||||
|
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), argv) != SUCCESS) {
|
||||||
|
- php_error_docref(NULL TSRMLS_CC, E_ERROR,
|
||||||
|
- "Error parsing arguments");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- ff_frame = _php_alloc_ff_frame();
|
||||||
|
-
|
||||||
|
- ret = ZEND_REGISTER_RESOURCE(NULL, ff_frame, le_ffmpeg_frame);
|
||||||
|
-
|
||||||
|
- object_init_ex(getThis(), ffmpeg_frame_class_entry_ptr);
|
||||||
|
- add_property_resource(getThis(), "ffmpeg_frame", ret);
|
||||||
|
-
|
||||||
|
- switch (Z_TYPE_PP(argv[0])) {
|
||||||
|
- case IS_STRING:
|
||||||
|
- convert_to_string_ex(argv[0]);
|
||||||
|
- zend_error(E_ERROR,
|
||||||
|
- "Creating an ffmpeg_frame from a file is not implemented\n");
|
||||||
|
- //_php_read_frame_from_file(ff_frame, Z_STRVAL_PP(argv[0]));
|
||||||
|
- break;
|
||||||
|
- case IS_RESOURCE:
|
||||||
|
- FFMPEG_PHP_FETCH_IMAGE_RESOURCE(gd_img, argv[0]);
|
||||||
|
-
|
||||||
|
- if (!gd_img->trueColor) {
|
||||||
|
- php_error_docref(NULL TSRMLS_CC, E_ERROR,
|
||||||
|
- "First parameter must be a truecolor gd image.");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- width = gdImageSX(gd_img);
|
||||||
|
- height = gdImageSY(gd_img);
|
||||||
|
-
|
||||||
|
- /* create a an av_frame and allocate space for it */
|
||||||
|
- frame = avcodec_alloc_frame();
|
||||||
|
- avpicture_alloc((AVPicture*)frame, PIX_FMT_RGBA32, width, height);
|
||||||
|
-
|
||||||
|
- /* copy the gd image to the av_frame */
|
||||||
|
- _php_gd_image_to_avframe(gd_img, frame, width, height);
|
||||||
|
-
|
||||||
|
- /* set the ffmepg_frame to point to this av_frame */
|
||||||
|
- ff_frame->av_frame = frame;
|
||||||
|
-
|
||||||
|
- /* set the ffpmeg_frame's properties */
|
||||||
|
- ff_frame->width = width;
|
||||||
|
- ff_frame->height = height;
|
||||||
|
- ff_frame->pixel_format = PIX_FMT_RGBA32;
|
||||||
|
- break;
|
||||||
|
- default:
|
||||||
|
- zend_error(E_ERROR, "Invalid argument\n");
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-/* }}} */
|
||||||
|
|
||||||
|
#endif /* HAVE_LIBGD20 */
|
||||||
|
|
39
multimedia/ffmpeg-php/patches/patch-ffmpeg_frame_h
Normal file
39
multimedia/ffmpeg-php/patches/patch-ffmpeg_frame_h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg_frame_h,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg_frame.h.orig Mon Oct 13 18:02:40 2008
|
||||||
|
+++ ffmpeg_frame.h Fri Nov 21 14:54:36 2008
|
||||||
|
@@ -38,6 +38,8 @@
|
||||||
|
|
||||||
|
#include "php_version.h"
|
||||||
|
|
||||||
|
+#include "php_ffmpeg.h"
|
||||||
|
+
|
||||||
|
#include <avcodec.h>
|
||||||
|
#include <avformat.h>
|
||||||
|
|
||||||
|
@@ -45,7 +47,7 @@
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-/* object can't be created from user space so no PHP constructor */
|
||||||
|
+/* ffmpeg_frame can't be instantiated from user space so no PHP constructor */
|
||||||
|
//FFMPEG_PHP_METHOD(ffmpeg_frame, __construct);
|
||||||
|
|
||||||
|
/* frame methods */
|
||||||
|
@@ -71,17 +73,6 @@ ff_frame_context* _php_create_ffmpeg_frame(INTERNAL_FU
|
||||||
|
|
||||||
|
int _php_convert_frame(ff_frame_context *ff_frame, int new_fmt);
|
||||||
|
|
||||||
|
-#define GET_FRAME_RESOURCE(ffmpeg_frame_object, ffmpeg_frame) {\
|
||||||
|
- zval **_tmp_zval;\
|
||||||
|
- if (zend_hash_find(Z_OBJPROP_P(ffmpeg_frame_object), "ffmpeg_frame",\
|
||||||
|
- sizeof("ffmpeg_frame"), (void **)&_tmp_zval) == FAILURE) {\
|
||||||
|
- zend_error(E_ERROR, "Unable to locate ffmpeg_frame resource in this object.");\
|
||||||
|
- RETURN_FALSE;\
|
||||||
|
- }\
|
||||||
|
-\
|
||||||
|
- ZEND_FETCH_RESOURCE(ffmpeg_frame, ff_frame_context*, _tmp_zval, -1,\
|
||||||
|
- "ffmpeg_frame", le_ffmpeg_frame);\
|
||||||
|
-}\
|
||||||
|
|
||||||
|
#endif // FFMPEG_FRAME_H
|
||||||
|
|
37
multimedia/ffmpeg-php/patches/patch-ffmpeg_movie_c
Normal file
37
multimedia/ffmpeg-php/patches/patch-ffmpeg_movie_c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg_movie_c,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg_movie.c.orig Mon Oct 13 17:46:53 2008
|
||||||
|
+++ ffmpeg_movie.c Fri Nov 21 14:54:38 2008
|
||||||
|
@@ -122,7 +122,7 @@ zend_function_entry ffmpeg_movie_class_methods[] = {
|
||||||
|
FFMPEG_PHP_MALIAS(ffmpeg_movie, getaudiobitrate, getAudioBitRate, NULL, 0)
|
||||||
|
FFMPEG_PHP_MALIAS(ffmpeg_movie, getvideobitrate, getVideoBitRate, NULL, 0)
|
||||||
|
FFMPEG_PHP_MALIAS(ffmpeg_movie, getpixelaspectratio, getPixelAspectRatio, NULL, 0)
|
||||||
|
- {NULL, NULL, NULL, 0, 0}
|
||||||
|
+ FFMPEG_PHP_END_METHODS
|
||||||
|
};
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
@@ -501,7 +501,7 @@ static AVCodecContext* _php_get_decoder_context(ff_mov
|
||||||
|
codec_id));
|
||||||
|
|
||||||
|
if (!decoder) {
|
||||||
|
- zend_error(E_ERROR, "Could not find decoder for %s",
|
||||||
|
+ zend_error(E_WARNING, "Could not find decoder for %s",
|
||||||
|
_php_get_filename(ffmovie_ctx));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -592,6 +592,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAlbum)
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
+
|
||||||
|
/* {{{ proto string getGenre()
|
||||||
|
* Return ID3 genre field from an mp3 file
|
||||||
|
*/
|
||||||
|
@@ -619,6 +620,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getTrackNumber)
|
||||||
|
RETURN_LONG(ffmovie_ctx->fmt_ctx->track);
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
+
|
||||||
|
|
||||||
|
/* {{{ proto int getYear()
|
||||||
|
* Return ID3 year field from an mp3 file
|
12
multimedia/ffmpeg-php/patches/patch-ffmpeg_movie_h
Normal file
12
multimedia/ffmpeg-php/patches/patch-ffmpeg_movie_h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
$OpenBSD: patch-ffmpeg_movie_h,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- ffmpeg_movie.h.orig Mon Oct 13 14:41:03 2008
|
||||||
|
+++ ffmpeg_movie.h Fri Nov 21 14:54:36 2008
|
||||||
|
@@ -32,6 +32,8 @@
|
||||||
|
#ifndef FFMPEG_MOVIE_H
|
||||||
|
#define FFMPEG_MOVIE_H
|
||||||
|
|
||||||
|
+#include "php_ffmpeg.h"
|
||||||
|
+
|
||||||
|
/* movie constructor */
|
||||||
|
FFMPEG_PHP_METHOD(ffmpeg_movie, __construct);
|
||||||
|
|
24
multimedia/ffmpeg-php/patches/patch-php_ffmpeg_h
Normal file
24
multimedia/ffmpeg-php/patches/patch-php_ffmpeg_h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
$OpenBSD: patch-php_ffmpeg_h,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
--- php_ffmpeg.h.orig Tue Oct 14 10:45:41 2008
|
||||||
|
+++ php_ffmpeg.h Fri Nov 21 14:54:36 2008
|
||||||
|
@@ -43,14 +43,16 @@
|
||||||
|
* PHP-4 doesn't have the METHOD, ME and MALIAS macros so map them back
|
||||||
|
* to the function macros for PHP-4
|
||||||
|
*/
|
||||||
|
-#if PHP_MAJOR_VERSION <= 4
|
||||||
|
-#define FFMPEG_PHP_METHOD(a,b) PHP_FUNCTION(b)
|
||||||
|
+#if PHP_MAJOR_VERSION <= 4 // PHP4; use FUNCTION macros
|
||||||
|
+#define FFMPEG_PHP_METHOD(a,b) PHP_FUNCTION(a)
|
||||||
|
#define FFMPEG_PHP_ME(a,b,c,d) PHP_FE(a,c)
|
||||||
|
-#define FFMPEG_PHP_MALIAS(a,b,c,d,e) PHP_FALIAS(b,c)
|
||||||
|
-#else /* Use METHOD macros for PHP-5 */
|
||||||
|
+#define FFMPEG_PHP_MALIAS(a,b,c,d,e) PHP_FALIAS(b,c,d)
|
||||||
|
+#define FFMPEG_PHP_END_METHODS {NULL, NULL, NULL}
|
||||||
|
+#else /* PHP5; Use METHOD macros */
|
||||||
|
#define FFMPEG_PHP_METHOD(a,b) PHP_METHOD(a,b)
|
||||||
|
#define FFMPEG_PHP_ME(a,b,c,d) PHP_ME(a,b,c,d)
|
||||||
|
#define FFMPEG_PHP_MALIAS(a,b,c,d,e) PHP_MALIAS(a,b,c,d,e)
|
||||||
|
+#define FFMPEG_PHP_END_METHODS {NULL, NULL, NULL, 0, 0}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SAFE_STRING(s) ((s)?(s):"")
|
12
multimedia/ffmpeg-php/pkg/DESCR
Normal file
12
multimedia/ffmpeg-php/pkg/DESCR
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
ffmpeg-php is an extension for PHP that adds an easy to use,
|
||||||
|
object-oriented API for accessing and retrieving information from video
|
||||||
|
and audio files. It has methods for returning frames from movie files
|
||||||
|
as images that can be manipulated using PHP's image functions. This
|
||||||
|
works well for automatically creating thumbnail images from movies.
|
||||||
|
ffmpeg-php is also useful for reporting the duration and bitrate of
|
||||||
|
audio files (mp3, wma, etc). ffmpeg-php can access many of the video
|
||||||
|
formats supported by ffmpeg (mov, avi, mpg, wmv, etc).
|
||||||
|
|
||||||
|
API documentation is available at:
|
||||||
|
|
||||||
|
http://ffmpeg-php.sourceforge.net/doc/api/
|
10
multimedia/ffmpeg-php/pkg/MESSAGE
Normal file
10
multimedia/ffmpeg-php/pkg/MESSAGE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
You can enable this module by creating a symbolic
|
||||||
|
link from ${PREFIX}/conf/php5.sample/ffmpeg.ini to
|
||||||
|
${PREFIX}/conf/php5/ffmpeg.ini.
|
||||||
|
|
||||||
|
ln -fs ${PREFIX}/conf/php5.sample/ffmpeg.ini \
|
||||||
|
${PREFIX}/conf/php5/ffmpeg.ini
|
||||||
|
|
||||||
|
If you already have Apache running on your machine,
|
||||||
|
you should not use "apachectl restart" - instead,
|
||||||
|
you should fully stop and then restart the server.
|
9
multimedia/ffmpeg-php/pkg/PLIST
Normal file
9
multimedia/ffmpeg-php/pkg/PLIST
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/08/16 20:04:39 jolan Exp $
|
||||||
|
@comment lib/
|
||||||
|
@comment lib/php/
|
||||||
|
@comment lib/php/modules/
|
||||||
|
@owner root
|
||||||
|
@group bin
|
||||||
|
lib/php/modules/ffmpeg.so
|
||||||
|
@owner
|
||||||
|
@group daemon
|
9
multimedia/ffmpeg-php/pkg/UNMESSAGE
Normal file
9
multimedia/ffmpeg-php/pkg/UNMESSAGE
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
You can disable this module by removing the
|
||||||
|
${PREFIX}/conf/php5/ffmpeg.ini symbolic link by
|
||||||
|
issuing the following command:
|
||||||
|
|
||||||
|
rm -f ${PREFIX}/conf/php5/ffmpeg.ini
|
||||||
|
|
||||||
|
If you already have Apache running on your machine,
|
||||||
|
you should not use "apachectl restart" - instead,
|
||||||
|
you should fully stop and then restart the server.
|
Loading…
Reference in New Issue
Block a user