TextSinkGStreamer.cpp [plain text]
#include "config.h"
#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
#include "TextSinkGStreamer.h"
GST_DEBUG_CATEGORY_STATIC(webkitTextSinkDebug);
#define GST_CAT_DEFAULT webkitTextSinkDebug
#define webkit_text_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE(WebKitTextSink, webkit_text_sink, GST_TYPE_APP_SINK,
GST_DEBUG_CATEGORY_INIT(webkitTextSinkDebug, "webkittextsink", 0,
"webkit text sink"));
enum {
Prop0,
PropSync,
PropLast
};
static void webkit_text_sink_init(WebKitTextSink* sink)
{
gst_base_sink_set_sync(GST_BASE_SINK(sink), false);
}
static void webkitTextSinkGetProperty(GObject*, guint ,
GValue*, GParamSpec*)
{
}
static void webkitTextSinkSetProperty(GObject*, guint ,
const GValue*, GParamSpec*)
{
}
static gboolean webkitTextSinkQuery(GstElement *element, GstQuery *query)
{
switch (GST_QUERY_TYPE(query)) {
case GST_QUERY_DURATION:
case GST_QUERY_POSITION:
return false;
default:
WebKitTextSink* sink = WEBKIT_TEXT_SINK(element);
GstElement* parent = GST_ELEMENT(&sink->parent);
return GST_ELEMENT_CLASS(parent_class)->query(parent, query);
}
}
static void webkit_text_sink_class_init(WebKitTextSinkClass* klass)
{
GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
GstElementClass* elementClass = GST_ELEMENT_CLASS(klass);
gst_element_class_set_metadata(elementClass, "WebKit text sink", "Generic",
"An appsink that ignores the sync property and position and duration queries",
"Brendan Long <b.long@cablelabs.com>");
gobjectClass->get_property = GST_DEBUG_FUNCPTR(webkitTextSinkGetProperty);
gobjectClass->set_property = GST_DEBUG_FUNCPTR(webkitTextSinkSetProperty);
elementClass->query = GST_DEBUG_FUNCPTR(webkitTextSinkQuery);
g_object_class_override_property(gobjectClass, PropSync, "sync");
}
GstElement* webkitTextSinkNew()
{
return GST_ELEMENT(g_object_new(WEBKIT_TYPE_TEXT_SINK, nullptr));
}
#endif // ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)