You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#ifndef __SERVLET_CHANNEL_WEB_SOCKET_HEADER__
#define __SERVLET_CHANNEL_WEB_SOCKET_HEADER__
#include "../../components/base/basicThread.h"
extern "C" { #include <libavdevice/avdevice.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avio.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/file.h>
#include <libavutil/mathematics.h>
#include <libavutil/error.h>
#include <libavutil/imgutils.h>
};
#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 <vector>
#include <queue>
typedef std::queue<AVPacket *> pipeAVPacket;
#define PKT_BUF_LEN 1
class servletChannelWS: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: servletChannelWS(); virtual ~servletChannelWS(); bool create( CSTR MediaURI ); pipeAVPacket * getPipe( void ){ return &m_qMediaBus; };};
typedef std::vector<servletChannelWS *> vectorChannelsWS;
#endif
|