static SWFFontCharacter getFontCharacter(zval *id TSRMLS_DC);
static SWFSoundInstance getSoundInstance(zval *id TSRMLS_DC);
static SWFVideoStream getVideoStream(zval *id TSRMLS_DC);
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
static SWFPrebuiltClip getPrebuiltClip(zval *id TSRMLS_DC);
#endif
static int le_swffontcharp;
static int le_swfsoundinstancep;
static int le_swfvideostreamp;
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
static int le_swfprebuiltclipp;
#endif
static zend_class_entry *fontchar_class_entry_ptr;
static zend_class_entry *soundinstance_class_entry_ptr;
static zend_class_entry *videostream_class_entry_ptr;
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
static zend_class_entry *prebuiltclip_class_entry_ptr;
#endif
else if(Z_OBJCE_P(id) == videostream_class_entry_ptr)
return (SWFCharacter)getVideoStream(id TSRMLS_CC);
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
else if(Z_OBJCE_P(id) == prebuiltclip_class_entry_ptr)
return (SWFCharacter)getPrebuiltClip(id TSRMLS_CC);
#endif
};
/* }}} */
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
/* {{{ SWFPrebuiltClip */
/* {{{ proto class swfprebuiltclip_init([file])
Returns a SWFPrebuiltClip object */
PHP_METHOD(swfmovie, output)
{
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
zval **zlimit = NULL;
int limit = -1;
int argc = ZEND_NUM_ARGS();
RETURN_FALSE;
}
}
- oldval = Ming_setSWFCompression(limit);
+ oldval = Ming_setSWFCompression(limit);
out = SWFMovie_output(movie, &phpByteOutputMethod, NULL);
if (oldval >= -1 && oldval <= 9) {
Ming_setSWFCompression(oldval);
}
RETURN_LONG(out);
+#elif defined(HAVE_NEW_MING)
+ zval **zlimit = NULL;
+ int limit = -1;
+ int argc = ZEND_NUM_ARGS();
+
+ if(argc) {
+ if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long_ex(zlimit);
+ limit = Z_LVAL_PP(zlimit);
+
+ if ((limit < 0) || (limit > 9)) {
+ php_error(E_WARNING,"compression level must be within 0..9");
+ RETURN_FALSE;
+ }
+ }
+ RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL, limit));
#else
RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL));
#endif
PHP_METHOD(swfmovie, saveToFile)
{
zval **x;
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
zval **zlimit = NULL;
int limit = -1;
+#endif
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
int oldval = INT_MIN;
long out;
#endif
WRONG_PARAM_COUNT;
break;
case 2:
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE)
WRONG_PARAM_COUNT;
convert_to_long_ex(zlimit);
php_error(E_WARNING,"compression level must be within 0..9");
RETURN_FALSE;
}
+#endif
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
oldval = Ming_setSWFCompression(limit);
#endif
break;
}
ZEND_FETCH_RESOURCE(what, php_stream *, x, -1,"File-Handle",php_file_le_stream());
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
out = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, what);
if (oldval >= -1 && oldval <=9)
Ming_setSWFCompression(oldval);
RETURN_LONG(out);
+#elif defined(HAVE_NEW_MING)
+ RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what, limit));
#else
RETURN_LONG(SWFMovie_output(movie, &phpStreamOutputMethod, what));
#endif
PHP_METHOD(swfmovie, save)
{
zval **x;
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
zval **zlimit = NULL;
int limit = -1;
+#endif
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
int oldval = INT_MIN;
#endif
long retval;
}
break;
case 2:
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) || defined(HAVE_NEW_MING)
if (zend_get_parameters_ex(2, &x, &zlimit) == FAILURE) {
WRONG_PARAM_COUNT;
}
php_error(E_WARNING,"compression level must be within 0..9");
RETURN_FALSE;
}
+#endif
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
oldval = Ming_setSWFCompression(limit);
#endif
break;
if (Z_TYPE_PP(x) == IS_RESOURCE) {
ZEND_FETCH_RESOURCE(stream, php_stream *, x, -1,"File-Handle",php_file_le_stream());
- RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream));
+#if defined(HAVE_NEW_MING)
+ RETURN_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream, limit));
+#else
+ RETVAL_LONG(SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, stream));
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
+ if(oldval >= -1 && oldval <=9)
+ Ming_setSWFCompression(oldval);
+#endif
+ return;
+#endif
}
convert_to_string_ex(x);
RETURN_FALSE;
}
+#if defined(HAVE_NEW_MING)
+ retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream, limit);
+#else
retval = SWFMovie_output(getMovie(getThis() TSRMLS_CC), &phpStreamOutputMethod, (void *)stream);
+#endif
php_stream_close(stream);
-#ifdef HAVE_MING_ZLIB
+#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
if(oldval >= -1 && oldval <=9)
Ming_setSWFCompression(oldval);
#endif
zend_class_entry fontchar_class_entry;
zend_class_entry soundinstance_class_entry;
zend_class_entry videostream_class_entry;
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
zend_class_entry prebuiltclip_class_entry;
#endif
#ifdef HAVE_NEW_MING
le_swffontcharp = zend_register_list_destructors_ex(destroy_SWFFontCharacter_resource, NULL, "SWFFontCharacter", module_number);
le_swfsoundinstancep = zend_register_list_destructors_ex(NULL, NULL, "SWFSoundInstance", module_number);
-
le_swfvideostreamp = zend_register_list_destructors_ex(destroy_SWFVideoStream_resource, NULL, "SWFVideoStream", module_number);
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
le_swfprebuiltclipp = zend_register_list_destructors_ex(destroy_SWFPrebuiltClip_resource, NULL, "SWFPrebuiltClip", module_number);
#endif
INIT_CLASS_ENTRY(fontchar_class_entry, "SWFFontChar", swffontchar_functions);
INIT_CLASS_ENTRY(soundinstance_class_entry, "SWFSoundInstance", swfsoundinstance_functions);
INIT_CLASS_ENTRY(videostream_class_entry, "SWFVideoStream", swfvideostream_functions);
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
INIT_CLASS_ENTRY(prebuiltclip_class_entry, "SWFPrebuiltClip", swfprebuiltclip_functions);
#endif
fontchar_class_entry_ptr = zend_register_internal_class(&fontchar_class_entry TSRMLS_CC);
soundinstance_class_entry_ptr = zend_register_internal_class(&soundinstance_class_entry TSRMLS_CC);
videostream_class_entry_ptr = zend_register_internal_class(&videostream_class_entry TSRMLS_CC);
+#endif
+#ifdef HAVE_SWFPREBUILTCLIP
prebuiltclip_class_entry_ptr = zend_register_internal_class(&prebuiltclip_class_entry TSRMLS_CC);
#endif