예제 #1
0
        /// <summary>
        /// rest packet
        /// </summary>
        /// <param name="sitpacket"></param>
        public void Rest(SitPacket sitpacket)
        {
            sitpacket.Users.ForEach(u =>
            {
                IAliveEntity entity;

                switch (u.VisualType)
                {
                case VisualType.Player:
                    entity = Broadcaster.Instance.GetCharacter(s => s.VisualId == u.VisualId);
                    break;

                default:
                    _logger.Error(LogLanguage.Instance.GetMessageFromKey(LanguageKey.VISUALTYPE_UNKNOWN), u.VisualType);
                    return;
                }
                entity.Rest();
            });
        }
예제 #2
0
파일: BlueMux.cs 프로젝트: 2php/TsRemux_HK
        private void CreatePsi()
        {
            pidMappings  = new Dictionary <ushort, ushort>();
            Continuities = new Dictionary <ushort, byte>();
            ushort currentVideoPid = Constants.DEFAULT_VIDEO_PID;
            ushort currentAudioPid = Constants.DEFAULT_AUDIO_PID;
            ushort currentSubPid   = Constants.DEFAULT_SUBTITLE_PID;
            ushort currentPresPid  = Constants.DEFAULT_PRESENTATION_GRAPHICS_PID;
            ushort currentIntPid   = Constants.DEFAULT_INTERACTIVE_GRAPHICS_PID;

            pmtStreams = new List <StreamInfo>();
            StreamInfo sitemp = null;

            foreach (StreamInfo si in StreamsToKeep)
            {
                if (pidMappings.ContainsKey(si.ElementaryPID))
                {
                    throw new ArgumentException(String.Format("Invalid/Duplicate StreamInfo with pid {0}", si.ElementaryPID));
                }
                switch (si.StreamType)
                {
                case ElementaryStreamTypes.AUDIO_STREAM_AC3:
                case ElementaryStreamTypes.AUDIO_STREAM_AC3_PLUS:
                    pidMappings.Add(si.ElementaryPID, currentAudioPid);
                    if (this.fileType == TsFileType.BLU_RAY)
                    {
                        sitemp = new StreamInfo(si.StreamType, currentAudioPid);
                    }
                    else
                    {
                        sitemp = new StreamInfo(ElementaryStreamTypes.AUDIO_STREAM_AC3, currentAudioPid);
                    }
                    Continuities.Add(currentAudioPid, 0);
                    currentAudioPid++;
                    break;

                case ElementaryStreamTypes.AUDIO_STREAM_AC3_TRUE_HD:
                    pidMappings.Add(si.ElementaryPID, currentAudioPid);
                    if (MlpToAc3)
                    {
                        sitemp = new StreamInfo(ElementaryStreamTypes.AUDIO_STREAM_AC3, currentAudioPid);
                    }
                    else
                    {
                        sitemp = new StreamInfo(ElementaryStreamTypes.AUDIO_STREAM_AC3_TRUE_HD, currentAudioPid);
                    }
                    Continuities.Add(currentAudioPid, 0);
                    currentAudioPid++;
                    break;

                case ElementaryStreamTypes.AUDIO_STREAM_DTS_HD:
                case ElementaryStreamTypes.AUDIO_STREAM_DTS_HD_MASTER_AUDIO:
                    pidMappings.Add(si.ElementaryPID, currentAudioPid);
                    if (MlpToAc3)
                    {
                        sitemp = new StreamInfo(ElementaryStreamTypes.AUDIO_STREAM_DTS, currentAudioPid);
                    }
                    else
                    {
                        sitemp = new StreamInfo(si.StreamType, currentAudioPid);
                    }
                    Continuities.Add(currentAudioPid, 0);
                    currentAudioPid++;
                    break;

                case ElementaryStreamTypes.AUDIO_STREAM_DTS:
                case ElementaryStreamTypes.AUDIO_STREAM_LPCM:
                case ElementaryStreamTypes.AUDIO_STREAM_MPEG1:
                case ElementaryStreamTypes.AUDIO_STREAM_MPEG2:
                    pidMappings.Add(si.ElementaryPID, currentAudioPid);
                    sitemp = new StreamInfo(si.StreamType, currentAudioPid);
                    Continuities.Add(currentAudioPid, 0);
                    currentAudioPid++;
                    break;

                case ElementaryStreamTypes.SUBTITLE_STREAM:
                    pidMappings.Add(si.ElementaryPID, currentSubPid);
                    sitemp = new StreamInfo(si.StreamType, currentSubPid);
                    Continuities.Add(currentSubPid, 0);
                    currentSubPid++;
                    break;

                case ElementaryStreamTypes.PRESENTATION_GRAPHICS_STREAM:
                    pidMappings.Add(si.ElementaryPID, currentPresPid);
                    sitemp = new StreamInfo(si.StreamType, currentPresPid);
                    Continuities.Add(currentPresPid, 0);
                    currentPresPid++;
                    break;

                case ElementaryStreamTypes.INTERACTIVE_GRAPHICS_STREAM:
                    pidMappings.Add(si.ElementaryPID, currentIntPid);
                    sitemp = new StreamInfo(si.StreamType, currentIntPid);
                    Continuities.Add(currentIntPid, 0);
                    currentIntPid++;
                    break;

                case ElementaryStreamTypes.VIDEO_STREAM_H264:
                case ElementaryStreamTypes.VIDEO_STREAM_MPEG1:
                case ElementaryStreamTypes.VIDEO_STREAM_MPEG2:
                case ElementaryStreamTypes.VIDEO_STREAM_VC1:
                    pidMappings.Add(si.ElementaryPID, currentVideoPid);
                    sitemp = new StreamInfo(si.StreamType, currentVideoPid);
                    Continuities.Add(currentVideoPid, 0);
                    currentVideoPid++;
                    if (0 == VideoType)
                    {
                        VideoType = (byte)si.StreamType;
                    }
                    break;
                }
                sitemp.ElementaryDescriptors = si.ElementaryDescriptors;
                sitemp.AspectRatio           = si.AspectRatio;
                sitemp.AudioPresentationType = si.AudioPresentationType;
                sitemp.FrameRate             = si.FrameRate;
                sitemp.SamplingFrequency     = si.SamplingFrequency;
                sitemp.VideoFormat           = si.VideoFormat;
                pmtStreams.Add(sitemp);
            }
            pat = new PatPacket();
            ProgramInfo[] pi = new ProgramInfo[2];
            pi[0]                 = new ProgramInfo(0, Constants.SIT_PID);
            pi[1]                 = new ProgramInfo(1, Constants.DEFAULT_PMT_PID);
            pat.Programs          = pi;
            pmt                   = new PmtPacket();
            pmt.PID               = Constants.DEFAULT_PMT_PID;
            pmt.ElementaryStreams = pmtStreams.ToArray();
            List <byte> programDescriptors = new List <byte>();

            programDescriptors.AddRange(Constants.copy_control_descriptor);
            programDescriptors.AddRange(Constants.hdmv_registration_descriptor);
            pmt.ProgramDescriptorsData = programDescriptors.ToArray();
            sit = new SitPacket();
            buffer.Add(pat);
            pat.IncrementContinuityCounter();
            buffer.Add(pmt);
            pmt.IncrementContinuityCounter();
            buffer.Add(sit);
            sit.IncrementContinuityCounter();
        }