本文整理汇总了C++中GST_PAD函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_PAD函数的具体用法?C++ GST_PAD怎么用?C++ GST_PAD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_PAD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_a2dp_sink_init_ghost_pad
static gboolean gst_a2dp_sink_init_ghost_pad(GstA2dpSink *self)
{
GstPad *capsfilter_pad;
/* we search for the capsfilter sinkpad */
capsfilter_pad = gst_element_get_static_pad(self->capsfilter, "sink");
/* now we add a ghostpad */
self->ghostpad = GST_GHOST_PAD(gst_ghost_pad_new("sink",
capsfilter_pad));
g_object_unref(capsfilter_pad);
/* the getcaps of our ghostpad must reflect the device caps */
gst_pad_set_getcaps_function(GST_PAD(self->ghostpad),
gst_a2dp_sink_get_caps);
self->ghostpad_setcapsfunc = GST_PAD_SETCAPSFUNC(self->ghostpad);
gst_pad_set_setcaps_function(GST_PAD(self->ghostpad),
GST_DEBUG_FUNCPTR(gst_a2dp_sink_set_caps));
/* we need to handle events on our own and we also need the eventfunc
* of the ghostpad for forwarding calls */
self->ghostpad_eventfunc = GST_PAD_EVENTFUNC(GST_PAD(self->ghostpad));
gst_pad_set_event_function(GST_PAD(self->ghostpad),
gst_a2dp_sink_handle_event);
if (!gst_element_add_pad(GST_ELEMENT(self), GST_PAD(self->ghostpad)))
GST_ERROR_OBJECT(self, "failed to add ghostpad");
return TRUE;
}
示例2: gst_freeze_sink_event
static gboolean
gst_freeze_sink_event (GstPad * pad, GstEvent * event)
{
gboolean ret = TRUE;
GstFreeze *freeze = GST_FREEZE (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
GST_DEBUG_OBJECT (freeze, "EOS on sink pad %s",
gst_pad_get_name (GST_PAD (freeze->sinkpad)));
gst_event_unref (event);
break;
case GST_EVENT_NEWSEGMENT:
/* FALL TROUGH */
case GST_EVENT_FLUSH_STOP:
gst_freeze_clear_buffer (freeze);
/* FALL TROUGH */
default:
ret = gst_pad_event_default (GST_PAD (freeze->sinkpad), event);
break;
}
gst_object_unref (freeze);
return ret;
}
示例3: mpegts_parse_sync_program_pads
static void
mpegts_parse_sync_program_pads (MpegTSParse2 * parse)
{
GList *walk;
GST_INFO_OBJECT (parse, "begin sync pads");
for (walk = parse->pads_to_remove; walk; walk = walk->next)
gst_element_remove_pad (GST_ELEMENT (parse), GST_PAD (walk->data));
for (walk = parse->pads_to_add; walk; walk = walk->next)
gst_element_add_pad (GST_ELEMENT (parse), GST_PAD (walk->data));
if (parse->pads_to_add)
g_list_free (parse->pads_to_add);
if (parse->pads_to_remove)
g_list_free (parse->pads_to_remove);
GST_OBJECT_LOCK (parse);
parse->pads_to_remove = NULL;
parse->pads_to_add = NULL;
parse->need_sync_program_pads = FALSE;
GST_OBJECT_UNLOCK (parse);
GST_INFO_OBJECT (parse, "end sync pads");
}
示例4: kms_audio_mixer_remove_sometimes_src_pad
static void
kms_audio_mixer_remove_sometimes_src_pad (KmsAudioMixer * self,
GstElement * adder)
{
GstProxyPad *internal;
GstPad *srcpad, *peer;
srcpad = gst_element_get_static_pad (adder, "src");
peer = gst_pad_get_peer (srcpad);
if (peer == NULL)
goto end_phase_1;
internal = gst_proxy_pad_get_internal ((GstProxyPad *) peer);
if (internal == NULL)
goto end_phase_2;
gst_ghost_pad_set_target (GST_GHOST_PAD (internal), NULL);
if (GST_STATE (self) < GST_STATE_PAUSED
|| GST_STATE_PENDING (self) < GST_STATE_PAUSED
|| GST_STATE_TARGET (self) < GST_STATE_PAUSED) {
gst_pad_set_active (GST_PAD (internal), FALSE);
}
GST_DEBUG ("Removing source pad %" GST_PTR_FORMAT, internal);
gst_element_remove_pad (GST_ELEMENT (self), GST_PAD (internal));
gst_object_unref (internal);
end_phase_2:
gst_object_unref (peer);
end_phase_1:
gst_object_unref (srcpad);
}
示例5: _request_new_pad
/****************************************************
* GstElement vmetods *
****************************************************/
static GstPad *
_request_new_pad (GstElement * element, GstPadTemplate * templ,
const gchar * name, const GstCaps * caps)
{
GstPad *audioresample_srcpad, *audioconvert_sinkpad, *tmpghost;
GstPad *ghost;
GstElement *audioconvert, *audioresample;
PadInfos *infos = g_slice_new0 (PadInfos);
GESSmartAdder *self = GES_SMART_ADDER (element);
infos->adder_pad = gst_element_request_pad (self->adder, templ, NULL, caps);
if (infos->adder_pad == NULL) {
GST_WARNING_OBJECT (element, "Could not get any pad from GstAdder");
return NULL;
}
infos->self = self;
infos->bin = gst_bin_new (NULL);
audioconvert = gst_element_factory_make ("audioconvert", NULL);
audioresample = gst_element_factory_make ("audioresample", NULL);
gst_bin_add_many (GST_BIN (infos->bin), audioconvert, audioresample, NULL);
gst_element_link_many (audioconvert, audioresample, NULL);
audioconvert_sinkpad = gst_element_get_static_pad (audioconvert, "sink");
tmpghost = GST_PAD (gst_ghost_pad_new (NULL, audioconvert_sinkpad));
gst_object_unref (audioconvert_sinkpad);
gst_pad_set_active (tmpghost, TRUE);
gst_element_add_pad (GST_ELEMENT (infos->bin), tmpghost);
gst_bin_add (GST_BIN (self), infos->bin);
ghost = gst_ghost_pad_new (NULL, tmpghost);
gst_pad_set_active (ghost, TRUE);
if (!gst_element_add_pad (GST_ELEMENT (self), ghost))
goto could_not_add;
audioresample_srcpad = gst_element_get_static_pad (audioresample, "src");
tmpghost = GST_PAD (gst_ghost_pad_new (NULL, audioresample_srcpad));
gst_object_unref (audioresample_srcpad);
gst_pad_set_active (tmpghost, TRUE);
gst_element_add_pad (GST_ELEMENT (infos->bin), tmpghost);
gst_pad_link (tmpghost, infos->adder_pad);
LOCK (self);
g_hash_table_insert (self->pads_infos, ghost, infos);
UNLOCK (self);
GST_DEBUG_OBJECT (self, "Returning new pad %" GST_PTR_FORMAT, ghost);
return ghost;
could_not_add:
{
GST_ERROR_OBJECT (self, "could not add pad");
destroy_pad (infos);
return NULL;
}
}
示例6: _create_input_chain
static gboolean
_create_input_chain (GstGLMixerBin * self, struct input_chain *chain,
GstPad * mixer_pad)
{
GstGLMixerBinClass *klass = GST_GL_MIXER_BIN_GET_CLASS (self);
GstPad *pad;
gboolean res = TRUE;
gchar *name;
chain->self = self;
chain->mixer_pad = mixer_pad;
chain->upload = gst_element_factory_make ("glupload", NULL);
chain->in_convert = gst_element_factory_make ("glcolorconvert", NULL);
res &= gst_bin_add (GST_BIN (self), chain->in_convert);
res &= gst_bin_add (GST_BIN (self), chain->upload);
pad = gst_element_get_static_pad (chain->in_convert, "src");
if (gst_pad_link (pad, mixer_pad) != GST_PAD_LINK_OK) {
gst_object_unref (pad);
return FALSE;
}
gst_object_unref (pad);
res &=
gst_element_link_pads (chain->upload, "src", chain->in_convert, "sink");
pad = gst_element_get_static_pad (chain->upload, "sink");
if (!pad) {
return FALSE;
} else {
GST_DEBUG_OBJECT (self, "setting target sink pad %" GST_PTR_FORMAT, pad);
name = gst_object_get_name (GST_OBJECT (mixer_pad));
if (klass->create_input_pad) {
chain->ghost_pad = klass->create_input_pad (self, chain->mixer_pad);
gst_object_set_name (GST_OBJECT (chain->ghost_pad), name);
gst_ghost_pad_set_target (chain->ghost_pad, pad);
} else {
chain->ghost_pad =
GST_GHOST_PAD (gst_ghost_pad_new (GST_PAD_NAME (chain->mixer_pad),
pad));
}
g_free (name);
GST_OBJECT_LOCK (self);
if (self->priv->running)
gst_pad_set_active (GST_PAD (chain->ghost_pad), TRUE);
GST_OBJECT_UNLOCK (self);
gst_element_add_pad (GST_ELEMENT_CAST (self), GST_PAD (chain->ghost_pad));
gst_object_unref (pad);
}
gst_element_sync_state_with_parent (chain->upload);
gst_element_sync_state_with_parent (chain->in_convert);
return TRUE;
}
示例7: gst_imx_compositor_sink_query
static gboolean gst_imx_compositor_sink_query(GstImxBPAggregator *aggregator, GstImxBPAggregatorPad *pad, GstQuery *query)
{
switch (GST_QUERY_TYPE(query))
{
case GST_QUERY_CAPS:
{
/* Custom caps query response. Take the sinkpad template caps,
* optionally filter them, and return them as the result.
* This ensures that the caps that the derived class supports
* for input data are actually used (by default, the aggregator
* base classes try to keep input and output caps equal) */
GstCaps *filter, *caps;
gst_query_parse_caps(query, &filter);
caps = gst_pad_get_pad_template_caps(GST_PAD(pad));
if (filter != NULL)
{
GstCaps *unfiltered_caps = gst_caps_make_writable(caps);
caps = gst_caps_intersect(unfiltered_caps, filter);
gst_caps_unref(unfiltered_caps);
}
GST_DEBUG_OBJECT(aggregator, "responding to CAPS query with caps %" GST_PTR_FORMAT, (gpointer)caps);
gst_query_set_caps_result(query, caps);
gst_caps_unref(caps);
return TRUE;
}
case GST_QUERY_ACCEPT_CAPS:
{
/* Custom accept_caps query response. Simply check if
* the supplied caps are a valid subset of the sinkpad's
* template caps. This is done for the same reasons
* as the caps query response above. */
GstCaps *accept_caps = NULL, *template_caps = NULL;
gboolean ret;
gst_query_parse_accept_caps(query, &accept_caps);
template_caps = gst_pad_get_pad_template_caps(GST_PAD(pad));
ret = gst_caps_is_subset(accept_caps, template_caps);
GST_DEBUG_OBJECT(aggregator, "responding to ACCEPT_CAPS query with value %d (acceptcaps: %" GST_PTR_FORMAT " template caps %" GST_PTR_FORMAT ")", ret, (gpointer)accept_caps, (gpointer)template_caps);
gst_query_set_accept_caps_result(query, ret);
return TRUE;
}
default:
return GST_IMXBP_AGGREGATOR_CLASS(gst_imx_compositor_parent_class)->sink_query(aggregator, pad, query);
}
}
示例8: ofLogError
bool ofGstVideoPlayer::allocate(int bpp){
if(bIsAllocated) return true;
guint64 durationNanos = videoUtils.getDurationNanos();
nFrames = 0;
if(GstPad* pad = gst_element_get_static_pad(videoUtils.getSink(), "sink")){
#if GST_VERSION_MAJOR==0
int width,height;
if(gst_video_get_size(GST_PAD(pad), &width, &height)){
if(!videoUtils.allocate(width,height,bpp)) return false;
}else{
ofLogError("ofGstVideoPlayer") << "allocate(): couldn't query width and height";
return false;
}
const GValue *framerate = gst_video_frame_rate(pad);
fps_n=0;
fps_d=0;
if(framerate && GST_VALUE_HOLDS_FRACTION (framerate)){
fps_n = gst_value_get_fraction_numerator (framerate);
fps_d = gst_value_get_fraction_denominator (framerate);
nFrames = (float)(durationNanos / (float)GST_SECOND) * (float)fps_n/(float)fps_d;
ofLogVerbose("ofGstVideoPlayer") << "allocate(): framerate: " << fps_n << "/" << fps_d;
}else{
ofLogWarning("ofGstVideoPlayer") << "allocate(): cannot get framerate, frame seek won't work";
}
bIsAllocated = true;
#else
if(GstCaps *caps = gst_pad_get_current_caps (GST_PAD (pad))){
GstVideoInfo info;
gst_video_info_init (&info);
if (gst_video_info_from_caps (&info, caps)){
if(!videoUtils.allocate(info.width,info.height,bpp)) return false;
}else{
ofLogError("ofGstVideoPlayer") << "allocate(): couldn't query width and height";
return false;
}
fps_n = info.fps_n;
fps_d = info.fps_d;
nFrames = (float)(durationNanos / (float)GST_SECOND) * (float)fps_n/(float)fps_d;
gst_caps_unref(caps);
bIsAllocated = true;
}else{
ofLogError("ofGstVideoPlayer") << "allocate(): cannot get pipeline caps";
bIsAllocated = false;
}
#endif
gst_object_unref(GST_OBJECT(pad));
}else{
ofLogError("ofGstVideoPlayer") << "allocate(): cannot get sink pad";
bIsAllocated = false;
}
return bIsAllocated;
}
示例9: gst_tcp_mix_src_pad_start
static gboolean
gst_tcp_mix_src_pad_start (GstTCPMixSrcPad * pad)
{
gboolean res = FALSE;
if (GST_PAD_TASK (pad) == NULL) {
GstTaskFunction func = (GstTaskFunction) gst_tcp_mix_src_loop;
res = gst_pad_start_task (GST_PAD (pad), func, GST_PAD (pad), NULL);
}
return res;
}
示例10: splitmux_part_pad_constructed
static void
splitmux_part_pad_constructed (GObject * pad)
{
gst_pad_set_chain_function (GST_PAD (pad),
GST_DEBUG_FUNCPTR (splitmux_part_pad_chain));
gst_pad_set_event_function (GST_PAD (pad),
GST_DEBUG_FUNCPTR (splitmux_part_pad_event));
gst_pad_set_query_function (GST_PAD (pad),
GST_DEBUG_FUNCPTR (splitmux_part_pad_query));
G_OBJECT_CLASS (gst_splitmux_part_pad_parent_class)->constructed (pad);
}
示例11: _request_new_pad
static GstPad *
_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
{
GstAggregator *self;
GstAggregatorPad *agg_pad;
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
GstAggregatorPrivate *priv = GST_AGGREGATOR (element)->priv;
self = GST_AGGREGATOR (element);
if (templ == gst_element_class_get_pad_template (klass, "sink_%u")) {
gint serial = 0;
gchar *name = NULL;
GST_OBJECT_LOCK (element);
if (req_name == NULL || strlen (req_name) < 6
|| !g_str_has_prefix (req_name, "sink_")) {
/* no name given when requesting the pad, use next available int */
priv->padcount++;
} else {
/* parse serial number from requested padname */
serial = g_ascii_strtoull (&req_name[5], NULL, 10);
if (serial >= priv->padcount)
priv->padcount = serial;
}
name = g_strdup_printf ("sink_%u", priv->padcount);
agg_pad = g_object_new (GST_AGGREGATOR_GET_CLASS (self)->sinkpads_type,
"name", name, "direction", GST_PAD_SINK, "template", templ, NULL);
g_free (name);
GST_OBJECT_UNLOCK (element);
} else {
return NULL;
}
GST_DEBUG_OBJECT (element, "Adding pad %s", GST_PAD_NAME (agg_pad));
if (priv->running)
gst_pad_set_active (GST_PAD (agg_pad), TRUE);
/* add the pad to the element */
gst_element_add_pad (element, GST_PAD (agg_pad));
return GST_PAD (agg_pad);
}
示例12: gst_switch_request_new_pad
static GstPad *
gst_switch_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
{
GstSwitch *swit = GST_SWITCH (element);
GstGhostPad *pad;
INFO ("requesting: %s.%s (%d=%d+%d)", GST_ELEMENT_NAME (swit),
name ? name : GST_PAD_TEMPLATE_NAME_TEMPLATE (templ),
element->numpads, element->numsrcpads, element->numsinkpads);
GST_SWITCH_LOCK (swit);
switch (GST_PAD_TEMPLATE_DIRECTION (templ)) {
case GST_PAD_SRC:
pad = gst_switch_request_new_src_pad (swit, templ, name, caps);
break;
case GST_PAD_SINK:
pad = gst_switch_request_new_sink_pad (swit, templ, name, caps);
break;
default:
pad = NULL;
break;
}
if (pad) {
gst_pad_set_active (GST_PAD (pad), TRUE);
if (gst_element_add_pad (GST_ELEMENT (swit), GST_PAD (pad))) {
GstPad *basepad = gst_ghost_pad_get_target (pad);
GstElement *swcase = GST_ELEMENT (GST_PAD_PARENT (basepad));
GST_OBJECT_FLAG_SET (basepad, GST_SWITCH_PAD_FLAG_GHOSTED);
GST_DEBUG_OBJECT (swit, "New %s:%s on %s:%s",
GST_ELEMENT_NAME (swit), GST_PAD_NAME (pad),
GST_ELEMENT_NAME (swcase), GST_PAD_NAME (basepad));
INFO ("requested %s.%s on %s.%s",
GST_ELEMENT_NAME (swit), GST_PAD_NAME (pad),
GST_ELEMENT_NAME (swcase), GST_PAD_NAME (basepad));
}
}
GST_SWITCH_UNLOCK (swit);
return GST_PAD (pad);
}
示例13: gst_gl_mixer_bin_release_pad
static void
gst_gl_mixer_bin_release_pad (GstElement * element, GstPad * pad)
{
GstGLMixerBin *self = GST_GL_MIXER_BIN (element);
GList *l = self->priv->input_chains;
gboolean released = FALSE;
GST_OBJECT_LOCK (element);
while (l) {
struct input_chain *chain = l->data;
if (GST_PAD (chain->ghost_pad) == pad) {
self->priv->input_chains =
g_list_delete_link (self->priv->input_chains, l);
GST_OBJECT_UNLOCK (element);
_free_input_chain (chain);
gst_element_remove_pad (element, pad);
released = TRUE;
break;
}
l = l->next;
}
if (!released)
GST_OBJECT_UNLOCK (element);
}
示例14: gst_imx_compositor_pad_update_canvas
static void gst_imx_compositor_pad_update_canvas(GstImxCompositorPad *compositor_pad, GstImxRegion const *source_region)
{
GstImxCompositor *compositor;
GstVideoInfo *info = &(GST_IMXBP_VIDEO_AGGREGATOR_PAD(compositor_pad)->info);
/* Catch redundant calls */
if (!(compositor_pad->canvas_needs_update))
return;
compositor = GST_IMX_COMPOSITOR(gst_pad_get_parent_element(GST_PAD(compositor_pad)));
/* (Re)compute the outer region */
gst_imx_compositor_pad_compute_outer_region(compositor_pad);
/* (Re)computer the inner region */
gst_imx_canvas_calculate_inner_region(&(compositor_pad->canvas), info);
/* Next, clip the canvas against the overall region,
* which describes the output frame's size
* This way, it is ensured that only the parts that are "within"
* the output frame are blit */
gst_imx_canvas_clip(
&(compositor_pad->canvas),
&(compositor->overall_region),
info,
source_region,
&(compositor_pad->source_subset)
);
/* Canvas updated, mark it as such */
compositor_pad->canvas_needs_update = FALSE;
gst_object_unref(GST_OBJECT(compositor));
}
示例15: gst_switch_select
static GstElement *
gst_switch_select (GstSwitch * swit,
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
{
GList *item = GST_BIN_CHILDREN (GST_BIN (swit));
GstElement *swcase = NULL;
for (; item; item = g_list_next (item)) {
GList *paditem = GST_ELEMENT_PADS (GST_ELEMENT (item->data));
GstPad *basepad = NULL, *pad = NULL;
for (; paditem; paditem = g_list_next (paditem)) {
pad = GST_PAD (paditem->data);
if (GST_PAD_IS_SINK (pad) && !gst_pad_is_linked (pad) &&
!GST_OBJECT_FLAG_IS_SET (GST_OBJECT (pad),
GST_SWITCH_PAD_FLAG_GHOSTED)) {
basepad = pad;
break;
}
}
if (basepad) {
swcase = GST_ELEMENT (item->data);
break;
}
}
if (!swcase) {
swcase = gst_switch_request_new_case (swit, templ, caps);
}
return swcase;
}