📄 network_video_send.cpp
字号:
///////////////////////////////////////////////////////// FileName: network_video_send.cpp// Author: b1gm0use// Project: myvideo#include <iostream>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <unistd.h>#include <qapplication.h>#include <qsemaphore.h>#include "network_video_send.h"#include "network.h"#include "capture_event.h"#include "video.h"#include "avi.h"using namespace std;///////////////////////////////////////////////////////// Public Functions///////////////////////////////////////////////////////// 构造函数network_video_send::network_video_send ( avi * avi_ptr_in ) // {{{{ verbose_output( 2, "create network_video_send" ); cfd = 0; last_buff = NULL; avi_ptr = avi_ptr_in;} // }}}network_video_send::~network_video_send ( void ) // {{{{ delete [] last_buff;} // }}}// 初始化函数int network_video_send::init ( void ) // {{{{ verbose_output( 2, "init network_video_send" ); last_buff = new BUFF [ avi_ptr->video_opt.min_height * avi_ptr->video_opt.factor * avi_ptr->video_opt.min_width * avi_ptr->video_opt.factor * 3 ]; return SUCCEED;} // }}} // 向网络上发送图像int network_video_send::send_image ( const BUFF * buff, int size ) // {{{{ verbose_output( 2, "network_video_send send_image" ); memcpy( last_buff, buff, size ); capture_event new_event( VIDEO_NET_SEND_EVENT, last_buff, size ); if ( NULL != avi_ptr->network_ctrl_ptr ) { (*(avi_ptr->send_image_semaphore))++; QApplication::sendEvent( (QObject *) avi_ptr->network_ctrl_ptr, (QEvent *) &new_event ); (*(avi_ptr->send_image_semaphore))--; } verbose_output( 3, "send video frame ok" ); return SUCCEED;} // }}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -