Skip to content

Commit 29216b8

Browse files
committed
Updated the extension name
1 parent 7b9d016 commit 29216b8

File tree

4 files changed

+78
-78
lines changed

4 files changed

+78
-78
lines changed

config.m4

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
LDFLAGS=`libmikmod-config --libs`
22

3-
PHP_ARG_WITH(mod_player, for module audio files support,
4-
[ --with-mod-player[=DIR] include cli audio support])
3+
PHP_ARG_WITH(modplayer, for module audio files support,
4+
[ --with-modplayer[=DIR] include module player support])
55

6-
if test "$PHP_MOD_PLAYER" != "no"; then
7-
for i in $PHP_MOD_PLAYER /usr/local /usr; do
6+
if test "$PHP_MODPLAYER" != "no"; then
7+
for i in $PHP_MODPLAYER /usr/local /usr; do
88
test -f $i/include/mikmod.h && MIKMOD_DIR=$i && break
99
done
1010

11-
if test -z "$PHP_MOD_PLAYER"; then
11+
if test -z "$PHP_MODPLAYER"; then
1212
AC_MSG_ERROR(mikmod.h not found. Please reinstall libmikmod.)
1313
fi
1414

15-
PHP_ADD_LIBRARY_WITH_PATH(mod_player, $MIKMOD_DIR/$PHP_LIBDIR)
15+
PHP_ADD_LIBRARY_WITH_PATH(modplayer, $MIKMOD_DIR/$PHP_LIBDIR)
1616
PHP_ADD_INCLUDE($MIKMOD_DIR/include)
1717

18-
PHP_NEW_EXTENSION(mod_player, mod_player.c, $ext_shared,,)
18+
PHP_NEW_EXTENSION(modplayer, modplayer.c, $ext_shared, cli,)
1919
fi

mod_player.c renamed to modplayer.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,60 +19,60 @@
1919

2020
#include "php.h"
2121
#include "php_ini.h"
22-
#include "php_mod_player.h"
22+
#include "php_modplayer.h"
2323
#include "mikmod.h"
2424

25-
ZEND_DECLARE_MODULE_GLOBALS(mod_player)
25+
ZEND_DECLARE_MODULE_GLOBALS(modplayer)
2626

