我是 Gstreamer 的新手。我对插件的 change_state 函数有疑问。正如我在本指南中所读到的:http: //gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-statemanage-states.html#section-statemanage-filters
static GstStateChangeReturn
gst_my_filter_change_state (GstElement *element, GstStateChange transition)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstMyFilter *filter = GST_MY_FILTER (element);
switch (transition) {
**//Downwards state change;**
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;
**//upward state change**
}
return ret;
}
我真的不知道我们如何使用parent_class并调用parent_class->change_state 因为在这个元素的 init 函数中:
gst_my_filter_class_init (GstMyFilterClass *klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
element_class->change_state = gst_my_filter_change_state;**strong text**
}
element_class->change_state被分配给gst_my_filter_change_state。为什么当 element_class->change_state 分配给另一个函数时,我们仍然可以 在gst_my_filter_change_state中调用element_class->change_state 。谢谢!