static void post_decodebin_pad_removed_handler (GstElement * decodebin, GstPad * pad, KmsHttpEndpoint * self) { GstElement *appsink, *appsrc; GstPad *sinkpad; if (GST_PAD_IS_SINK (pad)) return; GST_DEBUG ("pad %" GST_PTR_FORMAT " removed", pad); appsink = g_object_steal_qdata (G_OBJECT (pad), appsink_data_quark ()); if (appsink == NULL) { GST_ERROR ("No appsink was found associated with %" GST_PTR_FORMAT, pad); return; } sinkpad = gst_element_get_static_pad (appsink, "sink"); appsrc = g_object_get_qdata (G_OBJECT (sinkpad), appsrc_data_quark ()); g_object_unref (sinkpad); if (!gst_element_set_locked_state (appsink, TRUE)) GST_ERROR ("Could not block element %s", GST_ELEMENT_NAME (appsink)); GST_DEBUG ("Removing appsink %s from %s", GST_ELEMENT_NAME (appsink), GST_ELEMENT_NAME (self->pipeline)); gst_element_set_state (appsink, GST_STATE_NULL); gst_bin_remove (GST_BIN (self->pipeline), appsink); if (appsrc == NULL) { GST_ERROR ("No appsink was found associated with %" GST_PTR_FORMAT, pad); return; } if (GST_OBJECT_PARENT (appsrc) != NULL) { g_object_ref (appsrc); gst_bin_remove (GST_BIN (GST_OBJECT_PARENT (appsrc)), appsrc); gst_element_set_state (appsrc, GST_STATE_NULL); g_object_unref (appsrc); } }
static void dvb_base_bin_dispose (GObject * object) { DvbBaseBin *dvbbasebin = GST_DVB_BASE_BIN (object); if (!dvbbasebin->disposed) { /* remove mpegtsparse BEFORE dvbsrc, since the mpegtsparse::pad-removed * signal handler uses dvbsrc */ dvb_base_bin_reset (dvbbasebin); if (dvbbasebin->tsparse != NULL) gst_bin_remove (GST_BIN (dvbbasebin), dvbbasebin->tsparse); gst_bin_remove (GST_BIN (dvbbasebin), dvbbasebin->dvbsrc); gst_bin_remove (GST_BIN (dvbbasebin), dvbbasebin->buffer_queue); dvbbasebin->disposed = TRUE; } if (G_OBJECT_CLASS (parent_class)->dispose) G_OBJECT_CLASS (parent_class)->dispose (object); }
HubImpl::~HubImpl() { std::shared_ptr<MediaPipelineImpl> pipe; pipe = std::dynamic_pointer_cast<MediaPipelineImpl> (getMediaPipeline() ); gst_bin_remove (GST_BIN ( pipe->getPipeline() ), element); gst_element_set_state (element, GST_STATE_NULL); g_object_unref (element); }
PointerDetectorFilter::~PointerDetectorFilter() throw () { GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE ( ( (std::shared_ptr<MediaPipeline> &) parent)->pipeline) ); g_signal_handler_disconnect (bus, bus_handler_id); g_object_unref (bus); gst_bin_remove (GST_BIN ( ( (std::shared_ptr<MediaPipeline> &) parent)->pipeline), element); gst_element_set_state (element, GST_STATE_NULL); g_object_unref (element); }
static void gate_block_async_cb(GstPad * pad, gboolean blocked, gpointer user_data) { GstStateChangeReturn ret; std::string location[4]; GstRTSPMedia *media; SMC::RTSPserverGate *object = static_cast<SMC::RTSPserverGate*> (user_data); media = static_cast<GstRTSPMedia*> (g_hash_table_lookup( object->factory->medias, object->factory->key)); GstElement * pipeline = (GstElement *) media->element; GstState rtspstate; GstElement *source, *rtspsrc, *buffer; buffer = gst_bin_get_by_name(GST_BIN(pipeline), "buffer"); source = gst_bin_get_by_name(GST_BIN(pipeline), "gate"); gst_element_set_state(pipeline, GST_STATE_PAUSED); gst_element_unlink(source, buffer); if (TRUE == gst_bin_remove(GST_BIN(pipeline), source)) std::clog << "########## Removed" << std::endl; else std::clog << "########## Not Removed" << std::endl; gst_element_get_state(source, &rtspstate, NULL, GST_CLOCK_TIME_NONE); std::clog << "########## FIRST rtsp: " << gst_element_state_get_name( rtspstate) << " ::: " << object->getState().c_str() << std::endl; if (object->getState() == "gate") object->setState("gate1"); else object->setState("gate"); rtspsrc = gst_element_factory_make("rtspsrc", "gate"); std::clog << "########## LAST rtsp" << object->getState().c_str() << std::endl; std::clog << "########## Flusso:" << object->getLocation().c_str() << std::endl; g_object_set(rtspsrc, "location", object->getLocation().c_str(),"tcp-timeout", 600000, NULL); gst_bin_add(GST_BIN(pipeline), rtspsrc); g_signal_connect(rtspsrc, "pad-added", G_CALLBACK(gate_on_rtsppad_added), object); gst_element_set_state(rtspsrc, GST_STATE_PLAYING); gst_element_set_state(pipeline, GST_STATE_PLAYING); g_idle_add((GSourceFunc) stop_data, source); std::clog << "########## start rtsp:" << object->getLocation().c_str() << std::endl; std::clog << "########## Playing Pause:" << std::endl; }
static gboolean gst_a2dp_sink_init_avdtp_sink(GstA2dpSink *self) { GstElement *sink; /* check if we don't need a new sink */ if (self->sink_is_in_bin) return TRUE; if (self->sink == NULL) sink = gst_element_factory_make("avdtpsink", "avdtpsink"); else sink = GST_ELEMENT(self->sink); if (sink == NULL) { GST_ERROR_OBJECT(self, "Couldn't create avdtpsink"); return FALSE; } if (!gst_bin_add(GST_BIN(self), sink)) { GST_ERROR_OBJECT(self, "failed to add avdtpsink " "to the bin"); goto cleanup_and_fail; } if (gst_element_set_state(sink, GST_STATE_READY) == GST_STATE_CHANGE_FAILURE) { GST_ERROR_OBJECT(self, "avdtpsink failed to go to ready"); goto remove_element_and_fail; } if (!gst_element_link(GST_ELEMENT(self->rtp), sink)) { GST_ERROR_OBJECT(self, "couldn't link rtpsbcpay " "to avdtpsink"); goto remove_element_and_fail; } self->sink = GST_AVDTP_SINK(sink); self->sink_is_in_bin = TRUE; g_object_set(G_OBJECT(self->sink), "device", self->device, NULL); gst_element_set_state(sink, GST_STATE_PAUSED); return TRUE; remove_element_and_fail: gst_element_set_state(sink, GST_STATE_NULL); gst_bin_remove(GST_BIN(self), sink); return FALSE; cleanup_and_fail: if (sink != NULL) g_object_unref(G_OBJECT(sink)); return FALSE; }
static void gst_auto_video_src_clear_kid (GstAutoVideoSrc * src) { if (src->kid) { gst_element_set_state (src->kid, GST_STATE_NULL); gst_bin_remove (GST_BIN (src), src->kid); src->kid = NULL; /* Don't loose SOURCE flag */ GST_OBJECT_FLAG_SET (src, GST_ELEMENT_FLAG_SOURCE); } }
static gboolean set_source(GHashTable *args) { OwrMediaRenderer *renderer; OwrMediaSource *source; OwrMediaRendererPrivate *priv; g_return_val_if_fail(args, G_SOURCE_REMOVE); renderer = g_hash_table_lookup(args, "renderer"); source = g_hash_table_lookup(args, "source"); g_return_val_if_fail(OWR_IS_MEDIA_RENDERER(renderer), G_SOURCE_REMOVE); g_return_val_if_fail(!source || OWR_IS_MEDIA_SOURCE(source), G_SOURCE_REMOVE); priv = renderer->priv; g_mutex_lock(&priv->media_renderer_lock); if (source == priv->source) { g_mutex_unlock(&priv->media_renderer_lock); goto end; } if (priv->source) { _owr_media_source_release_source(priv->source, priv->src); gst_element_set_state(priv->src, GST_STATE_NULL); gst_bin_remove(GST_BIN(priv->pipeline), priv->src); priv->src = NULL; g_object_unref(priv->source); priv->source = NULL; } if (!source) { /* Shut down the pipeline if we have no source */ gst_element_set_state(priv->pipeline, GST_STATE_NULL); OWR_POST_EVENT(renderer, RENDERER_STOPPED, NULL); g_mutex_unlock(&priv->media_renderer_lock); goto end; } priv->source = g_object_ref(source); _owr_media_renderer_reconfigure_element(renderer); maybe_start_renderer(renderer); g_mutex_unlock(&priv->media_renderer_lock); end: g_object_unref(renderer); if (source) g_object_unref(source); g_hash_table_unref(args); return G_SOURCE_REMOVE; }
static void gst_auto_video_sink_clear_kid (GstAutoVideoSink * sink) { if (sink->kid) { gst_element_set_state (sink->kid, GST_STATE_NULL); gst_bin_remove (GST_BIN (sink), sink->kid); sink->kid = NULL; /* Don't lose the SINK flag */ GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_IS_SINK); } }
static void gst_a2dp_sink_remove_dynamic_elements(GstA2dpSink *self) { if (self->rtp) { GST_LOG_OBJECT(self, "removing rtp element from the bin"); if (!gst_bin_remove(GST_BIN(self), GST_ELEMENT(self->rtp))) GST_WARNING_OBJECT(self, "failed to remove rtp " "element from bin"); else self->rtp = NULL; } }
void TapeComposition::disconnectTape( void ) { for ( SampleInstanceList::const_iterator it = m_samples.begin(); it != m_samples.end(); ++ it ) { gst_bin_remove( GST_BIN( m_selfElement ), it->second->m_element ); delete it->second; } m_samples.clear(); }
int video_close() { GstElement *thread; if (!gst_element_set_state(pipeline, GST_STATE_READY)) return VIDEO_ERROR; /* Get the audio and video threads out of the pipeline: */ thread = gst_bin_get_by_name(GST_BIN(pipeline), "vthread"); if (thread) gst_bin_remove(GST_BIN(pipeline), thread); thread = gst_bin_get_by_name(GST_BIN(pipeline), "athread"); if (thread) gst_bin_remove(GST_BIN(pipeline), thread); apeer = NULL; if (!gst_element_set_state (pipeline, GST_STATE_NULL)) return VIDEO_ERROR; video_width = video_height = 0; return VIDEO_OK; }
/* Disable audio on-the-fly: */ void disable_audio() { if (audio_disabled) return; if (!gst_bin_get_by_name(GST_BIN(pipeline), "athread")) return; if (!GST_PAD_IS_LINKED(aqueuesink)) return; if (!apeer) return; gst_pad_unlink(apeer, aqueuesink); gst_bin_remove(GST_BIN(pipeline), athread); gst_element_set_state(athread, GST_STATE_READY); gst_bin_sync_children_state (GST_BIN (pipeline)); }
static void remove_all_children (GstUriTranscodeBin * self) { if (self->sink) { gst_element_set_state (self->sink, GST_STATE_NULL); gst_bin_remove (GST_BIN (self), self->sink); self->sink = NULL; } if (self->transcodebin) { gst_element_set_state (self->transcodebin, GST_STATE_NULL); gst_bin_remove (GST_BIN (self), self->transcodebin); self->transcodebin = NULL; } if (self->src) { gst_element_set_state (self->src, GST_STATE_NULL); gst_bin_remove (GST_BIN (self), self->src); self->src = NULL; } }
static void remove_elements (RsnDvdBin * dvdbin) { gint i; GList *tmp; if (dvdbin->pieces[DVD_ELEM_MQUEUE] != NULL) { for (tmp = dvdbin->mq_req_pads; tmp; tmp = g_list_next (tmp)) { gst_element_release_request_pad (dvdbin->pieces[DVD_ELEM_MQUEUE], GST_PAD (tmp->data)); } } g_list_free (dvdbin->mq_req_pads); dvdbin->mq_req_pads = NULL; for (i = 0; i < DVD_ELEM_LAST; i++) { DVDBIN_LOCK (dvdbin); if (dvdbin->pieces[i] != NULL) { GstElement *piece = dvdbin->pieces[i]; dvdbin->pieces[i] = NULL; DVDBIN_UNLOCK (dvdbin); gst_element_set_state (piece, GST_STATE_NULL); gst_bin_remove (GST_BIN (dvdbin), piece); } else DVDBIN_UNLOCK (dvdbin); } if (dvdbin->video_pad) { if (dvdbin->video_added) gst_element_remove_pad (GST_ELEMENT (dvdbin), dvdbin->video_pad); else gst_object_unref (dvdbin->video_pad); } if (dvdbin->audio_pad) { if (dvdbin->audio_added) gst_element_remove_pad (GST_ELEMENT (dvdbin), dvdbin->audio_pad); else gst_object_unref (dvdbin->audio_pad); } if (dvdbin->subpicture_pad) { if (dvdbin->subpicture_added) gst_element_remove_pad (GST_ELEMENT (dvdbin), dvdbin->subpicture_pad); else gst_object_unref (dvdbin->subpicture_pad); } dvdbin->video_added = dvdbin->audio_added = dvdbin->subpicture_added = FALSE; dvdbin->audio_broken = FALSE; dvdbin->video_pad = dvdbin->audio_pad = dvdbin->subpicture_pad = NULL; dvdbin->did_no_more_pads = FALSE; }
static void remove_from_parent (GstElement *element) { GstBin *parent = GST_BIN (GST_OBJECT_PARENT (element) ); if (parent == NULL) { return; } gst_element_set_locked_state (element, TRUE); gst_element_set_state (element, GST_STATE_NULL); gst_bin_remove (parent, element); }
/* remove the source from the pipeline after removing it from adder */ static void remove_source (SourceInfo * info) { g_print ("remove freq %5.0f, pos %3.1f\n", info->freq, info->pos); /* lock the state so that we can put it to NULL without the parent messing * with our state */ gst_element_set_locked_state (info->src, TRUE); gst_element_set_locked_state (info->fx, TRUE); /* first stop the source. Remember that this might block when in the PAUSED * state. Alternatively one could send EOS to the source, install an event * probe and schedule a state change/unlink/release from the mainthread. */ gst_element_set_state (info->fx, GST_STATE_NULL); /* NOTE that the source emits EOS when shutting down but the EOS will not * reach the adder sinkpad because the effect is in the NULL state. We will * send an EOS to adder later. */ gst_element_set_state (info->src, GST_STATE_NULL); /* unlink from adder */ gst_pad_unlink (info->src_srcpad, info->fx_sinkpad); gst_pad_unlink (info->fx_srcpad, info->adder_sinkpad); gst_object_unref (info->src_srcpad); gst_object_unref (info->fx_srcpad); gst_object_unref (info->fx_sinkpad); /* remove from the bin */ gst_bin_remove (GST_BIN (pipeline), info->src); gst_bin_remove (GST_BIN (pipeline), info->fx); /* send EOS to the sinkpad to make adder EOS when needed */ gst_pad_send_event (info->adder_sinkpad, gst_event_new_eos ()); /* give back the pad */ gst_element_release_request_pad (adder, info->adder_sinkpad); gst_object_unref (info->adder_sinkpad); g_free (info); }
static void fps_display_sink_stop (GstFPSDisplaySink * self) { if (self->text_overlay) { gst_element_unlink (self->text_overlay, self->video_sink); gst_bin_remove (GST_BIN (self), self->text_overlay); gst_object_unref (self->text_overlay); self->text_overlay = NULL; } else { /* print the max and minimum fps values */ g_print ("Max-fps: %0.2f\nMin-fps: %0.2f\n", self->max_fps, self->min_fps); } }
static void webkit_data_src_finalize(WebkitDataSrc* src) { g_free(src->uri); if (src->kid) { GST_DEBUG_OBJECT(src, "Removing giostreamsrc element"); gst_element_set_state(src->kid, GST_STATE_NULL); gst_bin_remove(GST_BIN(src), src->kid); src->kid = 0; } GST_CALL_PARENT(G_OBJECT_CLASS, finalize, ((GObject* )(src))); }
gboolean nle_composition_remove (GstBin * comp, GstElement * object) { gboolean ret; ret = gst_bin_remove (comp, object); if (!ret) return ret; commit_and_wait ((GstElement *) comp, &ret); return ret; }
/* * Method: remove(*elements) * elements: a list of Gst::Element objects. * * Removes one or more Gst::Element objects from the bin, unparenting * as well. * * Returns: nil. */ static VALUE rb_gst_bin_remove(int argc, VALUE *argv, VALUE self) { int i; GstBin *bin; bin = SELF(self); for (i = 0; i < argc; i++) { G_CHILD_REMOVE(self, argv[i]); gst_bin_remove(bin, RVAL2GST_ELEMENT(argv[i])); } return Qnil; }
G_GNUC_UNUSED static GstCaps * gst_play_type_find (GstBin * bin, GstElement * element) { GstElement *typefind; GstElement *pipeline; GstCaps *caps = NULL; GST_DEBUG ("GstPipeline: typefind for element \"%s\"", GST_ELEMENT_NAME (element)); pipeline = gst_pipeline_new ("autoplug_pipeline"); typefind = gst_element_factory_make ("typefind", "typefind"); g_return_val_if_fail (typefind != NULL, FALSE); gst_pad_link (gst_element_get_pad (element, "src"), gst_element_get_pad (typefind, "sink")); gst_bin_add (bin, typefind); gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (bin)); gst_element_set_state (pipeline, GST_STATE_PLAYING); /* push a buffer... the have_type signal handler will set the found flag */ gst_bin_iterate (GST_BIN (pipeline)); gst_element_set_state (pipeline, GST_STATE_NULL); caps = gst_pad_get_caps (gst_element_get_pad (element, "src")); gst_pad_unlink (gst_element_get_pad (element, "src"), gst_element_get_pad (typefind, "sink")); gst_bin_remove (bin, typefind); gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin)); gst_object_unref (typefind); gst_object_unref (pipeline); return caps; }
static void dvb_base_bin_dispose (GObject * object) { DvbBaseBin *dvbbasebin = GST_DVB_BASE_BIN (object); if (!dvbbasebin->disposed) { /* remove mpegtsparse BEFORE dvbsrc, since the mpegtsparse::pad-removed * signal handler uses dvbsrc */ dvb_base_bin_reset (dvbbasebin); if (dvbbasebin->tsparse != NULL) gst_bin_remove (GST_BIN (dvbbasebin), dvbbasebin->tsparse); gst_bin_remove (GST_BIN (dvbbasebin), dvbbasebin->dvbsrc); gst_bin_remove (GST_BIN (dvbbasebin), dvbbasebin->buffer_queue); g_free (dvbbasebin->program_numbers); gst_poll_free (dvbbasebin->poll); gst_object_unref (dvbbasebin->task); g_rec_mutex_clear (&dvbbasebin->lock); dvbbasebin->disposed = TRUE; } if (G_OBJECT_CLASS (parent_class)->dispose) G_OBJECT_CLASS (parent_class)->dispose (object); }
static void really_remove_filter (GstPad *pad, gboolean blocked, RBGstPipelineOp *op) { GstPad *mypad; GstPad *prevpad, *nextpad; GstElement *bin; /* get the containing bin and remove it */ bin = GST_ELEMENT (gst_element_get_parent (op->element)); if (bin == NULL) { return; } rb_debug ("removing filter %p", op->element); _rb_player_gst_filter_emit_filter_pre_remove (RB_PLAYER_GST_FILTER (op->player), op->element); /* probably check return? */ gst_element_set_state (bin, GST_STATE_NULL); /* unlink our sink */ mypad = gst_element_get_static_pad (bin, "sink"); prevpad = gst_pad_get_peer (mypad); gst_pad_unlink (prevpad, mypad); gst_object_unref (mypad); /* unlink our src */ mypad = gst_element_get_static_pad (bin, "src"); nextpad = gst_pad_get_peer (mypad); gst_pad_unlink (mypad, nextpad); gst_object_unref (mypad); /* link previous and next pads */ gst_pad_link (prevpad, nextpad); gst_object_unref (prevpad); gst_object_unref (nextpad); gst_bin_remove (GST_BIN (op->fixture), bin); gst_object_unref (bin); /* if we're supposed to be playing, unblock the sink */ if (blocked) { rb_debug ("unblocking pad after removing filter"); gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback)pipeline_op_done, NULL); } free_pipeline_op (op); }
static void free_gap (Gap * gap) { GESTrack *track = gap->track; GST_DEBUG_OBJECT (track, "Removed gap with start %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT, GST_TIME_ARGS (gap->start), GST_TIME_ARGS (gap->duration)); gst_bin_remove (GST_BIN (track->priv->composition), gap->gnlobj); gst_element_set_state (gap->gnlobj, GST_STATE_NULL); gst_object_unref (gap->gnlobj); g_slice_free (Gap, gap); }
static void remove_from_parent (GstElement *element) { GstBin *parent = GST_BIN (GST_OBJECT_PARENT (element) ); if (parent == NULL) return; gst_object_ref (element); gst_bin_remove (parent, element); gst_element_set_state (element, GST_STATE_NULL); gst_object_unref (element); }
static void pad_removed_cb (GstElement * timeline, GstPad * pad, GESTimelinePipeline * self) { OutputChain *chain; GESTrack *track; GstPad *peer; GST_DEBUG_OBJECT (self, "pad removed %s:%s", GST_DEBUG_PAD_NAME (pad)); if (G_UNLIKELY (!(track = ges_timeline_get_track_for_pad (self->priv->timeline, pad)))) { GST_WARNING_OBJECT (self, "Couldn't find coresponding track !"); return; } if (G_UNLIKELY (!(chain = get_output_chain_for_track (self, track)))) { GST_DEBUG_OBJECT (self, "Pad wasn't used"); return; } /* Unlink encodebin */ if (chain->encodebinpad) { peer = gst_pad_get_peer (chain->encodebinpad); gst_pad_unlink (peer, chain->encodebinpad); gst_object_unref (peer); gst_element_release_request_pad (self->priv->encodebin, chain->encodebinpad); } /* Unlink playsink */ if (chain->playsinkpad) { peer = gst_pad_get_peer (chain->playsinkpad); gst_pad_unlink (peer, chain->playsinkpad); gst_object_unref (peer); gst_element_release_request_pad (self->priv->playsink, chain->playsinkpad); gst_object_unref (chain->playsinkpad); } /* Unlike/remove tee */ peer = gst_element_get_static_pad (chain->tee, "sink"); gst_pad_unlink (pad, peer); gst_object_unref (peer); gst_element_set_state (chain->tee, GST_STATE_NULL); gst_bin_remove (GST_BIN (self), chain->tee); self->priv->chains = g_list_remove (self->priv->chains, chain); g_free (chain); GST_DEBUG ("done"); }
static void fps_display_sink_start (GstFPSDisplaySink * self) { GstPad *target_pad = NULL; /* Init counters */ self->next_ts = GST_CLOCK_TIME_NONE; self->last_ts = GST_CLOCK_TIME_NONE; self->frames_rendered = G_GUINT64_CONSTANT (0); self->frames_dropped = G_GUINT64_CONSTANT (0); GST_DEBUG_OBJECT (self, "Use text-overlay? %d", self->use_text_overlay); if (self->use_text_overlay) { if (!self->text_overlay) { self->text_overlay = gst_element_factory_make ("textoverlay", "fps-display-text-overlay"); if (!self->text_overlay) { GST_WARNING_OBJECT (self, "text-overlay element could not be created"); self->use_text_overlay = FALSE; goto no_text_overlay; } gst_object_ref (self->text_overlay); g_object_set (self->text_overlay, "font-desc", DEFAULT_FONT, "silent", FALSE, NULL); gst_bin_add (GST_BIN (self), self->text_overlay); if (!gst_element_link (self->text_overlay, self->video_sink)) { GST_ERROR_OBJECT (self, "Could not link elements"); } } target_pad = gst_element_get_static_pad (self->text_overlay, "video_sink"); } no_text_overlay: if (!self->use_text_overlay) { if (self->text_overlay) { gst_element_unlink (self->text_overlay, self->video_sink); gst_bin_remove (GST_BIN (self), self->text_overlay); self->text_overlay = NULL; } target_pad = gst_element_get_static_pad (self->video_sink, "sink"); } gst_ghost_pad_set_target (GST_GHOST_PAD (self->ghost_pad), target_pad); gst_object_unref (target_pad); /* Set a timeout for the fps display */ self->timeout_id = g_timeout_add (FPS_DISPLAY_INTERVAL_MS, display_current_fps, (gpointer) self); }
GstPadProbeReturn MediaPlayer::cb_event_probe_toggle_splitter(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) { MediaPlayer * self = reinterpret_cast<MediaPlayer*>( user_data ); // remove the probe first gst_pad_remove_probe( pad, GST_PAD_PROBE_INFO_ID (info) ); // Is the element already in the bin? if ( self->m_gst_audio_karaokesplitter == 0 ) { Logger::debug( "GstMediaPlayer: karaokesplitter is not enabled, enabling"); self->m_gst_audio_karaokesplitter = self->createElement ("audiokaraoke", "karaoke", false ); // This might happen if the player requested it despite us returning no such capability if ( !self->m_gst_audio_karaokesplitter ) return GST_PAD_PROBE_OK; // Add splitter into the bin gst_bin_add( GST_BIN (self->m_gst_pipeline), self->m_gst_audio_karaokesplitter ); // Unlink the place for the splitter gst_element_unlink( self->m_gst_audioconverter, self->m_gst_audio_volume ); // Link it in gst_element_link_many( self->m_gst_audioconverter, self->m_gst_audio_karaokesplitter, self->m_gst_audio_volume, NULL ); // And start playing it gst_element_set_state( self->m_gst_audio_karaokesplitter, GST_STATE_PLAYING ); Logger::debug( "GstMediaPlayer: karaoke splitter enabled"); } else { Logger::debug( "GstMediaPlayer: karaokesplitter is enabled, disabling"); // Stop the splitter gst_element_set_state( self->m_gst_audio_karaokesplitter, GST_STATE_NULL ); // Remove splitter from the bin (it unlinks it too) gst_bin_remove( GST_BIN (self->m_gst_pipeline), self->m_gst_audio_karaokesplitter ); self->m_gst_audio_karaokesplitter = 0; // And link the disconnected elements again gst_element_link_many( self->m_gst_audioconverter, self->m_gst_audio_volume, NULL ); Logger::debug( "GstMediaPlayer: karaoke splitter disabled"); } return GST_PAD_PROBE_OK; }
static void handoff_src (GstElement * element) { g_print ("identity handoff\n"); if (gst_element_set_state (thread, GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove (GST_BIN (thread), src); }