MythTV  master
flacencoder.h
Go to the documentation of this file.
1 #ifndef FLACENCODER_H_
2 #define FLACENCODER_H_
3 
4 #include <cstdint>
5 
6 #include <FLAC/stream_encoder.h>
7 
8 #include "encoder.h"
10 
11 static constexpr size_t MAX_SAMPLES { 588_UZ * 4 };
12 static constexpr int8_t NUM_CHANNELS { 2 };
13 
14 class MusicMetadata;
15 class QString;
16 
17 class FlacEncoder : public Encoder
18 {
19  public:
20  FlacEncoder(const QString &outfile, int qualitylevel, MusicMetadata *metadata);
21  ~FlacEncoder() override;
22  int addSamples(int16_t *bytes, unsigned int len) override; // Encoder
23 
24  private:
25  FLAC__StreamEncoder *m_encoder {nullptr};
26  unsigned int m_sampleIndex {0};
27 
28  std::array<std::array<FLAC__int32,MAX_SAMPLES>,NUM_CHANNELS> m_inputIn {};
29  std::array<FLAC__int32 *,NUM_CHANNELS>m_input {};
30 };
31 
32 #endif
FlacEncoder::m_input
std::array< FLAC__int32 *, NUM_CHANNELS > m_input
Definition: flacencoder.h:29
FlacEncoder::~FlacEncoder
~FlacEncoder() override
Definition: flacencoder.cpp:73
FlacEncoder::addSamples
int addSamples(int16_t *bytes, unsigned int len) override
Definition: flacencoder.cpp:87
MAX_SAMPLES
static constexpr size_t MAX_SAMPLES
Definition: flacencoder.h:11
Encoder
Definition: encoder.h:13
MusicMetadata
Definition: musicmetadata.h:80
FlacEncoder
Definition: flacencoder.h:17
FlacEncoder::m_inputIn
std::array< std::array< FLAC__int32, MAX_SAMPLES >, NUM_CHANNELS > m_inputIn
Definition: flacencoder.h:28
sizetliteral.h
NUM_CHANNELS
static constexpr int8_t NUM_CHANNELS
Definition: flacencoder.h:12
FlacEncoder::m_encoder
FLAC__StreamEncoder * m_encoder
Definition: flacencoder.h:25
musicbrainzngs.compat.bytes
bytes
Definition: compat.py:49
encoder.h
FlacEncoder::FlacEncoder
FlacEncoder(const QString &outfile, int qualitylevel, MusicMetadata *metadata)
Definition: flacencoder.cpp:20
FlacEncoder::m_sampleIndex
unsigned int m_sampleIndex
Definition: flacencoder.h:26