Skip to content

Commit

Permalink
Merge pull request IntelRealSense#2 from IntelRealSense/nhershko_ethe…
Browse files Browse the repository at this point in the history
…rnet_device

stream profile class
  • Loading branch information
nhershko authored Dec 8, 2019
2 parents 8334a16 + d665689 commit 6635531
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ethernet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(LIVE third-party/live555)
"*.h"
"*.cpp"
"rtsp_client/*.cpp"
"common/*.hh"
${LIVE}/groupsock/*.c*
${LIVE}/liveMedia/*.c*
${LIVE}/UsageEnvironment/*.c*
Expand Down
35 changes: 35 additions & 0 deletions src/ethernet/common/stream_profile.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

typedef enum stream_type_id
{
STREAM_DEPTH,
STREAM_COLOR,
};

typedef struct stream_resolution
{
int width;
int hight;
};

class stream_profile
{
public:
stream_profile(stream_type_id id, stream_resolution res, int fps)
:m_stream_type(id),
m_stream_res(res),
m_stream_fps(fps){}

//in case we want to have self-contained sdp parser
stream_profile(char* sdp_line);

int width(){ return m_stream_res.width; }
int hight(){ return m_stream_res.hight; }
int fps(){ return m_stream_fps; }
stream_type_id stream_type(){ return m_stream_type; }

private:
stream_type_id m_stream_type;
stream_resolution m_stream_res;
int m_stream_fps;

};
19 changes: 19 additions & 0 deletions src/ethernet/ethernet-device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ethernet-device.h"
#include "common/stream_profile.hh"

int frame_number = 0;
std::chrono::high_resolution_clock::time_point last;
Expand Down Expand Up @@ -42,6 +43,13 @@ rs2::ethernet_device::~ethernet_device()
std::vector<rs2::sensor> rs2::ethernet_device::ethernet_device::query_sensors() const
{
std::cout << "Mock ethernet device querry";

/*
TODO: use rtsp client
std::vector<stream_profile> rtsp_profiles = rtsp_client.query_streams();
std::vector<rs2_video_stream> ethernet_devie_streams = rtsp_stream_to_rs_video_stream(rtsp_profiles);
*/

std::vector<rs2::sensor> sensors;
//TODO: get device sensors via network
rs2::sensor mock_sensor;
Expand Down Expand Up @@ -90,6 +98,17 @@ void rs2::ethernet_device::add_frame_to_queue(int type, Frame* raw_frame)

void rs2::ethernet_device::inject_frames_to_sw_device()
{

/*
TODO: replace the pre-loop code with tream generation according to profile_list
something like:
for each stream in streams_list:
rs2_video_stream new_video_stream = { stream.stream_id, 0, 1, stream.W,stream.H, stream.fps, BPP, RS2_FORMAT_YUYV/Z16, stream.intrinsics };
new_sw_sensor = rs2_software_device_add_sensor(dev, stream.desciption + "(remote)", NULL);
rs2_software_sensor_add_video_stream(new_sensor, st2, NULL);
*/

rs2_intrinsics depth_intrinsics = get_intrinsics();
depth_sensor = rs2_software_device_add_sensor(dev, "Depth (Remote)", NULL);

Expand Down

0 comments on commit 6635531

Please sign in to comment.