dev-php/ffmpeg-php: Remove package wrt bug 602164

This commit is contained in:
Brian Evans
2017-01-17 12:36:11 -05:00
parent 685f720383
commit f70a15efe4
13 changed files with 0 additions and 799 deletions
-1
View File
@@ -1 +0,0 @@
DIST ffmpeg-php-0.6.0.tbz2 275557 SHA256 ec8a9847e0f4d5101a5afedb7dac318e9a13f099865215ae99d08d56add9b141 SHA512 837c854870886486683cf9d3ac2de376f0b4067487d68d4f5c685dd0bd4d306e406334821140bd1fab2d48105e7ee17956db70f2f70fb9bec4dcea14a2104127 WHIRLPOOL b390017ae6d7db3a7e40847468abfb9c151571e878545d02550c854d1f319add693cf87afe3391b03f3f2399a78ac225c0dcc28cdfbac2b58baa8ba8ef871605
@@ -1,48 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
PHP_EXT_NAME="ffmpeg"
PHP_EXT_INI="yes"
PHP_EXT_ZENDEXT="no"
USE_PHP="php5-6 php5-5 php5-4"
inherit php-ext-source-r2 eutils
KEYWORDS="amd64 x86"
DESCRIPTION="PHP extension that provides access to movie info"
HOMEPAGE="https://sourceforge.net/projects/ffmpeg-php/"
SRC_URI="mirror://sourceforge/ffmpeg-php/${P}.tbz2"
LICENSE="GPL-2"
SLOT="0"
IUSE=""
DEPEND="virtual/ffmpeg
dev-lang/php:*[gd]"
RDEPEND="${DEPEND}"
# The test breaks with the test movie, but it the same code works fine with
# other movies
RESTRICT="test"
DOCS="CREDITS ChangeLog EXPERIMENTAL TODO"
src_prepare() {
for slot in $(php_get_slots) ; do
cd "${WORKDIR}/${slot}"
epatch "${FILESDIR}/${P}-avutil50.patch"
epatch "${FILESDIR}/${P}-ffmpeg.patch"
epatch "${FILESDIR}/${P}-log.patch"
epatch "${FILESDIR}/${P}-php5-4.patch"
epatch "${FILESDIR}/${P}-ffincludes.patch"
epatch "${FILESDIR}/${P}-ffmpeg1.patch"
epatch "${FILESDIR}/${P}-api.patch"
epatch "${FILESDIR}/${P}-libav10.patch"
done
php-ext-source-r2_src_prepare
}
@@ -1,49 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
PHP_EXT_NAME="ffmpeg"
PHP_EXT_INI="yes"
PHP_EXT_ZENDEXT="no"
USE_PHP="php5-6 php5-5 php5-4"
inherit php-ext-source-r2 eutils
KEYWORDS="~amd64 ~x86"
DESCRIPTION="PHP extension that provides access to movie info"
HOMEPAGE="https://sourceforge.net/projects/ffmpeg-php/"
SRC_URI="mirror://sourceforge/ffmpeg-php/${P}.tbz2"
LICENSE="GPL-2"
SLOT="0"
IUSE="libav"
DEPEND="libav? ( media-video/libav:0= )
!libav? ( media-video/ffmpeg:0= )
dev-lang/php:*[gd]"
RDEPEND="${DEPEND}"
# The test breaks with the test movie, but it the same code works fine with
# other movies
RESTRICT="test"
DOCS="CREDITS ChangeLog EXPERIMENTAL TODO"
src_prepare() {
for slot in $(php_get_slots) ; do
cd "${WORKDIR}/${slot}"
epatch "${FILESDIR}/${P}-avutil50.patch"
epatch "${FILESDIR}/${P}-ffmpeg.patch"
epatch "${FILESDIR}/${P}-log.patch"
epatch "${FILESDIR}/${P}-php5-4.patch"
epatch "${FILESDIR}/${P}-ffincludes.patch"
epatch "${FILESDIR}/${P}-ffmpeg1.patch"
epatch "${FILESDIR}/${P}-api.patch"
epatch "${FILESDIR}/${P}-libav10.patch"
done
php-ext-source-r2_src_prepare
}
@@ -1,74 +0,0 @@
diff --git a/ffmpeg_movie.c b/ffmpeg_movie.c
index 0ce2c0f..6b77eb5 100644
--- a/ffmpeg_movie.c
+++ b/ffmpeg_movie.c
@@ -39,6 +39,7 @@
#include "ext/standard/info.h"
#include <libavcodec/avcodec.h>
+#include <libavcodec/version.h>
#include <libavformat/avformat.h>
#include <libavutil/pixfmt.h>
#include <libavutil/pixdesc.h>
@@ -252,17 +257,17 @@ static int _php_open_movie_file(ff_movie_context *ffmovie_ctx,
char* filename)
{
if (ffmovie_ctx->fmt_ctx) {
- av_close_input_file(ffmovie_ctx->fmt_ctx);
+ avformat_close_input(&ffmovie_ctx->fmt_ctx);
ffmovie_ctx->fmt_ctx = NULL;
}
/* open the file with generic libav function */
if (avformat_open_input(&ffmovie_ctx->fmt_ctx, filename, NULL, NULL) < 0) {
return 1;
}
/* decode the first frames to get the stream parameters. */
- av_find_stream_info(ffmovie_ctx->fmt_ctx);
+ avformat_find_stream_info(ffmovie_ctx->fmt_ctx, NULL);
return 0;
}
@@ -416,7 +421,7 @@ static void _php_free_ffmpeg_movie(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
}
- av_close_input_file(ffmovie_ctx->fmt_ctx);
+ avformat_close_input(&ffmovie_ctx->fmt_ctx);
efree(ffmovie_ctx);
}
@@ -440,7 +445,7 @@ static void _php_free_ffmpeg_pmovie(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
}
- av_close_input_file(ffmovie_ctx->fmt_ctx);
+ avformat_close_input(&ffmovie_ctx->fmt_ctx);
free(ffmovie_ctx);
}
@@ -512,7 +517,7 @@ static AVCodecContext* _php_get_decoder_context(ff_movie_context *ffmovie_ctx,
GET_CODEC_PTR(ffmovie_ctx->fmt_ctx->streams[stream_index]->codec);
/* open the decoder */
- if (avcodec_open(ffmovie_ctx->codec_ctx[stream_index], decoder) < 0) {
+ if (avcodec_open2(ffmovie_ctx->codec_ctx[stream_index], decoder, NULL) < 0) {
zend_error(E_WARNING, "Could not open codec for %s", _php_get_filename(ffmovie_ctx));
return NULL;
}
@@ -966,12 +967,14 @@ static const char* _php_get_codec_name(ff_movie_context *ffmovie_ctx, int type)
/* Copied from libavcodec/utils.c::avcodec_string */
if (p) {
codec_name = p->name;
+#ifdef FF_API_SUB_ID
if (decoder_ctx->codec_id == CODEC_ID_MP3) {
if (decoder_ctx->sub_id == 2)
codec_name = "mp2";
else if (decoder_ctx->sub_id == 1)
codec_name = "mp1";
}
+#endif
} else if (decoder_ctx->codec_id == CODEC_ID_MPEG2TS) {
/* fake mpeg2 transport stream codec (currently not registered) */
codec_name = "mpeg2ts";
@@ -1,31 +0,0 @@
Index: ffmpeg-php-0.6.0/ffmpeg_frame.c
===================================================================
--- ffmpeg-php-0.6.0.orig/ffmpeg_frame.c
+++ ffmpeg-php-0.6.0/ffmpeg_frame.c
@@ -333,7 +333,7 @@ FFMPEG_PHP_METHOD(ffmpeg_frame, toGDImag
GET_FRAME_RESOURCE(getThis(), ff_frame);
- _php_convert_frame(ff_frame, PIX_FMT_RGBA32);
+ _php_convert_frame(ff_frame, PIX_FMT_RGB32);
return_value->value.lval = _php_get_gd_image(ff_frame->width,
ff_frame->height);
@@ -418,7 +418,7 @@ FFMPEG_PHP_METHOD(ffmpeg_frame, ffmpeg_f
/* create a an av_frame and allocate space for it */
frame = avcodec_alloc_frame();
- avpicture_alloc((AVPicture*)frame, PIX_FMT_RGBA32, width, height);
+ avpicture_alloc((AVPicture*)frame, PIX_FMT_RGB32, width, height);
/* copy the gd image to the av_frame */
_php_gd_image_to_avframe(gd_img, frame, width, height);
@@ -429,7 +429,7 @@ FFMPEG_PHP_METHOD(ffmpeg_frame, ffmpeg_f
/* set the ffpmeg_frame's properties */
ff_frame->width = width;
ff_frame->height = height;
- ff_frame->pixel_format = PIX_FMT_RGBA32;
+ ff_frame->pixel_format = PIX_FMT_RGB32;
break;
default:
zend_error(E_ERROR, "Invalid argument\n");
@@ -1,115 +0,0 @@
Incldue properly FFmpeg headers.
https://bugs.gentoo.org/show_bug.cgi?id=461438
Index: php5.3/config.m4
===================================================================
--- php5.3.orig/config.m4
+++ php5.3/config.m4
@@ -31,15 +31,8 @@ if test "$PHP_FFMPEG" != "no"; then
FFMPEG_INC_FOUND=$i/include
break
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/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
+ PHP_ADD_INCLUDE($i/include)
+ FFMPEG_INC_FOUND=$i/include
break
fi
done
Index: php5.3/ffmpeg-php.c
===================================================================
--- php5.3.orig/ffmpeg-php.c
+++ php5.3/ffmpeg-php.c
@@ -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"
Index: php5.3/ffmpeg_errorhandler.c
===================================================================
--- php5.3.orig/ffmpeg_errorhandler.c
+++ php5.3/ffmpeg_errorhandler.c
@@ -34,7 +34,7 @@
*/
#include "php.h"
-#include <avcodec.h>
+#include <libavcodec/avcodec.h>
/* {{{ ffmpeg_errorhandler()
*/
Index: php5.3/ffmpeg_frame.h
===================================================================
--- php5.3.orig/ffmpeg_frame.h
+++ php5.3/ffmpeg_frame.h
@@ -38,8 +38,8 @@
#include "php_version.h"
-#include <avcodec.h>
-#include <avformat.h>
+#include <libavcodec/avcodec.h>
+#include <libavformat/avformat.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
Index: php5.3/ffmpeg_movie.c
===================================================================
--- php5.3.orig/ffmpeg_movie.c
+++ php5.3/ffmpeg_movie.c
@@ -34,9 +34,9 @@
#include "php_globals.h"
#include "ext/standard/info.h"
-#include <avcodec.h>
-#include <avformat.h>
-#include <pixdesc.h>
+#include <libavcodec/avcodec.h>
+#include <libavformat/avformat.h>
+#include <libavutil/pixdesc.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
Index: php5.3/ffmpeg_tools.c
===================================================================
--- php5.3.orig/ffmpeg_tools.c
+++ php5.3/ffmpeg_tools.c
@@ -42,7 +42,7 @@
#include "ffmpeg_tools.h"
#ifdef HAVE_SWSCALER
-#include <swscale.h>
+#include <libswscale/swscale.h>
#endif
/* {{{ ffmpeg_img_convert()
Index: php5.3/ffmpeg_tools.h
===================================================================
--- php5.3.orig/ffmpeg_tools.h
+++ php5.3/ffmpeg_tools.h
@@ -36,7 +36,7 @@
#ifndef FFMPEG_TOOLS_H
#define FFMPEG_TOOLS_H
-#include <avcodec.h>
+#include <libavcodec/avcodec.h>
int ffmpeg_img_convert(
AVPicture *dst, int dst_pix_fmt,
@@ -1,350 +0,0 @@
Index: work/php5.3/ffmpeg_movie.c
===================================================================
--- work.orig/php5.3/ffmpeg_movie.c
+++ work/php5.3/ffmpeg_movie.c
@@ -36,6 +36,7 @@
#include <avcodec.h>
#include <avformat.h>
+#include <pixdesc.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -67,6 +68,9 @@
#define GET_CODEC_FIELD(codec, field) codec.field
#define GET_CODEC_PTR(codec) &codec
#endif
+#ifndef MAX_STREAMS
+#define MAX_STREAMS 20
+#endif
typedef struct {
AVFormatContext *fmt_ctx;
@@ -149,7 +153,7 @@ static int _php_get_stream_index(AVForma
*/
static AVStream *_php_get_video_stream(AVFormatContext *fmt_ctx)
{
- int i = _php_get_stream_index(fmt_ctx, CODEC_TYPE_VIDEO);
+ int i = _php_get_stream_index(fmt_ctx, AVMEDIA_TYPE_VIDEO);
return i < 0 ? NULL : fmt_ctx->streams[i];
}
@@ -162,7 +166,7 @@ static AVStream *_php_get_video_stream(A
*/
static AVStream *_php_get_audio_stream(AVFormatContext *fmt_ctx)
{
- int i = _php_get_stream_index(fmt_ctx, CODEC_TYPE_AUDIO);
+ int i = _php_get_stream_index(fmt_ctx, AVMEDIA_TYPE_AUDIO);
return i < 0 ? NULL : fmt_ctx->streams[i];
}
@@ -481,7 +485,7 @@ static AVCodecContext* _php_get_decoder_
stream_index = _php_get_stream_index(ffmovie_ctx->fmt_ctx, stream_type);
if (stream_index < 0) {
// FIXME: factor out the conditional.
- if (stream_type == CODEC_TYPE_VIDEO) {
+ if (stream_type == AVMEDIA_TYPE_VIDEO) {
zend_error(E_WARNING, "Can't find video stream in %s",
_php_get_filename(ffmovie_ctx));
return NULL;
@@ -519,17 +523,26 @@ static AVCodecContext* _php_get_decoder_
}
/* }}} */
+static const char* get_metadata(AVDictionary *metadata, const char* val){
+ AVDictionaryEntry *ade;
+ ade = av_dict_get(metadata, val, NULL, 0 );
+ if(ade == NULL) return "";
+ return ade->value;
+}
+
/* {{{ proto string getComment()
*/
FFMPEG_PHP_METHOD(ffmpeg_movie, getComment)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
+
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "COMMENT");
- RETURN_STRINGL(ffmovie_ctx->fmt_ctx->comment,
- strlen(ffmovie_ctx->fmt_ctx->comment), 1);
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -540,11 +553,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getComme
FFMPEG_PHP_METHOD(ffmpeg_movie, getTitle)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_STRINGL(ffmovie_ctx->fmt_ctx->title,
- strlen(ffmovie_ctx->fmt_ctx->title), 1);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "TITLE");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -555,11 +569,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getTitle
FFMPEG_PHP_METHOD(ffmpeg_movie, getAuthor)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_STRINGL(ffmovie_ctx->fmt_ctx->author,
- strlen(ffmovie_ctx->fmt_ctx->author), 1);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "ARTIST");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -569,11 +584,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAutho
FFMPEG_PHP_METHOD(ffmpeg_movie, getCopyright)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_STRINGL(ffmovie_ctx->fmt_ctx->copyright,
- strlen(ffmovie_ctx->fmt_ctx->copyright), 1);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "COPYRIGHT");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -584,11 +600,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getCopyr
FFMPEG_PHP_METHOD(ffmpeg_movie, getAlbum)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_STRINGL(ffmovie_ctx->fmt_ctx->album,
- strlen(ffmovie_ctx->fmt_ctx->album), 1);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "ALBUM");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -598,11 +615,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAlbum
FFMPEG_PHP_METHOD(ffmpeg_movie, getGenre)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_STRINGL(ffmovie_ctx->fmt_ctx->genre,
- strlen(ffmovie_ctx->fmt_ctx->genre), 1);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "GENRE");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -613,10 +631,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getGenre
FFMPEG_PHP_METHOD(ffmpeg_movie, getTrackNumber)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_LONG(ffmovie_ctx->fmt_ctx->track);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "TRACK");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -626,10 +646,12 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getTrack
FFMPEG_PHP_METHOD(ffmpeg_movie, getYear)
{
ff_movie_context *ffmovie_ctx;
+ const char* val;
GET_MOVIE_RESOURCE(ffmovie_ctx);
- RETURN_LONG(ffmovie_ctx->fmt_ctx->year);
+ val = get_metadata(ffmovie_ctx->fmt_ctx->metadata, "DATE");
+ RETURN_STRINGL(val, strlen(val), 1);
}
/* }}} */
@@ -675,7 +697,7 @@ static float _php_get_framerate(ff_movie
}
#if LIBAVCODEC_BUILD > 4753
- if (GET_CODEC_FIELD(st->codec, codec_type) == CODEC_TYPE_VIDEO){
+ if (GET_CODEC_FIELD(st->codec, codec_type) == AVMEDIA_TYPE_VIDEO){
if (st->r_frame_rate.den && st->r_frame_rate.num) {
rate = av_q2d(st->r_frame_rate);
} else {
@@ -807,7 +829,7 @@ static long _php_get_framenumber(ff_movi
{
AVCodecContext *decoder_ctx = NULL;
- decoder_ctx = _php_get_decoder_context(ffmovie_ctx, CODEC_TYPE_VIDEO);
+ decoder_ctx = _php_get_decoder_context(ffmovie_ctx, AVMEDIA_TYPE_VIDEO);
if (!decoder_ctx) {
return 0;
}
@@ -847,7 +869,7 @@ static int _php_get_pixelformat(ff_movie
{
AVCodecContext *decoder_ctx;
- decoder_ctx = _php_get_decoder_context(ffmovie_ctx, CODEC_TYPE_VIDEO);
+ decoder_ctx = _php_get_decoder_context(ffmovie_ctx, AVMEDIA_TYPE_VIDEO);
return decoder_ctx ? decoder_ctx->pix_fmt : 0;
}
@@ -865,7 +887,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getPixel
GET_MOVIE_RESOURCE(ffmovie_ctx);
pix_fmt = _php_get_pixelformat(ffmovie_ctx);
- fmt = avcodec_get_pix_fmt_name(pix_fmt);
+ fmt = av_get_pix_fmt_name(pix_fmt);
if (fmt) {
/* cast const to non-const to keep compiler from complaining,
@@ -960,7 +982,7 @@ static const char* _php_get_codec_name(f
codec_name = decoder_ctx->codec_name;
} else {
/* output avi tags */
- if (decoder_ctx->codec_type == CODEC_TYPE_VIDEO) {
+ if (decoder_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
snprintf(buf1, sizeof(buf1), "%c%c%c%c",
decoder_ctx->codec_tag & 0xff,
(decoder_ctx->codec_tag >> 8) & 0xff,
@@ -986,7 +1008,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getVideo
GET_MOVIE_RESOURCE(ffmovie_ctx);
- codec_name = (char*)_php_get_codec_name(ffmovie_ctx, CODEC_TYPE_VIDEO);
+ codec_name = (char*)_php_get_codec_name(ffmovie_ctx, AVMEDIA_TYPE_VIDEO);
if (codec_name) {
RETURN_STRINGL(codec_name, strlen(codec_name), 1);
@@ -1006,7 +1028,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAudio
GET_MOVIE_RESOURCE(ffmovie_ctx);
- codec_name = (char*)_php_get_codec_name(ffmovie_ctx, CODEC_TYPE_AUDIO);
+ codec_name = (char*)_php_get_codec_name(ffmovie_ctx, AVMEDIA_TYPE_AUDIO);
if (codec_name) {
RETURN_STRINGL(codec_name, strlen(codec_name), 1);
@@ -1026,7 +1048,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getVideo
GET_MOVIE_RESOURCE(ffmovie_ctx);
- stream_id= _php_get_stream_index(ffmovie_ctx->fmt_ctx, CODEC_TYPE_VIDEO);
+ stream_id= _php_get_stream_index(ffmovie_ctx->fmt_ctx, AVMEDIA_TYPE_VIDEO);
if( stream_id == -1 )
{
@@ -1048,7 +1070,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAudio
GET_MOVIE_RESOURCE(ffmovie_ctx);
- stream_id= _php_get_stream_index(ffmovie_ctx->fmt_ctx, CODEC_TYPE_AUDIO);
+ stream_id= _php_get_stream_index(ffmovie_ctx->fmt_ctx, AVMEDIA_TYPE_AUDIO);
if( stream_id == -1 )
{
@@ -1086,7 +1108,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAudio
GET_MOVIE_RESOURCE(ffmovie_ctx);
- channels = _php_get_codec_channels(ffmovie_ctx, CODEC_TYPE_AUDIO);
+ channels = _php_get_codec_channels(ffmovie_ctx, AVMEDIA_TYPE_AUDIO);
if (channels) {
RETURN_LONG(channels);
@@ -1122,7 +1144,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAudio
GET_MOVIE_RESOURCE(ffmovie_ctx);
- sample_rate = _php_get_codec_sample_rate(ffmovie_ctx, CODEC_TYPE_AUDIO);
+ sample_rate = _php_get_codec_sample_rate(ffmovie_ctx, AVMEDIA_TYPE_AUDIO);
if (sample_rate) {
RETURN_LONG(sample_rate);
@@ -1158,7 +1180,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getAudio
GET_MOVIE_RESOURCE(ffmovie_ctx);
- bit_rate = _php_get_codec_bit_rate(ffmovie_ctx, CODEC_TYPE_AUDIO);
+ bit_rate = _php_get_codec_bit_rate(ffmovie_ctx, AVMEDIA_TYPE_AUDIO);
if (bit_rate) {
RETURN_LONG(bit_rate);
@@ -1178,7 +1200,7 @@ FFMPEG_PHP_METHOD(ffmpeg_movie, getVideo
GET_MOVIE_RESOURCE(ffmovie_ctx);
- bit_rate = _php_get_codec_bit_rate(ffmovie_ctx, CODEC_TYPE_VIDEO);
+ bit_rate = _php_get_codec_bit_rate(ffmovie_ctx, AVMEDIA_TYPE_VIDEO);
if (bit_rate) {
RETURN_LONG(bit_rate);
@@ -1201,7 +1223,7 @@ static AVFrame* _php_read_av_frame(ff_mo
int got_frame;
video_stream = _php_get_stream_index(ffmovie_ctx->fmt_ctx,
- CODEC_TYPE_VIDEO);
+ AVMEDIA_TYPE_VIDEO);
if (video_stream < 0) {
return NULL;
}
@@ -1212,11 +1234,10 @@ static AVFrame* _php_read_av_frame(ff_mo
while (av_read_frame(ffmovie_ctx->fmt_ctx, &packet) >= 0) {
if (packet.stream_index == video_stream) {
- avcodec_decode_video(decoder_ctx, frame, &got_frame,
- packet.data, packet.size);
+ avcodec_decode_video2(decoder_ctx, frame, &got_frame, &packet);
if (got_frame) {
- *is_keyframe = (packet.flags & PKT_FLAG_KEY);
+ *is_keyframe = (packet.flags & AV_PKT_FLAG_KEY);
*pts = packet.pts;
av_free_packet(&packet);
return frame;
@@ -1243,7 +1264,7 @@ static AVFrame* _php_get_av_frame(ff_mov
AVCodecContext *decoder_ctx = NULL;
AVFrame *frame = NULL;
- decoder_ctx = _php_get_decoder_context(ffmovie_ctx, CODEC_TYPE_VIDEO);
+ decoder_ctx = _php_get_decoder_context(ffmovie_ctx, AVMEDIA_TYPE_VIDEO);
if (decoder_ctx == NULL) {
return NULL;
}
@@ -1279,9 +1300,7 @@ static AVFrame* _php_get_av_frame(ff_mov
wanted_frame != GETFRAME_NEXTFRAME &&
wanted_frame - ffmovie_ctx->frame_number >
decoder_ctx->gop_size + 1) {
- decoder_ctx->hurry_up = 1;
- } else {
- decoder_ctx->hurry_up = 0;
+ decoder_ctx->skip_frame = AVDISCARD_BIDIR;
}
ffmovie_ctx->frame_number++;
@@ -1440,7 +1459,7 @@ static double _php_get_sample_aspect_rat
AVCodecContext *decoder_ctx;
- decoder_ctx = _php_get_decoder_context(ffmovie_ctx, CODEC_TYPE_VIDEO);
+ decoder_ctx = _php_get_decoder_context(ffmovie_ctx, AVMEDIA_TYPE_VIDEO);
if (!decoder_ctx) {
return -1;
}
@@ -1,30 +0,0 @@
Fix runtime with ffmpeg-1.
https://bugs.gentoo.org/show_bug.cgi?id=461438
Index: php5.3/ffmpeg-php.c
===================================================================
--- php5.3.orig/ffmpeg-php.c
+++ php5.3/ffmpeg-php.c
@@ -90,9 +90,6 @@ PHP_INI_END()
*/
PHP_MINIT_FUNCTION(ffmpeg)
{
- /* must be called before using avcodec libraries. */
- avcodec_init();
-
/* register all codecs */
av_register_all();
Index: php5.3/ffmpeg_movie.c
===================================================================
--- php5.3.orig/ffmpeg_movie.c
+++ php5.3/ffmpeg_movie.c
@@ -259,7 +259,7 @@ static int _php_open_movie_file(ff_movie
}
/* open the file with generic libav function */
- if (av_open_input_file(&ffmovie_ctx->fmt_ctx, filename, NULL, 0, NULL) < 0) {
+ if (avformat_open_input(&ffmovie_ctx->fmt_ctx, filename, NULL, NULL) < 0) {
return 1;
}
@@ -1,44 +0,0 @@
diff -aurN a/ffmpeg_movie.c b/ffmpeg_movie.c
--- a/ffmpeg_movie.c 2015-06-22 19:46:01.220498329 -0400
+++ b/ffmpeg_movie.c 2015-06-22 20:44:26.802671398 -0400
@@ -697,7 +697,16 @@
return rate;
}
-#if LIBAVCODEC_BUILD > 4753
+#if LIBAVCODEC_BUILD > 3604480 /* libav-10 */
+ if (GET_CODEC_FIELD(st->codec, codec_type) == AVMEDIA_TYPE_VIDEO){
+ if (st->avg_frame_rate.den && st->avg_frame_rate.num) {
+ rate = av_q2d(st->avg_frame_rate);
+ } else {
+ rate = 1 / av_q2d(GET_CODEC_FIELD(st->codec, time_base));
+ }
+ }
+ return (float)rate;
+#elif LIBAVCODEC_BUILD > 4753
if (GET_CODEC_FIELD(st->codec, codec_type) == AVMEDIA_TYPE_VIDEO){
if (st->r_frame_rate.den && st->r_frame_rate.num) {
rate = av_q2d(st->r_frame_rate);
@@ -980,14 +980,22 @@
if (p) {
codec_name = p->name;
#ifdef FF_API_SUB_ID
+#if LIBAVCODEC_BUILD > 3604480 /* libav-10 */
+ if (decoder_ctx->codec_id == AV_CODEC_ID_MP3) {
+#else
if (decoder_ctx->codec_id == CODEC_ID_MP3) {
+#endif
if (decoder_ctx->sub_id == 2)
codec_name = "mp2";
else if (decoder_ctx->sub_id == 1)
codec_name = "mp1";
}
#endif
+#if LIBAVCODEC_BUILD > 3604480 /* libav-10 */
+ } else if (decoder_ctx->codec_id == AV_CODEC_ID_MPEG2TS) {
+#else
} else if (decoder_ctx->codec_id == CODEC_ID_MPEG2TS) {
+#endif
/* fake mpeg2 transport stream codec (currently not registered) */
codec_name = "mpeg2ts";
} else if (decoder_ctx->codec_name[0] != '\0') {
@@ -1,12 +0,0 @@
Index: work/php5.3/ffmpeg-php.c
===================================================================
--- work.orig/php5.3/ffmpeg-php.c
+++ work/php5.3/ffmpeg-php.c
@@ -101,6 +101,7 @@ PHP_MINIT_FUNCTION(ffmpeg)
if (INI_BOOL("ffmpeg.show_warnings")) {
av_log_set_callback(ffmpeg_errorhandler);
}
+ else av_log_set_level(AV_LOG_QUIET);
register_ffmpeg_movie_class(module_number);
register_ffmpeg_frame_class(module_number);
@@ -1,29 +0,0 @@
--- ffmpeg-php-0.6.0.orig/ffmpeg_movie.c.bak 2013-02-24 16:44:31.162791000 +0200
+++ ffmpeg-php-0.6.0/ffmpeg_movie.c 2013-02-24 16:45:20.632791000 +0200
@@ -308,7 +308,7 @@
}
if (persistent) {
- list_entry *le;
+ zend_rsrc_list_entry *le;
/* resolve the fully-qualified path name to use as the hash key */
fullpath = expand_filepath(filename, NULL TSRMLS_CC);
@@ -343,7 +343,7 @@
}
} else { /* no existing persistant movie, create one */
- list_entry new_le;
+ zend_rsrc_list_entry new_le;
ffmovie_ctx = _php_alloc_ffmovie_ctx(1);
if (_php_open_movie_file(ffmovie_ctx, filename)) {
@@ -357,7 +357,7 @@
new_le.ptr = ffmovie_ctx;
if (FAILURE == zend_hash_update(&EG(persistent_list), hashkey,
- hashkey_length+1, (void *)&new_le, sizeof(list_entry),
+ hashkey_length+1, (void *)&new_le, sizeof(zend_rsrc_list_entry),
NULL)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Failed to register persistent resource");
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>php-bugs@gentoo.org</email>
<name>PHP</name>
</maintainer>
<upstream>
<remote-id type="sourceforge">ffmpeg-php</remote-id>
</upstream>
</pkgmetadata>