#include "PL_H264Encoder.h"
|
|
extern "C"
|
{
|
#include <libyuv.h>
|
}
|
|
struct PL_H264Encoder_Internal
|
{
|
uint8_t buffer[1920*1080*4];
|
size_t buffSize;
|
size_t buffSizeMax;
|
|
bool payError;
|
|
PL_H264Encoder_Internal() :
|
buffSize(0), buffSizeMax(sizeof(buffer)),
|
payError(true)
|
{
|
}
|
|
~PL_H264Encoder_Internal()
|
{
|
}
|
|
void reset()
|
{
|
buffSize = 0;
|
payError = true;
|
}
|
};
|
|
PipeLineElem* create_PL_H264Encoder()
|
{
|
return new PL_H264Encoder;
|
}
|
|
PL_H264Encoder::PL_H264Encoder() : internal(new PL_H264Encoder_Internal)
|
{
|
}
|
|
PL_H264Encoder::~PL_H264Encoder()
|
{
|
delete (PL_H264Encoder_Internal*)internal;
|
internal= nullptr;
|
}
|
|
bool PL_H264Encoder::init(void* args)
|
{
|
PL_H264Encoder_Internal* in = (PL_H264Encoder_Internal*)internal;
|
in->reset();
|
|
return true;
|
}
|
|
void PL_H264Encoder::finit()
|
{
|
PL_H264Encoder_Internal* in = (PL_H264Encoder_Internal*)internal;
|
|
}
|
|
bool PL_H264Encoder::pay(const PipeMaterial& pm)
|
{
|
PL_H264Encoder_Internal* in = (PL_H264Encoder_Internal*)internal;
|
|
//in->buffer readly
|
|
//static size_t f=0;
|
//char fname[50];
|
//sprintf(fname, "%u.bgra", ++f);
|
//FILE * pFile = fopen (fname,"wb");
|
//fwrite (in->buffer , sizeof(char), in->buffSize, pFile);
|
//fclose(pFile);
|
|
return true;
|
}
|
|
bool PL_H264Encoder::gain(PipeMaterial& pm)
|
{
|
PL_H264Encoder_Internal* in = (PL_H264Encoder_Internal*)internal;
|
|
pm.buffer = in->buffer;
|
pm.buffSize = in->buffSize;
|
pm.former = this;
|
return true;
|
}
|