aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/DsdLib.cxx1
-rw-r--r--src/decoder/FaadDecoderPlugin.cxx1
-rw-r--r--src/decoder/FlacCommon.cxx3
-rw-r--r--src/decoder/FlacCommon.hxx2
-rw-r--r--src/decoder/FlacDecoderPlugin.cxx8
-rw-r--r--src/decoder/FlacMetadata.cxx4
-rw-r--r--src/decoder/FlacMetadata.hxx4
-rw-r--r--src/decoder/MadDecoderPlugin.cxx32
-rw-r--r--src/decoder/OggCodec.cxx2
-rw-r--r--src/decoder/OpusDecoderPlugin.cxx11
-rw-r--r--src/decoder/PcmDecoderPlugin.cxx1
-rw-r--r--src/decoder/VorbisComments.cxx10
-rw-r--r--src/decoder/VorbisComments.hxx3
-rw-r--r--src/decoder/VorbisDecoderPlugin.cxx4
-rw-r--r--src/decoder/sidplay_decoder_plugin.cxx1
15 files changed, 46 insertions, 41 deletions
diff --git a/src/decoder/DsdLib.cxx b/src/decoder/DsdLib.cxx
index cc23c490b..d18131184 100644
--- a/src/decoder/DsdLib.cxx
+++ b/src/decoder/DsdLib.cxx
@@ -31,6 +31,7 @@
#include "TagId3.hxx"
#include <unistd.h>
+#include <string.h>
#include <stdio.h> /* for SEEK_SET, SEEK_CUR */
#ifdef HAVE_ID3TAG
diff --git a/src/decoder/FaadDecoderPlugin.cxx b/src/decoder/FaadDecoderPlugin.cxx
index d87c48628..1b7edb49f 100644
--- a/src/decoder/FaadDecoderPlugin.cxx
+++ b/src/decoder/FaadDecoderPlugin.cxx
@@ -29,6 +29,7 @@
#include <glib.h>
#include <assert.h>
+#include <string.h>
#include <unistd.h>
#undef G_LOG_DOMAIN
diff --git a/src/decoder/FlacCommon.cxx b/src/decoder/FlacCommon.cxx
index 74a0347f2..6b6c20d3c 100644
--- a/src/decoder/FlacCommon.cxx
+++ b/src/decoder/FlacCommon.cxx
@@ -43,8 +43,7 @@ flac_data::flac_data(struct decoder *_decoder,
flac_data::~flac_data()
{
- if (tag != nullptr)
- tag_free(tag);
+ delete tag;
}
static enum sample_format
diff --git a/src/decoder/FlacCommon.hxx b/src/decoder/FlacCommon.hxx
index ca6c9a8f9..e3555efba 100644
--- a/src/decoder/FlacCommon.hxx
+++ b/src/decoder/FlacCommon.hxx
@@ -81,7 +81,7 @@ struct flac_data : public FlacInput {
struct decoder *decoder;
struct input_stream *input_stream;
- struct tag *tag;
+ Tag *tag;
flac_data(struct decoder *decoder, struct input_stream *input_stream);
~flac_data();
diff --git a/src/decoder/FlacDecoderPlugin.cxx b/src/decoder/FlacDecoderPlugin.cxx
index cd15b4b29..3bc50aa4e 100644
--- a/src/decoder/FlacDecoderPlugin.cxx
+++ b/src/decoder/FlacDecoderPlugin.cxx
@@ -172,11 +172,11 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec,
data->first_frame = t_start;
while (true) {
- if (data->tag != nullptr && !tag_is_empty(data->tag)) {
+ if (data->tag != nullptr && !data->tag->IsEmpty()) {
cmd = decoder_tag(data->decoder, data->input_stream,
data->tag);
- tag_free(data->tag);
- data->tag = tag_new();
+ delete data->tag;
+ data->tag = new Tag();
} else
cmd = decoder_get_command(decoder);
@@ -260,7 +260,7 @@ flac_decode_internal(struct decoder * decoder,
return;
struct flac_data data(decoder, input_stream);
- data.tag = tag_new();
+ data.tag = new Tag();
FLAC__StreamDecoderInitStatus status =
stream_init(flac_dec, &data, is_ogg);
diff --git a/src/decoder/FlacMetadata.cxx b/src/decoder/FlacMetadata.cxx
index 64f091c04..3c0120ab4 100644
--- a/src/decoder/FlacMetadata.cxx
+++ b/src/decoder/FlacMetadata.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "FlacMetadata.hxx"
#include "XiphTags.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "TagHandler.hxx"
#include "TagTable.hxx"
#include "replay_gain_info.h"
@@ -228,7 +228,7 @@ flac_scan_metadata(const FLAC__StreamMetadata *block,
}
void
-flac_vorbis_comments_to_tag(struct tag *tag,
+flac_vorbis_comments_to_tag(Tag *tag,
const FLAC__StreamMetadata_VorbisComment *comment)
{
flac_scan_comments(comment, &add_tag_handler, tag);
diff --git a/src/decoder/FlacMetadata.hxx b/src/decoder/FlacMetadata.hxx
index cce34c3a7..52c6abbce 100644
--- a/src/decoder/FlacMetadata.hxx
+++ b/src/decoder/FlacMetadata.hxx
@@ -109,7 +109,7 @@ public:
};
struct tag_handler;
-struct tag;
+struct Tag;
struct replay_gain_info;
static inline unsigned
@@ -130,7 +130,7 @@ flac_parse_mixramp(char **mixramp_start, char **mixramp_end,
const FLAC__StreamMetadata *block);
void
-flac_vorbis_comments_to_tag(struct tag *tag,
+flac_vorbis_comments_to_tag(Tag *tag,
const FLAC__StreamMetadata_VorbisComment *comment);
void
diff --git a/src/decoder/MadDecoderPlugin.cxx b/src/decoder/MadDecoderPlugin.cxx
index c9b2f0a6c..9f36fd86b 100644
--- a/src/decoder/MadDecoderPlugin.cxx
+++ b/src/decoder/MadDecoderPlugin.cxx
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <glib.h>
#include <mad.h>
@@ -143,8 +144,8 @@ struct MadDecoder {
bool Seek(long offset);
bool FillBuffer();
- void ParseId3(size_t tagsize, struct tag **mpd_tag);
- enum mp3_action DecodeNextFrameHeader(struct tag **tag);
+ void ParseId3(size_t tagsize, Tag **mpd_tag);
+ enum mp3_action DecodeNextFrameHeader(Tag **tag);
enum mp3_action DecodeNextFrame();
gcc_pure
@@ -158,7 +159,7 @@ struct MadDecoder {
*/
void FileSizeToSongLength();
- bool DecodeFirstFrame(struct tag **tag);
+ bool DecodeFirstFrame(Tag **tag);
gcc_pure
long TimeToFrame(double t) const;
@@ -334,7 +335,7 @@ parse_id3_mixramp(char **mixramp_start, char **mixramp_end,
#endif
inline void
-MadDecoder::ParseId3(size_t tagsize, struct tag **mpd_tag)
+MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
{
#ifdef HAVE_ID3TAG
struct id3_tag *id3_tag = nullptr;
@@ -379,10 +380,9 @@ MadDecoder::ParseId3(size_t tagsize, struct tag **mpd_tag)
}
if (mpd_tag) {
- struct tag *tmp_tag = tag_id3_import(id3_tag);
+ Tag *tmp_tag = tag_id3_import(id3_tag);
if (tmp_tag != nullptr) {
- if (*mpd_tag != nullptr)
- tag_free(*mpd_tag);
+ delete *mpd_tag;
*mpd_tag = tmp_tag;
}
}
@@ -453,7 +453,7 @@ id3_tag_query(const void *p0, size_t length)
#endif /* !HAVE_ID3TAG */
enum mp3_action
-MadDecoder::DecodeNextFrameHeader(struct tag **tag)
+MadDecoder::DecodeNextFrameHeader(Tag **tag)
{
if ((stream.buffer == nullptr || stream.error == MAD_ERROR_BUFLEN) &&
!FillBuffer())
@@ -807,7 +807,7 @@ MadDecoder::FileSizeToSongLength()
}
inline bool
-MadDecoder::DecodeFirstFrame(struct tag **tag)
+MadDecoder::DecodeFirstFrame(Tag **tag)
{
struct xing xing;
struct lame lame;
@@ -1079,13 +1079,13 @@ MadDecoder::Read()
bool skip = false;
do {
- struct tag *tag = nullptr;
+ Tag *tag = nullptr;
ret = DecodeNextFrameHeader(&tag);
if (tag != nullptr) {
decoder_tag(decoder, input_stream, tag);
- tag_free(tag);
+ delete tag;
}
} while (ret == DECODE_CONT);
if (ret == DECODE_BREAK)
@@ -1113,10 +1113,9 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
{
MadDecoder data(decoder, input_stream);
- struct tag *tag = nullptr;
+ Tag *tag = nullptr;
if (!data.DecodeFirstFrame(&tag)) {
- if (tag != nullptr)
- tag_free(tag);
+ delete tag;
if (decoder_get_command(decoder) == DECODE_COMMAND_NONE)
g_warning
@@ -1134,8 +1133,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
g_warning("%s", error->message);
g_error_free(error);
- if (tag != nullptr)
- tag_free(tag);
+ delete tag;
return;
}
@@ -1145,7 +1143,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
if (tag != nullptr) {
decoder_tag(decoder, input_stream, tag);
- tag_free(tag);
+ delete tag;
}
while (data.Read()) {}
diff --git a/src/decoder/OggCodec.cxx b/src/decoder/OggCodec.cxx
index 5ad9c69d6..d7e5b7642 100644
--- a/src/decoder/OggCodec.cxx
+++ b/src/decoder/OggCodec.cxx
@@ -24,6 +24,8 @@
#include "config.h"
#include "OggCodec.hxx"
+#include <string.h>
+
enum ogg_codec
ogg_codec_detect(struct decoder *decoder, struct input_stream *is)
{
diff --git a/src/decoder/OpusDecoderPlugin.cxx b/src/decoder/OpusDecoderPlugin.cxx
index 84467371c..148125347 100644
--- a/src/decoder/OpusDecoderPlugin.cxx
+++ b/src/decoder/OpusDecoderPlugin.cxx
@@ -36,6 +36,7 @@
#include <glib.h>
#include <stdio.h>
+#include <string.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "opus"
@@ -221,16 +222,16 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
inline enum decoder_command
MPDOpusDecoder::HandleTags(const ogg_packet &packet)
{
- struct tag *tag = tag_new();
+ Tag tag;
enum decoder_command cmd;
- if (ScanOpusTags(packet.packet, packet.bytes, &add_tag_handler, tag) &&
- !tag_is_empty(tag))
- cmd = decoder_tag(decoder, input_stream, tag);
+ if (ScanOpusTags(packet.packet, packet.bytes,
+ &add_tag_handler, &tag) &&
+ !tag.IsEmpty())
+ cmd = decoder_tag(decoder, input_stream, &tag);
else
cmd = decoder_get_command(decoder);
- tag_free(tag);
return cmd;
}
diff --git a/src/decoder/PcmDecoderPlugin.cxx b/src/decoder/PcmDecoderPlugin.cxx
index c86d0fa3b..f64357e68 100644
--- a/src/decoder/PcmDecoderPlugin.cxx
+++ b/src/decoder/PcmDecoderPlugin.cxx
@@ -27,6 +27,7 @@ extern "C" {
#include <glib.h>
#include <unistd.h>
+#include <string.h>
#include <stdio.h> /* for SEEK_SET */
#undef G_LOG_DOMAIN
diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx
index a2bec30f1..88a8dc772 100644
--- a/src/decoder/VorbisComments.cxx
+++ b/src/decoder/VorbisComments.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "VorbisComments.hxx"
#include "XiphTags.hxx"
-#include "tag.h"
+#include "Tag.hxx"
#include "TagTable.hxx"
#include "TagHandler.hxx"
#include "replay_gain_info.h"
@@ -135,14 +135,14 @@ vorbis_comments_scan(char **comments,
}
-struct tag *
+Tag *
vorbis_comments_to_tag(char **comments)
{
- struct tag *tag = tag_new();
+ Tag *tag = new Tag();
vorbis_comments_scan(comments, &add_tag_handler, tag);
- if (tag_is_empty(tag)) {
- tag_free(tag);
+ if (tag->IsEmpty()) {
+ delete tag;
tag = NULL;
}
diff --git a/src/decoder/VorbisComments.hxx b/src/decoder/VorbisComments.hxx
index 2abb7c6a5..7a8374785 100644
--- a/src/decoder/VorbisComments.hxx
+++ b/src/decoder/VorbisComments.hxx
@@ -24,6 +24,7 @@
struct replay_gain_info;
struct tag_handler;
+struct Tag;
bool
vorbis_comments_to_replay_gain(struct replay_gain_info *rgi, char **comments);
@@ -32,7 +33,7 @@ void
vorbis_comments_scan(char **comments,
const struct tag_handler *handler, void *handler_ctx);
-struct tag *
+Tag *
vorbis_comments_to_tag(char **comments);
#endif
diff --git a/src/decoder/VorbisDecoderPlugin.cxx b/src/decoder/VorbisDecoderPlugin.cxx
index 7e039ab1e..36b3e3139 100644
--- a/src/decoder/VorbisDecoderPlugin.cxx
+++ b/src/decoder/VorbisDecoderPlugin.cxx
@@ -154,12 +154,12 @@ static void
vorbis_send_comments(struct decoder *decoder, struct input_stream *is,
char **comments)
{
- struct tag *tag = vorbis_comments_to_tag(comments);
+ Tag *tag = vorbis_comments_to_tag(comments);
if (!tag)
return;
decoder_tag(decoder, is, tag);
- tag_free(tag);
+ delete tag;
}
#ifndef HAVE_TREMOR
diff --git a/src/decoder/sidplay_decoder_plugin.cxx b/src/decoder/sidplay_decoder_plugin.cxx
index 565274d83..cfe82cf57 100644
--- a/src/decoder/sidplay_decoder_plugin.cxx
+++ b/src/decoder/sidplay_decoder_plugin.cxx
@@ -26,6 +26,7 @@ extern "C" {
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <glib.h>
#include <sidplay/sidplay2.h>