Beispiel #1
0
        public SwyhDevice()
        {
            this.Device = UPnPDevice.CreateRootDevice(1800, 1.0, "\\");

            this.Device.FriendlyName = "Stream What You Hear (" + Environment.MachineName + "):"; //Environment.MachineName + ": Stream What You Hear";
            this.Device.Manufacturer = "Sebastien.Warin.fr";
            this.Device.ManufacturerURL = "http://sebastien.warin.fr";
            this.Device.ModelURL = new Uri("http://www.streamwhatyouhear.com");
            this.Device.ModelName = "Windows Media Connect SWYH"; //"Stream What You Hear";
            this.Device.ModelDescription = "Stream What You Hear (SWYH) is a Windows application to stream the sound from your PC to an UPnP / DLNA device";
            this.Device.ModelNumber = "1.4";
            this.Device.SerialNumber = "SWYH_UPNP_14";
            this.Device.HasPresentation = true;
            this.Device.PresentationURL = "about/swyh.html";
            this.Device.DeviceURN = "urn:schemas-upnp-org:device:MediaServer:1";
            this.Device.Icon = Properties.Resources.swyh128.ToBitmap();
            this.Device.Icon2 = Properties.Resources.swyh48.ToBitmap();
            this.Device.AddCustomFieldInDescription("dlna:X_DLNADOC", "DMS-1.50", "urn:schemas-dlna-org:device-1-0");

            DvX_MS_MediaReceiverRegistrar X_MS_MediaReceiverRegistrar = new DvX_MS_MediaReceiverRegistrar();
            X_MS_MediaReceiverRegistrar.External_IsAuthorized = new DvX_MS_MediaReceiverRegistrar.Delegate_IsAuthorized(X_MS_MediaReceiverRegistrar.IsAuthorized);
            X_MS_MediaReceiverRegistrar.External_IsValidated = new DvX_MS_MediaReceiverRegistrar.Delegate_IsValidated(X_MS_MediaReceiverRegistrar.IsValidated);
            X_MS_MediaReceiverRegistrar.External_RegisterDevice = new DvX_MS_MediaReceiverRegistrar.Delegate_RegisterDevice(X_MS_MediaReceiverRegistrar.RegisterDevice);
            this.Device.AddService(X_MS_MediaReceiverRegistrar);

            ConnectionManager = new DvConnectionManager();
            ConnectionManager.External_GetCurrentConnectionIDs = new DvConnectionManager.Delegate_GetCurrentConnectionIDs(ConnectionManager.GetCurrentConnectionIDs);
            ConnectionManager.External_GetCurrentConnectionInfo = new DvConnectionManager.Delegate_GetCurrentConnectionInfo(ConnectionManager.GetCurrentConnectionInfo);
            ConnectionManager.External_GetProtocolInfo = new DvConnectionManager.Delegate_GetProtocolInfo(ConnectionManager.GetProtocolInfo);
            this.Device.AddService(ConnectionManager);

            ContentDirectory = new DvContentDirectory();
            ContentDirectory.External_Browse = new DvContentDirectory.Delegate_Browse(ContentDirectory.Browse);
            ContentDirectory.External_GetSearchCapabilities = new DvContentDirectory.Delegate_GetSearchCapabilities(ContentDirectory.GetSearchCapabilities);
            ContentDirectory.External_GetSortCapabilities = new DvContentDirectory.Delegate_GetSortCapabilities(ContentDirectory.GetSortCapabilities);
            ContentDirectory.External_GetSystemUpdateID = new DvContentDirectory.Delegate_GetSystemUpdateID(ContentDirectory.GetSystemUpdateID);
            ContentDirectory.External_X_GetFeatureList = new DvContentDirectory.Delegate_X_GetFeatureList(ContentDirectory.X_GetFeatureList);
            ContentDirectory.External_Search = new DvContentDirectory.Delegate_Search(ContentDirectory.Search);
            this.Device.AddService(ContentDirectory);

            // Setting the initial value of evented variables
            X_MS_MediaReceiverRegistrar.Evented_AuthorizationDeniedUpdateID = 0;
            X_MS_MediaReceiverRegistrar.Evented_ValidationSucceededUpdateID = 0;
            X_MS_MediaReceiverRegistrar.Evented_ValidationRevokedUpdateID = 0;
            X_MS_MediaReceiverRegistrar.Evented_AuthorizationGrantedUpdateID = 0;
            ConnectionManager.Evented_SourceProtocolInfo = "Sample String";
            ConnectionManager.Evented_SinkProtocolInfo = "Sample String";
            ConnectionManager.Evented_CurrentConnectionIDs = "Sample String";
            ContentDirectory.Evented_ContainerUpdateIDs = "Sample String";
            ContentDirectory.Evented_SystemUpdateID = 0;

            // Add Virtual Directory
            this.Device.AddVirtualDirectory("about", HeaderHandler, PageHandler);
            this.Device.AddVirtualDirectory("stream", HeaderHandler, PageHandler);

            // Duplicate audio stream
            Thread duplicateMp3AudioThread = new Thread(new ThreadStart(duplicateMp3AudioStream));
            Thread duplicatePcmAudioThread = new Thread(new ThreadStart(duplicatePcmAudioStream));
            duplicateMp3AudioThread.Start();
            duplicatePcmAudioThread.Start();
        }
Beispiel #2
0
 internal _DvContentDirectory(DvContentDirectory n)
 {
     Outer = n;
     S = BuildUPnPService();
 }