public GhostPad(string name, Pad target) : base(IntPtr.Zero) { IntPtr native_name = OldGLib.Marshaller.StringToPtrGStrdup (name); this.raw = gst_ghost_pad_new (native_name, target.ToIntPtr ()); OldGLib.Marshaller.Free (native_name); }
public Pad GetStaticPad(string name) { IntPtr native_name = OldGLib.Marshaller.StringToPtrGStrdup (name); Pad ret = new Pad (gst_element_get_static_pad (raw, native_name)); OldGLib.Marshaller.Free (native_name); return ret; }
public bool SetTarget(Pad target) { bool ret = gst_ghost_pad_set_target (raw, target.ToIntPtr ()); return ret; }
private PadProbeReturn SetNewTrackLocationBlocked(IntPtr pad, IntPtr probe_info, IntPtr user_data) { Hyena.ThreadAssist.Spawn( delegate () { //Hyena.Log.Information ("[Streamrecorder] changing location blocked" + (Hyena.ThreadAssist.InMainThread ? " in main thread" : " in new thread")); GCHandle gch = GCHandle.FromIntPtr (user_data); object[] user_objects = (object[])gch.Target; PadProbeInfo info = (PadProbeInfo) Marshal.PtrToStructure (probe_info, typeof (PadProbeInfo)); Pad teepad = new Pad ((IntPtr) user_objects[0]); string new_location = (string)user_objects [1]; IntPtr active_pad = (IntPtr)user_objects [2]; encoder_bin.SendEvent (Marshaller.NewEOSEvent ()); encoder_bin.SetState (State.Null); if (encoder_bin.GetState () == StateChangeReturn.Success) { //Hyena.Log.Information ("[Streamrecorder] setting new location: " + new_location); file_sink.Location = new_location; } else { Hyena.Log.Debug ("[Streamrecorder] State change failed"); } encoder_bin.SetState (State.Playing); teepad.RemoveProbe (info.id); if (active_pad != IntPtr.Zero) outputselector.SetProperty ("active-pad", new Element (active_pad)); if (!new_location.Equals (empty_file)) { Hyena.Log.Debug ("[Streamrecorder] <SetNewTrackLocationBlocked> Recording started"); is_recording = true; } }); return PadProbeReturn.GST_PAD_PROBE_OK; }
/// <summary> /// Creates a new recoding pipeline with the best (by user preference) available encoder and attaches it /// to the audiotee /// </summary> /// <returns> /// A <see cref="System.Boolean"/>, true if the pipeline was successfully created, false otherwise. /// </returns> public bool Create() { string bin_description = BuildPipeline (); try { audiotee = new PlayerAudioTee (ServiceManager.PlayerEngine.ActiveEngine.GetBaseElements ()[2]); if (bin_description.Equals ("")) { return false; } encoder_bin = Parse.BinFromDescription (bin_description, true); // Hyena.Log.Debug ("DEBUG bin to string: " + encoder_bin.ToString()); tagger = new TagSetter (encoder_bin.GetByInterface (TagSetter.GetType ())); file_sink = encoder_bin.GetByName ("file_sink").ToFileSink (); file_sink.Location = empty_file; file_sink.SetBooleanProperty ("sync", true); file_sink.SetBooleanProperty ("async", false); OldGLib.Object.GetObject (file_sink.ToIntPtr ()).AddNotification ("allow-overwrite", OnAllowOverwrite); ghost_pad = encoder_bin.GetStaticPad ("sink").ToGhostPad (); outputselector = encoder_bin.GetByName ("sel"); Pad filesinkpad = file_sink.GetStaticPad ("sink"); selector_filepad = filesinkpad.GetPeer (); Element fake_sink = encoder_bin.GetByName ("fake_sink"); Pad fakesinkpad = fake_sink.GetStaticPad ("sink"); selector_fakepad = fakesinkpad.GetPeer (); audiotee.AddBin (encoder_bin, ServiceManager.PlayerEngine.CurrentState == PlayerState.Playing); Hyena.Log.Debug ("[Recorder] Recorder attached"); } catch (Exception e) { Hyena.Log.InformationFormat ("[Streamrecorder] An exception occurred during pipeline construction: {0}", bin_description); Hyena.Log.Debug (e.Message); Hyena.Log.Debug (e.StackTrace); return false; } return true; }
public bool RemovePad(Pad pad) { bool ret = gst_element_remove_pad (raw, pad.ToIntPtr ()); return ret; }
public bool AddPad(Pad pad) { return gst_element_add_pad (raw, pad.ToIntPtr ()); }
public bool AddPad(Pad pad) { return(gst_element_add_pad(raw, pad.ToIntPtr())); }
public bool RemovePad(Pad pad) { bool ret = gst_element_remove_pad(raw, pad.ToIntPtr()); return(ret); }