-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathIDecoder.hpp
More file actions
73 lines (60 loc) · 2.07 KB
/
Copy pathIDecoder.hpp
File metadata and controls
73 lines (60 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _AV_TRANSCODER_ESSENCE_STREAM_IDECODER_HPP_
#define _AV_TRANSCODER_ESSENCE_STREAM_IDECODER_HPP_
#include <AvTranscoder/common.hpp>
#include <AvTranscoder/data/decoded/IFrame.hpp>
#include <AvTranscoder/profile/ProfileLoader.hpp>
namespace avtranscoder
{
class AvExport IDecoder
{
protected:
IDecoder()
: _decoded_frames_counter(0)
{
}
public:
virtual ~IDecoder(){};
/**
* @brief Setup the decoder
* @param profile: set decoder parameters from the given profile
* @note Open the decoder.
*/
virtual void setupDecoder(const ProfileLoader::Profile& profile = ProfileLoader::Profile()) {}
/**
* @brief Decode next frame
* @param frameBuffer: the frame decoded
* @warn the frameBuffer reference belongs to the decoder and is valid only until the
* next call to this function or until closing or flushing the
* decoder. The caller may not write to it.
* @return status of decoding
*/
virtual bool decodeNextFrame(IFrame& frameBuffer) = 0;
/**
* @brief Decode substream of next frame
* @param frameBuffer: the frame decoded
* @param channelIndexArray: list of channels to extract
* @return status of decoding
*/
virtual bool decodeNextFrame(IFrame& frameBuffer, const std::vector<size_t> channelIndexArray) = 0;
/**
* @brief Set the next frame of the input stream (which bypass the work of decoding)
* @note Not yet implemented for VideoDecoder and AudioDecoder
* @param inputFrame: the new next frame
*/
virtual void setNextFrame(IFrame& inputFrame) {}
/**
* @brief Reset the internal decoder state / flush internal buffers.
* @note Should be called when seeking or when switching to a different stream.
* @note Not sense for generators.
*/
virtual void flushDecoder() {}
size_t getNbDecodedFrames() { return _decoded_frames_counter; }
protected:
void incrementNbDecodedFrames(const size_t& nb_frames = 1) {
_decoded_frames_counter += nb_frames;
}
private:
size_t _decoded_frames_counter;
};
}
#endif