#ifndef __SERVLET_CHANNEL_WEB_RTC_HEADER__ #define __SERVLET_CHANNEL_WEB_RTC_HEADER__ #include "../../components/base/basicThread.h" extern "C" { #include #include #include #include #include #include #include #include #include }; #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) #define av_frame_alloc avcodec_alloc_frame #define av_frame_free avcodec_free_frame #define avcodec_free_context av_free #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 #endif #define CLEAR(x) memset(&(x), 0, sizeof(x)) #include #include typedef std::queue pipeAVPacket; #define PKT_BUF_LEN 1 class servletChannelWebRTC:basicThread{ private: basicLogCollection * m_pLog; bool b_is_waiting_; bool b_new_pkt; bool b_fill_buf; bool b_streaming; pthread_mutex_t new_pkt_mutex; pthread_cond_t new_pkt_cond; pthread_mutex_t fill_buff_mutex; pthread_cond_t fill_buff_cond; pipeAVPacket m_qMediaBus; /* Encoder fields */ AVFormatContext * m_pFormatCtx; AVCodecContext * m_pCodecCtx; AVCodec * m_pCodec; uint32_t m_fFrameRate; uint32_t m_nWidth; uint32_t m_nHeight; int m_iVideoStreamID; bool initLibAV(void); protected: virtual void m_fThreadProc( void ); public: servletChannelWebRTC(); virtual ~servletChannelWebRTC(); bool create( CSTR MediaURI ); pipeAVPacket * getPipe( void ){ return &m_qMediaBus; }; }; typedef std::vector vectorChannelsWebRTC; #endif