Пример #1
0
        /// <summary>
        /// Helper function to really remove the bin from the audio player tee
        /// </summary>
        /// <param name="pad">
        /// A <see cref="IntPtr"/> referencing the pad that may need to be unblocked
        /// </param>
        /// <param name="blocked">
        /// A <see cref="System.Boolean"/> indicating if the pad is blocked
        /// </param>
        /// <param name="user_data">
        /// A <see cref="IntPtr"/> containing a reference to the bin
        /// </param>
        private void ReallyRemoveBin (IntPtr pad, bool blocked, IntPtr user_data)
        {
            Bin element = new Bin (user_data);

            Bin bin;
            Bin parent_bin;

            string element_path = element.GetPathString ();
            if (!element_path.Contains (":") && element_path.StartsWith ("/0x")) {
                Hyena.Log.Debug ("[Streamrecorder.PlayerAudioTee]<ReallyRemoveBin> element empty, assume disposed, exiting: " + element_path);
                return;
            }

            bin = new Bin (element.GetParent ().ToIntPtr ());
            bin.Ref ();

            parent_bin = new Bin (bin.GetParent ().ToIntPtr ());
            parent_bin.Remove (bin);

            bin.SetState (State.Null);
            bin.Remove (element);
            bin.UnRef ();

            attached = false;

            /* if we're supposed to be playing, unblock the sink */
            if (blocked) {
                Hyena.Log.Debug ("[Streamrecorder.PlayerAudioTee]<ReallyRemoveBin> unblocking pad after removing tee");
                new Pad (pad).SetBlockedAsync (false, AddRemoveBinDone, IntPtr.Zero);
            }

        }
        /// <summary>
        /// Helper function to really remove the bin from the audio player tee
        /// </summary>
        /// <param name="pad">
        /// A <see cref="IntPtr"/> referencing the pad that may need to be unblocked
        /// </param>
        /// <param name="blocked">
        /// A <see cref="System.Boolean"/> indicating if the pad is blocked
        /// </param>
        /// <param name="user_data">
        /// A <see cref="IntPtr"/> containing a reference to the bin
        /// </param>
        private PadProbeReturn ReallyRemoveBin(IntPtr pad, IntPtr probe_info, IntPtr user_data, bool blocked)
        {
            Bin element = new Bin (user_data);

            Bin bin;
            Bin parent_bin;

            string element_path = element.GetPathString ();
            if (!element_path.Contains (":") && element_path.StartsWith ("/0x")) {
                Hyena.Log.Debug ("[Streamrecorder.PlayerAudioTee]<ReallyRemoveBin> element empty, assume disposed, exiting: " + element_path);
                return PadProbeReturn.GST_PAD_PROBE_OK;
            }

            bin = new Bin (element.GetParent ().ToIntPtr ());
            bin.Ref ();

            parent_bin = new Bin (bin.GetParent ().ToIntPtr ());
            parent_bin.Remove (bin);

            bin.SetState (State.Null);
            bin.Remove (element);
            bin.UnRef ();

            attached = false;

            /* if we're supposed to be playing, unblock the sink */
            if (blocked) {
                Hyena.Log.Debug ("[Streamrecorder.PlayerAudioTee]<ReallyRemoveBin> unblocking pad after removing tee");
            //                new Pad (pad).AddProbe (PadProbeType.GST_PAD_PROBE_TYPE_BLOCK, AddRemoveBinDone, IntPtr.Zero, null);
                PadProbeInfo info = (PadProbeInfo) Marshal.PtrToStructure (probe_info, typeof (PadProbeInfo));
                new Pad (pad).RemoveProbe (info.id);
                AddRemoveBinDone (IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
            }

            return PadProbeReturn.GST_PAD_PROBE_OK;
        }