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; }
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; }
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"); }
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); }
/**************************************************** * 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; } }
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; }
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); } }
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; }
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; }
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); }
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); }
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); }
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); }
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)); }
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; }
static GstPad * gst_gl_mixer_bin_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps) { GstGLMixerBin *self = GST_GL_MIXER_BIN (element); GstPadTemplate *mixer_templ; struct input_chain *chain; GstPad *mixer_pad; chain = g_new0 (struct input_chain, 1); mixer_templ = _find_element_pad_template (self->mixer, GST_PAD_TEMPLATE_DIRECTION (templ), GST_PAD_TEMPLATE_PRESENCE (templ)); g_return_val_if_fail (mixer_templ, NULL); mixer_pad = gst_element_request_pad (self->mixer, mixer_templ, req_name, NULL); g_return_val_if_fail (mixer_pad, NULL); if (!_create_input_chain (self, chain, mixer_pad)) { gst_element_release_request_pad (self->mixer, mixer_pad); _free_input_chain (chain); return NULL; } GST_OBJECT_LOCK (element); self->priv->input_chains = g_list_prepend (self->priv->input_chains, chain); GST_OBJECT_UNLOCK (element); gst_child_proxy_child_added (GST_CHILD_PROXY (self), G_OBJECT (chain->ghost_pad), GST_OBJECT_NAME (chain->ghost_pad)); return GST_PAD (chain->ghost_pad); }
gboolean eos_callback(GstPad *pad, GstObject *parent, GstEvent *event) { GstEvent *seek_event; GstElement *bkgdec; GValue v=G_VALUE_INIT; GstPad *srcpad; GstIterator *srcpads; gboolean result; g_print("Decodebin received EOS. Someone should handle that...\n"); bkgdec=gst_pad_get_parent_element(pad); if(bkgdec->numsrcpads>0) { srcpads=gst_element_iterate_src_pads(bkgdec); gst_iterator_next(srcpads,&v); srcpad=GST_PAD(g_value_get_object(&v)); seek_event=gst_event_new_seek ( 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); result=gst_pad_send_event(srcpad,seek_event); if(result==TRUE) { g_print("seek event sent OK.\n"); } else { g_print("seek sent FAILED.\n"); } g_value_reset(&v); g_value_unset(&v); gst_iterator_free(srcpads); return TRUE; } return gst_pad_event_default(pad,parent,event); }
void kms_tree_bin_unlink_input_element_from_tee (KmsTreeBin * self) { GstPad *queue_sink, *peer, *tee_src; GstElement *tee; queue_sink = gst_element_get_static_pad (self->priv->input_element, "sink"); peer = gst_pad_get_peer (queue_sink); if (GST_IS_PROXY_PAD (peer)) { GstProxyPad *ghost; ghost = gst_proxy_pad_get_internal (GST_PROXY_PAD (peer)); tee_src = gst_pad_get_peer (GST_PAD (ghost)); g_object_unref (peer); g_object_unref (ghost); } else { tee_src = peer; } gst_pad_unlink (tee_src, queue_sink); tee = gst_pad_get_parent_element (tee_src); if (tee != NULL) { gst_element_release_request_pad (tee, tee_src); g_object_unref (tee); } g_object_unref (tee_src); g_object_unref (queue_sink); }
/// Constructor. inline explicit SourcePadJitterEntry(const GstPad* pSourcePad) : m_pPad(GST_PAD(gst_object_ref(GST_OBJECT(pSourcePad)))) , m_ElementName(GetPadParentElementName(pSourcePad)) , m_PadName(gst_pad_get_name(pSourcePad)) , m_LastSourceTimestamp(0) , m_StatsCollection(PipelineTracer::STATS_COLLECTION_SIZE) {}
static gboolean _unresponsive_timeout (GstClock * clock, GstClockTime time, GstClockID id, gpointer user_data) { GstAggregatorPad *aggpad; GstAggregator *self; if (user_data == NULL) return FALSE; aggpad = GST_AGGREGATOR_PAD (user_data); /* avoid holding the last reference to the parent element here */ PAD_LOCK_EVENT (aggpad); self = GST_AGGREGATOR (gst_pad_get_parent (GST_PAD (aggpad))); GST_DEBUG_OBJECT (aggpad, "marked unresponsive"); g_atomic_int_set (&aggpad->unresponsive, TRUE); if (self) { QUEUE_PUSH (self); gst_object_unref (self); } PAD_UNLOCK_EVENT (aggpad); return TRUE; }
static GstPad * _get_peer_pad (GstPad * pad) { GstPad *peer = gst_pad_get_peer (pad); if (!peer) return NULL; while (GST_IS_PROXY_PAD (peer)) { GstPad *next_pad; if (GST_IS_GHOST_PAD (peer)) { next_pad = gst_pad_get_peer (peer); if (next_pad == pad) next_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (peer)); } else { next_pad = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (peer))); } if (!next_pad) return NULL; gst_object_unref (peer); peer = next_pad; } return peer; }
static void gst_gl_video_mixer_pad_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstGLVideoMixerPad *pad = GST_GL_VIDEO_MIXER_PAD (object); GstGLMixer *mix = GST_GL_MIXER (gst_pad_get_parent (GST_PAD (pad))); switch (prop_id) { case PROP_PAD_XPOS: pad->xpos = g_value_get_int (value); pad->geometry_change = TRUE; break; case PROP_PAD_YPOS: pad->ypos = g_value_get_int (value); pad->geometry_change = TRUE; break; case PROP_PAD_WIDTH: pad->width = g_value_get_int (value); pad->geometry_change = TRUE; break; case PROP_PAD_HEIGHT: pad->height = g_value_get_int (value); pad->geometry_change = TRUE; break; case PROP_PAD_ALPHA: pad->alpha = g_value_get_double (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } gst_object_unref (mix); }
static GstPad * gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir, GstPadTemplate * templ) { GstGhostPad *ret; g_return_val_if_fail (dir != GST_PAD_UNKNOWN, NULL); /* OBJECT CREATION */ if (templ) { ret = g_object_new (GST_TYPE_GHOST_PAD, "name", name, "direction", dir, "template", templ, NULL); } else { ret = g_object_new (GST_TYPE_GHOST_PAD, "name", name, "direction", dir, NULL); } if (!gst_ghost_pad_construct (ret)) goto construct_failed; return GST_PAD (ret); construct_failed: /* already logged */ gst_object_unref (ret); return NULL; }
/* used for catching newsegment events while we don't have a sink, for * later forwarding it to the sink */ static gboolean gst_a2dp_sink_handle_event(GstPad *pad, GstEvent *event) { GstA2dpSink *self; GstTagList *taglist = NULL; GstObject *parent; self = GST_A2DP_SINK(GST_PAD_PARENT(pad)); parent = gst_element_get_parent(GST_ELEMENT(self->sink)); if (GST_EVENT_TYPE(event) == GST_EVENT_NEWSEGMENT && parent != GST_OBJECT_CAST(self)) { if (self->newseg_event != NULL) gst_event_unref(self->newseg_event); self->newseg_event = gst_event_ref(event); } else if (GST_EVENT_TYPE(event) == GST_EVENT_TAG && parent != GST_OBJECT_CAST(self)) { if (self->taglist == NULL) gst_event_parse_tag(event, &self->taglist); else { gst_event_parse_tag(event, &taglist); gst_tag_list_insert(self->taglist, taglist, GST_TAG_MERGE_REPLACE); } } if (parent != NULL) gst_object_unref(GST_OBJECT(parent)); return self->ghostpad_eventfunc(GST_PAD(self->ghostpad), event); }
static gboolean gst_audiomixer_sink_query (GstAggregator * agg, GstAggregatorPad * aggpad, GstQuery * query) { gboolean res = FALSE; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_CAPS: { GstCaps *filter, *caps; gst_query_parse_caps (query, &filter); caps = gst_audiomixer_sink_getcaps (agg, GST_PAD (aggpad), filter); gst_query_set_caps_result (query, caps); gst_caps_unref (caps); res = TRUE; break; } default: res = GST_AGGREGATOR_CLASS (parent_class)->sink_query (agg, aggpad, query); break; } return res; }
static void gst_deinterleave_set_pads_caps (GstDeinterleave * self, GstCaps * caps) { GList *l; GstStructure *s; gint i; for (l = self->srcpads, i = 0; l; l = l->next, i++) { GstPad *pad = GST_PAD (l->data); GstCaps *srccaps; /* Set channel position if we know it */ if (self->keep_positions) { GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE }; srccaps = gst_caps_copy (caps); s = gst_caps_get_structure (srccaps, 0); if (self->pos) gst_audio_set_channel_positions (s, &self->pos[i]); else gst_audio_set_channel_positions (s, pos); } else { srccaps = caps; } gst_pad_set_caps (pad, srccaps); if (self->keep_positions) gst_caps_unref (srccaps); } }
/* Push buffers and switch for each selector pad */ static void push_switched_buffers (GList * input_pads, GstElement * elem, GList * peer_pads, gint num_buffers) { GstBuffer *buf = NULL; GList *l = peer_pads; GstPad *selpad = NULL; /* setup dummy buffer */ buf = gst_buffer_new_and_alloc (1); while (l != NULL) { /* set selector pad */ selpad = gst_pad_get_peer (GST_PAD (l->data)); selector_set_active_pad (elem, selpad); if (selpad) { gst_object_unref (selpad); } /* push buffers */ push_input_buffers (input_pads, buf, num_buffers); /* switch to next selector pad */ l = g_list_next (l); } /* cleanup buffer */ gst_buffer_unref (buf); }
static gboolean _sink_query (GstAggregator * self, GstAggregatorPad * aggpad, GstQuery * query) { GstPad *pad = GST_PAD (aggpad); return gst_pad_query_default (pad, GST_OBJECT (self), query); }
static void dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer user_data) { GstPad *target = GST_PAD (user_data); gst_pad_link (newpad, target); gst_object_unref (target); }
/* generate queries to adaptive demux */ static gboolean testQueryCheckDataReceived (GstAdaptiveDemuxTestEngine * engine, GstAdaptiveDemuxTestOutputStream * stream, GstBuffer * buffer, gpointer user_data) { GList *pads; GstPad *pad; GstQuery *query; gboolean ret; gint64 duration; gboolean seekable; gint64 segment_start; gint64 segment_end; gchar *uri; gchar *redirect_uri; gboolean redirect_permanent; pads = GST_ELEMENT_PADS (stream->appsink); /* AppSink should have only 1 pad */ fail_unless (pads != NULL); fail_unless (g_list_length (pads) == 1); pad = GST_PAD (pads->data); query = gst_query_new_duration (GST_FORMAT_TIME); ret = gst_pad_peer_query (pad, query); fail_unless (ret == TRUE); gst_query_parse_duration (query, NULL, &duration); fail_unless (duration == 135743 * GST_MSECOND); gst_query_unref (query); query = gst_query_new_seeking (GST_FORMAT_TIME); ret = gst_pad_peer_query (pad, query); fail_unless (ret == TRUE); gst_query_parse_seeking (query, NULL, &seekable, &segment_start, &segment_end); fail_unless (seekable == TRUE); fail_unless (segment_start == 0); fail_unless (segment_end == duration); gst_query_unref (query); query = gst_query_new_uri (); ret = gst_pad_peer_query (pad, query); fail_unless (ret == TRUE); gst_query_parse_uri (query, &uri); gst_query_parse_uri_redirection (query, &redirect_uri); gst_query_parse_uri_redirection_permanent (query, &redirect_permanent); fail_unless (strcmp (uri, "http://unit.test/test.mpd") == 0); /* adaptive demux does not reply with redirect information */ fail_unless (redirect_uri == NULL); fail_unless (redirect_permanent == FALSE); g_free (uri); g_free (redirect_uri); gst_query_unref (query); return gst_adaptive_demux_test_check_received_data (engine, stream, buffer, user_data); }