public ParseError ( GLib &error, string &debug ) : void | ||
error | GLib | |
debug | string | |
리턴 | void |
// 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 bool BusCall (Bus bus, Message message) { switch (message.Type) { case MessageType.Error: string msg; Enum err; message.ParseError (out err, out msg); Console.WriteLine ("Gstreamer error: {0}", msg); loop.Quit(); break; case MessageType.Eos: Console.WriteLine ("End-of-stream"); loop.Quit(); break; default: Console.WriteLine ("Entered BusCall:\t{0}", message.Type); break; } return true; }
private static 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); loop.Quit (); break; case MessageType.Eos: if (song_idx >= songs.Length) { Console.WriteLine ("Thank you, come again"); loop.Quit (); } else { play.SetState (State.Null); play.Uri = songs[song_idx++]; play.SetState (State.Playing); } 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; }
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 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; }
private bool OnBusMessage (Bus bus, Message message) { switch (message.Type) { case MessageType.Error: string msg; Enum err; message.ParseError (out err, out msg); GLib.Source.Remove (progress_timeout); OnError (msg); break; case MessageType.Eos: pipeline.SetState (State.Null); GLib.Source.Remove (progress_timeout); OnFinished(); 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; }
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 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.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; }
private static bool BusCb (Bus bus, Message message) { switch (message.Type) { case MessageType.Error: Enum err; string msg; message.ParseError (out err, out msg); Assert.Fail (String.Format ("Error message: {0}", msg)); loop.Quit (); break; case MessageType.Eos: loop.Quit (); 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 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 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 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; }