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
258d0ea9
Commit
258d0ea9
authored
Jul 28, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mpg123: convert to C++
parent
d3641766
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
16 deletions
+48
-16
Makefile.am
Makefile.am
+3
-1
DecoderList.cxx
src/DecoderList.cxx
+1
-1
Mpg123DecoderPlugin.cxx
src/decoder/Mpg123DecoderPlugin.cxx
+19
-14
Mpg123DecoderPlugin.hxx
src/decoder/Mpg123DecoderPlugin.hxx
+25
-0
No files found.
Makefile.am
View file @
258d0ea9
...
...
@@ -504,7 +504,9 @@ libdecoder_plugins_a_SOURCES += \
endif
if
HAVE_MPG123
libdecoder_plugins_a_SOURCES
+=
src/decoder/mpg123_decoder_plugin.c
libdecoder_plugins_a_SOURCES
+=
\
src/decoder/Mpg123DecoderPlugin.cxx
\
src/decoder/Mpg123DecoderPlugin.hxx
endif
if
HAVE_MPCDEC
...
...
src/DecoderList.cxx
View file @
258d0ea9
...
...
@@ -36,12 +36,12 @@
#include "decoder/FaadDecoderPlugin.hxx"
#include "decoder/MadDecoderPlugin.hxx"
#include "decoder/SndfileDecoderPlugin.hxx"
#include "decoder/Mpg123DecoderPlugin.hxx"
#include <glib.h>
#include <string.h>
extern
const
struct
decoder_plugin
mpg123_decoder_plugin
;
extern
const
struct
decoder_plugin
mpcdec_decoder_plugin
;
extern
const
struct
decoder_plugin
modplug_decoder_plugin
;
extern
const
struct
decoder_plugin
mikmod_decoder_plugin
;
...
...
src/decoder/
mpg123_decoder_plugin.c
→
src/decoder/
Mpg123DecoderPlugin.cxx
View file @
258d0ea9
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,6 +18,7 @@
*/
#include "config.h"
/* must be first for large file support */
#include "Mpg123DecoderPlugin.hxx"
#include "decoder_api.h"
#include "audio_check.h"
#include "tag_handler.h"
...
...
@@ -57,7 +58,7 @@ static bool
mpd_mpg123_open
(
mpg123_handle
*
handle
,
const
char
*
path_fs
,
struct
audio_format
*
audio_format
)
{
GError
*
gerror
=
NULL
;
GError
*
gerror
=
nullptr
;
char
*
path_dup
;
int
error
;
int
channels
,
encoding
;
...
...
@@ -111,8 +112,8 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
/* open the file */
handle
=
mpg123_new
(
NULL
,
&
error
);
if
(
handle
==
NULL
)
{
handle
=
mpg123_new
(
nullptr
,
&
error
);
if
(
handle
==
nullptr
)
{
g_warning
(
"mpg123_new() failed: %s"
,
mpg123_plain_strerror
(
error
));
return
;
...
...
@@ -172,7 +173,7 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
/* send to MPD */
cmd
=
decoder_data
(
decoder
,
NULL
,
buffer
,
nbytes
,
info
.
bitrate
);
cmd
=
decoder_data
(
decoder
,
nullptr
,
buffer
,
nbytes
,
info
.
bitrate
);
if
(
cmd
==
DECODE_COMMAND_SEEK
)
{
off_t
c
=
decoder_seek_where
(
decoder
)
*
audio_format
.
sample_rate
;
...
...
@@ -202,8 +203,8 @@ mpd_mpg123_scan_file(const char *path_fs,
int
error
;
off_t
num_samples
;
handle
=
mpg123_new
(
NULL
,
&
error
);
if
(
handle
==
NULL
)
{
handle
=
mpg123_new
(
nullptr
,
&
error
);
if
(
handle
==
nullptr
)
{
g_warning
(
"mpg123_new() failed: %s"
,
mpg123_plain_strerror
(
error
));
return
false
;
...
...
@@ -231,15 +232,19 @@ mpd_mpg123_scan_file(const char *path_fs,
static
const
char
*
const
mpg123_suffixes
[]
=
{
"mp3"
,
NULL
nullptr
};
const
struct
decoder_plugin
mpg123_decoder_plugin
=
{
.
name
=
"mpg123"
,
.
init
=
mpd_mpg123_init
,
.
finish
=
mpd_mpg123_finish
,
.
file_decode
=
mpd_mpg123_file_decode
,
"mpg123"
,
mpd_mpg123_init
,
mpd_mpg123_finish
,
/* streaming not yet implemented */
.
scan_file
=
mpd_mpg123_scan_file
,
.
suffixes
=
mpg123_suffixes
,
nullptr
,
mpd_mpg123_file_decode
,
mpd_mpg123_scan_file
,
nullptr
,
nullptr
,
mpg123_suffixes
,
nullptr
,
};
src/decoder/Mpg123DecoderPlugin.hxx
0 → 100644
View file @
258d0ea9
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DECODER_MPG123_HXX
#define MPD_DECODER_MPG123_HXX
extern
const
struct
decoder_plugin
mpg123_decoder_plugin
;
#endif
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