MPD: decoder/plugins/DsdLib.hxx Source File

MPD 0.20.18

DsdLib.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_DECODER_DSDLIB_HXX
21 #define MPD_DECODER_DSDLIB_HXX
22
23 #include "system/ByteOrder.hxx"
24 #include "input/Offset.hxx"
25 #include "Compiler.h"
26
27 #include <stdint.h>
28
29 struct TagHandler;
30 class DecoderClient;
31 class InputStream;
32
33 struct DsdId {
34 char value[4];
35
36 gcc_pure
37 bool Equals(const char *s) const noexcept;
38 };
39
40 class DsdUint64 {
41 uint32_t lo;
42 uint32_t hi;
43
44 public:
45 constexpr uint64_t Read() const {
46 return (uint64_t(FromLE32(hi)) << 32) |
47 uint64_t(FromLE32(lo));
48 }
49 };
50
51 class DffDsdUint64 {
52 uint32_t hi;
53 uint32_t lo;
54
55 public:
56 constexpr uint64_t Read() const {
57 return (uint64_t(FromBE32(hi)) << 32) |
58 uint64_t(FromBE32(lo));
59 }
60 };
61
62 bool
63 dsdlib_skip_to(DecoderClient *client, InputStream &is,
64 offset_type offset);
65
66 bool
67 dsdlib_skip(DecoderClient *client, InputStream &is,
68 offset_type delta);
69
73 gcc_const
74 bool
75 dsdlib_valid_freq(uint32_t samplefreq) noexcept;
76
81 void
82 dsdlib_tag_id3(InputStream &is,
83 const TagHandler &handler,
84 void *handler_ctx, offset_type tagoffset);
85
86 #endif
DsdUint64::Read
constexpr uint64_t Read() const
Definition: DsdLib.hxx:45
DsdUint64
Definition: DsdLib.hxx:40
DecoderClient
An interface between the decoder plugin and the MPD core.
Definition: Client.hxx:39
dsdlib_valid_freq
gcc_const bool dsdlib_valid_freq(uint32_t samplefreq) noexcept
Check if the sample frequency is a valid DSD frequency.
DffDsdUint64
Definition: DsdLib.hxx:51
TagHandler
A callback table for receiving metadata of a song.
Definition: TagHandler.hxx:32
dsdlib_skip
bool dsdlib_skip(DecoderClient *client, InputStream &is, offset_type delta)
FromLE32
static constexpr uint32_t FromLE32(uint32_t value)
Converts a 32bit value from little endian to the system&#39;s byte order.
Definition: ByteOrder.hxx:178
InputStream
Definition: InputStream.hxx:36
dsdlib_tag_id3
void dsdlib_tag_id3(InputStream &is, const TagHandler &handler, void *handler_ctx, offset_type tagoffset)
Add tags from ID3 tag.
Compiler.h
gcc_const
#define gcc_const
Definition: Compiler.h:109
DffDsdUint64::Read
constexpr uint64_t Read() const
Definition: DsdLib.hxx:56
DsdId::value
char value[4]
Definition: DsdLib.hxx:34
offset_type
uint64_t offset_type
A type for absolute offsets in a file.
Definition: Offset.hxx:30
Offset.hxx
ByteOrder.hxx
DsdId
Definition: DsdLib.hxx:33
FromBE32
static constexpr uint32_t FromBE32(uint32_t value)
Converts a 32bit value from big endian to the system&#39;s byte order.
Definition: ByteOrder.hxx:151
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
DsdId::Equals
gcc_pure bool Equals(const char *s) const noexcept
dsdlib_skip_to
bool dsdlib_skip_to(DecoderClient *client, InputStream &is, offset_type offset)