AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
VideoStream.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGXOSG_VIDEOSTREAM_H
18#define AGXOSG_VIDEOSTREAM_H
19
21#include <agxOSG/VideoCapture.h>
22#include <agxNet/WebSocket.h>
23
24#if AGX_USE_FFMPEG()
25
26namespace agxOSG
27{
28 class ExampleApplication;
29
30 AGX_DECLARE_POINTER_TYPES(VideoStream);
31 class VideoStream : public agx::Referenced
32 {
33 public:
34 VideoStream(ExampleApplication *app, agx::UInt16 port, agx::UInt width, agx::UInt height);
35
36 bool service();
37
38 agx::UInt16 getPort() const;
39
40 protected:
41 virtual ~VideoStream();
42
43 private:
44
45 void clientConnected(agxNet::WebSocket *socket);
46 void clientDisconnected(agxNet::WebSocket *socket);
47 void writeVideoData(agx::UInt8 *data, size_t size);
48 void receiveClientData(agxNet::WebSocket *socket, agx::UInt8* data, size_t size);
49
50 private:
51 agxNet::WebSocketServerRef m_server;
52 agxNet::WebSocketServer::SocketCallback m_socketConnectedCallback;
53 agxNet::WebSocketServer::SocketCallback m_socketDisconnectedCallback;
54 agxNet::WebSocket::ReceiveCallback m_socketReceiveCallback;
56 VideoCaptureRef m_capture;
57 ExampleApplication *m_app;
58 agx::Mutex m_mutex;
59 agx::UInt m_width;
60 agx::UInt m_height;
61 agx::Real m_eventMaxX;
62 agx::Real m_eventMaxY;
63 };
64
65}
66
67#endif
68#endif /* AGXOSG_VIDEOSTREAM_H */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
Base class providing referencing counted objects.
Definition Referenced.h:120
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::ref_ptr< RenderToTexture > RenderToTextureRef
agx::ref_ptr< VideoCapture > VideoCaptureRef
uint16_t UInt16
Definition Integer.h:31
std::mutex Mutex
Definition Referenced.h:99
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
uint8_t UInt8
Definition Integer.h:30