mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
basesrc: implement a default get_caps function
Don't rely on the return value of a vmethod to trigger the default implementation but make a real defaul implementation of the method that the subclass can chain up to.
This commit is contained in:
parent
86a45f236e
commit
54a9c5d3f8
1 changed files with 30 additions and 18 deletions
|
@ -278,6 +278,8 @@ gst_base_src_get_type (void)
|
|||
return base_src_type;
|
||||
}
|
||||
|
||||
static GstCaps *gst_base_src_default_get_caps (GstBaseSrc * bsrc,
|
||||
GstCaps * filter);
|
||||
static GstCaps *gst_base_src_getcaps (GstPad * pad, GstCaps * filter);
|
||||
static void gst_base_src_default_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
static void gst_base_src_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
|
@ -367,6 +369,7 @@ gst_base_src_class_init (GstBaseSrcClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_base_src_change_state);
|
||||
gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_base_src_send_event);
|
||||
|
||||
klass->get_caps = GST_DEBUG_FUNCPTR (gst_base_src_default_get_caps);
|
||||
klass->negotiate = GST_DEBUG_FUNCPTR (gst_base_src_default_negotiate);
|
||||
klass->fixate = GST_DEBUG_FUNCPTR (gst_base_src_default_fixate);
|
||||
klass->prepare_seek_segment =
|
||||
|
@ -807,22 +810,17 @@ gst_base_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
|||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_base_src_getcaps (GstPad * pad, GstCaps * filter)
|
||||
gst_base_src_default_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
GstBaseSrc *bsrc;
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
bsrc = GST_BASE_SRC (GST_PAD_PARENT (pad));
|
||||
bclass = GST_BASE_SRC_GET_CLASS (bsrc);
|
||||
if (bclass->get_caps)
|
||||
caps = bclass->get_caps (bsrc, filter);
|
||||
|
||||
if (caps == NULL) {
|
||||
GstPadTemplate *pad_template;
|
||||
GstBaseSrcClass *bclass;
|
||||
|
||||
bclass = GST_BASE_SRC_GET_CLASS (bsrc);
|
||||
|
||||
pad_template =
|
||||
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "src");
|
||||
|
||||
if (pad_template != NULL) {
|
||||
caps = gst_pad_template_get_caps (pad_template);
|
||||
|
||||
|
@ -835,7 +833,21 @@ gst_base_src_getcaps (GstPad * pad, GstCaps * filter)
|
|||
caps = intersection;
|
||||
}
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_base_src_getcaps (GstPad * pad, GstCaps * filter)
|
||||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
GstBaseSrc *bsrc;
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
bsrc = GST_BASE_SRC (GST_PAD_PARENT (pad));
|
||||
bclass = GST_BASE_SRC_GET_CLASS (bsrc);
|
||||
if (bclass->get_caps)
|
||||
caps = bclass->get_caps (bsrc, filter);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue