MythTV master
spdifencoder.h
Go to the documentation of this file.
1#ifndef SPDIFENCODER_H_
2#define SPDIFENCODER_H_
3
4#include <cstddef>
5#include <cstdint>
6
7#include <QString>
8
9extern "C" {
10#include "libavcodec/avcodec.h"
11#include "libavformat/avformat.h"
12}
13
15{
16 public:
17 SPDIFEncoder(const QString& muxer, AVCodecID codec_id);
19 void WriteFrame(unsigned char *data, int size);
20 int GetData(unsigned char *buffer, size_t &dest_size);
21 int GetProcessedSize();
22 unsigned char *GetProcessedBuffer();
23 void Reset();
24 bool Succeeded() const { return m_complete; };
25 bool SetMaxHDRate(int rate);
26
27 private:
28 static int funcIO(void *opaque, const uint8_t *buf, int size);
29 void Destroy();
30
31 private:
32 bool m_complete {false};
33 AVFormatContext *m_oc {nullptr};
34 long m_size {0};
35};
36
37#endif
SPDIFEncoder(const QString &muxer, AVCodecID codec_id)
SPDIFEncoder constructor Args: QString muxer : name of the muxer.
static int funcIO(void *opaque, const uint8_t *buf, int size)
funcIO: Internal callback function that will receive encoded frames
void Destroy()
Destroy and free all allocated memory.
unsigned char * GetProcessedBuffer()
void Reset()
Reset the internal encoder buffer.
int GetProcessedSize()
void WriteFrame(unsigned char *data, int size)
Encode data through created muxer unsigned char data: pointer to data to encode int size: size of dat...
bool Succeeded() const
Definition: spdifencoder.h:24
bool SetMaxHDRate(int rate)
Set the maximum HD rate.
AVFormatContext * m_oc
Definition: spdifencoder.h:33
int GetData(unsigned char *buffer, size_t &dest_size)
Retrieve encoded data and copy it in the provided buffer.