| | |
| | | #include "PL_RTSPClient.h"
|
| | | #include "MaterialBuffer.h"
|
| | | #include "logger.h"
|
| | | #include <pthread.h>
|
| | |
|
| | | void rtsp_client_sdp_callback(void* arg, const char* val);
|
| | | void rtsp_client_fmtp_callback(void* arg, const char* val);
|
| | | void rtsp_client_frame_callback(void* arg, uint8_t* buffer, size_t buffSize, timeval presentationTime);
|
| | | void rtsp_client_continue_callback(void* arg);
|
| | | //struct RTSPConfig;
|
| | | //struct PL_RTSPClient_Config;
|
| | | #include "live555/testProgs/testRTSPClient.hpp"
|
| | |
|
| | | struct RTSPClient_Internal
|
| | | {
|
| | | RTSPConfig rtspConfig;
|
| | | PL_RTSPClient_Config rtspConfig;
|
| | | pthread_t live_daemon_thid;
|
| | | char eventLoopWatchVariable;
|
| | | bool live_daemon_running;
|
| | |
| | |
|
| | | void reset()
|
| | | {
|
| | | RTSPConfig _rtspConfig;
|
| | | PL_RTSPClient_Config _rtspConfig;
|
| | | rtspConfig = _rtspConfig;
|
| | | live_daemon_thid = 0;
|
| | | eventLoopWatchVariable = 0;
|
| | |
| | | if (args == nullptr)
|
| | | return false;
|
| | |
|
| | | const RTSPConfig* config = reinterpret_cast<const RTSPConfig*>(args);
|
| | | const PL_RTSPClient_Config* config = reinterpret_cast<const PL_RTSPClient_Config*>(args);
|
| | | RTSPClient_Internal* in = (RTSPClient_Internal*)internal;
|
| | | in->reset();
|
| | | in->rtspConfig = *config;
|
| | |
| | | }
|
| | |
|
| | | pm.type = PipeMaterial::PMT_FRAME;
|
| | | pm.buffer = (uint8_t*)(&(in->lastFrame));
|
| | | pm.buffSize = sizeof(in->lastFrame);
|
| | | pm.buffer = &(in->lastFrame);
|
| | | pm.buffSize = 0;
|
| | | pm.former = this;
|
| | |
|
| | | return true;
|
| | |
| | | if (client->manager == nullptr)
|
| | | return;
|
| | |
|
| | | client->manager->set_global_param(PLGP_RTSP_SDP, val);
|
| | | client->manager->set_param(PLGP_RTSP_SDP, val);
|
| | | }
|
| | |
|
| | | void rtsp_client_fmtp_callback(void* arg, const char* val)
|
| | |
| | | if (client->manager == nullptr)
|
| | | return;
|
| | |
|
| | | client->manager->set_global_param(PLGP_RTSP_FMTP, val);
|
| | | client->manager->set_param(PLGP_RTSP_FMTP, val);
|
| | | }
|
| | |
|
| | | void rtsp_client_frame_callback(void* arg, uint8_t* buffer, size_t buffSize, timeval presentationTime)
|
| | |
| | | in->lastFrame.type = MB_Frame::MBFT_H264_NALU;
|
| | | in->lastFrame.buffer = buffer;
|
| | | in->lastFrame.buffSize = buffSize;
|
| | | in->lastFrame.width = 0;
|
| | | in->lastFrame.height = 0;
|
| | | in->lastFrame.pts = presentationTime;
|
| | |
|
| | | int ret = pthread_mutex_unlock(in->frame_mutex);
|
| | | if(ret != 0)
|
| | | {
|
| | | printf("pthread_mutex_unlock frame_mutex: %s/n", strerror(ret));
|
| | | LOG_ERROR << "pthread_mutex_unlock frame_mutex: " << strerror(ret) << std::endl;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | int ret = pthread_mutex_lock(in->continue_mutex);
|
| | | if(ret != 0)
|
| | | {
|
| | | printf("pthread_mutex_unlock continue_mutex: %s/n", strerror(ret));
|
| | | LOG_ERROR << "pthread_mutex_unlock continue_mutex: " << strerror(ret) << std::endl;
|
| | | }
|
| | | }
|