/// <summary>
        /// Event handler for media status changes
        /// </summary>
        /// <param name="Tags">Array of tags</param>
        /// <param name="Properties">Array of property values</param>
        public void MediaStatusChange(MEDIASTATUSPROPERTYTAG[] tags, object[] properties)
        {
            //  Check to see if the socket server is valid
            if (MediaSink.SocketServer == null)
            {
                return;
            }

            try
            {
                for (int i = 0; i < tags.Length; i++)
                {
                    MEDIASTATUSPROPERTYTAG tag = tags[i];
                    object property            = properties[i];
                    //  Remove duplicate notifications
                    if ((tag == m_prevTag) && (property.ToString() == m_prevProp.ToString()))
                    {
                        return;
                    }
                    else
                    {
                        m_prevTag  = tag;
                        m_prevProp = property;
                    }

                    Trace.TraceInformation("{0}={1}", tag, property);

                    //  Announce the status change to all listeners
                    MediaSink.SocketServer.SendMessage(string.Format(CultureInfo.InvariantCulture, "{0}={1}\r\n", tag, property));

                    //  Update the media state information
                    MediaState.UpdateState(tag, property);

                    //  Check for MediaName status changes and get additional EPG data
                    //if (tag == MEDIASTATUSPROPERTYTAG.MediaName && MediaState.MediaMode == MEDIASTATUSPROPERTYTAG.TVTuner)
                    //{
                    //  Look up epg info in a background worker thread
                    //    ThreadPool.QueueUserWorkItem(new WaitCallback(LookupEpgInfo), property);
                    //}
                    //else if (tag == MEDIASTATUSPROPERTYTAG.MediaName && MediaState.MediaMode == MEDIASTATUSPROPERTYTAG.PVR)
                    //{
                    //    //  Get pvr media info in a background worker thread
                    //    ThreadPool.QueueUserWorkItem(new WaitCallback(RetrieveDvrmsInfo));
                    //}
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception: {0}", ex.ToString());
            }
        }
示例#2
0
        /// <summary>
        /// Updates the state.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="property">The property.</param>
        public static void UpdateState(MEDIASTATUSPROPERTYTAG tag, object property)
        {
            if (property == null) {
                return;
            }

            switch (tag) {
                    //  Volume
                case MEDIASTATUSPROPERTYTAG.Volume:
                    m_volume = property.ToString();
                    break;

                    //  Mute
                case MEDIASTATUSPROPERTYTAG.Mute:
                    m_mute = property.ToString();
                    break;

                    //  Current Navigation Page
                case MEDIASTATUSPROPERTYTAG.FS_DVD:
                case MEDIASTATUSPROPERTYTAG.FS_Guide:
                case MEDIASTATUSPROPERTYTAG.FS_Home:
                case MEDIASTATUSPROPERTYTAG.FS_Music:
                case MEDIASTATUSPROPERTYTAG.FS_Photos:
                case MEDIASTATUSPROPERTYTAG.FS_Radio:
                case MEDIASTATUSPROPERTYTAG.FS_RecordedShows:
                case MEDIASTATUSPROPERTYTAG.FS_TV:
                case MEDIASTATUSPROPERTYTAG.FS_Unknown:
                case MEDIASTATUSPROPERTYTAG.FS_Videos:
                    if ((bool) property == true) {
                        m_page = tag;
                    }
                    break;

                    //  Play Rates
                case MEDIASTATUSPROPERTYTAG.Play:
                case MEDIASTATUSPROPERTYTAG.Stop:
                case MEDIASTATUSPROPERTYTAG.Pause:
                case MEDIASTATUSPROPERTYTAG.FF1:
                case MEDIASTATUSPROPERTYTAG.FF2:
                case MEDIASTATUSPROPERTYTAG.FF3:
                case MEDIASTATUSPROPERTYTAG.Rewind1:
                case MEDIASTATUSPROPERTYTAG.Rewind2:
                case MEDIASTATUSPROPERTYTAG.Rewind3:
                case MEDIASTATUSPROPERTYTAG.SlowMotion1:
                case MEDIASTATUSPROPERTYTAG.SlowMotion2:
                case MEDIASTATUSPROPERTYTAG.SlowMotion3:
                    if ((bool) property == true) {
                        m_playRate = tag;
                    }
                    break;

                    //  Current Media Mode
                case MEDIASTATUSPROPERTYTAG.StreamingContentAudio:
                case MEDIASTATUSPROPERTYTAG.StreamingContentVideo:
                case MEDIASTATUSPROPERTYTAG.PVR:
                case MEDIASTATUSPROPERTYTAG.TVTuner:
                case MEDIASTATUSPROPERTYTAG.CD:
                case MEDIASTATUSPROPERTYTAG.DVD:
                    if ((bool) property == true) {
                        m_metaData.Clear();
                        m_mediaMode = tag;
                    }
                    break;

                default:
                    m_metaData[tag.ToString()] = property;
                    break;
            }
        }
示例#3
0
        /// <summary>
        /// Updates the state.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="property">The property.</param>
        public static void UpdateState(MEDIASTATUSPROPERTYTAG tag, object property)
        {
            if (property == null)
            {
                return;
            }

            switch (tag)
            {
            //  Volume
            case MEDIASTATUSPROPERTYTAG.Volume:
                m_volume = property.ToString();
                break;

            //  Mute
            case MEDIASTATUSPROPERTYTAG.Mute:
                m_mute = property.ToString();
                break;

            //  Current Navigation Page
            case MEDIASTATUSPROPERTYTAG.FS_DVD:
            case MEDIASTATUSPROPERTYTAG.FS_Guide:
            case MEDIASTATUSPROPERTYTAG.FS_Home:
            case MEDIASTATUSPROPERTYTAG.FS_Music:
            case MEDIASTATUSPROPERTYTAG.FS_Photos:
            case MEDIASTATUSPROPERTYTAG.FS_Radio:
            case MEDIASTATUSPROPERTYTAG.FS_RecordedShows:
            case MEDIASTATUSPROPERTYTAG.FS_TV:
            case MEDIASTATUSPROPERTYTAG.FS_Unknown:
            case MEDIASTATUSPROPERTYTAG.FS_Videos:
                if ((bool)property == true)
                {
                    m_page = tag;
                }
                break;

            //  Play Rates
            case MEDIASTATUSPROPERTYTAG.Play:
            case MEDIASTATUSPROPERTYTAG.Stop:
            case MEDIASTATUSPROPERTYTAG.Pause:
            case MEDIASTATUSPROPERTYTAG.FF1:
            case MEDIASTATUSPROPERTYTAG.FF2:
            case MEDIASTATUSPROPERTYTAG.FF3:
            case MEDIASTATUSPROPERTYTAG.Rewind1:
            case MEDIASTATUSPROPERTYTAG.Rewind2:
            case MEDIASTATUSPROPERTYTAG.Rewind3:
            case MEDIASTATUSPROPERTYTAG.SlowMotion1:
            case MEDIASTATUSPROPERTYTAG.SlowMotion2:
            case MEDIASTATUSPROPERTYTAG.SlowMotion3:
                if ((bool)property == true)
                {
                    m_playRate = tag;
                }
                break;

            //  Current Media Mode
            case MEDIASTATUSPROPERTYTAG.StreamingContentAudio:
            case MEDIASTATUSPROPERTYTAG.StreamingContentVideo:
            case MEDIASTATUSPROPERTYTAG.PVR:
            case MEDIASTATUSPROPERTYTAG.TVTuner:
            case MEDIASTATUSPROPERTYTAG.CD:
            case MEDIASTATUSPROPERTYTAG.DVD:
                if ((bool)property == true)
                {
                    m_metaData.Clear();
                    m_mediaMode = tag;
                }
                break;

            default:
                m_metaData[tag.ToString()] = property;
                break;
            }
        }
示例#4
0
        public void MediaStatusChange(MEDIASTATUSPROPERTYTAG[] tags, object[] properties)
        {
            for (int i = 0; i < tags.Length; i++)
            {
                MEDIASTATUSPROPERTYTAG tag = tags[i];
                object property            = properties[i];

                switch (tag)
                {
                //set the current transport control
                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Play:
                    this.CurrentTransport = Transport.Play;
                    this._uniqueId        = Guid.NewGuid().ToString();
//						Console.WriteLine(uniqueId);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Pause:
                    this.CurrentTransport = Transport.Pause;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Stop:
                    this.CurrentTransport = Transport.Stop;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Rewind1:
                    this.CurrentTransport = Transport.Rewind1;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Rewind2:
                    this.CurrentTransport = Transport.Rewind2;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Rewind3:
                    this.CurrentTransport = Transport.Rewind3;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FF1:
                    this.CurrentTransport = Transport.FastForward1;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FF2:
                    this.CurrentTransport = Transport.FastForward2;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FF3:
                    this.CurrentTransport = Transport.FastForward3;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Prev:
                    this.CurrentTransport = Transport.Prev;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_PrevFrame:
                    this.CurrentTransport = Transport.PrevFrame;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Next:
                    this.CurrentTransport = Transport.Next;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_NextFrame:
                    this.CurrentTransport = Transport.NextFrame;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_SlowMotion1:
                    this.CurrentTransport = Transport.SlowMotion1;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_SlowMotion2:
                    this.CurrentTransport = Transport.SlowMotion2;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_SlowMotion3:
                    this.CurrentTransport = Transport.SlowMotion3;
                    break;

                // set the global session state
                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_DVD:
                    this.CurrentGlobalSession = GlobalSessionState.DVD;
                    this.CurrentSession       = SessionState.DVD;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Guide:
                    this.CurrentGlobalSession = GlobalSessionState.Guide;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Home:
                    this.CurrentGlobalSession = GlobalSessionState.Home;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Music:
                    this.CurrentGlobalSession = GlobalSessionState.Music;
                    this.CurrentSession       = SessionState.StreamingContentAudio;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Photos:
                    this.CurrentGlobalSession = GlobalSessionState.Photos;
                    this.CurrentSession       = SessionState.Photos;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Radio:
                    this.CurrentGlobalSession = GlobalSessionState.Radio;
                    this.CurrentSession       = SessionState.Radio;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_RecordedShows:
                    this.CurrentGlobalSession = GlobalSessionState.RecordedShows;
                    this.CurrentSession       = SessionState.PVR;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_TV:
                    this.CurrentGlobalSession = GlobalSessionState.TV;
                    this.CurrentSession       = SessionState.TVTuner;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Unknown:
                    this.CurrentGlobalSession = GlobalSessionState.Unknown;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Videos:
                    this.CurrentGlobalSession = GlobalSessionState.Videos;
                    this.CurrentSession       = SessionState.StreamingContentVideo;
                    break;

                // set other stuff
                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Ejecting:
                    this.Ejecting = true;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Mute:
                    this.Mute = System.Convert.ToBoolean(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Volume:
                    this.Volume = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_GuideLoaded:
                    this.GuideLoaded = true;
                    break;

                // set the current session state
                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CD:
                    this.CurrentSession = SessionState.CD;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_DVD:
                    this.CurrentSession = SessionState.DVD;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_PVR:
                    this.CurrentSession = SessionState.PVR;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TVTuner:
                    this.CurrentSession = SessionState.TVTuner;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Photos:
                    this.CurrentSession = SessionState.Photos;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Radio:
                    this.CurrentSession = SessionState.Radio;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_StreamingContentAudio:
                    this.CurrentSession = SessionState.StreamingContentAudio;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_StreamingContentVideo:
                    this.CurrentSession = SessionState.StreamingContentVideo;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_PhoneCall:
                    this.CurrentSession = SessionState.PhoneCall;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Unknown:
                    this.CurrentSession = SessionState.Unknown;
                    break;

                // Caller ID
                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CallingPartyName:
                    this.CallingPartyName = System.Convert.ToString(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CallingPartyNumber:
                    this.CallingPartyNumber = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Recording:
                    this.CurrentSession = SessionState.Recording;
                    this.Recording      = true;
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_ArtistName:
                    this.ArtistName = System.Convert.ToString(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_MediaName:
                    this.MediaName = System.Convert.ToString(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_MediaTime:
                    this.MediaTime = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TitleNumber:
                    this.TitleNumber = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackName:
                    this.TrackName = System.Convert.ToString(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackTime:
                    this.TrackTime = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackDuration:
                    this.TrackDuration = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TotalTracks:
                    this.TotalTracks = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackNumber:
                    this.TrackNumber = System.Convert.ToInt32(property);
                    Clear();
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Visualization:
                    this.Shuffle = System.Convert.ToBoolean(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_RepeatSet:
                    this.Shuffle = System.Convert.ToBoolean(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Shuffle:
                    this.Shuffle = System.Convert.ToBoolean(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TransitionTime:
                    this.TransitionTime = System.Convert.ToInt32(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_ParentalAdvisoryRating:
                    this.ParentalAdvisoryRating = System.Convert.ToString(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_RadioFrequency:
                    this.RadioFrequency = System.Convert.ToString(property);
                    break;

                case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CurrentPicture:
                    this.CurrentPicture = System.Convert.ToString(property);
                    break;
                }
            }
            _lastWrite = DateTime.Now.Ticks;
        }
示例#5
0
        /// <summary>
        /// Event handler for media status changes
        /// </summary>
        /// <param name="Tags">Array of tags</param>
        /// <param name="Properties">Array of property values</param>
        public void MediaStatusChange(MEDIASTATUSPROPERTYTAG[] tags, object[] properties)
        {
            //  Check to see if the socket server is valid
            if (MediaSink.SocketServer == null) return;

            try
            {
                for (int i = 0; i < tags.Length; i++)
                {
                    MEDIASTATUSPROPERTYTAG tag = tags[i];
                    object property = properties[i];
                    //  Remove duplicate notifications
                    if ((tag == m_prevTag) && (property.ToString() == m_prevProp.ToString()))
                        return;
                    else
                    {
                        m_prevTag = tag;
                        m_prevProp = property;
                    }

                    Trace.TraceInformation("{0}={1}", tag, property);

                    //  Announce the status change to all listeners
                    MediaSink.SocketServer.SendMessage(string.Format(CultureInfo.InvariantCulture, "{0}={1}\r\n", tag, property));

                    //  Update the media state information
                    MediaState.UpdateState(tag, property);

                    //  Check for MediaName status changes and get additional EPG data
                    //if (tag == MEDIASTATUSPROPERTYTAG.MediaName && MediaState.MediaMode == MEDIASTATUSPROPERTYTAG.TVTuner)
                    //{
                        //  Look up epg info in a background worker thread
                    //    ThreadPool.QueueUserWorkItem(new WaitCallback(LookupEpgInfo), property);
                    //}
                    //else if (tag == MEDIASTATUSPROPERTYTAG.MediaName && MediaState.MediaMode == MEDIASTATUSPROPERTYTAG.PVR)
                    //{
                    //    //  Get pvr media info in a background worker thread
                    //    ThreadPool.QueueUserWorkItem(new WaitCallback(RetrieveDvrmsInfo));
                    //}
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception: {0}", ex.ToString());
            }
        }
        public void MediaStatusChange(MEDIASTATUSPROPERTYTAG[] tags, object[] properties)
        {
            for (int i = 0; i < tags.Length; i++)
            {
                MEDIASTATUSPROPERTYTAG tag = tags[i];
                object property = properties[i];

                switch (tag)
                {
                    //set the current transport control
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Play:
                        this.CurrentTransport = Transport.Play;
                        this._uniqueId = Guid.NewGuid().ToString();
            //						Console.WriteLine(uniqueId);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Pause:
                        this.CurrentTransport = Transport.Pause;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Stop:
                        this.CurrentTransport = Transport.Stop;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Rewind1:
                        this.CurrentTransport = Transport.Rewind1;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Rewind2:
                        this.CurrentTransport = Transport.Rewind2;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Rewind3:
                        this.CurrentTransport = Transport.Rewind3;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FF1:
                        this.CurrentTransport = Transport.FastForward1;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FF2:
                        this.CurrentTransport = Transport.FastForward2;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FF3:
                        this.CurrentTransport = Transport.FastForward3;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Prev:
                        this.CurrentTransport = Transport.Prev;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_PrevFrame:
                        this.CurrentTransport = Transport.PrevFrame;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Next:
                        this.CurrentTransport = Transport.Next;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_NextFrame:
                        this.CurrentTransport = Transport.NextFrame;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_SlowMotion1:
                        this.CurrentTransport = Transport.SlowMotion1;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_SlowMotion2:
                        this.CurrentTransport = Transport.SlowMotion2;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_SlowMotion3:
                        this.CurrentTransport = Transport.SlowMotion3;
                        break;
                    // set the global session state
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_DVD:
                        this.CurrentGlobalSession = GlobalSessionState.DVD;
                        this.CurrentSession = SessionState.DVD;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Guide:
                        this.CurrentGlobalSession = GlobalSessionState.Guide;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Home:
                        this.CurrentGlobalSession = GlobalSessionState.Home;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Music:
                        this.CurrentGlobalSession = GlobalSessionState.Music;
                        this.CurrentSession = SessionState.StreamingContentAudio;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Photos:
                        this.CurrentGlobalSession = GlobalSessionState.Photos;
                        this.CurrentSession = SessionState.Photos;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Radio:
                        this.CurrentGlobalSession = GlobalSessionState.Radio;
                        this.CurrentSession = SessionState.Radio;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_RecordedShows:
                        this.CurrentGlobalSession = GlobalSessionState.RecordedShows;
                        this.CurrentSession = SessionState.PVR;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_TV:
                        this.CurrentGlobalSession = GlobalSessionState.TV;
                        this.CurrentSession = SessionState.TVTuner;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Unknown:
                        this.CurrentGlobalSession = GlobalSessionState.Unknown;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_FS_Videos:
                        this.CurrentGlobalSession = GlobalSessionState.Videos;
                        this.CurrentSession = SessionState.StreamingContentVideo;
                        break;

                    // set other stuff
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Ejecting:
                        this.Ejecting = true;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Mute:
                        this.Mute = System.Convert.ToBoolean(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Volume:
                        this.Volume = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_GuideLoaded:
                        this.GuideLoaded = true;
                        break;

                    // set the current session state
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CD:
                        this.CurrentSession = SessionState.CD;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_DVD:
                        this.CurrentSession = SessionState.DVD;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_PVR:
                        this.CurrentSession = SessionState.PVR;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TVTuner:
                        this.CurrentSession = SessionState.TVTuner;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Photos:
                        this.CurrentSession = SessionState.Photos;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Radio:
                        this.CurrentSession = SessionState.Radio;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_StreamingContentAudio:
                        this.CurrentSession = SessionState.StreamingContentAudio;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_StreamingContentVideo:
                        this.CurrentSession = SessionState.StreamingContentVideo;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_PhoneCall:
                        this.CurrentSession = SessionState.PhoneCall;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Unknown:
                        this.CurrentSession = SessionState.Unknown;
                        break;

                    // Caller ID
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CallingPartyName:
                        this.CallingPartyName = System.Convert.ToString(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CallingPartyNumber:
                        this.CallingPartyNumber = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Recording:
                        this.CurrentSession = SessionState.Recording;
                        this.Recording = true;
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_ArtistName:
                        this.ArtistName = System.Convert.ToString(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_MediaName:
                        this.MediaName = System.Convert.ToString(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_MediaTime:
                        this.MediaTime = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TitleNumber:
                        this.TitleNumber = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackName:
                        this.TrackName = System.Convert.ToString(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackTime:
                        this.TrackTime = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackDuration:
                        this.TrackDuration = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TotalTracks:
                        this.TotalTracks = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TrackNumber:
                        this.TrackNumber = System.Convert.ToInt32(property);
                        Clear();
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Visualization:
                        this.Shuffle = System.Convert.ToBoolean(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_RepeatSet:
                        this.Shuffle = System.Convert.ToBoolean(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_Shuffle:
                        this.Shuffle = System.Convert.ToBoolean(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_TransitionTime:
                        this.TransitionTime = System.Convert.ToInt32(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_ParentalAdvisoryRating:
                        this.ParentalAdvisoryRating = System.Convert.ToString(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_RadioFrequency:
                        this.RadioFrequency = System.Convert.ToString(property);
                        break;
                    case MEDIASTATUSPROPERTYTAG.MSPROPTAG_CurrentPicture:
                        this.CurrentPicture = System.Convert.ToString(property);
                        break;
                }
            }
            _lastWrite = DateTime.Now.Ticks;
        }
 public void MediaStatusChange(MEDIASTATUSPROPERTYTAG[] tags, object[] properties)
 {
     MsasSink.WriteToLog(EventLogEntryType.Information, "[Session] MediaStatusChange({0})", _id);
     _session.MediaStatusChange(tags, properties);
     MsasSink.WriteFile();
 }
示例#8
0
        /// <summary>
        /// Updates the state.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="property">The property.</param>
        public static void UpdateState(MEDIASTATUSPROPERTYTAG tag, object property)
        {
            var sb = new StringBuilder();

            if (property == null)
            {
                return;
            }

            switch (tag)
            {
            //  Volume
            case MEDIASTATUSPROPERTYTAG.Volume:
                m_volume = property.ToString();
                break;

            //  Mute
            case MEDIASTATUSPROPERTYTAG.Mute:
                m_mute = property.ToString();
                break;

            //  Current Navigation Page
            case MEDIASTATUSPROPERTYTAG.FS_DVD:
            case MEDIASTATUSPROPERTYTAG.FS_Extensibility:
            case MEDIASTATUSPROPERTYTAG.FS_Guide:
            case MEDIASTATUSPROPERTYTAG.FS_Home:
            case MEDIASTATUSPROPERTYTAG.FS_Music:
            case MEDIASTATUSPROPERTYTAG.FS_Photos:
            case MEDIASTATUSPROPERTYTAG.FS_Radio:
            case MEDIASTATUSPROPERTYTAG.FS_RecordedShows:
            case MEDIASTATUSPROPERTYTAG.FS_TV:
            case MEDIASTATUSPROPERTYTAG.FS_Unknown:
            case MEDIASTATUSPROPERTYTAG.FS_Videos:
                if ((bool)property == true)
                {
                    m_page = tag;
                    Sink.SocketServer.SendMessage(
                        string.Format(CultureInfo.InvariantCulture, "m_page={0}\r\n", tag)
                        );
                }
                break;

            //  Play Rates
            case MEDIASTATUSPROPERTYTAG.Play:
            case MEDIASTATUSPROPERTYTAG.Stop:
            case MEDIASTATUSPROPERTYTAG.Pause:
            case MEDIASTATUSPROPERTYTAG.FF1:
            case MEDIASTATUSPROPERTYTAG.FF2:
            case MEDIASTATUSPROPERTYTAG.FF3:
            case MEDIASTATUSPROPERTYTAG.Rewind1:
            case MEDIASTATUSPROPERTYTAG.Rewind2:
            case MEDIASTATUSPROPERTYTAG.Rewind3:
            case MEDIASTATUSPROPERTYTAG.SlowMotion1:
            case MEDIASTATUSPROPERTYTAG.SlowMotion2:
            case MEDIASTATUSPROPERTYTAG.SlowMotion3:
                if ((bool)property == true)
                {
                    m_playRate = tag;
                    Sink.SocketServer.SendMessage(
                        string.Format(CultureInfo.InvariantCulture, "m_playRate={0}\r\n", tag)
                        );
                }
                break;

            //  Current Media Mode
            case MEDIASTATUSPROPERTYTAG.StreamingContentAudio:
            case MEDIASTATUSPROPERTYTAG.StreamingContentVideo:
            case MEDIASTATUSPROPERTYTAG.PVR:
            case MEDIASTATUSPROPERTYTAG.TVTuner:
            case MEDIASTATUSPROPERTYTAG.CD:
            case MEDIASTATUSPROPERTYTAG.DVD:
            case MEDIASTATUSPROPERTYTAG.PhoneCall:
            case MEDIASTATUSPROPERTYTAG.Photos:
            case MEDIASTATUSPROPERTYTAG.Radio:
            case MEDIASTATUSPROPERTYTAG.Recording:
                if ((bool)property == true)
                {
                    foreach (KeyValuePair <string, object> item in MediaState.MetaData)
                    {
                        switch (item.Key)
                        {
                        case "ArtistName":
                        case "CurrentPicture":
                        case "MediaName":
                        case "ParentalAdvisoryRating":
                        case "RadioFrequency":
                        case "TrackName":
                            sb.AppendFormat("{0}={1}\r\n", item.Key, "");
                            break;

                        case "MediaTime":
                        case "TitleNumber":
                        case "TotalTracks":
                        case "TrackDuration":
                        case "TrackNumber":
                        case "TrackTime":
                            sb.AppendFormat("{0}={1}\r\n", item.Key, 0);
                            break;

                        default:
                            break;
                        }
                    }
                    m_metaData.Clear();
                    m_mediaMode = tag;
                    sb.AppendFormat(string.Format(CultureInfo.InvariantCulture, "m_mediaMode={0}\r\n", tag));
                    Sink.SocketServer.SendMessage(sb.ToString());
                }
                break;

            default:
                m_metaData[tag.ToString()] = property;
                break;
            }
        }