[gst-debugger/refactor-v1.0] refactor: restore buffer module
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gst-debugger/refactor-v1.0] refactor: restore buffer module
- Date: Sat, 3 Oct 2015 19:55:01 +0000 (UTC)
commit 1ed6b7abcf27e4583438073f00e645a2fd551402
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Oct 3 21:28:56 2015 +0200
refactor: restore buffer module
src/common/gstdebugger.proto | 12 ++
src/debugserver/Makefile.am | 4 +-
src/debugserver/gstdebugserver.c | 17 +++
src/debugserver/gstdebugserver.h | 2 +
src/debugserver/gstdebugserverbuffer.c | 150 ++++++++++++++---------
src/debugserver/gstdebugserverbuffer.h | 21 ++--
src/gst-debugger/Makefile.am | 2 +
src/gst-debugger/controller/command_factory.cpp | 12 ++
src/gst-debugger/controller/command_factory.h | 1 +
src/gst-debugger/controller/controller.cpp | 7 +
src/gst-debugger/controller/controller.h | 2 +
src/gst-debugger/modules/buffer_module.cpp | 91 ++++++++++++++
src/gst-debugger/modules/buffer_module.h | 44 +++++++
src/gst-debugger/modules/event_module.cpp | 2 +-
src/gst-debugger/modules/main_module.cpp | 8 +-
src/gst-debugger/modules/qe_control_module.h | 13 +--
src/gst-debugger/modules/query_module.cpp | 2 +-
17 files changed, 300 insertions(+), 90 deletions(-)
---
diff --git a/src/common/gstdebugger.proto b/src/common/gstdebugger.proto
index d4c2aa0..b8ecd8a 100644
--- a/src/common/gstdebugger.proto
+++ b/src/common/gstdebugger.proto
@@ -89,6 +89,17 @@ message QueryInfo {
required bytes structure_data = 3;
}
+message BufferInfo {
+ required uint64 pts = 1;
+ required uint64 dts = 2;
+ required uint64 duration = 3;
+ required uint64 offset = 4;
+ required uint64 offset_end = 5;
+ required uint64 size = 6;
+ required string pad = 7;
+ optional bytes data = 8;
+}
+
message TypeDescriptionRequest {
enum Type {
FACTORY = 0;
@@ -211,5 +222,6 @@ message GStreamerData {
QueryInfo query_info = 9;
PropertyValue property_value = 10;
ElementKlass element_klass = 11;
+ BufferInfo buffer_info = 12;
}
}
diff --git a/src/debugserver/Makefile.am b/src/debugserver/Makefile.am
index ba3f26e..96c0253 100644
--- a/src/debugserver/Makefile.am
+++ b/src/debugserver/Makefile.am
@@ -8,8 +8,8 @@ libgstdebugserver_la_SOURCES = \
gstdebugservertypes.c gstdebugservertypes.h \
gstdebugserverqe.c gstdebugserverqe.h \
gstdebugservertopology.c gstdebugservertopology.h \
- gstdebugserverwatcher.c gstdebugserverwatcher.h
-# gstdebugserverbuffer.c gstdebugserverbuffer.h \
+ gstdebugserverwatcher.c gstdebugserverwatcher.h \
+ gstdebugserverbuffer.c gstdebugserverbuffer.h
# gstdebugserverfactory.c gstdebugserverfactory.h
libgstdebugserver_la_LDFLAGS = $(GSTREAMER_LIBS) $(PROTOBUF_C_LIBS) $(GIO_LIBS)
diff --git a/src/debugserver/gstdebugserver.c b/src/debugserver/gstdebugserver.c
index 3c2440b..22451ac 100644
--- a/src/debugserver/gstdebugserver.c
+++ b/src/debugserver/gstdebugserver.c
@@ -163,6 +163,10 @@ do_pad_query_pre (GstTracer * self, guint64 ts, GstPad * pad, GstQuery * query)
static void
do_pad_push_pre (GstTracer * self, guint64 ts, GstPad * pad, GstBuffer * buffer)
{
+ GstDebugserverTracer *tracer = GST_DEBUGSERVER_TRACER (self);
+
+ gst_debugserver_buffer_send_buffer (tracer->buffer, tracer->tcp_server, pad, buffer);
+
}
static void
@@ -174,6 +178,7 @@ gst_debugserver_tracer_client_disconnected (TcpClient * client, gpointer user_da
gst_debugserver_message_remove_client (self->message, client);
gst_debugserver_qe_remove_client (self->event, client);
gst_debugserver_qe_remove_client (self->query, client);
+ gst_debugserver_buffer_remove_client (self->buffer, client);
}
static void
@@ -260,6 +265,8 @@ gst_debugserver_tracer_init (GstDebugserverTracer * self)
self->query = gst_debugserver_qe_new ();
+ self->buffer = gst_debugserver_buffer_new ();
+
gst_tracing_register_hook (tracer, "element-new",
G_CALLBACK (do_element_new));
gst_tracing_register_hook (tracer, "pad-push-event-pre",
@@ -294,6 +301,7 @@ gst_debugserver_tracer_finalize (GObject * obj)
gst_debugserver_message_free (self->message);
gst_debugserver_qe_free (self->event);
gst_debugserver_qe_free (self->query);
+ gst_debugserver_buffer_free (self->buffer);
}
static void
@@ -359,6 +367,15 @@ static void gst_debugserver_process_pad_watch (GstDebugserverTracer * self, GstD
gst_debugserver_tcp_send_packet (self->tcp_server, client, &data);
}
break;
+ case GST_DEBUGGER__PAD_WATCH_REQUEST__PAD_WATCH_TYPE_BUFFER:
+ if (gst_debugserver_buffer_set_watch (self->buffer, request->action == GST_DEBUGGER__ACTION__ADD,
request->buffer->send_data, pad,
+ request->pad, client)) {
+ GstDebugger__GStreamerData data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
+ data.confirmation = command;
+ data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_CONFIRMATION;
+ gst_debugserver_tcp_send_packet (self->tcp_server, client, &data);
+ }
+ break;
}
}
diff --git a/src/debugserver/gstdebugserver.h b/src/debugserver/gstdebugserver.h
index fc35572..c8940dd 100644
--- a/src/debugserver/gstdebugserver.h
+++ b/src/debugserver/gstdebugserver.h
@@ -27,6 +27,7 @@
#include "gstdebugserverlog.h"
#include "gstdebugservermessage.h"
#include "gstdebugserverqe.h"
+#include "gstdebugserverbuffer.h"
#include <gst/gst.h>
@@ -66,6 +67,7 @@ struct _GstDebugserverTracer {
GstDebugserverMessage *message;
GstDebugserverQE *event;
GstDebugserverQE *query;
+ GstDebugserverBuffer *buffer;
};
struct _GstDebugserverTracerClass {
diff --git a/src/debugserver/gstdebugserverbuffer.c b/src/debugserver/gstdebugserverbuffer.c
index ebc8d55..4c79b66 100644
--- a/src/debugserver/gstdebugserverbuffer.c
+++ b/src/debugserver/gstdebugserverbuffer.c
@@ -19,99 +19,135 @@
#include "gstdebugserverbuffer.h"
+#include "common/gst-utils.h"
+
+typedef struct {
+ gboolean send_data;
+ GstPad * pad;
+ gchar * pad_path;
+} BufferWatch;
+
+static BufferWatch * buffer_watch_new (gboolean send_data, GstPad * pad, gchar * pad_path)
+{
+ BufferWatch * watch = (BufferWatch *) g_malloc (sizeof (BufferWatch));
+
+ watch->send_data = send_data;
+ watch->pad = pad;
+ watch->pad_path = g_strdup (pad_path);
+
+ return watch;
+}
+
+static void buffer_watch_free (BufferWatch * watch)
+{
+ g_free (watch->pad_path);
+ g_free (watch);
+}
+
+static void buffer_watch_list_free (gpointer ptr)
+{
+ g_slist_free_full (ptr, (GDestroyNotify) buffer_watch_free);
+}
+
+static gint buffer_watch_compare (gconstpointer a, gconstpointer b)
+{
+ BufferWatch *a1 = (BufferWatch*) a;
+ BufferWatch *b1 = (BufferWatch*) b;
+
+ if (g_strcmp0 (a1->pad_path, b1->pad_path) == 0 || a1->pad == NULL) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+static gboolean gst_debugserver_buffer_ok (GstDebugger__GStreamerData* original, gpointer new_ptr)
+{
+ GSList *list = new_ptr;
+ BufferWatch watch;
+
+ watch.pad = NULL;
+ watch.pad_path = original->buffer_info->pad;
+
+ return g_slist_find_custom (list, &watch, buffer_watch_compare) != NULL;
+}
+
GstDebugserverBuffer * gst_debugserver_buffer_new (void)
{
GstDebugserverBuffer *buf = (GstDebugserverBuffer*)g_malloc (sizeof(GstDebugserverBuffer));
- buf->clients = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
- (GDestroyNotify) g_slist_free);
+
+ gst_debugserver_watcher_init (&buf->watcher, gst_debugserver_buffer_ok, (GDestroyNotify)
buffer_watch_list_free, buffer_watch_compare);
return buf;
}
void gst_debugserver_buffer_free (GstDebugserverBuffer * buf)
{
- g_hash_table_unref (buf->clients);
+ gst_debugserver_buffer_clean (buf);
+ gst_debugserver_watcher_deinit (&buf->watcher);
g_free (buf);
}
gboolean gst_debugserver_buffer_add_watch (GstDebugserverBuffer * buf,
- GstPad * pad, gpointer client_info)
+ gboolean send_data, GstPad * pad, gchar * pad_path, TcpClient * client)
{
- GSList *listeners =
- (GSList *) g_hash_table_lookup (buf->clients, pad);
-
- if (listeners == NULL) {
- listeners = g_slist_append (listeners, client_info);
- g_hash_table_insert (buf->clients, pad, listeners);
- return TRUE;
- }
-
- if (g_slist_find (listeners, client_info) == NULL) {
- listeners = g_slist_append (listeners, client_info);
- g_hash_table_replace (buf->clients, pad,
- listeners);
+ BufferWatch *w = buffer_watch_new (send_data, pad, pad_path);
+ if (gst_debugserver_watcher_add_watch (&buf->watcher, w, client) == TRUE) {
return TRUE;
} else {
+ buffer_watch_free (w);
return FALSE;
}
}
gboolean gst_debugserver_buffer_remove_watch (GstDebugserverBuffer * buf,
- GstPad * pad, gpointer client_info)
-{
- GSList *listeners =
- (GSList *) g_hash_table_lookup (buf->clients, pad),
- *found = NULL;
-
- if ((found = g_slist_find (listeners, client_info)) == NULL) {
- return FALSE;
- } else {
- listeners = g_slist_remove_link (listeners, found);
- g_hash_table_replace (buf->clients, pad, listeners);
- return TRUE;
- }
-}
-
-GSList* gst_debugserver_buffer_get_clients (GstDebugserverBuffer * buf,
- GstPad * pad)
+ gboolean send_data, GstPad * pad, gchar * pad_path, TcpClient * client)
{
- GSList *base = (GSList *) g_hash_table_lookup (buf->clients, pad);
- GSList *clients = g_slist_copy (base);
- base = (GSList *) g_hash_table_lookup (buf->clients, NULL);
-
- for (; base != NULL; base = g_slist_next (base)) {
- if (g_slist_find (clients, base->data) == NULL) {
- clients = g_slist_append(clients, base->data);
- }
- }
+ BufferWatch w = { send_data, pad, pad_path };
- return clients;
+ return gst_debugserver_watcher_remove_watch (&buf->watcher, &w, client);
}
-gboolean gst_debugserver_buffer_set_watch (GstDebugserverBuffer * buf,
- gboolean enable, GstPad * pad, gpointer client_info)
+gboolean gst_debugserver_buffer_set_watch (GstDebugserverBuffer * buf, gboolean enable,
+ gboolean send_data, GstPad * pad, gchar * pad_path, TcpClient * client)
{
if (enable) {
- return gst_debugserver_buffer_add_watch (buf, pad, client_info);
+ return gst_debugserver_buffer_add_watch (buf, send_data, pad, pad_path, client);
} else {
- return gst_debugserver_buffer_remove_watch (buf, pad, client_info);
+ return gst_debugserver_buffer_remove_watch (buf, send_data, pad, pad_path, client);
}
}
-void gst_debugserver_buffer_remove_client (GstDebugserverBuffer * buf, gpointer client_info)
+void gst_debugserver_buffer_send_buffer (GstDebugserverBuffer * buffer,
+ GstDebugserverTcp * tcp_server, GstPad * pad, GstBuffer * gst_buffer)
{
- GList *list = g_hash_table_get_keys (buf->clients);
- GList *free_list = list;
+ GstDebugger__GStreamerData gst_data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
+ GstDebugger__BufferInfo buffer_info = GST_DEBUGGER__BUFFER_INFO__INIT;
+ gchar *pad_path = gst_utils_get_object_path (GST_OBJECT_CAST (pad));
- while (list) {
- gst_debugserver_buffer_remove_watch (buf, GST_PAD_CAST (list->data), client_info);
- list = g_list_next (list);
- }
+ buffer_info.dts = GST_BUFFER_DTS (gst_buffer);
+ buffer_info.pts = GST_BUFFER_PTS (gst_buffer);
+ buffer_info.duration = GST_BUFFER_DURATION (gst_buffer);
+ buffer_info.offset = GST_BUFFER_OFFSET (gst_buffer);
+ buffer_info.offset = GST_BUFFER_OFFSET_END (gst_buffer);
+ buffer_info.pad = pad_path;
+ buffer_info.size = gst_buffer_get_size (gst_buffer);
+ buffer_info.has_data = FALSE; // todo
- g_list_free (free_list);
+ gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_BUFFER_INFO;
+ gst_data.buffer_info = &buffer_info;
+
+ gst_debugserver_watcher_send_data (&buffer->watcher, tcp_server, &gst_data);
+
+ g_free (pad_path);
+}
+
+void gst_debugserver_buffer_remove_client (GstDebugserverBuffer * buf, TcpClient * client)
+{
+ g_hash_table_remove (buf->watcher.clients, client);
}
void gst_debugserver_buffer_clean (GstDebugserverBuffer * buf)
{
- g_hash_table_remove_all (buf->clients);
+ gst_debugserver_watcher_clean (&buf->watcher);
}
diff --git a/src/debugserver/gstdebugserverbuffer.h b/src/debugserver/gstdebugserverbuffer.h
index bdf290c..72693b3 100644
--- a/src/debugserver/gstdebugserverbuffer.h
+++ b/src/debugserver/gstdebugserverbuffer.h
@@ -20,7 +20,7 @@
#ifndef __GST_DEBUGSERVER_BUFFER_H__
#define __GST_DEBUGSERVER_BUFFER_H__
-#include "common/gstdebugger.pb-c.h"
+#include "gstdebugserverwatcher.h"
#include <gst/gst.h>
@@ -29,28 +29,23 @@ G_BEGIN_DECLS
typedef struct _GstDebugserverBuffer GstDebugserverBuffer;
struct _GstDebugserverBuffer {
- GHashTable *clients;
+ GstDebugserverWatcher watcher;
};
GstDebugserverBuffer * gst_debugserver_buffer_new (void);
-void gst_debugserver_buffer_free (GstDebugserverBuffer * buf);
-
-gboolean gst_debugserver_buffer_add_watch (GstDebugserverBuffer * buf,
- GstPad * pad, gpointer client_info);
-gboolean gst_debugserver_buffer_remove_watch (GstDebugserverBuffer * buf,
- GstPad * pad, gpointer client_info);
+void gst_debugserver_buffer_free (GstDebugserverBuffer * buf);
-gboolean gst_debugserver_buffer_set_watch (GstDebugserverBuffer * buf,
- gboolean enable, GstPad * pad, gpointer client_info);
+gboolean gst_debugserver_buffer_set_watch (GstDebugserverBuffer * buf, gboolean enable,
+ gboolean send_data, GstPad * pad, gchar * pad_path, TcpClient * client);
-GSList* gst_debugserver_buffer_get_clients (GstDebugserverBuffer * buf,
- GstPad * pad);
+void gst_debugserver_buffer_send_buffer (GstDebugserverBuffer * buffer,
+ GstDebugserverTcp * tcp_server, GstPad * pad, GstBuffer * gst_buffer);
void gst_debugserver_buffer_clean (GstDebugserverBuffer * buf);
void gst_debugserver_buffer_remove_client (GstDebugserverBuffer * buf,
- gpointer client_info);
+ TcpClient * client);
G_END_DECLS
diff --git a/src/gst-debugger/Makefile.am b/src/gst-debugger/Makefile.am
index f33893a..92bc8df 100644
--- a/src/gst-debugger/Makefile.am
+++ b/src/gst-debugger/Makefile.am
@@ -67,6 +67,8 @@ gst_debugger_ GST_API_VERSION@_SOURCES = \
dialogs/factories_dialog.h \
modules/gst_properties_module.cpp \
modules/gst_properties_module.h \
+ modules/buffer_module.cpp \
+ modules/buffer_module.h \
models/gst_klass_model.h \
dialogs/klasses_dialog.h \
dialogs/klasses_dialog.cpp \
diff --git a/src/gst-debugger/controller/command_factory.cpp b/src/gst-debugger/controller/command_factory.cpp
index 4f20e69..e07d1ab 100644
--- a/src/gst-debugger/controller/command_factory.cpp
+++ b/src/gst-debugger/controller/command_factory.cpp
@@ -61,6 +61,18 @@ void CommandFactory::send_event_request_command(bool enable, const std::string &
client->send_command(cmd);
}
+void CommandFactory::send_buffer_request_command(bool enable, const std::string &pad_path, bool send_data)
+{
+ auto request = create_pad_watch_request(enable, pad_path);
+ GstDebugger::BufferWatchRequest *buf_request = new GstDebugger::BufferWatchRequest();
+ buf_request->set_send_data(send_data);
+ request->set_allocated_buffer(buf_request);
+ GstDebugger::Command cmd;
+ cmd.set_allocated_pad_watch(request);
+
+ client->send_command(cmd);
+}
+
void CommandFactory::send_message_request_command(int message_type, bool enable)
{
GstDebugger::MessageRequest *request = new GstDebugger::MessageRequest();
diff --git a/src/gst-debugger/controller/command_factory.h b/src/gst-debugger/controller/command_factory.h
index 00101f4..a004ed8 100644
--- a/src/gst-debugger/controller/command_factory.h
+++ b/src/gst-debugger/controller/command_factory.h
@@ -22,6 +22,7 @@ public:
void send_property_request_command(const std::string &element_path, const std::string &property_name);
void send_event_request_command(bool enable, const std::string &pad_path, int type);
void send_query_request_command(bool enable, const std::string &pad_path, int type);
+ void send_buffer_request_command(bool enable, const std::string &pad_path, bool send_data);
void send_message_request_command(int message_type, bool enable);
void send_set_threshold_command(const std::string &threshold_list, bool overwrite);
void send_set_log_watch_command(bool enable, const std::string &category, int log_level);
diff --git a/src/gst-debugger/controller/controller.cpp b/src/gst-debugger/controller/controller.cpp
index 3b2cd3a..b7a35a5 100644
--- a/src/gst-debugger/controller/controller.cpp
+++ b/src/gst-debugger/controller/controller.cpp
@@ -290,6 +290,13 @@ void Controller::add_property(const GstDebugger::PropertyValue &value)
}
}
+std::string Controller::get_selected_pad_path() const
+{
+ return (selected_object && std::dynamic_pointer_cast<PadModel>(selected_object)) ?
+ ElementPathProcessor::get_object_path(selected_object) :
+ std::string();
+}
+
void Controller::log(const std::string &message)
{
// todo date/time?
diff --git a/src/gst-debugger/controller/controller.h b/src/gst-debugger/controller/controller.h
index dc062a8..4954947 100644
--- a/src/gst-debugger/controller/controller.h
+++ b/src/gst-debugger/controller/controller.h
@@ -76,6 +76,8 @@ public:
std::shared_ptr<ObjectModel> get_selected_object() const { return selected_object; }
+ std::string get_selected_pad_path() const;
+
void log(const std::string &message);
sigc::signal<void> on_debug_categories_changed;
diff --git a/src/gst-debugger/modules/buffer_module.cpp b/src/gst-debugger/modules/buffer_module.cpp
new file mode 100644
index 0000000..3fef793
--- /dev/null
+++ b/src/gst-debugger/modules/buffer_module.cpp
@@ -0,0 +1,91 @@
+/*
+ * buffer_module.cpp
+ *
+ * Created on: Oct 3, 2015
+ * Author: loganek
+ */
+
+
+#include "buffer_module.h"
+
+#include "controller/controller.h"
+
+BufferModule::BufferModule()
+: BaseMainModule(GstDebugger::GStreamerData::kBufferInfo, "buffers")
+{
+}
+
+void BufferModule::load_details(gpointer data)
+{
+ auto buffer_info = (GstDebugger::BufferInfo*)data;
+
+ append_details_row("Pts", std::to_string(buffer_info->pts()));
+ append_details_row("Dts", std::to_string(buffer_info->dts()));
+ append_details_row("Duration", std::to_string(buffer_info->duration()));
+ append_details_row("Offset", std::to_string(buffer_info->offset()));
+ append_details_row("Offset End", std::to_string(buffer_info->offset_end()));
+ append_details_row("Data Size", std::to_string(buffer_info->size()));
+ append_details_row("Object path", buffer_info->pad());
+
+ if (buffer_info->has_data())
+ {
+ append_details_row("Data", "data"); // todo
+ }
+}
+
+void BufferModule::data_received(const Gtk::TreeModel::Row& row, GstDebugger::GStreamerData *data)
+{
+ row[columns.header] = "Buffer of size " + std::to_string(data->buffer_info().size());
+ row[columns.data] = new GstDebugger::BufferInfo(data->buffer_info());
+}
+
+BufferControlModule::BufferControlModule()
+: ControlModule()
+{
+ pad_path_label = Gtk::manage(new Gtk::Label());
+ main_box->pack_start(*pad_path_label, false, true);
+ main_box->reorder_child(*pad_path_label, 0);
+
+ data_check_button = Gtk::manage(new Gtk::CheckButton());
+ main_box->pack_start(*data_check_button, false, true);
+ main_box->reorder_child(*data_check_button, 1);
+
+ create_dispatcher("selected-object", [this] {
+ auto pad_path = controller->get_selected_pad_path();
+ if (pad_path.empty())
+ pad_path = "none (any path)";
+ pad_path_label->set_text(pad_path);
+ }, nullptr);
+
+ hooks_tree_view->append_column("Pad", hooks_model_columns.str1);
+}
+
+void BufferControlModule::add_watch()
+{
+ controller->send_buffer_request_command(true, controller->get_selected_pad_path(),
+ data_check_button->get_active());
+}
+
+void BufferControlModule::remove_watch(const Gtk::TreeModel::Row& row)
+{
+ Glib::ustring pad_path = row[hooks_model_columns.str1];
+ controller->send_buffer_request_command(false, pad_path,
+ data_check_button->get_active());
+}
+
+void BufferControlModule::confirmation_received(GstDebugger::Command* cmd)
+{
+ if (!cmd->has_pad_watch() || !cmd->pad_watch().has_buffer())
+ return;
+
+ auto confirmation = cmd->pad_watch();
+ if (confirmation.action() == GstDebugger::ADD)
+ {
+ Gtk::TreeModel::Row row = *(hooks_model->append());
+ row[hooks_model_columns.str1] = confirmation.pad();
+ }
+ else
+ {
+ remove_hook(confirmation);
+ }
+}
diff --git a/src/gst-debugger/modules/buffer_module.h b/src/gst-debugger/modules/buffer_module.h
new file mode 100644
index 0000000..9dbd01e
--- /dev/null
+++ b/src/gst-debugger/modules/buffer_module.h
@@ -0,0 +1,44 @@
+/*
+ * buffer_module.h
+ *
+ * Created on: Oct 3, 2015
+ * Author: loganek
+ */
+
+#ifndef SRC_GST_DEBUGGER_MODULES_BUFFER_MODULE_H_
+#define SRC_GST_DEBUGGER_MODULES_BUFFER_MODULE_H_
+
+#include "control_module.h"
+#include "base_main_module.h"
+
+class BufferModule : public BaseMainModule
+{
+ void data_received(const Gtk::TreeModel::Row& row, GstDebugger::GStreamerData *data) override;
+ void load_details(gpointer data) override;
+
+public:
+ BufferModule();
+ virtual ~BufferModule() {}
+};
+
+class BufferControlModule : public ControlModule
+{
+ Gtk::Label *pad_path_label;
+ Gtk::CheckButton *data_check_button;
+
+ void add_watch() override;
+ void remove_watch(const Gtk::TreeModel::Row& row) override;
+ void confirmation_received(GstDebugger::Command* cmd) override;
+
+ bool hook_is_the_same(const Gtk::TreeModel::Row& row, gconstpointer confirmation) override
+ {
+ auto buffer = reinterpret_cast<const GstDebugger::PadWatchRequest*>(confirmation);
+ return row[hooks_model_columns.str1] == buffer->pad();
+ }
+
+public:
+ BufferControlModule();
+ virtual ~BufferControlModule() {}
+};
+
+#endif /* SRC_GST_DEBUGGER_MODULES_BUFFER_MODULE_H_ */
diff --git a/src/gst-debugger/modules/event_module.cpp b/src/gst-debugger/modules/event_module.cpp
index c8ceaad..ceceba6 100644
--- a/src/gst-debugger/modules/event_module.cpp
+++ b/src/gst-debugger/modules/event_module.cpp
@@ -49,7 +49,7 @@ void EventControlModule::add_watch()
if (it)
{
Gtk::TreeModel::Row row = *it;
- controller->send_event_request_command(true, get_pad_path(),
row[types_model_columns.type_id]);
+ controller->send_event_request_command(true, controller->get_selected_pad_path(),
row[types_model_columns.type_id]);
}
}
diff --git a/src/gst-debugger/modules/main_module.cpp b/src/gst-debugger/modules/main_module.cpp
index d90eabd..b105a7b 100644
--- a/src/gst-debugger/modules/main_module.cpp
+++ b/src/gst-debugger/modules/main_module.cpp
@@ -12,7 +12,7 @@
#include "message_module.h"
#include "event_module.h"
#include "query_module.h"
-//#include "pad_path_types_control_module.h"
+#include "buffer_module.h"
#include "controller/controller.h"
#include "controller/element_path_processor.h"
@@ -47,9 +47,9 @@ void MainModule::load_submodules(const Glib::RefPtr<Gtk::Builder>& builder)
submodules["busMessages"].display_module = std::make_shared<MessageModule>();
submodules["busMessages"].control_module = std::make_shared<MessageControlModule>();
- /*submodules["buffers"].display_module = std::make_shared<BufferModule>();
- submodules["buffers"].control_module =
std::make_shared<PadPathControlModule>(PadWatch_WatchType_BUFFER);
-*/
+ submodules["buffers"].display_module = std::make_shared<BufferModule>();
+ submodules["buffers"].control_module = std::make_shared<BufferControlModule>();
+
submodules["events"].display_module = std::make_shared<EventModule>();
submodules["events"].control_module = std::make_shared<EventControlModule>();
diff --git a/src/gst-debugger/modules/qe_control_module.h b/src/gst-debugger/modules/qe_control_module.h
index 6f153cd..07b2d14 100644
--- a/src/gst-debugger/modules/qe_control_module.h
+++ b/src/gst-debugger/modules/qe_control_module.h
@@ -10,8 +10,6 @@
#include "control_module.h"
-#include "controller/element_path_processor.h"
-
class QEControlModule : virtual public ControlModule
{
const std::string enum_name;
@@ -23,15 +21,6 @@ protected:
Gtk::Label *pad_path_label;
Gtk::ComboBox *types_combobox;
- std::string get_pad_path() const
- {
- auto obj = controller->get_selected_object();
-
- return (obj && std::dynamic_pointer_cast<PadModel>(obj)) ?
- ElementPathProcessor::get_object_path(obj) :
- std::string();
- }
-
bool hook_is_the_same(const Gtk::TreeModel::Row& row, gconstpointer confirmation) override
{
auto pad = reinterpret_cast<const GstDebugger::PadWatchRequest*>(confirmation);
@@ -57,7 +46,7 @@ public:
hooks_tree_view->append_column("Pad", hooks_model_columns.str2);
create_dispatcher("selected-object", [this] {
- auto pad_path = get_pad_path();
+ auto pad_path = controller->get_selected_pad_path();
if (pad_path.empty())
pad_path = "none (any path)";
pad_path_label->set_text(pad_path);
diff --git a/src/gst-debugger/modules/query_module.cpp b/src/gst-debugger/modules/query_module.cpp
index 1c83ce2..de4bcd9 100644
--- a/src/gst-debugger/modules/query_module.cpp
+++ b/src/gst-debugger/modules/query_module.cpp
@@ -43,7 +43,7 @@ void QueryControlModule::add_watch()
if (it)
{
Gtk::TreeModel::Row row = *it;
- controller->send_query_request_command(true, get_pad_path(),
row[types_model_columns.type_id]);
+ controller->send_query_request_command(true, controller->get_selected_pad_path(),
row[types_model_columns.type_id]);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]