internal override TrackBase InternalGetTrackInfo(TrackType trackType, int trackIndex, ref bool isActiveTrack)
        {
            TrackBase result = null;

            switch (trackType)
            {
            case TrackType.Video:
            {
                string trackName     = AVPPlayerGetVideoTrackName(_playerIndex, trackIndex);
                string trackLanguage = AVPPlayerGetVideoTrackLanguage(_playerIndex, trackIndex);
                bool   isActive      = AVPPlayerIsVideoTrackActive(_playerIndex, trackIndex);
                result = new VideoTrack(trackIndex, trackName, trackLanguage, isActive);
                break;
            }

            case TrackType.Audio:
            {
                string trackName     = AVPPlayerGetAudioTrackName(_playerIndex, trackIndex);
                string trackLanguage = AVPPlayerGetAudioTrackLanguage(_playerIndex, trackIndex);
                bool   isActive      = AVPPlayerIsAudioTrackActive(_playerIndex, trackIndex);
                result = new AudioTrack(trackIndex, trackName, trackLanguage, isActive);
                break;
            }

            case TrackType.Text:
            {
                string trackName     = AVPPlayerGetTextTrackName(_playerIndex, trackIndex);
                string trackLanguage = AVPPlayerGetTextTrackLanguage(_playerIndex, trackIndex);
                bool   isActive      = AVPPlayerIsTextTrackActive(_playerIndex, trackIndex);
                result = new TextTrack(trackIndex, trackName, trackLanguage, isActive);
                break;
            }
            }
            return(result);
        }
Пример #2
0
        private void SetActiveTrack(TrackCollection collection, TrackBase track)
        {
            // Check if this is already the active track
            if (collection.IsActiveTrack(track))
            {
                return;
            }

            // Convert from TextTrack to uid
            int trackUid = -1;

            if (track != null)
            {
                trackUid = track.Uid;
            }

            // Set track based on uid (-1 is no active track)
            // NOTE: TrackType is pulled from collection as track may be null
            if (InternalSetActiveTrack(collection.TrackType, trackUid))
            {
                collection.SetActiveTrack(track);
                switch (collection.TrackType)
                {
                case TrackType.Text:
                    UpdateTextCue(force: true);
                    break;
                }
            }
        }
Пример #3
0
        private void PopulateTrackCollection(TrackCollection collection)
        {
            collection.Clear();
            int trackCount = InternalGetTrackCount(collection.TrackType);

            for (int i = 0; i < trackCount; i++)
            {
                bool      isActiveTrack = false;
                TrackBase track         = InternalGetTrackInfo(collection.TrackType, i, ref isActiveTrack);
                if (track != null)
                {
                    collection.Add(track);
                    if (isActiveTrack)
                    {
                        collection.SetActiveTrack(track);
                    }
                }
                else
                {
                    UnityEngine.Debug.LogWarning(string.Format("[AVProVideo] Failed to enumerate {0} track {1} ", collection.TrackType, i));
                }
            }
        }
Пример #4
0
 internal abstract void SetActiveTrack(TrackBase track);
Пример #5
0
 internal abstract bool IsActiveTrack(TrackBase track);
Пример #6
0
 internal abstract void Add(TrackBase track);