Skip to content

Commit 083ba8b

Browse files
committed
MultiDecoder comments
1 parent 8314ab3 commit 083ba8b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/AudioTools/AudioCodecs/MultiDecoder.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ namespace audio_tools {
99

1010
/**
1111
* @brief Manage multiple decoders: the actual decoder is only opened when it
12-
* has been selected.
12+
* has been selected. The relevant decoder is determined dynamically at the first
13+
* write from the determined mime type. You can add your own custom mime type
14+
* determination logic.
1315
* @ingroup codecs
1416
* @ingroup decoder
1517
* @author Phil Schatzmann
1618
* @copyright GPLv3
1719
*/
1820
class MultiDecoder : public AudioDecoder {
19-
//
20-
bool begin() {
21+
/// Enables the automatic mime type determination
22+
bool begin() override {
2123
mime_detector.begin();
2224
is_first = true;
2325
return true;
2426
}
2527

2628
/// closes the actual decoder
27-
void end() {
29+
void end() override {
2830
if (actual_decoder.decoder != nullptr && actual_decoder.is_open) {
2931
actual_decoder.decoder->end();
3032
}
@@ -40,7 +42,7 @@ class MultiDecoder : public AudioDecoder {
4042
decoders.push_back(info);
4143
}
4244

43-
// selects the actual decoder by mime type
45+
/// selects the actual decoder by mime type - this is usually called automatically from the determined mime type
4446
bool selectDecoder(const char* mime) {
4547
bool result = false;
4648
// do nothing if no change
@@ -63,7 +65,7 @@ class MultiDecoder : public AudioDecoder {
6365
return result;
6466
}
6567

66-
virtual size_t write(const uint8_t* data, size_t len) {
68+
size_t write(const uint8_t* data, size_t len) override {
6769
if (is_first) {
6870
// select the decoder based on the detemined mime type
6971
mime_detector.write((uint8_t*)data, len);

0 commit comments

Comments
 (0)