public static Gst.Interfaces.NavigationMessageType MessageGetType(Gst.Message message) { int raw_ret = gst_navigation_message_get_type(message == null ? IntPtr.Zero : message.Handle); Gst.Interfaces.NavigationMessageType ret = (Gst.Interfaces.NavigationMessageType)raw_ret; return(ret); }
void OnBusSyncMessage(object o, SyncMessageArgs sargs) { Gst.Message msg = sargs.Message; if (!Gst.Video.Global.IsVideoOverlayPrepareWindowHandleMessage(msg)) { return; } Element src = msg.Src as Element; if (src == null) { return; } try { src["force-aspect-ratio"] = true; } catch (PropertyNotFoundException) { /* Don't care */ } Element overlay = (src as Gst.Bin)?.GetByInterface(VideoOverlayAdapter.GType); if (overlay == null) { Console.WriteLine("Overlay is null"); return; } VideoOverlayAdapter adapter = new VideoOverlayAdapter(overlay.Handle); adapter.WindowHandle = _videoPanelHandle; adapter.HandleEvents(true); }
public static void ParseRecordToggled(Gst.Message message, out Gst.Interfaces.MixerTrack track, out bool record) { IntPtr native_ptr; gst_mixer_message_parse_record_toggled(message == null ? IntPtr.Zero : message.Handle, out native_ptr, out record); track = (MixerTrack)GLib.Object.GetObject(native_ptr, false); }
public static void ParseOptionsListChanged(Gst.Message message, out Gst.Interfaces.MixerOptions options) { IntPtr native_options; gst_mixer_message_parse_options_list_changed(message == null ? IntPtr.Zero : message.Handle, out native_options); options = (MixerOptions)GLib.Object.GetObject(native_options, false); }
void OnBusSyncMessage(object o, SyncMessageArgs args) { Bus bus = o as Bus; Gst.Message msg = args.Message; if (!Gst.Video.Global.IsVideoOverlayPrepareWindowHandleMessage(msg)) { return; } Element src = msg.Src as Element; if (src == null) { return; } src = _pipeline; Element overlay = null ?? (src as Gst.Bin)?.GetByInterface(VideoOverlayAdapter.GType); Assert(overlay != null, "Overlay is null"); VideoOverlayAdapter adapter = new VideoOverlayAdapter(overlay.Handle); adapter.WindowHandle = _videoPanelHandle; adapter.HandleEvents(true); }
public static void ParseOptionChanged(Gst.Message message, out Gst.Interfaces.MixerOptions options, out string value) { IntPtr native_value; IntPtr native_options; gst_mixer_message_parse_option_changed(message == null ? IntPtr.Zero : message.Handle, out native_options, out native_value); options = (MixerOptions)GLib.Object.GetObject(native_options, false); value = GLib.Marshaller.Utf8PtrToString(native_value); }
/// <summary> /// This function is called when an error message is posted on the bus /// </summary> void ErrorCb(object o, GLib.SignalArgs args) { Gst.Message msg = (Gst.Message)args.Args[0]; msg.ParseError(out GException err, out string debug); Console.WriteLine($"Error received from element {msg.Src.Name}: {err.Message}"); Console.WriteLine("Debugging information: {0}", debug ?? "(none)"); _playbin.SetState(State.Ready); }
public static string GetInstallerDetail(Gst.Message msg) { if (!IsMissingPluginMessage(msg)) { throw new ApplicationException(); } IntPtr raw_ret = gst_missing_plugin_message_get_installer_detail(msg.Handle); string ret = GLib.Marshaller.PtrToStringGFree(raw_ret); return(ret); }
bool OnBusMessage(object o, Gst.Message message) { var msgSrc = message.Src as Element; switch (message.Type) { case MessageType.Eos: Console.WriteLine("EOS"); break; case MessageType.Error: message.ParseError(out GLib.GException err, out string debug); $"Error received from element {message.Src.Name}: {err.Message}".PrintErr(); String.Format("Debugging information {0}", debug ?? "(none)").PrintErr(); break; case MessageType.DeviceAdded: { var dev = message.ParseDeviceAdded(); _devices.Add(dev.DisplayName); var cam = _pipeline.GetByName("camsource"); Console.WriteLine(cam["device-name"]); if ((string)cam["device-name"] == null) { ShowCamera(dev.DisplayName); } break; } case MessageType.DeviceRemoved: { string selectedDevice = (string)listBox1.SelectedItem; var dev = message.ParseDeviceRemoved(); _devices.Remove(dev.DisplayName); if (listBox1.Items.Count == 0) { ShowCamera(null); } else if (selectedDevice == dev.DisplayName) { var newDev = _devMon.Devices.Where(d => d.DeviceClass == "Video/Source").FirstOrDefault(); ShowCamera(newDev.DisplayName); } break; } default: break; } return(true); }
void OnBusMessage(object o, MessageArgs margs) { Gst.Message message = margs.Message; switch (message.Type) { case MessageType.Error: message.ParseError(out GLib.GException err, out string debug); Console.WriteLine($"Error message: {debug}"); _pipelineOK = false; break; case MessageType.Eos: Console.WriteLine("EOS"); break; } }
public static void ParseVolumeChanged(Gst.Message message, out Gst.Interfaces.MixerTrack track, out int[] volumes) { IntPtr native_track; IntPtr native_volumes; int n_native_volumes; gst_mixer_message_parse_volume_changed(message == null ? IntPtr.Zero : message.Handle, out native_track, out native_volumes, out n_native_volumes); track = (MixerTrack)GLib.Object.GetObject(native_track, false); volumes = new int[n_native_volumes]; for (int i = 0; i < n_native_volumes; i++) { volumes[i] = Marshal.ReadInt32(native_volumes, i * 4); } GLib.Marshaller.Free(native_volumes); }
// may try to use to find EOS on pipeline private static bool BusCb (Bus bus, Message message) { switch (message.Type) { case MessageType.Error: Enum err; string msg; message.ParseError (out err, out msg); Console.WriteLine ("Gstreamer error: {0}", msg); //loop.Quit (); break; case MessageType.Eos: //_isRecording = false; //SaveAsWav (_path); //loop.Quit(); Console.WriteLine ("End of stream"); break; } return true; }
private void OnBusSyncMessage(object o, SyncMessageArgs sargs) { Bus bus = o as Bus; Gst.Message msg = sargs.Message; if (!Gst.Video.Global.IsVideoOverlayPrepareWindowHandleMessage(msg)) { bus.Dispose(); msg.Dispose(); return; } Element src = msg.Src as Element; if (src == null) { bus.Dispose(); msg.Dispose(); return; } try { src["force-aspect-ratio"] = true; } catch (PropertyNotFoundException ex) { Console.WriteLine(ex.Message, ex); } Element overlay = (_pipeline)?.GetByInterface(VideoOverlayAdapter.GType); var _adapter = new VideoOverlayAdapter(overlay.Handle); _adapter.WindowHandle = _handle; _adapter.HandleEvents(true); bus.Dispose(); msg.Dispose(); overlay?.Dispose(); src?.Dispose(); }
private bool OnBusMessage (Bus bus, Message msg) { switch (msg.Type) { case MessageType.Eos: Close (false); OnEventChanged (PlayerEvent.EndOfStream); OnEventChanged (PlayerEvent.RequestNextTrack); break; case MessageType.StateChanged: State old_state, new_state, pending_state; msg.ParseStateChanged (out old_state, out new_state, out pending_state); HandleStateChange (old_state, new_state, pending_state); break; case MessageType.Buffering: int buffer_percent; msg.ParseBuffering (out buffer_percent); HandleBuffering (buffer_percent); break; case MessageType.Tag: Pad pad; TagList tag_list; msg.ParseTag (out pad, out tag_list); HandleTag (pad, tag_list); break; case MessageType.Error: Enum error_type; string err_msg, debug; msg.ParseError (out error_type, out err_msg, out debug); // TODO: What to do with the error? break; } return true; }
private bool BusCb(Bus bus, Message message) { switch (message.Type) { case MessageType.Error: string err = String.Empty; message.ParseError (out err); Console.WriteLine ("Gstreamer error: {0}", err); Stop(); break; case MessageType.Eos: Stop(); break; } return true; }
public static bool IsMissingPluginMessage(Gst.Message msg) { return(msg != null && gst_is_missing_plugin_message(msg.Handle)); }
private bool OnBusMessage (Bus bus, Message msg) { switch (msg.Type) { case MessageType.Tag: Pad pad; TagList tag_list; msg.ParseTag (out pad, out tag_list); foreach (var name in tag_list.Tags) { if (name == "beats-per-minute") { if (tag_list.GetTagSize (name) < 1) continue; var tag = tag_list.GetTag (name); foreach (var val in tag) { if (val is double) { double bpm = (double)val; int rounded = (int) Math.Round (bpm); if (!bpm_histogram.ContainsKey(rounded)) { bpm_histogram[rounded] = 1; } else { bpm_histogram[rounded]++; } } break; } } } tag_list.Dispose (); break; case MessageType.Error: Enum error_type; string err_msg, debug; msg.ParseError (out error_type, out err_msg, out debug); IsDetecting = false; Log.ErrorFormat ("BPM Detection error", err_msg); break; case MessageType.Eos: IsDetecting = false; pipeline.SetState (State.Null); SafeUri uri = current_uri; int best_bpm = -1, best_bpm_count = 0; foreach (int bpm in bpm_histogram.Keys) { int count = bpm_histogram[bpm]; if (count > best_bpm_count) { best_bpm_count = count; best_bpm = bpm; } } Reset (); var handler = FileFinished; if (handler != null) { handler (this, new BpmEventArgs (uri, best_bpm)); } break; } return true; }
private bool OnBusMessage (Bus bus, Message msg) { switch (msg.Type) { case MessageType.Eos: StopIterating (); Close (false); OnEventChanged (PlayerEvent.EndOfStream); OnEventChanged (PlayerEvent.RequestNextTrack); break; case MessageType.StateChanged: if (msg.Src == playbin) { State old_state, new_state, pending_state; msg.ParseStateChanged (out old_state, out new_state, out pending_state); HandleStateChange (old_state, new_state, pending_state); } break; case MessageType.Buffering: int buffer_percent; msg.ParseBuffering (out buffer_percent); HandleBuffering (buffer_percent); break; case MessageType.Tag: Pad pad; TagList tag_list; msg.ParseTag (out pad, out tag_list); HandleTag (pad, tag_list); break; case MessageType.Error: Enum error_type; string err_msg, debug; msg.ParseError (out error_type, out err_msg, out debug); HandleError (error_type, err_msg, debug); break; case MessageType.Element: if (MissingPluginMessage.IsMissingPluginMessage (msg)) { string detail = MissingPluginMessage.GetInstallerDetail (msg); if (detail == null) return false; if (missing_details.Contains (detail)) { Log.DebugFormat ("Ignoring missing element details, already prompted ('{0}')", detail); return false; } Log.DebugFormat ("Saving missing element details ('{0}')", detail); missing_details.Add (detail); Log.Error ("Missing GStreamer Plugin", MissingPluginMessage.GetDescription (msg), true); InstallPluginsContext install_context = new InstallPluginsContext (); Install.InstallPlugins (missing_details.ToArray (), install_context, OnInstallPluginsReturn); } else if (msg.Src == playbin && msg.Structure.Name == "playbin2-stream-changed") { HandleStreamChanged (); } else if (NavigationMessage.MessageGetType (msg) == NavigationMessageType.CommandsChanged) { dvd_manager.HandleCommandsChanged (playbin); } break; case MessageType.Application: string name; Structure s = msg.Structure; name = s.Name; if (String.IsNullOrEmpty (name) && name == "stream-changed") { video_manager.ParseStreamInfo (); } break; } return true; }
private bool OnBusMessage(Bus bus, Message msg) { switch (msg.Type) { case MessageType.Eos: StopIterating (); Close (false); OnEventChanged (PlayerEvent.EndOfStream); OnEos (); break; case MessageType.StateChanged: if (msg.Src == playbin) { State old_state, new_state, pending_state; msg.ParseStateChanged (out old_state, out new_state, out pending_state); HandleStateChange (old_state, new_state, pending_state); } break; case MessageType.Buffering: int buffer_percent = msg.ParseBuffering (); HandleBuffering (buffer_percent); break; case MessageType.Tag: TagList tag_list = msg.ParseTag (); tag_list.Foreach (HandleTag); break; case MessageType.Error: GLib.GException err; string debug; msg.ParseError (out err, out debug); HandleError (err); break; case MessageType.Element: if (Gst.PbUtils.Global.IsMissingPluginMessage (msg)) { string detail = Gst.PbUtils.Global.MissingPluginMessageGetInstallerDetail (msg); if (detail == null) return false; if (missing_details.Contains (detail)) { Log.DebugFormat ("Ignoring missing element details, already prompted ('{0}')", detail); return false; } Log.DebugFormat ("Saving missing element details ('{0}')", detail); missing_details.Add (detail); Log.Error ("Missing GStreamer Plugin", Gst.PbUtils.Global.MissingPluginMessageGetDescription (msg), true); InstallPluginsContext install_context = new InstallPluginsContext (); Gst.PbUtils.Global.InstallPluginsAsync (missing_details.ToArray (), install_context, OnInstallPluginsReturn); } else if (NavigationAdapter.MessageGetType (msg) == NavigationMessageType.CommandsChanged) { dvd_manager.HandleCommandsChanged (playbin); } break; case MessageType.StreamStart: HandleStreamStart (); break; case MessageType.Application: string name; Structure s = msg.Structure; name = s.Name; if (String.IsNullOrEmpty (name) && name == "stream-changed") { video_manager.ParseStreamInfo (); } break; } return true; }
private bool OnBusMessage(Bus bus, Message msg) { switch (msg.Type) { case MessageType.Eos: pipeline.SetState (State.Null); timer.Stop (); OnFinished (); break; case MessageType.StateChanged: State old_state, new_state, pending_state; msg.ParseStateChanged (out old_state, out new_state, out pending_state); if (old_state == State.Ready && new_state == State.Paused && pending_state == State.Playing) { string mimetype = ProbeMimeType (); if (mimetype == null) return true; Log.InformationFormat ("Ripper : Found Mime Type for encoded content: {0}", mimetype); RefreshTrackMimeType (mimetype); } break; case MessageType.Error: GLib.GException err; string debug; msg.ParseError (out err, out debug); RaiseError (current_track, String.Format ("{0} : {1}", err.Message, debug)); timer.Stop (); break; } return true; }
void ButtonOpenClicked(object sender, EventArgs args) { FileChooserDialog dialog = new FileChooserDialog("Open", this, FileChooserAction.Open, new object[] { "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept }); dialog.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (dialog.Run() == (int)ResponseType.Accept) { _pipelineOK = false; if (_playbin != null) { _playbin.SetState(Gst.State.Null); } else { _playbin = ElementFactory.Make("playbin", "playbin"); } _scale.Value = 0; if (_playbin == null) { Console.WriteLine("Unable to create element 'playbin'"); } _playbin.Bus.EnableSyncMessageEmission(); _playbin.Bus.AddSignalWatch(); _playbin.Bus.SyncMessage += delegate(object bus, SyncMessageArgs sargs) { Gst.Message msg = sargs.Message; if (!Gst.Video.GlobalVideo.IsVideoOverlayPrepareWindowHandleMessage(msg)) { return; } Element src = msg.Src as Element; if (src == null) { return; } try { src["force-aspect-ratio"] = true; } catch (PropertyNotFoundException) {} Element overlay = null; if (src is Gst.Bin) { overlay = ((Gst.Bin)src).GetByInterface(VideoOverlayAdapter.GType); } VideoOverlayAdapter adapter = new VideoOverlayAdapter(overlay.Handle); adapter.WindowHandle = _xWindowId; adapter.HandleEvents(true); }; _playbin.Bus.Message += delegate(object bus, MessageArgs margs) { Message message = margs.Message; switch (message.Type) { case Gst.MessageType.Error: GLib.GException err; string msg; message.ParseError(out err, out msg); Console.WriteLine(String.Format("Error message: {0}", msg)); _pipelineOK = false; break; case Gst.MessageType.Eos: Console.WriteLine("EOS"); break; } }; switch (System.Environment.OSVersion.Platform) { case PlatformID.Unix: _playbin["uri"] = "file://" + dialog.Filename; break; case PlatformID.Win32NT: case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.WinCE: _playbin["uri"] = "file:///" + dialog.Filename.Replace("\\", "/"); break; } StateChangeReturn sret = _playbin.SetState(Gst.State.Playing); if (sret == StateChangeReturn.Async) { State state, pending; sret = _playbin.GetState(out state, out pending, Constants.SECOND * 5L); } if (sret == StateChangeReturn.Success) { Console.WriteLine("State change successful"); _pipelineOK = true; } else { Console.WriteLine("State change failed for {0} ({1})\n", dialog.Filename, sret); } } dialog.Destroy(); }
private static void HandleMessage(Message msg) { switch (msg.Type) { case MessageType.Error: 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); terminate = true; break; case MessageType.Eos: Console.WriteLine("End-Of-Stream reached."); terminate = true; break; case MessageType.DurationChanged: // The duration has changed, mark the current one as invalid duration = -1; break; case MessageType.StateChanged: // We are only interested in state-changed messages from the pipeline if (msg.Src == playbin) { State oldState, newState, pendingState; msg.ParseStateChanged(out oldState, out newState, out pendingState); Console.WriteLine ("Pipeline state changed from {0} to {1}:", Element.StateGetName(oldState), Element.StateGetName(newState)); // Remember wheather we are in the PLAYING state playing = newState == State.Playing; if (playing) { // We have just moved to PLAYING. Check if seeking is possible var query = Query.NewSeeking (Format.Time); long start, end; Format fmt = Format.Time; if (playbin.Query (query)) { query.ParseSeeking (out fmt, out seekEnabled, out start, out end); if (seekEnabled) { Console.WriteLine ("Seeking is ENABLED from {0} to {1}", new TimeSpan(start), new TimeSpan(end)); } else { Console.WriteLine ("Seeking DISABLED for this stream."); } } else { Console.WriteLine ("Seeking query failed."); } } } break; default: // We should not reach here Console.WriteLine ("Unexpected message received."); break; } }
private bool OnBusMessage (Bus bus, Message msg) { switch (msg.Type) { case MessageType.Eos: pipeline.SetState (State.Null); pipeline = null; is_transcoding = false; timer.Stop (); RaiseTrackFinished (current_track, output_uri); break; case MessageType.Error: Enum error_type; string err_msg, debug; is_transcoding = false; timer.Stop (); msg.ParseError (out error_type, out err_msg, out debug); RaiseError (current_track, String.Format ("{0} : {1}", err_msg, debug)); timer.Stop (); break; default: break; } return true; }
public static bool ParseMouseOver(Gst.Message msg, out uint cur_angle, out uint n_angles) { return(gst_navigation_message_parse_angles_changed(msg.Handle, out cur_angle, out n_angles)); }
private bool OnBusMessage(Bus bus, Message msg) { switch (msg.Type) { case MessageType.Tag: TagList tag_list = msg.ParseTag (); foreach (var name in tag_list.Tags) { if (name == "beats-per-minute") { if (tag_list.GetTagSize (name) < 1) { continue; } tag_list.Foreach (delegate(TagList list, string tagname) { for (uint i = 0; i < tag_list.GetTagSize (tagname); i++) { GLib.Value val = tag_list.GetValueIndex (tagname, i); if (val.Val is double) { double bpm = (double)val; int rounded = (int)Math.Round (bpm); if (!bpm_histogram.ContainsKey (rounded)) { bpm_histogram [rounded] = 1; } else { bpm_histogram [rounded]++; } } val.Dispose (); } }); } } break; case MessageType.Error: string debug; GLib.GException error; msg.ParseError (out error, out debug); IsDetecting = false; Log.ErrorFormat ("BPM Detection error: {0}", error.Message); break; case MessageType.Eos: IsDetecting = false; pipeline.SetState (State.Null); SafeUri uri = current_uri; int best_bpm = -1, best_bpm_count = 0; foreach (int bpm in bpm_histogram.Keys) { int count = bpm_histogram[bpm]; if (count > best_bpm_count) { best_bpm_count = count; best_bpm = bpm; } } Reset (); var handler = FileFinished; if (handler != null) { handler (this, new BpmEventArgs (uri, best_bpm)); } break; } return true; }
void ButtonOpenClicked (object sender, EventArgs args) { FileChooserDialog dialog = new FileChooserDialog ("Open", this, FileChooserAction.Open, new object[] { "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept }); dialog.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal)); if (dialog.Run () == (int) ResponseType.Accept) { _pipelineOK = false; if (_playbin != null) { _playbin.SetState (Gst.State.Null); } else { _playbin = new PlayBin2 (); } _scale.Value = 0; if (_playbin == null) Console.WriteLine ("Unable to create element 'playbin'"); _playbin.Bus.EnableSyncMessageEmission (); _playbin.Bus.AddSignalWatch (); _playbin.Bus.SyncMessage += delegate (object bus, SyncMessageArgs sargs) { Gst.Message msg = sargs.Message; if (msg == null || msg.Type != Gst.MessageType.Element || msg.Structure == null || msg.Structure.Name == null || !msg.Structure.Name.Equals ("prepare-xwindow-id")) return; Element src = msg.Src as Element; if (src == null) return; if (src.HasProperty ("force-aspect-ratio")) src["force-aspect-ratio"] = true; (src as XOverlay).XwindowId = _xWindowId; (src as XOverlay).HandleEvents (true); }; _playbin.Bus.Message += delegate (object bus, MessageArgs margs) { Message message = margs.Message; switch (message.Type) { case Gst.MessageType.Error: Enum err; string msg; message.ParseError (out err, out msg); Console.WriteLine (String.Format ("Error message: {0}", msg)); _pipelineOK = false; break; case Gst.MessageType.Eos: Console.WriteLine ("EOS"); break; } }; switch (System.Environment.OSVersion.Platform) { case PlatformID.Unix: _playbin["uri"] = "file://" + dialog.Filename; break; case PlatformID.Win32NT: case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.WinCE: _playbin["uri"] = "file:///" + dialog.Filename.Replace("\\","/"); break; } StateChangeReturn sret = _playbin.SetState (Gst.State.Playing); if (sret == StateChangeReturn.Async) { State state, pending; sret = _playbin.GetState (out state, out pending, Clock.Second * 5); } if (sret == StateChangeReturn.Success) { Console.WriteLine ("State change successful"); _pipelineOK = true; } else { Console.WriteLine ("State change failed for {0} ({1})\n", dialog.Filename, sret); } } dialog.Destroy (); }
private bool BusCb(Bus bus, Message message) { switch (message.Type) { case MessageType.Error: Enum err; string msg; message.ParseError(out err, out msg); if (err is Gst.ResourceError && (Gst.ResourceError)err == Gst.ResourceError.NotFound) { if (playRetries < 5) { Console.WriteLine("Stream not found. Retrying..."); System.Threading.Thread.Sleep(1000); playRetries++; Play(); return true; } else { Console.WriteLine("Exceeded max play retires."); } } Console.WriteLine("Gstreamer error: " + err.ToString() + " " + msg); loop.Quit(); //throw new Exception(msg); break; case MessageType.Eos: EventHandler handler = Stopped; if(handler != null) handler(this, EventArgs.Empty); break; case MessageType.Element: if (message.Structure.Name == "progress") { double progress = (double)message.Structure["percent-double"]; long curTime; long duration; Gst.Format format = Gst.Format.Time; bin.QueryPosition(ref format, out curTime); bin.QueryDuration(ref format, out duration); ProgressEventHandler progressHandler = Progress; if (progressHandler != null) progressHandler(this, (int)(curTime / 1000000000), (int)(duration / 1000000000), progress); } break; default: //File.AppendAllLines("log.txt", new string[] { message.Type.ToString() }); break; } return true; }
private void OnMessage(Gst.Message message) { switch (message.Type) { case MessageType.StateChanged: State oldstate, newstate, pendingstate; message.ParseStateChanged(out oldstate, out newstate, out pendingstate); System.Console.WriteLine($"[StateChange] From {oldstate} to {newstate} pending at {pendingstate}"); break; case MessageType.StreamStatus: Element owner; StreamStatusType type; message.ParseStreamStatus(out type, out owner); System.Console.WriteLine($"[StreamStatus] Type {type} from {owner}"); break; case MessageType.DurationChanged: long duration; Pipeline.QueryDuration(Format.Time, out duration); System.Console.WriteLine($"[DurationChanged] New duration is {(duration / Gst.Constants.SECOND)} seconds"); break; case MessageType.ResetTime: ulong runningtime = message.ParseResetTime(); System.Console.WriteLine($"[ResetTime] Running time is {runningtime}"); break; case MessageType.AsyncDone: ulong desiredrunningtime = message.ParseAsyncDone(); System.Console.WriteLine($"[AsyncDone] Running time is {desiredrunningtime}"); break; case MessageType.NewClock: Clock clock = message.ParseNewClock(); System.Console.WriteLine($"[NewClock] {clock}"); break; case MessageType.Buffering: int percent = message.ParseBuffering(); System.Console.WriteLine($"[Buffering] {percent}% done"); if (!IsLive) { if (percent < 100) { Pipeline.SetState(State.Paused); } else { Pipeline.SetState(State.Playing); } break; } break; case MessageType.Tag: TagList list = message.ParseTag(); System.Console.WriteLine($"[Tag] Information in scope {list.Scope} is {list.ToString()}"); break; case MessageType.Error: GLib.GException gerror; string debug; message.ParseError(out gerror, out debug); System.Console.WriteLine($"[Error] {gerror.Message}, debug information {debug}."); break; case MessageType.Eos: System.Console.WriteLine("[Eos] Playback has ended."); break; default: System.Console.WriteLine($"[Recv] {message.Type}"); break; } }
private bool OnBusMessage(Bus bus, Message message) { switch (message.Type) { case MessageType.Error: Enum err; string msg; message.ParseError(out err, out msg); Console.WriteLine("Gstreamer error: {0}\n{1}", msg, message.Structure.Get("debug")); break; case MessageType.Eos: if (_currentTrackIndex+1 < _trackArray.Length) { _playBin.SetState(State.Ready); OnTrackChanged(new TrackChangedEventArgs { NewTrack = _trackArray[_currentTrackIndex + 1], OldTrack = _trackArray[_currentTrackIndex] }); _playBin.Uri = PathStringToUri(_trackArray[++_currentTrackIndex].Path); _playBin.SetState(State.Playing); } break; /*case MessageType.StateChanged: State oldState; State newState; State pendingState; message.ParseStateChanged(out oldState, out newState, out pendingState); Console.WriteLine("Gstreamer {0} message: oldState: {1} newState: {2} pendingState: {3}", message.Type, oldState, newState, pendingState); break;*/ case MessageType.StreamStatus: StreamStatusType streamStatusType; Element owner; message.ParseStreamStatus(out streamStatusType, out owner); Console.WriteLine("Gstreamer {0} message: type {1} owner {2}", message.Type, streamStatusType, owner); break; case MessageType.Tag: break; /*default: Console.WriteLine("Gstreamer {0} message: {1}", message.Type, message); break;*/ } return true; }
public static bool ParseMouseOver(Gst.Message msg, out bool active) { return(gst_navigation_message_parse_mouse_over(msg.Handle, out active)); }