- The relationship between pad and caps
|-name_template(eg:wavparse_src, wavparse_sink) | |-direction(src or sink) GstStaticPadTemplate-| | |-presence(Sometimes, Always, request) | | | | |-GstCaps(String is stored in GstStruct) | |-GstStaticCaps----| | |-String(support caps) gst_static_pad_template_get() | | |-GstObject V | GstPadTemplate------|-direction | | | |-presence | | | |-GstCaps | gst_pad_new_from_static_template() | | V |-GstObject GstPad-------|-GstPadTemplate |...
- Add pad into element and set relation
gst_element_add_pad(element, pad) { _set_parent(element, pad) { pad->parent = element } if(pad->direction == src) element->srcpads = pad else if(pad->direction == sink) element->sinkpads = pad element->pads = pad } +---------+ +------------+ +---------+ | parent------>| element |<------parent | | Gstpad |<-----sinkpad srcpad------>| GstPad | +---------+ +------------+ +---------+
- Set pad active from srcpad to sinkpad
- element state change from READY to PAUSE, set pad active
gst_element_pads_activate(element, TRUE) { //set srcpad activate_pads(element->srcpads, TRUE); //set sinkpad activate_pads(element->sinkpads, TRUE); }
- check pad current mode and call pad->activefunc
gst_pad_set_active(pad) { mode = GST_PAD_ACTIVATE_MODE(pad); if(mode == GST_ACTIVATE_PUSH || mode == GST_ACTIVATE_PULL) { //pad already activation return TRUE; } else if (mode == GST_ACTIVATE_NONE) GST_PAD_ACTIVATEFUNC(pad) (pad); }
- call pad->activepushfunc or pad->activepullfunc, default is pushfunc
gst_pad_activate_push(pad) { GST_PAD_ACTIVATE_MODE(pad) = GST_ACTIVATE_PUSH; GST_PAD_ACTIVATEPUSHFUNC(pad) (pad); } gst_pad_activate_pull(pad) { GST_PAD_ACTIVATE_MODE(pad) = GST_ACTIVATE_PULL; GST_PAD_ACTIVATEPULLFUNC(pad) (pad); }
- element state change from READY to PAUSE, set pad active
搜尋此網誌
2011年1月30日 星期日
Gstreamer Pad
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言