27-
static zend_function_entry mod_player_functions[] = {
27+
static zend_function_entry modplayer_functions[] = {
2828
PHP_FE(play_module_file, NULL)
2929
PHP_FE(mod_player_getpid, NULL)
3030
PHP_FE(stop_module_file, NULL)
3131
{NULL, NULL, NULL}
3232
};
3333

34-
zend_module_entry mod_player_module_entry = {
34+
zend_module_entry modplayer_module_entry = {
3535
#if ZEND_MODULE_API_NO >= 20010901
3636
STANDARD_MODULE_HEADER,
3737
#endif
38-
PHP_MOD_PLAYER_EXTNAME,
39-
mod_player_functions,
40-
PHP_MINIT(mod_player),
41-
PHP_MSHUTDOWN(mod_player),
38+
PHP_MODPLAYER_EXTNAME,
39+
modplayer_functions,
40+
PHP_MINIT(modplayer),
41+
PHP_MSHUTDOWN(modplayer),
4242
NULL,
4343
NULL,
4444
NULL,
4545
#if ZEND_MODULE_API_NO >= 20010901
46-
PHP_MOD_PLAYER_VERSION,
46+
PHP_MODPLAYER_VERSION,
4747
#endif
4848
STANDARD_MODULE_PROPERTIES
4949
};
5050

51-
#ifdef COMPILE_DL_MOD_PLAYER
52-
ZEND_GET_MODULE(mod_player)
51+
#ifdef COMPILE_DL_MODPLAYER
52+
ZEND_GET_MODULE(modplayer)
5353
#endif
5454

5555
PHP_INI_BEGIN()
56-
PHP_INI_ENTRY("mod_player.maxchan","64",PHP_INI_ALL,NULL)
57-
PHP_INI_ENTRY("mod_player.curious","0",PHP_INI_ALL,NULL)
56+
PHP_INI_ENTRY("modplayer.maxchan","64",PHP_INI_ALL,NULL)
57+
PHP_INI_ENTRY("modplayer.curious","0",PHP_INI_ALL,NULL)
5858
PHP_INI_END()
5959

60-
static void php_mod_player_init_globals(zend_mod_player_globals *mod_player_globals)
60+
static void php_modplayer_init_globals(zend_modplayer_globals *modplayer_globals)
6161
{
62-
mod_player_globals->pid = 0;
62+
modplayer_globals->pid = 0;
6363
}
6464

65-
PHP_MINIT_FUNCTION(mod_player)
65+
PHP_MINIT_FUNCTION(modplayer)
6666
{
67-
ZEND_INIT_MODULE_GLOBALS(mod_player, php_mod_player_init_globals, NULL);
67+
ZEND_INIT_MODULE_GLOBALS(modplayer, php_modplayer_init_globals, NULL);
6868
REGISTER_INI_ENTRIES();
6969
return SUCCESS;
7070
}
7171

72-
PHP_MSHUTDOWN_FUNCTION(mod_player)
72+
PHP_MSHUTDOWN_FUNCTION(modplayer)
7373
{
74-
if (MOD_PLAYER_G(pid) > 0) {
75-
kill(MOD_PLAYER_G(pid), SIGKILL);
74+
if (MODPLAYER_G(pid) > 0) {
75+
kill(MODPLAYER_G(pid), SIGKILL);
7676
}
7777

7878
UNREGISTER_INI_ENTRIES();
@@ -89,7 +89,7 @@ PHP_FUNCTION(play_module_file)
8989
RETURN_NULL();
9090
}
9191

92-
if (MOD_PLAYER_G(pid) > 0) {
92+
if (MODPLAYER_G(pid) > 0) {
9393
zend_error(E_ERROR, "You've already started the module player");
9494
RETURN_NULL();
9595
}
@@ -101,25 +101,25 @@ PHP_FUNCTION(play_module_file)
101101
RETURN_NULL();
102102
}
103103

104-
s_pid = stream_audio(fptr, INI_INT("mod_player.maxchan"), INI_INT("mod_player.curious"));
104+
s_pid = stream_audio(fptr, INI_INT("modplayer.maxchan"), INI_INT("modplayer.curious"));
105105

106106
if (s_pid > 0) {
107-
MOD_PLAYER_G(pid) = s_pid;
107+
MODPLAYER_G(pid) = s_pid;
108108
}
109109

110110
RETURN_LONG(s_pid);
111111
}
112112

113113
PHP_FUNCTION(mod_player_getpid)
114114
{
115-
RETURN_LONG(MOD_PLAYER_G(pid));
115+
RETURN_LONG(MODPLAYER_G(pid));
116116
}
117117

118118
PHP_FUNCTION(stop_module_file)
119119
{
120-
if (MOD_PLAYER_G(pid) > 0) {
121-
kill(MOD_PLAYER_G(pid), SIGKILL);
122-
MOD_PLAYER_G(pid) = 0;
120+
if (MODPLAYER_G(pid) > 0) {
121+
kill(MODPLAYER_G(pid), SIGKILL);
122+
MODPLAYER_G(pid) = 0;
123123
}
124124

125125
RETURN_NULL();
@@ -152,7 +152,7 @@ int stream_audio(FILE *fptr, int maxchan, int curious)
152152
Player_Start(module);
153153

154154
s_pid = getpid();
155-
MOD_PLAYER_G(pid) = s_pid;
155+
MODPLAYER_G(pid) = s_pid;
156156

157157
while (Player_Active()) {
158158
usleep(10000);
@@ -166,7 +166,7 @@ int stream_audio(FILE *fptr, int maxchan, int curious)
166166
fclose(fptr);
167167
MikMod_Exit();
168168
} else if (m_pid < 0) {
169-
zend_error(E_ERROR, "Failed to fork CLI Audio Stream process");
169+
zend_error(E_ERROR, "Failed to fork CLI audio stream process");
170170
return -1;
171171
}
172172

php_mod_player.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

php_modplayer.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* PHP CLI AUDIO STREAMMER
3+
*
4+
* This is a extension to provide a stream of module audio files under
5+
* the CLI SAPI. This library is licensed under the MIT license.
6+
*
7+
* Developed by: devSDMF <devsdmf@gmail.com>
8+
*
9+
*/
10+
#ifndef PHP_MODPLAYER_H
11+
#define PHP_MODPLAYER_H 1
12+
13+
#ifdef ZTS
14+
#include "TSRM.h"
15+
#endif
16+
17+
ZEND_BEGIN_MODULE_GLOBALS(modplayer)
18+
long pid;
19+
ZEND_END_MODULE_GLOBALS(modplayer)
20+
21+
#ifdef ZTS
22+
#define MODPLAYER_G(v) TSRM(modplayer_globals_id, zend_modplayer_globals *, v)
23+
#else
24+
#define MODPLAYER_G(v) (modplayer_globals.v)
25+
#endif
26+
27+
#define PHP_MODPLAYER_EXTNAME "modplayer"
28+
#define PHP_MODPLAYER_VERSION "1.1.0"
29+
30+
PHP_MINIT_FUNCTION(modplayer);
31+
PHP_MSHUTDOWN_FUNCTION(modplayer);
32+
33+
PHP_FUNCTION(play_module_file);
34+
PHP_FUNCTION(mod_player_getpid);
35+
PHP_FUNCTION(stop_module_file);
36+
37+
int stream_audio(FILE *fptr, int maxchan, int curious);
38+
39+
extern zend_module_entry modplayer_module_entry;
40+
#define phpext_mod_player_ptr &modplayer_module_entry;
41+
42+
#endif

0 commit comments

Comments
 (0)