增加windows端屏幕捕获编码demo
This commit is contained in:
30
demo/windows_sender/NetworkSender.h
Normal file
30
demo/windows_sender/NetworkSender.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
|
||||
struct PacketHeader {
|
||||
uint64_t timestamp;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t frameType; // 0=I, 1=P
|
||||
uint32_t dataSize;
|
||||
};
|
||||
|
||||
class NetworkSender {
|
||||
public:
|
||||
NetworkSender();
|
||||
~NetworkSender();
|
||||
|
||||
bool Initialize(const std::string& ip, int port);
|
||||
bool SendFrame(const std::vector<uint8_t>& data, uint64_t timestamp, int width, int height, bool isKeyFrame);
|
||||
|
||||
private:
|
||||
SOCKET socket_ = INVALID_SOCKET;
|
||||
sockaddr_in destAddr_;
|
||||
};
|
||||
Reference in New Issue
Block a user