diff options
author | Max Kellermann <max@duempel.org> | 2013-07-28 12:45:48 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-07-28 13:03:04 +0200 |
commit | 258d0ea97eb38dee79564fe3a36d2f3adec4b269 (patch) | |
tree | 3f55c3ddb5d9f9f70cf5a9f23e7671357ae3dcc4 /src/decoder | |
parent | d3641766a580d20c4848d056a78399f10fcc6f18 (diff) | |
download | mpd-258d0ea97eb38dee79564fe3a36d2f3adec4b269.tar.gz mpd-258d0ea97eb38dee79564fe3a36d2f3adec4b269.tar.xz mpd-258d0ea97eb38dee79564fe3a36d2f3adec4b269.zip |
decoder/mpg123: convert to C++
Diffstat (limited to '')
-rw-r--r-- | src/decoder/Mpg123DecoderPlugin.cxx (renamed from src/decoder/mpg123_decoder_plugin.c) | 33 | ||||
-rw-r--r-- | src/decoder/Mpg123DecoderPlugin.hxx | 25 |
2 files changed, 44 insertions, 14 deletions
diff --git a/src/decoder/mpg123_decoder_plugin.c b/src/decoder/Mpg123DecoderPlugin.cxx index 657a9c889..f43aa5dea 100644 --- a/src/decoder/mpg123_decoder_plugin.c +++ b/src/decoder/Mpg123DecoderPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * 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 @@ -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, }; diff --git a/src/decoder/Mpg123DecoderPlugin.hxx b/src/decoder/Mpg123DecoderPlugin.hxx new file mode 100644 index 000000000..273b03eaf --- /dev/null +++ b/src/decoder/Mpg123DecoderPlugin.hxx @@ -0,0 +1,25 @@ +/* + * 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 |