public void LinkMany(Element[] elements)
 {
     if (elements.Length < 1)
         return;
     this.Link (elements[0]);
     for (int i = 0; i < elements.Length - 1; i++) {
         elements[i].Link (elements[i + 1]);
     }
 }
        void IDelayedInitializeService.DelayedInitialize()
        {
            if (!has_karaoke) return;

            playbin = new Bin (ServiceManager.PlayerEngine.ActiveEngine.GetBaseElements ()[0]);
            audiobin = new Bin (ServiceManager.PlayerEngine.ActiveEngine.GetBaseElements ()[1]);
            audiotee = new Bin (ServiceManager.PlayerEngine.ActiveEngine.GetBaseElements ()[2]);

            if (playbin.IsNull ()) {
                Hyena.Log.Debug ("[Karaoke] Playbin is not yet initialized, cannot start Karaoke Mode");
            }

            audiokaraoke = audiobin.GetByName ("karaoke");

            if (audiokaraoke.IsNull ()) {
                audiokaraoke = ElementFactory.Make ("audiokaraoke","karaoke");

                //add audiokaraoke to audiobin
                audiobin.Add (audiokaraoke);

                //setting new audiobin sink to audiokaraoke sink
                GhostPad teepad = new GhostPad (audiobin.GetStaticPad ("sink").ToIntPtr ());
                Pad audiokaraokepad = audiokaraoke.GetStaticPad ("sink");
                teepad.SetTarget (audiokaraokepad);

                //link audiokaraoke sink and audiotee sink
                audiokaraoke.Link (audiotee);
            }

            if (!karaoke_enabled) {
                audiokaraoke.SetFloatProperty ("level", 0);
                audiokaraoke.SetFloatProperty ("mono-level", 0);
            } else {
                audiokaraoke.SetFloatProperty ("level", effect_level);
                audiokaraoke.SetFloatProperty ("mono-level", effect_level);
            }
        }
 public void SetProperty(string name, Element value)
 {
     IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
     IntPtr native_value = value.ToIntPtr ();
     gst_util_set_object_arg (raw, native_name, native_value);
     GLib.Marshaller.Free (native_name);
 }
        /// <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 void SetProperty(string name, Element value)
 {
     OldGLib.Value val = new OldGLib.Value (OldGLib.GType.Object);
     val.Val = OldGLib.Object.GetObject (value.ToIntPtr ());
     IntPtr native_name = OldGLib.Marshaller.StringToPtrGStrdup (name);
     g_object_set_property (raw, native_name, ref val);
     OldGLib.Marshaller.Free (native_name);
 }
 public bool Link(Element dest)
 {
     bool ret = gst_element_link (raw, dest.ToIntPtr ());
     return ret;
 }
 public void Unlink(Element dest)
 {
     gst_element_unlink (raw, dest.ToIntPtr ());
 }
Beispiel #8
0
 public bool Add (Element element)
 {
     return gst_bin_add (raw, element.ToIntPtr ());
 }
Beispiel #9
0
 public bool Remove (Element element)
 {
     return gst_bin_remove (raw, element.ToIntPtr ());
 }
Beispiel #10
0
 public void AddMany (Element[] elements)
 {
     foreach (Element element in elements) {
         Add (element);
     }
 }