using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gst;
using GLib;
using System.Xml.Serialization;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Testing test_case = new Testing();
            test_case.test();
        }

    }
    class Testing
    {
        public void Glib_Loop()
        {
            loop = new MainLoop();
            loop.Run();
        }

        MainLoop loop;

        public void test()
        {
            System.Environment.SetEnvironmentVariable("GST_DEBUG", "*:3");
            System.Environment.SetEnvironmentVariable("GST_PLUGIN_PATH", "c:\\gstreamer-old\\lib\\gstreamer-0.10");
            System.Environment.SetEnvironmentVariable("PATH",
            System.Environment.GetEnvironmentVariable("PATH") + ";" + "c:\\gstreamer-old\\bin");
            string[] args2 = { "--gst-debug-level=*:3" };
            Gst.Application.Init("Sharp_Client", ref args2);
            
            //Gst.Application.Init();
            System.Threading.Thread glib_loop_thread;

            glib_loop_thread = new System.Threading.Thread(this.Glib_Loop);
            glib_loop_thread.Start();

            Console.WriteLine("test");
            XmlSerializer serializer = new XmlSerializer(typeof(System.Object));

            try
            {
                Element udp_src = ElementFactory.Make("udpsrc", "udp_src");
                Element pipeline = ElementFactory.Make("pipeline", "pipe");
            }
            catch (Exception E)
            {
                Console.WriteLine("Creating Elements failed");
                Console.WriteLine(E.GetBaseException().ToString());
            }
            loop.Quit();

        }
    }
}
