void SourceSetup(object sender, GLib.SignalArgs args) { // we need to delve into the source portion of the uridecodebin to modify the "latency" property, need to add some validation here to ensure this is an rtspsrc var source = (Element)args.Args[0]; System.Diagnostics.Debug.WriteLine("SourceSetup: source is named: " + source.Name + ", and is of type: " + source.NativeType.ToString()); source["latency"] = 0; // this COULD throw an exception if the source is not rtspsrc or similar with a "latency" property }
void OnDeleteEvent(object sender, GLib.SignalArgs args) { pipeline.SetState(Gst.State.Null); pipeline.Dispose(); pipeline = null; args.RetVal = true; }
// This function is called when an error message is posted on the bus static void HandleTags(object sender, GLib.SignalArgs args) { // We are possibly in the Gstreamer working thread, so we notify the main thread of this event through a message in the bus var s = new Structure("tags-changed"); Playbin.PostMessage(new Message(Playbin, s)); }
private void WebViewHandler_DecidePolicy(object o, GLib.SignalArgs args) { var decision = (GLib.Object)args.Args[0]; var type = (int)args.Args[1]; if (type != 0 && type != 1) { return; } var request = NativeMethods.webkit_navigation_policy_decision_get_request(decision.Handle); var uri = new Uri(NativeMethods.webkit_uri_request_get_uri(request)); switch (type) { case 0: // WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION var loadingArgs = new WebViewLoadingEventArgs(uri, true); documentLoading?.Invoke(this, loadingArgs); args.RetVal = loadingArgs.Cancel; break; case 1: // WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION var newWindowArgs = new WebViewNewWindowEventArgs(uri, ""); openNewWindow?.Invoke(this, newWindowArgs); args.RetVal = newWindowArgs.Cancel; break; } }
void OnAboutToFinish(object o, GLib.SignalArgs args) { // HACK: ugly workaround for GStreamer's bug http://bugzilla.gnome.org/722769 // long story short, AboutToFinish signal firing twice for the same play of the same track // causes problems when Gapless Enabled because of RequestNextTrack event being fired twice if (about_to_finish_time_stamp == CurrentTrackTimeStamp) { return; } about_to_finish_time_stamp = CurrentTrackTimeStamp; // This is needed to make Shuffle-by-* work. // Shuffle-by-* uses the LastPlayed field to determine what track in the grouping to play next. // Therefore, we need to update this before requesting the next track. // // This will be overridden by IncrementLastPlayed () called by // PlaybackControllerService's EndOfStream handler. CurrentTrack.UpdateLastPlayed(); next_track_set.Reset(); pending_uri = null; next_track_pending = true; OnEventChanged(PlayerEvent.RequestNextTrack); // Gapless playback with Playbin2 requires that the about-to-finish callback does not return until // the next uri has been set. Block here for a second or until the RequestNextTrack event has // finished triggering. if (!next_track_set.WaitOne(1000, false)) { Log.Warning("[Gapless]: Timed out while waiting for next track to be set."); next_track_set.Set(); } }
static void GotLocation(object sender, GLib.SignalArgs args) { var propObject = (Gst.Object)args.Args [0]; var location = (string)propObject["temp-location"]; Console.WriteLine("Temporary file: {0}", location); // Uncomment this line to keep the temporary file after the program exits // g_object_set (G_OBJECT (prop_object), "temp-remove", FALSE, NULL); }
// This function is called when an "application" message is posted on the bus. Here we retrieve the message posted by the HandleTags callback static void HandleApplication(object sender, GLib.SignalArgs args) { var msg = (Message)args.Args [0]; if (msg.Structure.Name.Equals("tags-changed")) { // If the message is the "tags-changed" (only one we are currently issuing), update the stream info GUI AnalyzeStreams(); } }
/// <summary> /// This function is called when an error message is posted on the bus /// </summary> static void HandleError(object o, GLib.SignalArgs args) { var msg = (Message)args.Args[0]; // Print error details on the screen msg.ParseError(out GLib.GException err, out string debug); Console.WriteLine($"Error received from element {msg.Src.Name}: {err.Message}"); Console.WriteLine("Debugging information: {0}", debug ?? "none"); _data.MainLoop.Quit(); }
// This function is called when an error message is posted on the bus static void HandleError (object sender, GLib.SignalArgs args) { GLib.GException err; string debug; var msg = (Message) args.Args[0]; // Print error details on the screen msg.ParseError (out err, out debug); Console.WriteLine ("Error received from element {0}: {1}", msg.Src.Name, err.Message); Console.WriteLine ("Debugging information: {0}", debug != null ? debug : "none"); MainLoop.Quit (); }
private bool SendToFocusWidget(GLib.SignalArgs args, Gdk.EventKey e) { var widget = window_shell.Focus; if (widget != null && widget.ProcessEvent(e)) { args.RetVal = true; return(true); } return(false); }
// This function is called when an error message is posted on the bus static void HandleError(object sender, GLib.SignalArgs args) { var msg = (Message)args.Args [0]; string debug; GLib.GException exc; msg.ParseError(out exc, out debug); Console.WriteLine(string.Format("Error received from element {0}: {1}", msg.Src.Name, exc.Message)); Console.WriteLine("Debugging information: {0}", debug); // Set the pipeline to READY (which stops playback) Playbin.SetState(State.Ready); }
private void VideoSink_OnBeginDraw(Element sink, GLib.SignalArgs args) { Dispatcher.Invoke(() => _d3DImageEx.Lock()); var renderTarget = _D3D11Scene.GetRenderTarget(); _ = sink.Emit("draw", renderTarget, (UInt32)2, (UInt64)0, (UInt64)0); Dispatcher.Invoke(() => { InvalidateD3DImage(); _d3DImageEx.Unlock(); }); }
// The appsink has received a buffer static void NewSample(object sender, GLib.SignalArgs args) { var sink = (Gst.App.AppSink)sender; // Retrieve the buffer var sample = sink.PullSample(); if (sample != null) { // The only thing we do in this example is print a * to indicate a received buffer Console.Write("*"); sample.Dispose(); } }
private void WebViewHandler_LoadChanged(object o, GLib.SignalArgs args) { var loadEvent = (int)args.Args[0]; switch (loadEvent) { case 2: // WEBKIT_LOAD_COMMITTED navigated?.Invoke(this, new WebViewLoadedEventArgs(Url)); break; case 3: // WEBKIT_LOAD_FINISHED documentLoaded?.Invoke(this, new WebViewLoadedEventArgs(Url)); break; } }
// This function is called when playbin has created the appsrc element, so we have a chance to configure it. static void SourceSetup (object sender, GLib.SignalArgs args) { var info = new Gst.Audio.AudioInfo (); var source = new Gst.App.AppSrc(((Element)args.Args [0]).Handle); Console.WriteLine ("Source has been created. Configuring."); AppSource = source; // Configure appsrc Gst.Audio.AudioChannelPosition[] position = {}; info.SetFormat (Gst.Audio.AudioFormat.S16, SampleRate, 1, position); var audioCaps = info.ToCaps (); source ["caps"] = audioCaps; source ["format"] = Format.Time; source.NeedData += StartFeed; source.EnoughData += StopFeed; }
// This function is called when the pipeline changes states. We use it to keep track of the current state. static void HandleStateChanged(object sender, GLib.SignalArgs args) { var msg = (Message)args.Args [0]; State oldState, newState, pendingState; msg.ParseStateChanged(out oldState, out newState, out pendingState); if (msg.Src == Playbin) { State = newState; Console.WriteLine("State set to {0}", Element.StateGetName(newState)); if (oldState == State.Ready && newState == State.Paused) { // For extra responsiveness, we refresh the GUI as soon as we reach the PAUSED state RefreshUI(); } } }
/// <summary> /// This function is called when playbin has created the appsrc element, so we have /// a chance to configure it. /// </summary> static void HandleSourceSetup(object o, GLib.SignalArgs args) { var pipeline = o as Pipeline; Console.WriteLine("Source has been created. Configuring."); //AppSource = (Element)args.Args[0]; _data.AppSource = new Gst.App.AppSrc(((Element)args.Args[0]).Handle);; // Configure appsrc var info = new Gst.Audio.AudioInfo(); Gst.Audio.AudioChannelPosition[] position = { }; info.SetFormat(Gst.Audio.AudioFormat.S16, SAMPLE_RATE, 1, position); var audioCaps = info.ToCaps(); _data.AppSource["caps"] = audioCaps; _data.AppSource["format"] = Format.Time; _data.AppSource.NeedData += HandleStartFeed; _data.AppSource.EnoughData += HandleStopFeed; // AppSource.Connect("need-data", HandleStartFeed); // AppSource.Connect("enough-data", HandleStopFeed); audioCaps.Dispose(); }
void FocusNextItem(GLib.SignalArgs ev) { if (focusedViewIndex >= responderViewChain.Count - 1) { //leave element Window.ResignFirstResponder(); if (ev != null) { ev.RetVal = false; } } else { focusedViewIndex++; if (((NSView)FocusedView).Hidden) { FocusNextItem(ev); } else { Window.MakeFirstResponder((NSView)FocusedView); } } }
void FocusPreviousItem(GLib.SignalArgs ev) { if (focusedViewIndex <= 0) { //leave element Window.ResignFirstResponder(); if (ev != null) { ev.RetVal = false; } } else { focusedViewIndex--; if (((NSView)FocusedView).Hidden) { FocusPreviousItem(ev); } else { Window.MakeFirstResponder((NSView)FocusedView); } } }
private static void onCrossing(object o, GLib.SignalArgs args) { Actor actor = (Actor)o; bool isEnter = ((Event)args.Args[0]).Type() == EventType.Enter; float zpos; if (isEnter) { zpos = -250.0f; } else { zpos = 0.0f; } actor.SaveEasingState(); actor.EasingDuration = 500; actor.EasingMode = AnimationMode.EaseOutBounce; actor.ZPosition = zpos; actor.RestoreEasingState(); args.RetVal = false; }
void PerformIncrementHandler(object sender, GLib.SignalArgs args) { performIncrement?.Invoke(this, args); }
private void Dialog_Response(object o, GLib.SignalArgs args) { args.RetVal = true; Hide(); ListaPedidos.UnselectAll(); }
void PerformConfirmHandler(object sender, GLib.SignalArgs args) { performConfirm?.Invoke(this, args); }
void PerformShowMenuHandler(object sender, GLib.SignalArgs args) { performShowMenu?.Invoke(this, args); }
void PerformShowDefaultUIHandler(object sender, GLib.SignalArgs args) { performShowDefaultUI?.Invoke(this, args); }
void PerformShowAlternateUIHandler(object sender, GLib.SignalArgs args) { performShowAlternateUI?.Invoke(this, args); }
void PerformRaiseHandler(object sender, GLib.SignalArgs args) { performRaise?.Invoke(this, args); }
private void WebViewHandler_TitleChanged(object o, GLib.SignalArgs args) { titleChanged?.Invoke(this, new WebViewTitleEventArgs(DocumentTitle)); }
private void WebViewHandler_ContextMenu(object o, GLib.SignalArgs args) { args.RetVal = !BrowserContextMenuEnabled; }
void PerformPressHandler(object sender, GLib.SignalArgs args) { performPress?.Invoke(this, args); }