Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0c5329ae
Commit
0c5329ae
authored
Nov 14, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mikmod: merged open()/close() into decode()
These functions are trivial, we don't need them separate.
parent
2d236e28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
31 deletions
+12
-31
mikmod_plugin.c
src/decoder/mikmod_plugin.c
+12
-31
No files found.
src/decoder/mikmod_plugin.c
View file @
0c5329ae
...
...
@@ -131,38 +131,10 @@ typedef struct _mod_Data {
SBYTE
audio_buffer
[
MIKMOD_FRAME_SIZE
];
}
mod_Data
;
static
bool
mod_open
(
mod_Data
*
data
,
const
char
*
path
)
{
char
*
path2
;
MODULE
*
moduleHandle
;
path2
=
g_strdup
(
path
);
moduleHandle
=
Player_Load
(
path2
,
128
,
0
);
g_free
(
path2
);
if
(
moduleHandle
==
NULL
)
return
false
;
/* Prevent module from looping forever */
moduleHandle
->
loop
=
0
;
data
->
moduleHandle
=
moduleHandle
;
Player_Start
(
data
->
moduleHandle
);
return
true
;
}
static
void
mod_close
(
mod_Data
*
data
)
{
Player_Stop
();
Player_Free
(
data
->
moduleHandle
);
}
static
void
mod_decode
(
struct
decoder
*
decoder
,
const
char
*
path
)
{
char
*
path2
;
mod_Data
data
;
struct
audio_format
audio_format
;
float
total_time
=
0
.
0
;
...
...
@@ -170,11 +142,18 @@ mod_decode(struct decoder *decoder, const char *path)
float
secPerByte
;
enum
decoder_command
cmd
=
DECODE_COMMAND_NONE
;
if
(
!
mod_open
(
&
data
,
path
))
{
path2
=
g_strdup
(
path
);
data
.
moduleHandle
=
Player_Load
(
path2
,
128
,
0
);
g_free
(
path2
);
if
(
data
.
moduleHandle
==
NULL
)
{
g_warning
(
"failed to open mod: %s
\n
"
,
path
);
return
;
}
/* Prevent module from looping forever */
data
.
moduleHandle
->
loop
=
0
;
audio_format_init
(
&
audio_format
,
44100
,
16
,
2
);
assert
(
audio_format_valid
(
&
audio_format
));
...
...
@@ -184,6 +163,7 @@ mod_decode(struct decoder *decoder, const char *path)
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
0
);
Player_Start
(
data
.
moduleHandle
);
while
(
cmd
==
DECODE_COMMAND_NONE
&&
Player_Active
())
{
ret
=
VC_WriteBytes
(
data
.
audio_buffer
,
MIKMOD_FRAME_SIZE
);
total_time
+=
ret
*
secPerByte
;
...
...
@@ -192,7 +172,8 @@ mod_decode(struct decoder *decoder, const char *path)
total_time
,
0
,
NULL
);
}
mod_close
(
&
data
);
Player_Stop
();
Player_Free
(
data
.
moduleHandle
);
}
static
struct
tag
*
modTagDup
(
const
char
*
file
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment