如何在GstBin中覆盖handle_message? [英] How to override handle_message in GstBin?

查看:90
本文介绍了如何在GstBin中覆盖handle_message?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试创建子类:

mybin.h:

#pragma once

#include <gst/gstbin.h>

G_BEGIN_DECLS

G_DECLARE_DERIVABLE_TYPE(MyBin, my_bin, MY, BIN, GstBin)

struct _MyBinClass
{
    GstBinClass parent_class;
};

GstElement* my_bin_new(const gchar *name);

G_END_DECLS

mybin.c:

#include "mybin.h"

G_DEFINE_TYPE(MyBin, my_bin, GST_TYPE_BIN)

static void my_bin_init(MyBin *bin)
{
}

static void my_bin_class_init(MyBinClass *class)
{
    // virtual function overrides go here
}

GstElement* my_bin_new(const gchar *name)
{
    // ???
}

my_bin_new()中要写什么才能使my_bin_class_init()被调用?

What to write in my_bin_new() to make the my_bin_class_init() be called?

我已经在glib文档中看到了g_object_new(),但是尚不清楚要传递给它什么. gstreamer源调用了gst_element_factory_make(),但我看不到该工厂与我的自定义类之间的关系.

I've seen g_object_new() in the glib docs, but it's not clear what to pass to it. The gstreamer sources call gst_element_factory_make(), but I can't see how that factory is related to my custom class.

推荐答案

好的,是

g_object_new(my_bin_get_type(), NULL);

其中my_bin_get_type()G_DEFINE_TYPE提供.

这篇关于如何在GstBin中覆盖handle_message?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