| | |
| | | #include "PL_H264Decoder.h"
|
| | | #include "MaterialBuffer.h"
|
| | |
|
| | | #include <H264VideoRTPSource.hh> // for SPropRecord
|
| | | #include <libbase64.h>
|
| | |
| | |
|
| | | AVCodecContext* pAVCodecContext;
|
| | | AVFrame* pAVFrame;//#todo delete
|
| | | MB_Frame lastFrame;
|
| | |
|
| | | H264Decoder_Internal() :
|
| | | //buffSize(0), buffSizeMax(sizeof(buffer)),
|
| | | fmtp_set_to_context(false),
|
| | | payError(true),
|
| | | pAVCodecContext(nullptr), pAVFrame(nullptr)
|
| | | pAVCodecContext(nullptr), pAVFrame(nullptr), |
| | | lastFrame()
|
| | | {
|
| | | }
|
| | |
|
| | |
| | | //buffSize = 0;
|
| | | fmtp_set_to_context = false;
|
| | | payError = true;
|
| | | |
| | | MB_Frame _lastFrame;
|
| | | lastFrame = _lastFrame;
|
| | | }
|
| | | };
|
| | |
|
| | |
| | | in->fmtp_set_to_context = true;
|
| | | }
|
| | |
|
| | | bool ret = decodeH264(in, pm.buffer, pm.buffSize);
|
| | | if (pm.buffer == nullptr || pm.buffSize <= 0)
|
| | | return false;
|
| | | |
| | | bool ret = false;
|
| | | if (pm.type == PipeMaterial::PMT_BYTES)
|
| | | ret = decodeH264(in, pm.buffer, pm.buffSize);
|
| | | else if (pm.type == PipeMaterial::PMT_FRAME)
|
| | | {
|
| | | MB_Frame* frame = (MB_Frame*)pm.buffer;
|
| | | |
| | | ret = decodeH264(in, frame->buffer, frame->buffSize);
|
| | | if (ret)
|
| | | {
|
| | | in->lastFrame.type = MB_Frame::MBFT_PTR_AVFRAME;
|
| | | in->lastFrame.buffer = (uint8_t*)(in->pAVFrame);
|
| | | in->lastFrame.buffSize = sizeof(in->pAVFrame);
|
| | | //in->lastFrame.pts = frame->pts;//#todo
|
| | | gettimeofday(&(in->lastFrame.pts),NULL);
|
| | | }
|
| | | }
|
| | | |
| | | in->payError = !ret;
|
| | | return ret;
|
| | | }
|
| | |
| | |
|
| | | if (!in->payError)
|
| | | {
|
| | | pm.buffer = (uint8_t*)in->pAVFrame;//in->buffer;
|
| | | pm.buffSize = sizeof(uint8_t*);//in->buffSize;
|
| | | pm.type = PipeMaterial::PMT_FRAME;
|
| | | pm.buffer = (uint8_t*)(&(in->lastFrame));
|
| | | pm.buffSize = sizeof(uint8_t*);
|
| | | }
|
| | | pm.former = this;
|
| | | return !in->payError;
|