예제 #1
0
        GUIContent GetAudioTrackEnabledContent(ushort trackIdx)
        {
            while (m_AudioTrackInfos.Count <= trackIdx)
            {
                m_AudioTrackInfos.Add(new AudioTrackInfo());
            }

            AudioTrackInfo info = m_AudioTrackInfos[trackIdx];

            VideoPlayer player = null;

            if (!serializedObject.isEditingMultipleObjects)
            {
                player = (VideoPlayer)target;
            }

            // Only produce a decorated track label with single-selection.  No
            // point trying to come up with a label that makes the average of
            // the current track params...
            string language     = player ? player.GetAudioLanguageCode(trackIdx) : "";
            ushort channelCount = player ? player.GetAudioChannelCount(trackIdx) : (ushort)0;

            if (language != info.language || channelCount != info.channelCount || info.content == null)
            {
                string trackDetails = "";
                if (language.Length > 0)
                {
                    trackDetails += language;
                }

                if (channelCount > 0)
                {
                    if (trackDetails.Length > 0)
                    {
                        trackDetails += ", ";
                    }
                    trackDetails += channelCount.ToString() + " ch";
                }

                if (trackDetails.Length > 0)
                {
                    trackDetails = " [" + trackDetails + "]";
                }

                info.content         = EditorGUIUtility.TextContent("Track " + trackIdx + trackDetails);
                info.content.tooltip = s_Styles.enableDecodingTooltip;
            }

            return(info.content);
        }
예제 #2
0
        private GUIContent GetAudioTrackEnabledContent(ushort trackIdx)
        {
            while (this.m_AudioTrackInfos.Count <= (int)trackIdx)
            {
                this.m_AudioTrackInfos.Add(new VideoPlayerEditor.AudioTrackInfo());
            }
            VideoPlayerEditor.AudioTrackInfo audioTrackInfo = this.m_AudioTrackInfos[(int)trackIdx];
            VideoPlayer videoPlayer = null;

            if (!base.serializedObject.isEditingMultipleObjects)
            {
                videoPlayer = (VideoPlayer)base.target;
            }
            string text = (!videoPlayer) ? "" : videoPlayer.GetAudioLanguageCode(trackIdx);
            ushort num  = (!videoPlayer) ? 0 : videoPlayer.GetAudioChannelCount(trackIdx);

            if (text != audioTrackInfo.language || num != audioTrackInfo.channelCount || audioTrackInfo.content == null)
            {
                string text2 = "";
                if (text.Length > 0)
                {
                    text2 += text;
                }
                if (num > 0)
                {
                    if (text2.Length > 0)
                    {
                        text2 += ", ";
                    }
                    text2 = text2 + num.ToString() + " ch";
                }
                if (text2.Length > 0)
                {
                    text2 = " [" + text2 + "]";
                }
                audioTrackInfo.content         = EditorGUIUtility.TextContent("Track " + trackIdx + text2);
                audioTrackInfo.content.tooltip = VideoPlayerEditor.s_Styles.enableDecodingTooltip;
            }
            return(audioTrackInfo.content);
        }