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
cf3ada3d
Commit
cf3ada3d
authored
Apr 20, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://github.com/mcfiredrill/mpd
parents
7df94b17
9d55b169
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
0 deletions
+158
-0
Makefile.am
Makefile.am
+6
-0
configure.ac
configure.ac
+19
-0
gme_decoder_plugin.c
src/decoder/gme_decoder_plugin.c
+129
-0
decoder_list.c
src/decoder_list.c
+4
-0
No files found.
Makefile.am
View file @
cf3ada3d
...
...
@@ -411,6 +411,7 @@ DECODER_CFLAGS = \
$(AUDIOFILE_CFLAGS)
\
$(LIBMIKMOD_CFLAGS)
\
$(MODPLUG_CFLAGS)
\
$(GME_CFLAGS)
\
$(SIDPLAY_CFLAGS)
\
$(FLUIDSYNTH_CFLAGS)
\
$(WILDMIDI_CFLAGS)
\
...
...
@@ -426,6 +427,7 @@ DECODER_LIBS = \
$(SNDFILE_LIBS)
\
$(AUDIOFILE_LIBS)
$(LIBMIKMOD_LIBS)
\
$(MODPLUG_LIBS)
\
$(GME_LIBS)
\
$(SIDPLAY_LIBS)
\
$(FLUIDSYNTH_LIBS)
\
$(WILDMIDI_LIBS)
\
...
...
@@ -520,6 +522,10 @@ if ENABLE_SNDFILE
DECODER_SRC
+=
src/decoder/sndfile_decoder_plugin.c
endif
if
HAVE_GME
DECODER_SRC
+=
src/decoder/gme_decoder_plugin.c
endif
# encoder plugins
ENCODER_CFLAGS
=
\
...
...
configure.ac
View file @
cf3ada3d
...
...
@@ -533,6 +533,18 @@ if test x$enable_modplug = xyes; then
AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
fi
AC_ARG_ENABLE(gme,
AS_HELP_STRING([--enable-gme],
[enable Blargg's game music emulator plugin]),,
enable_gme=auto)
MPD_AUTO_PKG(gme, GME, [libgme],
[gme decoder plugin], [libgme not found])
AM_CONDITIONAL(HAVE_GME, test x$enable_gme = xyes)
if test x$enable_gme = xyes; then
AC_DEFINE(HAVE_GME, 1, [Define for gme support])
fi
AC_ARG_ENABLE(mpc,
AS_HELP_STRING([--disable-mpc],
[disable musepack (MPC) support (default: enable)]),,
...
...
@@ -1561,6 +1573,12 @@ else
echo " MODPLUG support ...............disabled"
fi
if test x$enable_gme = xyes; then
echo " GME support ....................enabled"
else
echo " GME support ...................disabled"
fi
if test x$enable_mad = xyes; then
echo " MAD mp3 decoder support .......enabled"
else
...
...
@@ -1647,6 +1665,7 @@ if
test x$enable_ffmpeg = xno &&
test x$enable_modplug = xno &&
test x$enable_sidplay = xno &&
test x$enable_gme = xno &&
test x$enable_fluidsynth = xno &&
test x$enable_wildmidi = xno &&
test x$enable_mp4 = xno &&
...
...
src/decoder/gme_decoder_plugin.c
0 → 100644
View file @
cf3ada3d
#include "config.h"
#include "../decoder_api.h"
#include "audio_check.h"
#include <glib.h>
#include <assert.h>
#include <gme/gme.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gme"
#define GME_BUF_SIZE 4096
static
void
gme_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
{
int
sample_rate
=
44100
;
int
track
=
0
;
/* index of track to play */
float
song_len
;
Music_Emu
*
emu
;
gme_info_t
*
ti
;
struct
audio_format
audio_format
;
enum
decoder_command
cmd
;
short
buf
[
GME_BUF_SIZE
];
const
char
*
gme_err
;
if
((
gme_err
=
gme_open_file
(
path_fs
,
&
emu
,
sample_rate
))
!=
NULL
){
g_warning
(
"%s"
,
gme_err
);
return
;
}
if
((
gme_err
=
gme_track_info
(
emu
,
&
ti
,
0
))
!=
NULL
){
g_warning
(
"%s"
,
gme_err
);
gme_delete
(
emu
);
return
;
}
if
(
ti
->
length
>
0
)
song_len
=
ti
->
length
/
1000
.
0
;
else
song_len
=
-
1
;
/* initialize the MPD decoder */
GError
*
error
=
NULL
;
if
(
!
audio_format_init_checked
(
&
audio_format
,
sample_rate
,
SAMPLE_FORMAT_S16
,
2
,
&
error
)){
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
gme_free_info
(
ti
);
gme_delete
(
emu
);
return
;
}
decoder_initialized
(
decoder
,
&
audio_format
,
true
,
song_len
);
if
((
gme_err
=
gme_start_track
(
emu
,
track
))
!=
NULL
)
g_warning
(
"%s"
,
gme_err
);
/* play */
do
{
if
((
gme_err
=
gme_play
(
emu
,
GME_BUF_SIZE
>>
1
,
buf
))
!=
NULL
){
g_warning
(
"%s"
,
gme_err
);
return
;
}
cmd
=
decoder_data
(
decoder
,
NULL
,
buf
,
GME_BUF_SIZE
,
0
);
if
(
cmd
==
DECODE_COMMAND_SEEK
)
{
float
where
=
decoder_seek_where
(
decoder
);
if
((
gme_err
=
gme_seek
(
emu
,
(
int
)
where
*
1000
))
!=
NULL
)
g_warning
(
"%s"
,
gme_err
);
decoder_command_finished
(
decoder
);
}
if
(
gme_track_ended
(
emu
))
break
;
}
while
(
cmd
!=
DECODE_COMMAND_STOP
);
gme_free_info
(
ti
);
gme_delete
(
emu
);
}
static
struct
tag
*
gme_tag_dup
(
const
char
*
path_fs
)
{
struct
tag
*
tag
=
tag_new
();
int
sample_rate
=
44100
;
Music_Emu
*
emu
;
gme_info_t
*
ti
;
const
char
*
gme_err
;
if
((
gme_err
=
gme_open_file
(
path_fs
,
&
emu
,
sample_rate
))
!=
NULL
){
g_warning
(
"%s"
,
gme_err
);
return
NULL
;
}
if
((
gme_err
=
gme_track_info
(
emu
,
&
ti
,
0
))
!=
NULL
){
g_warning
(
"%s"
,
gme_err
);
gme_delete
(
emu
);
return
NULL
;
}
if
(
ti
!=
NULL
){
if
(
ti
->
length
>
0
)
tag
->
time
=
ti
->
length
/
1000
;
if
(
ti
->
song
!=
NULL
)
tag_add_item
(
tag
,
TAG_TITLE
,
ti
->
song
);
if
(
ti
->
author
!=
NULL
)
tag_add_item
(
tag
,
TAG_ARTIST
,
ti
->
author
);
if
(
ti
->
comment
!=
NULL
)
tag_add_item
(
tag
,
TAG_COMMENT
,
ti
->
comment
);
if
(
ti
->
copyright
!=
NULL
)
tag_add_item
(
tag
,
TAG_DATE
,
ti
->
copyright
);
}
gme_free_info
(
ti
);
gme_delete
(
emu
);
return
tag
;
}
static
const
char
*
const
gme_suffixes
[]
=
{
"ay"
,
"gbs"
,
"gym"
,
"hes"
,
"kss"
,
"nsf"
,
"nsfe"
,
"sap"
,
"spc"
,
"vgm"
,
"vgz"
,
NULL
};
extern
const
struct
decoder_plugin
gme_decoder_plugin
;
const
struct
decoder_plugin
gme_decoder_plugin
=
{
.
name
=
"gme"
,
.
file_decode
=
gme_file_decode
,
.
tag_dup
=
gme_tag_dup
,
.
suffixes
=
gme_suffixes
,
};
src/decoder_list.c
View file @
cf3ada3d
...
...
@@ -44,6 +44,7 @@ extern const struct decoder_plugin sidplay_decoder_plugin;
extern
const
struct
decoder_plugin
wildmidi_decoder_plugin
;
extern
const
struct
decoder_plugin
fluidsynth_decoder_plugin
;
extern
const
struct
decoder_plugin
ffmpeg_decoder_plugin
;
extern
const
struct
decoder_plugin
gme_decoder_plugin
;
const
struct
decoder_plugin
*
const
decoder_plugins
[]
=
{
#ifdef HAVE_MAD
...
...
@@ -97,6 +98,9 @@ const struct decoder_plugin *const decoder_plugins[] = {
#ifdef HAVE_FFMPEG
&
ffmpeg_decoder_plugin
,
#endif
#ifdef HAVE_GME
&
gme_decoder_plugin
,
#endif
NULL
};
...
...
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