Skip to content

Commit 87b412d

Browse files
committed
Revert patch for warnings about missing headers. These are fixed in the latest version of libming.
Sync code for SWFMovie::streamMP3. This function will now return the number of frames in the file.
1 parent 25f01e8 commit 87b412d

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

ext/ming/config.m4

-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ int main(void) { SWFMovie_output(NULL, NULL, NULL, 0); return 0; }
8484
], [])
8585
CPPFLAGS=$old_CPPFLAGS
8686

87-
AC_CHECK_HEADERS([ming/displaylist.h])
88-
AC_CHECK_HEADERS([ming/movie.h])
89-
9087
PHP_NEW_EXTENSION(ming, ming.c, $ext_shared)
9188
PHP_SUBST(MING_SHARED_LIBADD)
9289
fi

ext/ming/ming.c

+21-12
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
#include <stdio.h>
3737
#include <math.h>
3838
#include <ming.h>
39-
#ifdef HAVE_MING_DISPLAYLIST_H
40-
# include <ming/displaylist.h>
41-
#endif
42-
#ifdef HAVE_MING_MOVIE_H
43-
# include <ming/movie.h>
44-
#endif
4539

4640
#define FLOAT_Z_DVAL_PP(x) ((float)Z_DVAL_PP(x))
4741
#define BYTE_Z_LVAL_PP(x) ((byte)Z_LVAL_PP(x))
@@ -2482,17 +2476,31 @@ PHP_METHOD(swfmovie, setFrames)
24822476
/* }}} */
24832477

24842478
#ifdef HAVE_NEW_MING
2485-
/* {{{ proto void swfmovie::streamMP3(mixed file)
2486-
Sets sound stream of the SWF movie. The parameter can be stream or string. */
2479+
/* {{{ proto int swfmovie::streamMP3(mixed file [, float skip])
2480+
Sets sound stream of the SWF movie. The parameter can be stream or string. Retuens the number of frames. */
24872481
PHP_METHOD(swfmovie, streamMP3)
24882482
{
2489-
zval **zfile;
2483+
zval **zfile, **zskip;
2484+
float skip;
24902485
SWFSoundStream sound;
24912486
SWFInput input;
24922487
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
24932488

2494-
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE) {
2495-
WRONG_PARAM_COUNT;
2489+
switch (ZEND_NUM_ARGS()) {
2490+
case 1:
2491+
if(zend_get_parameters_ex(1, &zfile) == FAILURE)
2492+
WRONG_PARAM_COUNT;
2493+
skip = 0;
2494+
break;
2495+
case 2:
2496+
if(zend_get_parameters_ex(2, &zfile, &zskip) == FAILURE)
2497+
WRONG_PARAM_COUNT;
2498+
convert_to_double_ex(zskip);
2499+
skip = Z_DVAL_PP(zskip);
2500+
break;
2501+
default:
2502+
WRONG_PARAM_COUNT;
2503+
break;
24962504
}
24972505

24982506
if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
@@ -2504,7 +2512,8 @@ PHP_METHOD(swfmovie, streamMP3)
25042512
}
25052513

25062514
sound = newSWFSoundStream_fromInput(input);
2507-
SWFMovie_setSoundStream(movie, sound);
2515+
SWFMovie_setSoundStreamAt(movie, sound, skip);
2516+
RETURN_LONG(SWFSoundStream_getFrames(sound));
25082517
}
25092518
/* }}} */
25102519

0 commit comments

Comments
 (0)