载入中...
搜索中...
未找到
Decoder.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Object.h"
4
5#include <memory>
6#include <vector>
7#include <string>
8
9namespace medialoader {
10class Decoder;
11}
12
13namespace eve {
14namespace sound {
15
20class Decoder : public Object {
21public:
23 Decoder(std::unique_ptr<medialoader::Decoder> impl, std::vector<char> ownedData);
24 ~Decoder() override;
25
27 Decoder *clone() const;
28
30 int decode();
32 int getSize() const;
34 void *getBuffer() const;
36 bool seek(double seconds);
38 bool rewind();
40 bool isSeekable();
42 bool isFinished();
44 int getChannelCount() const;
45 int getBitDepth() const;
46 int getSampleRate() const;
48 double getDuration();
49
51 medialoader::Decoder *getImpl() { return impl.get(); }
52
53private:
54 std::unique_ptr<medialoader::Decoder> impl;
55 std::vector<char> ownedData;
56};
57
58} // namespace sound
59} // namespace eve
void * impl
Object is the base class for all game objects. It provides reference counting and dirty flag for upda...
Definition Object.h:18
Streaming audio decoder (medialoader-backed). Owns the raw encoded bytes and decodes incrementally vi...
Definition Decoder.h:20
medialoader::Decoder * getImpl()
Underlying medialoader decoder (advanced).
Definition Decoder.h:51
void * getBuffer() const
Internal decoded buffer.
Definition Decoder.cpp:27
double getDuration()
Total duration in seconds.
Definition Decoder.cpp:35
bool isFinished()
True when the stream is fully decoded.
Definition Decoder.cpp:31
int getSampleRate() const
Definition Decoder.cpp:34
bool isSeekable()
True when seeking is supported.
Definition Decoder.cpp:30
int getChannelCount() const
Format metadata.
Definition Decoder.cpp:32
Decoder * clone() const
Duplicates the decoder (each clone keeps its own position).
Definition Decoder.cpp:17
bool rewind()
Rewinds to the start; false when unsupported.
Definition Decoder.cpp:29
bool seek(double seconds)
Seeks to a time in seconds; false when unsupported.
Definition Decoder.cpp:28
int getSize() const
Bytes decoded so far into the internal buffer.
Definition Decoder.cpp:26
int getBitDepth() const
Definition Decoder.cpp:33
int decode()
Decodes the next chunk; returns bytes produced (0 = end/error).
Definition Decoder.cpp:25
Definition Build.cpp:11