-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6df642a
commit cbf599a
Showing
15 changed files
with
146 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "player/decoder.h" | ||
|
||
#include "player/decoder_ogg.h" | ||
#include "player/decoder_wav.h" | ||
|
||
bool player::Decoder::Init() { | ||
return player::impl::Ogg::Init() && player::impl::Wav::Init(); | ||
} | ||
|
||
std::unique_ptr<player::Decoder> player::Decoder::Get(std::string_view decoder_name) { | ||
if (decoder_name == "ogg") { | ||
return player::impl::Ogg::Get(); | ||
} else if (decoder_name == "wav") { | ||
return player::impl::Wav::Get(); | ||
} else { | ||
return nullptr; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "player/decoder.h" | ||
|
||
#include <vorbis/vorbisfile.h> | ||
|
||
namespace player::impl { | ||
|
||
class Ogg : public Decoder { | ||
public: | ||
bool Open(const char* file_name) override; | ||
std::size_t Read(BuffByte* buff, std::size_t samples_count) override; | ||
void Close() override; | ||
|
||
Ogg() = default; | ||
~Ogg() override { | ||
this->Close(); | ||
} | ||
|
||
private: | ||
OggVorbis_File ov_file{}; | ||
|
||
Ogg(const Ogg&) = delete; | ||
Ogg& operator=(const Ogg&) = delete; | ||
Ogg(Ogg&&) = delete; | ||
Ogg& operator=(Ogg&&) = delete; | ||
|
||
public: | ||
static std::unique_ptr<Decoder> Get(); | ||
static bool Init(); | ||
}; // Ogg | ||
} // namesapce player::impl |
Oops, something went wrong.