-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/huskyroboticsteam/Orpheus
- Loading branch information
Showing
36 changed files
with
881 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,6 @@ packages | |
.vs/ | ||
*.csproj.user | ||
*.suo | ||
*.pdb | ||
*.pdb | ||
|
||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
device-scanner | ||
server | ||
server-wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CPP= g++ | ||
CFLAGS= -g -Wall -Wpedantic -std=c++14 | ||
GSFLAGS= `pkg-config --cflags --libs gstreamer-1.0` -lgstrtspserver-1.0 | ||
HEADERS= | ||
DEV= device-scanner | ||
SERVER= server-wrapper | ||
|
||
all: $(DEV) $(SERVER) | ||
rm *.o | ||
|
||
debug: $(DEV)_debug $(SERVER)_debug | ||
rm *.o | ||
|
||
server: $(HEADERS) server.cpp | ||
$(CPP) -O3 -c server.cpp $(GSFLAGS) $(CFLAGS) | ||
|
||
server-wrapper: $(HEADERS) $(SERVER).cpp server | ||
$(CPP) -O3 $(SERVER).cpp -o $(SERVER) server.o $(GSFLAGS) $(CFLAGS) | ||
|
||
device-scanner: $(HEADERS) $(DEV).cpp | ||
$(CPP) -O3 $(DEV).cpp -o $(DEV) $(GSFLAGS) $(CFLAGS) | ||
|
||
server-wrapper_debug: $(HEADERS) $(SERVER).cpp server | ||
$(CPP) -ggdb -D DEBUG $(SERVER).cpp -o $(SERVER) $(GSFLAGS) $(CFLAGS) | ||
|
||
device-scanner_debug: $(HEADERS) $(DEV).cpp | ||
$(CPP) -ggdb -D DEBUG $(DEV).cpp -o $(DEV) $(GSFLAGS) $(CFLAGS) | ||
|
||
clean: | ||
rm $(DEV) $(SERVER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Expects gstreamer and appropriate plugins to be installed based on pipeline. | ||
Expects gst-rtsp-server to be installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <signal.h> | ||
#include <gst/gst.h> | ||
#include <unistd.h> | ||
#include <cstring> | ||
|
||
#ifdef DEBUG | ||
void structure_fields(const GstStructure *device) | ||
{ | ||
gint n_fields = gst_structure_n_fields(device); | ||
for (int i = 0; i < n_fields; i++) | ||
{ | ||
const gchar *name; | ||
name = gst_structure_nth_field_name(device, i); | ||
g_print("%s:\n%s\n", name, gst_structure_get_string(device, name)); | ||
} | ||
} | ||
#endif | ||
|
||
GstDeviceMonitor *device_monitor(void) | ||
{ | ||
GstDeviceMonitor *monitor; | ||
GstBus *bus; | ||
GstCaps *caps; | ||
|
||
// starts the monitor for the devices | ||
monitor = gst_device_monitor_new (); | ||
|
||
// starts the bus for the monitor | ||
bus = gst_device_monitor_get_bus (monitor); | ||
gst_object_unref (bus); | ||
|
||
// adds a filter to scan for only video devices | ||
caps = gst_caps_new_empty_simple ("video/x-raw"); | ||
gst_device_monitor_add_filter (monitor, "Video/Source", caps); | ||
gst_caps_unref (caps); | ||
|
||
gst_device_monitor_start (monitor); | ||
|
||
return monitor; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
GstDeviceMonitor *monitor; | ||
GList *dev; | ||
GMainLoop *loop; | ||
gst_init(&argc, &argv); | ||
|
||
// create the monitor | ||
monitor = device_monitor(); | ||
dev = gst_device_monitor_get_devices(monitor); | ||
|
||
// loop for the lists | ||
GList *cur = g_list_first(dev); | ||
while(cur != NULL) | ||
{ | ||
GstDevice * devi = (GstDevice *) cur->data; | ||
GstStructure * type = gst_device_get_properties(devi); | ||
|
||
#ifdef DEBUG | ||
structure_fields(type); | ||
#endif | ||
const char * name = gst_device_get_display_name(devi); | ||
const char * path = gst_structure_get_string(type, "device.path"); | ||
g_print("Device-Scanner > Starting process for %s camera at %s\n", name, path); | ||
int mypid = fork(); | ||
if(mypid == 0) | ||
{ | ||
int ret; | ||
if (strcmp(name, "ZED") == 0) | ||
{ | ||
ret = execl("../zed_depth/zed_depth", argv[0]); | ||
} | ||
else | ||
{ | ||
ret = execl("./server-wrapper", argv[0], name, path, NULL); | ||
} | ||
return ret; // Shouldn't reach this line | ||
} | ||
cur = g_list_next(cur); | ||
} | ||
|
||
loop = g_main_loop_new(NULL, FALSE); | ||
g_main_loop_run(loop); | ||
g_main_loop_unref(loop); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "server.h" | ||
|
||
int | ||
main (int argc, char *argv[]) | ||
{ | ||
return start_server(argc, argv); | ||
} |
Oops, something went wrong.