| | |
| | | #include <PL_BlockGrouping.h>
|
| | | #include <PL_ColorConv.h>
|
| | | #include <PL_AndroidMediaCodecEncoder.h>
|
| | | #include <PL_RTSPServer.h>
|
| | |
|
| | | CameraWrapper::~CameraWrapper()
|
| | | {
|
| | |
| | | PipeLine::register_global_elem_creator("PL_Paint", create_PL_Paint);
|
| | | PipeLine::register_global_elem_creator("PL_V4L2Source", create_PL_V4L2Source);
|
| | | PipeLine::register_global_elem_creator("PL_BlockGrouping", create_PL_BlockGrouping);
|
| | | //PipeLine::register_global_elem_creator("PL_AndroidMediaCodecEncoder", create_PL_AndroidMediaCodecEncoder);
|
| | | PipeLine::register_global_elem_creator("PL_AndroidMediaCodecEncoder", create_PL_AndroidMediaCodecEncoder);
|
| | | PipeLine::register_global_elem_creator("PL_RTSPServer", create_PL_RTSPServer);
|
| | |
|
| | | bool ret = initPl_DecoderPl();
|
| | | if (!ret)
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | //PL_AndroidMediaCodecEncoder_Config amceCfg;
|
| | | //amceCfg.ak_bit_rate = 5000000; // 512KB
|
| | | //amceCfg.ak_color_format = 21; // COLOR_FormatYUV420SemiPlanar;
|
| | | //amceCfg.ak_frame_rate = 25;
|
| | | //amceCfg.ak_height = 480;
|
| | | //amceCfg.ak_i_frame_interval = 20;
|
| | | //amceCfg.ak_mime = "video/avc";
|
| | | //amceCfg.ak_width = 640;
|
| | | //PL_AndroidMediaCodecEncoder* plAMCE = (PL_AndroidMediaCodecEncoder*)pipeLineRender->push_elem("PL_AndroidMediaCodecEncoder");
|
| | | //ret = plAMCE->init(&amceCfg);
|
| | | PL_AndroidMediaCodecEncoder_Config amceCfg;
|
| | | amceCfg.ak_bit_rate = 5000000; // 512KB
|
| | | amceCfg.ak_color_format = 21; // COLOR_FormatYUV420SemiPlanar;
|
| | | amceCfg.ak_frame_rate = 25;
|
| | | amceCfg.ak_height = 480;
|
| | | amceCfg.ak_i_frame_interval = 20;
|
| | | amceCfg.ak_mime = "video/avc";
|
| | | amceCfg.ak_width = 640;
|
| | | PL_AndroidMediaCodecEncoder* plAMCE = (PL_AndroidMediaCodecEncoder*)pipeLineRender->push_elem("PL_AndroidMediaCodecEncoder");
|
| | | ret = plAMCE->init(&amceCfg);
|
| | | if (!ret)
|
| | | {
|
| | | LOG_ERROR << "pipeLineRender.plAMCE init error" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | |
|
| | | PL_RTSPServer* plRtspServer = (PL_RTSPServer*)pipeLineRender->push_elem("PL_RTSPServer");
|
| | | RTSPServerConfig rtspServerConfig;
|
| | | //rtspServerConfig.syncDeliverFrame = false;
|
| | | ret = plRtspServer->init(&rtspServerConfig);
|
| | | if (!ret)
|
| | | {
|
| | | LOG_ERROR << "pipeLineRender.plRtspServer init error" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | |
|
| | | //PL_ColorConv_Config PLColorConvCfg;
|
| | | //PL_ColorConv* plColorConv = (PL_ColorConv*)pipeLineRender->push_elem("PL_ColorConv");
|
| | | //ret = plColorConv->init(&PLColorConvCfg);
|
| | | //if (!ret)
|
| | | //{
|
| | | // LOG_ERROR << "pipeLineRender.plPaint init error" << LOG_ENDL;
|
| | | // return false;
|
| | | //}
|
| | |
|
| | | //PL_Paint_Config plPaintCfg;
|
| | | //plPaintCfg.fontPath = fontPath;
|
| | | //plPaintCfg.plplCtx = &plplContext;
|
| | | //PL_Paint* plPaint = (PL_Paint*)pipeLineRender->push_elem("PL_Paint");
|
| | | //ret = plPaint->init(&plPaintCfg);
|
| | | //if (!ret)
|
| | | //{
|
| | | // LOG_ERROR << "pipeLineRender.plAMCE init error" << LOG_ENDL;
|
| | | // LOG_ERROR << "pipeLineRender.plPaint init error" << LOG_ENDL;
|
| | | // return false;
|
| | | //}
|
| | |
|
| | | PL_ColorConv_Config PLColorConvCfg;
|
| | | PL_ColorConv* plColorConv = (PL_ColorConv*)pipeLineRender->push_elem("PL_ColorConv");
|
| | | ret = plColorConv->init(&PLColorConvCfg);
|
| | | if (!ret)
|
| | | {
|
| | | LOG_ERROR << "pipeLineRender.plPaint init error" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | |
|
| | | PL_Paint_Config plPaintCfg;
|
| | | plPaintCfg.fontPath = fontPath;
|
| | | plPaintCfg.plplCtx = &plplContext;
|
| | | PL_Paint* plPaint = (PL_Paint*)pipeLineRender->push_elem("PL_Paint");
|
| | | ret = plPaint->init(&plPaintCfg);
|
| | | if (!ret)
|
| | | {
|
| | | LOG_ERROR << "pipeLineRender.plPaint init error" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | |
|
| | | PL_AndroidSurfaceViewRender* asvRender = (PL_AndroidSurfaceViewRender*)pipeLineRender->push_elem("PL_AndroidSurfaceViewRender");
|
| | | ret = asvRender->init(&asvrConfig);
|
| | | if (!ret)
|
| | | {
|
| | | LOG_ERROR << "pipeLineRender.asvRender init error" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | | //PL_AndroidSurfaceViewRender* asvRender = (PL_AndroidSurfaceViewRender*)pipeLineRender->push_elem("PL_AndroidSurfaceViewRender");
|
| | | //ret = asvRender->init(&asvrConfig);
|
| | | //if (!ret)
|
| | | //{
|
| | | // LOG_ERROR << "pipeLineRender.asvRender init error" << LOG_ENDL;
|
| | | // return false;
|
| | | //}
|
| | | }
|
| | |
|
| | | return true;
|
| | |
| | | //#debug
|
| | | //test_paint(cameraWrapper);
|
| | |
|
| | | cameraWrapper.pipeLineRender->pipe(&pm);//#todo
|
| | | //if (cameraWrapper.pipeLineRender->check_pipe_complete(last = cameraWrapper.pipeLineRender->pipe(&pm)))
|
| | | // last->gain(pm);
|
| | | cameraWrapper.pipeLineRender->pipe(&pm);
|
| | | }
|
| | |
|
| | | LOG_INFO << "CameraWrapper::decoder_thd stop, ret=" << LOG_ENDL;
|
| | |
| | | {
|
| | | sleep(10);
|
| | |
|
| | | continue;//#todo
|
| | | if (time(nullptr) - cameraWrapper.lastAliveTime > 20)
|
| | | {
|
| | | PL_RTSPClient* rtspClient = (PL_RTSPClient*)cameraWrapper.pipeLineDecoderDetector->at(0);
|