Ejemplo n.º 1
0
        public void SetRenderFile(string file)
        {
            try
            {
                _hasRenderingErrors = false;

                if (streamRenderer != null)
                {
                    streamRenderer.Dispose();
                    streamRenderer = null;
                }

                // Select the proper renderer for the specified media
                Uri uri = null;
                try
                {
                    uri = new Uri(file, UriKind.Absolute);
                }
                catch
                {
                    uri = null;
                }

                if (uri != null && !uri.IsFile)
                {
                    //this.streamType = "URL";

                    if (streamRenderer as DSShoutcastRenderer == null)
                    {
                        streamRenderer = new DSShoutcastRenderer();
                    }
                }
                else
                {
                    if (DvdMedia.FromPath(file) != null)
                    {
                        //this.streamType = "DVD";

                        if (streamRenderer as DSDvdRenderer == null)
                        {
                            streamRenderer = new DSDvdRenderer();
                        }
                    }
                    else
                    {
                        string streamType = PathUtils.GetExtension(file).ToLowerInvariant();
                        if (streamType == "cda")
                        {
                            if (streamRenderer as DSAudioCDRenderer == null)
                            {
                                streamRenderer = new DSAudioCDRenderer();
                            }
                        }
                        else if (streamRenderer as DSFileRenderer == null)
                        {
                            streamRenderer = new DSFileRenderer();
                        }
                    }
                }

                Logger.LogTrace("Now playing media: {0}", file);

                if (streamRenderer != null)
                { 
                    streamRenderer.RenderRegion = renderPanel;

                    if (this.FilterState == OPMedia.Runtime.ProTONE.Rendering.DS.BaseClasses.FilterState.Stopped)
                    {
                        streamRenderer.RenderMediaName = file;
                    }
                }
            }
            catch (Exception ex)
            {
                ReportRenderingException(ex);
            }
        }
Ejemplo n.º 2
0
        private MediaRenderer()
        {
            streamRenderer = null;

            SuiteRegistrationSupport.Init(GetSupportedFileProvider());

            timerCheckState = new Timer();
            timerCheckState.Enabled = true;
            timerCheckState.Interval = 500;
            timerCheckState.Start();
            timerCheckState.Tick += new EventHandler(timerCheckState_Tick);

        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     if (streamRenderer != null)
     {
         streamRenderer.Dispose();
         streamRenderer = null;
     }
 }