From 9fcee608969be7be8dd085bb49c973c35cbde632 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 25 Jul 2023 14:49:04 -0700 Subject: [PATCH] making cmake work for target machine to compile' --- CMakeLists.txt | 3 +++ src/local_capture.cpp | 8 +++++--- src/main.cpp | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa735e7..397814f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,16 @@ set(CMAKE_CXX_STANDARD 17) find_package(PkgConfig) pkg_check_modules(GTKMM gtkmm-4.0) +pkg_check_modules(GST gstreamer-1.0) set (source_dir "${PROJECT_SOURCE_DIR}/src") file(GLOB source_files "${source_dir}/*.cpp") link_directories(${GTKMM_LIBRARY_DIRS}) include_directories(${GTKMM_INCLUDE_DIRS}) +include_directories(${GST_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${source_files}) target_link_libraries(${PROJECT_NAME} ${GTKMM_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} ${GST_LIBRARIES}) diff --git a/src/local_capture.cpp b/src/local_capture.cpp index 95d1311..df1d053 100644 --- a/src/local_capture.cpp +++ b/src/local_capture.cpp @@ -68,9 +68,11 @@ int LocalCapture::on_new_sample(GstElement *sink, gpointer data) { /* Retrieve the buffer */ g_signal_emit_by_name(sink, "pull-sample", &sample); if (sample) { - /* The only thing we do in this example is print a * to indicate a received - * buffer */ - g_print("*"); + GstBuffer *buffer = gst_sample_get_buffer(sample); + GstMapInfo map; + gst_buffer_map(buffer, &map, GST_MAP_READ); + std::cout << "received " << map.size << " bytes" << std::endl; + gst_sample_unref(sample); return GST_FLOW_OK; } diff --git a/src/main.cpp b/src/main.cpp index 55b1366..fbabf11 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,9 +13,10 @@ MyWindow::MyWindow() { set_title("flowy"); m_localCapture = new LocalCapture(); + Gtk::Picture picture; // todo: show frames here - //GtkWidget *area; + // GtkWidget *area; // g_object_get(m_localCapture->gtksink, "widget", &area, NULL); // Gtk::Widget *widget = Glib::wrap(area); // set_child(*widget);