小编aul*_*mus的帖子

ASCII可视化python中的节点图

我有一个名为Node的类

class Node:
   def __init__(self,name, childList, parentList):
      self.name = name
      # a list of all nodes which are children of this node
      # may have length 0 to many
      self.childList = childList 
      # a list of all nodes which are parents of this node
      # may have length 0 to many
      self.parentList = parentList
Run Code Online (Sandbox Code Playgroud)

我有一个节点列表(nodeList).这些节点可以在彼此的父列表或子列表中.我希望能够将他们的childLists和父代列表中指定的节点之间的关系可视化到stdout上(作为ASCII绘图).

例如,下面的名称是nodeList中节点的名称.

                           Classifier
                                |
                                |
                         FeatureCombiner
                          /           \
                         /             \
                        /               \
               FeatureGenerator1     FeatureGenerator2
                      \                     /
                       \                   /
                        \                 /
                         \               /
                          \             /
                           \           / …
Run Code Online (Sandbox Code Playgroud)

python ascii visualization graph

10
推荐指数
3
解决办法
3999
查看次数

GstMultifilesink消息后回调

我想知道如何使用post-messages = TRUE属性从gstreamer multifilesink元素获取回调?在下面的代码中,永不调用my_bus_callback函数。

Multifilesink文档说:如果“ post-messages”属性为TRUE,则在写入每个缓冲区后会发送名为“ GstMultiFileSink”的应用程序消息。

http://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gst-plugins-good-plugins-0.10/gst-plugins-good-plugins-multifilesink.html#GstMultiFileSink--帖子后消息

#include <gst/gst.h>
#include <stdio.h>
#include <unistd.h>

// Compilation:
// gcc gst_messages.c -g3 -o gst_messages `pkg-config --cflags --libs gstreamer-0.10`

static GMainLoop *loop;

static gboolean
my_bus_callback (GstBus     *bus,
         GstMessage *message,
         gpointer    data)
{
  printf("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));

  /* we want to be notified again the next time there is a message
   * on the bus, so returning TRUE (FALSE means we want to stop watching
   * for messages on the bus and our …
Run Code Online (Sandbox Code Playgroud)

c gtk signals glib gstreamer

3
推荐指数
1
解决办法
1031
查看次数

标签 统计

ascii ×1

c ×1

glib ×1

graph ×1

gstreamer ×1

gtk ×1

python ×1

signals ×1

visualization ×1