Exemplo n.º 1
0
        private void OnPadAdded (object sender, PadAddedArgs args)
        {
            Caps caps;
            Structure str;
            Pad audiopad;

            audiopad = sink_bin.GetStaticPad ("sink");

            if (audiopad.IsLinked) {
                return;
            }

            caps = args.Pad.Caps;
            str = caps [0];

            if(!str.Name.Contains ("audio")) {
                return;
            }
           
            args.Pad.Link (audiopad);
        }
Exemplo n.º 2
0
 void OnPadAdded (object o, PadAddedArgs args) {
   Console.WriteLine ("Entered OnPadAdded");
   Pad sinkpad = decoder.GetStaticPad ("sink");
   args.Pad.Link (sinkpad);
 }
Exemplo n.º 3
0
        static void HandlePadAdded(object o, PadAddedArgs args)
        {
            var src = (Element)o;
            var newPad = args.NewPad;
            var sinkPad = convert.GetStaticPad ("sink");

            Console.WriteLine (string.Format ("Received new pad '{0}' from '{1}':", newPad.Name, src.Name));

            // If our converter is already linked, we have nothing to do here
            if (sinkPad.IsLinked) {
                Console.WriteLine ("We are already linked. Ignoring.");
                return;
            }

            // Check the new pad's type
            var newPadCaps = newPad.Caps;
            var newPadStruct = newPadCaps.GetStructure (0);
            var newPadType = newPadStruct.Name;
            if (!newPadType.StartsWith ("audio/x-raw")) {
                Console.WriteLine ("It has type '{0}' which is not raw audio. Ignoring.", newPadType);
                return;
            }

            // Attempt the link
            var ret = newPad.Link (sinkPad);
            if (ret != PadLinkReturn.Ok)
                Console.WriteLine ("Type is '{0} but link failed.", newPadType);
            else
                Console.WriteLine ("Link succeeded (type '{0}').", newPadType);
        }