File was renamed from RtspFace/PL_AndroidMediaCodecFileFrame.cpp |
| | |
| | | #include "PL_AndroidMediaCodecFileFrame.h"
|
| | | #include "PL_H264FileFramer.h"
|
| | | #include "MaterialBuffer.h"
|
| | | #include "logger.h"
|
| | | #include "MediaHelper.h"
|
| | |
|
| | | #include <media/NdkMediaCodec.h>
|
| | | #include <media/NdkMediaFormat.h>
|
| | |
|
| | | #include <android/bitmap.h>
|
| | |
|
| | | #include "my_timer.hpp"
|
| | | #include <stdlib.h>
|
| | | #include <fstream>
|
| | | using namespace std;
|
| | | #include <liveMedia/liveMedia.hh>
|
| | |
|
| | | #define H264_HEAD "01"
|
| | |
|
| | |
| | |
|
| | | size_t inputFrameCount;
|
| | |
|
| | | PL_AndroidMediaCodecFileFrame_Config config;
|
| | |
|
| | | AMediaCodec* codec;
|
| | | PL_H264FileFramer_Config config;
|
| | |
|
| | | bool payOK;
|
| | |
|
| | |
| | |
|
| | | inputFrameCount = 0;
|
| | |
|
| | | PL_AndroidMediaCodecFileFrame_Config _config;
|
| | | PL_H264FileFramer_Config _config;
|
| | | config = _config;
|
| | |
|
| | | codec = nullptr;//#todo destory
|
| | |
| | | }
|
| | | };
|
| | |
|
| | | PipeLineElem* create_PL_AndroidMediaCodecFileFrame()
|
| | | PipeLineElem* create_PL_H264FileFramer()
|
| | | {
|
| | | return new PL_AndroidMediaCodecFileFrame;
|
| | | return new PL_H264FileFramer;
|
| | | }
|
| | |
|
| | | PL_AndroidMediaCodecFileFrame::PL_AndroidMediaCodecFileFrame() : internal(new PL_AMCE_Internal)
|
| | | PL_H264FileFramer::PL_H264FileFramer() : internal(new PL_AMCE_Internal)
|
| | | ,m_b_loop_play(false),m_begin(-1),m_current_time(0)
|
| | | {
|
| | | }
|
| | |
|
| | | PL_AndroidMediaCodecFileFrame::~PL_AndroidMediaCodecFileFrame()
|
| | | PL_H264FileFramer::~PL_H264FileFramer()
|
| | | {
|
| | | delete (PL_AMCE_Internal*)internal;
|
| | | internal= nullptr;
|
| | | }
|
| | |
|
| | | bool PL_AndroidMediaCodecFileFrame::init(void* args)
|
| | | bool PL_H264FileFramer::init(void* args)
|
| | | {
|
| | | PL_AMCE_Internal* in = (PL_AMCE_Internal*)internal;
|
| | | in->reset();
|
| | |
|
| | | PL_AndroidMediaCodecFileFrame_Config* config = (PL_AndroidMediaCodecFileFrame_Config*)args;
|
| | | PL_H264FileFramer_Config* config = (PL_H264FileFramer_Config*)args;
|
| | |
|
| | | int ret = read_file(config->sz_path);
|
| | | if(1!=ret)
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | void PL_AndroidMediaCodecFileFrame::finit()
|
| | | void PL_H264FileFramer::finit()
|
| | | {
|
| | | PL_AMCE_Internal* in = (PL_AMCE_Internal*)internal;
|
| | | //todo release codec
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | bool PL_AndroidMediaCodecFileFrame::pay(const PipeMaterial& pm)
|
| | | bool PL_H264FileFramer::pay(const PipeMaterial& pm)
|
| | | {
|
| | | PL_AMCE_Internal* in = (PL_AMCE_Internal*)internal;
|
| | |
|
| | |
| | | return in->payOK;
|
| | | }
|
| | |
|
| | | bool PL_AndroidMediaCodecFileFrame::gain(PipeMaterial& pm)
|
| | | bool PL_H264FileFramer::gain(PipeMaterial& pm)
|
| | | {
|
| | | PL_AMCE_Internal* in = (PL_AMCE_Internal*)internal;
|
| | |
|
| | |
| | |
|
| | | return false;
|
| | | }
|
| | | int PL_AndroidMediaCodecFileFrame::write_file(const char* p_path,const char* p_content,int nlength)
|
| | | int PL_H264FileFramer::write_file(const char* p_path,const char* p_content,int nlength)
|
| | | {
|
| | | std::fstream outfile(p_path, std::ios_base::out | std::ios_base::binary);
|
| | | outfile.write(p_content, nlength);
|
| | | outfile.close();
|
| | | }
|
| | | int PL_AndroidMediaCodecFileFrame::read_file(const char* p_path)
|
| | | int PL_H264FileFramer::read_file(const char* p_path)
|
| | | {
|
| | | std::fstream infile(p_path, std::ios_base::in | std::ios_base::binary | ios::ate);
|
| | | size_t nSize = infile.tellg();
|
| | |
| | | return 1;
|
| | | }
|
| | |
|
| | | int PL_AndroidMediaCodecFileFrame::analyse_context()
|
| | | int PL_H264FileFramer::analyse_context()
|
| | | {
|
| | | int _count = 0;
|
| | | int _begin = -1;
|