Skip to content

Commit

Permalink
Organized some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy Jetson TX2 committed May 2, 2019
1 parent 761d957 commit 5801e51
Show file tree
Hide file tree
Showing 24 changed files with 15 additions and 45 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion Rover/GStreamer/server-wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
int
main (int argc, char *argv[])
{
return start_server(argc, argv, nullptr);
return start_server(argc, argv);
}
29 changes: 1 addition & 28 deletions Rover/GStreamer/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,6 @@ using namespace std;

unordered_map<string, tuple<const char*, int, int, vector<float>*, const char*>> table;

void
media_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media, gpointer user_data)
{
GstElement *element, *appsrc;
MyContext *ctx;

element = gst_rtsp_media_get_element(media);
appsrc = gst_bin_get_by_name_recurse_up (GST_BIN (element), "mysrc");

gst_util_set_object_arg (G_OBJECT (appsrc), "format", "time");

ctx = g_new0(MyContext, 1);
ctx->white = FALSE;
ctx->timestamp = 0;

g_object_set_data_full (G_OBJECT (media), "my-extra-data", ctx, (GDestroyNotify) g_free);

g_signal_connect (appsrc, "need-data", (GCallback) *(void (**) (GstElement *, guint, MyContext *)) user_data, ctx);

gst_object_unref(appsrc);
gst_object_unref(element);
}

char *
construct_pipeline(const char * devpath, const char * input_type, int width, int height, float scale)
{
Expand Down Expand Up @@ -69,7 +46,7 @@ setup_map()
}

int
start_server (int argc, char *argv[], void (*fnc) (GstElement *, guint, MyContext *))
start_server (int argc, char *argv[])
{
GMainLoop *loop;
GstRTSPServer *server;
Expand Down Expand Up @@ -147,10 +124,6 @@ start_server (int argc, char *argv[], void (*fnc) (GstElement *, guint, MyContex
GstRTSPMediaFactory * factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory, pipelines[i]);
gst_rtsp_media_factory_set_shared (factory, TRUE);
if (fnc != NULL)
{
g_signal_connect (factory, "media-configure", (GCallback) media_configure, &fnc);
}
snprintf(attachment, 10, "/feed%hu", i);
gst_rtsp_mount_points_add_factory (mounts, attachment, factory);
g_print ("%s@%s: stream ready at rtsp://127.0.0.1:%s/feed%d\n", devname, devpath, port, i);
Expand Down
8 changes: 1 addition & 7 deletions Rover/GStreamer/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ struct g_server_data
const char *argv[8];
};

typedef struct
{
gboolean white;
GstClockTime timestamp;
} MyContext;

int start_server (int argc, char *argv[], void (*fnc)(GstElement *, guint, MyContext *));
int start_server (int argc, char *argv[]);

#endif // SERVER_H_
1 change: 0 additions & 1 deletion Rover/JetsonGStreamerServer/build

This file was deleted.

3 changes: 3 additions & 0 deletions Rover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Running GStreamer
Run the device-scanner binary in the GStreamer folder.
This binary will also start the zed-depth program.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions Rover/zed_depth/Makefile → Rover/ZedDepth/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CVFLAGS= `pkg-config --cflags --libs opencv4`
INCLUDES= -I/usr/local/zed/include -I/usr/local/cuda/include -I../GStreamer
LIBS= /usr/local/zed/lib/*.so -march=armv8-a+simd
HEADERS=
DEPTH= zed_depth
DEPTH= zed-depth

all: $(DEPTH)
rm *.o
Expand All @@ -16,10 +16,10 @@ debug: $(DEPTH)_debug
server: $(HEADERS) ../GStreamer/server.cpp
$(CPP) -O3 -c ../GStreamer/server.cpp $(GSFLAGS) $(CFLAGS)

zed_depth: $(HEADERS) $(DEPTH).cpp server
zed-depth: $(HEADERS) $(DEPTH).cpp server
$(CPP) -O3 $(DEPTH).cpp -o $(DEPTH) server.o $(GSFLAGS) $(CVFLAGS) $(CFLAGS) $(INCLUDES) $(LIBS)

zed_depth_debug: $(HEADERS) $(DEPTH).cpp server
zed-depth_debug: $(HEADERS) $(DEPTH).cpp server
$(CPP) -ggdb -D DEBUG $(DEPTH).cpp -o $(DEPTH) server.o $(GSFLAGS) $(CVFLAGS) $(CFLAGS) $(INCLUDES) $(LIBS)

clean:
Expand Down
1 change: 1 addition & 0 deletions Rover/ZedDepth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# DO NOT run zed-depth binary directly except for testing. Run device-scanner binary in /Rover/GStreamer/ to operate other cameras over the network
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions Rover/ZedDepth/run
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./zed-depth
File renamed without changes.
Binary file added Rover/ZedDepth/zed-depth
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ int main(int argc, char *argv[])
data.argv[0] = argv[0];
data.argv[1] = "intervideosrc";
data.argv[2] = "zed_depth";
data.argv[3] = "8888";
data.argv[3] = "5556";
data.argv[4] = "intervideosrc channel=rgb ! rtpvrawpay name=pay0 pt=96";

writer.open("appsrc ! video/x-raw,format=BGR ! videoconvert ! video/x-raw,format=I420 ! intervideosink channel=rgb", 0, 10, cv::Size(img_zed.getWidth(), img_zed.getHeight()), true);

std::thread t1(start_server, data.argc, (char **) data.argv, nullptr);
std::thread t1(start_server, data.argc, (char **) data.argv);
std::thread t2(getSomeImages);

#ifdef DEBUG
Expand All @@ -108,12 +108,12 @@ int main(int argc, char *argv[])
data2.argv[0] = argv[0];
data2.argv[1] = "intervideosrc";
data2.argv[2] = "zed_depth_debug";
data2.argv[3] = "8889";
data2.argv[3] = "8888";
data2.argv[4] = "intervideosrc channel=wshed ! rtpvrawpay name=pay0 pt=96";

writer_debug.open("appsrc ! video/x-raw,format=BGR ! videoconvert ! video/x-raw,format=I420 ! intervideosink channel=wshed", 0, 10, cv::Size(img_zed.getWidth(), img_zed.getHeight()), true);

std::thread t3(start_server, data2.argc, (char **) data2.argv, nullptr);
std::thread t3(start_server, data2.argc, (char **) data2.argv);
#endif

for(char key = ' '; key != 'q'; key = cv::waitKey(10))
Expand Down
1 change: 0 additions & 1 deletion Rover/zed_depth/run

This file was deleted.

0 comments on commit 5801e51

Please sign in to comment.