Exemplo n.º 1
0
        public AudioSampleProvider GetAudioSampleProvider(ushort trackIndex)
        {
            bool flag = trackIndex >= this.GetAudioTrackCount();

            if (flag)
            {
                throw new ArgumentOutOfRangeException("trackIndex", trackIndex, "VideoPlayback has " + this.GetAudioTrackCount().ToString() + " tracks.");
            }
            AudioSampleProvider audioSampleProvider = AudioSampleProvider.Lookup(this.GetAudioSampleProviderId(trackIndex), null, trackIndex);
            bool flag2 = audioSampleProvider == null;

            if (flag2)
            {
                throw new InvalidOperationException("VideoPlayback.GetAudioSampleProvider got null provider.");
            }
            bool flag3 = audioSampleProvider.owner != null;

            if (flag3)
            {
                throw new InvalidOperationException("Internal error: VideoPlayback.GetAudioSampleProvider got unexpected non-null provider owner.");
            }
            bool flag4 = audioSampleProvider.trackIndex != trackIndex;

            if (flag4)
            {
                throw new InvalidOperationException("Internal error: VideoPlayback.GetAudioSampleProvider got provider for track " + audioSampleProvider.trackIndex.ToString() + " instead of " + trackIndex.ToString());
            }
            return(audioSampleProvider);
        }
Exemplo n.º 2
0
        public AudioSampleProvider GetAudioSampleProvider(ushort trackIndex)
        {
            if (trackIndex >= GetAudioTrackCount())
            {
                throw new ArgumentOutOfRangeException(
                          "trackIndex", trackIndex,
                          "VideoPlayback has " + GetAudioTrackCount() + " tracks.");
            }

            var provider = AudioSampleProvider.Lookup(GetAudioSampleProviderId(trackIndex), null, trackIndex);

            if (provider == null)
            {
                throw new InvalidOperationException(
                          "VideoPlayback.GetAudioSampleProvider got null provider.");
            }

            if (provider.owner != null)
            {
                throw new InvalidOperationException(
                          "Internal error: VideoPlayback.GetAudioSampleProvider got unexpected non-null provider owner.");
            }

            if (provider.trackIndex != trackIndex)
            {
                throw new InvalidOperationException(
                          "Internal error: VideoPlayback.GetAudioSampleProvider got provider for track " +
                          provider.trackIndex + " instead of " + trackIndex);
            }

            return(provider);
        }
Exemplo n.º 3
0
 static AudioSampleProvider CreateAudioSampleProvider(AudioClip audioClip, long startSampleFrameIndex = 0,
                                                      long endSampleFrameIndex = 0, bool loop = false, bool allowDrop = false)
 {
     return(AudioSampleProvider.Lookup(
                audioClip.Internal_CreateAudioClipSampleProvider((ulong)startSampleFrameIndex, endSampleFrameIndex, loop, allowDrop),
                null, 0));
 }
Exemplo n.º 4
0
        public static AudioSampleProvider GetAudioSampleProvider(this VideoPlayer vp, ushort trackIndex)
        {
            var count = vp.controlledAudioTrackCount;

            if (trackIndex >= count)
            {
                throw new ArgumentOutOfRangeException(
                          "trackIndex", trackIndex,
                          "VideoPlayer is currently configured with " + count + " tracks.");
            }

            var mode = vp.audioOutputMode;

            if (mode != VideoAudioOutputMode.APIOnly)
            {
                throw new InvalidOperationException(
                          "VideoPlayer.GetAudioSampleProvider requires audioOutputMode to be APIOnly. " +
                          "Current: " + mode);
            }

            var provider = AudioSampleProvider.Lookup(
                InternalGetAudioSampleProviderId(vp, trackIndex), vp, trackIndex);

            if (provider == null)
            {
                throw new InvalidOperationException(
                          "VideoPlayer.GetAudioSampleProvider got null provider.");
            }

            if (provider.owner != vp)
            {
                throw new InvalidOperationException(
                          "Internal error: VideoPlayer.GetAudioSampleProvider got provider used by another object.");
            }

            if (provider.trackIndex != trackIndex)
            {
                throw new InvalidOperationException(
                          "Internal error: VideoPlayer.GetAudioSampleProvider got provider for track " +
                          provider.trackIndex + " instead of " + trackIndex);
            }

            return(provider);
        }
Exemplo n.º 5
0
        public static AudioSampleProvider GetAudioSampleProvider(this VideoPlayer vp, ushort trackIndex)
        {
            ushort controlledAudioTrackCount = vp.controlledAudioTrackCount;
            bool   flag = trackIndex >= controlledAudioTrackCount;

            if (flag)
            {
                throw new ArgumentOutOfRangeException("trackIndex", trackIndex, "VideoPlayer is currently configured with " + controlledAudioTrackCount.ToString() + " tracks.");
            }
            VideoAudioOutputMode audioOutputMode = vp.audioOutputMode;
            bool flag2 = audioOutputMode != VideoAudioOutputMode.APIOnly;

            if (flag2)
            {
                throw new InvalidOperationException("VideoPlayer.GetAudioSampleProvider requires audioOutputMode to be APIOnly. Current: " + audioOutputMode.ToString());
            }
            AudioSampleProvider audioSampleProvider = AudioSampleProvider.Lookup(vp.InternalGetAudioSampleProviderId(trackIndex), vp, trackIndex);
            bool flag3 = audioSampleProvider == null;

            if (flag3)
            {
                throw new InvalidOperationException("VideoPlayer.GetAudioSampleProvider got null provider.");
            }
            bool flag4 = audioSampleProvider.owner != vp;

            if (flag4)
            {
                throw new InvalidOperationException("Internal error: VideoPlayer.GetAudioSampleProvider got provider used by another object.");
            }
            bool flag5 = audioSampleProvider.trackIndex != trackIndex;

            if (flag5)
            {
                throw new InvalidOperationException("Internal error: VideoPlayer.GetAudioSampleProvider got provider for track " + audioSampleProvider.trackIndex.ToString() + " instead of " + trackIndex.ToString());
            }
            return(audioSampleProvider);
        }
Exemplo n.º 6
0
        public static AudioSampleProvider GetAudioSampleProvider(this VideoPlayer vp, ushort trackIndex)
        {
            ushort controlledAudioTrackCount = vp.controlledAudioTrackCount;

            if (trackIndex >= controlledAudioTrackCount)
            {
                throw new ArgumentOutOfRangeException("trackIndex", trackIndex, "VideoPlayer is currently configured with " + controlledAudioTrackCount + " tracks.");
            }
            VideoAudioOutputMode audioOutputMode = vp.audioOutputMode;

            if (audioOutputMode != VideoAudioOutputMode.APIOnly)
            {
                throw new InvalidOperationException("VideoPlayer.GetAudioSampleProvider requires audioOutputMode to be APIOnly. Current: " + audioOutputMode);
            }
            AudioSampleProvider audioSampleProvider = AudioSampleProvider.Lookup(VideoPlayerExtensions.InternalGetAudioSampleProviderId(vp, trackIndex), vp, trackIndex);

            if (audioSampleProvider == null)
            {
                throw new InvalidOperationException("VideoPlayer.GetAudioSampleProvider got null provider.");
            }
            if (audioSampleProvider.owner != vp)
            {
                throw new InvalidOperationException("Internal error: VideoPlayer.GetAudioSampleProvider got provider used by another object.");
            }
            if (audioSampleProvider.trackIndex != trackIndex)
            {
                throw new InvalidOperationException(string.Concat(new object[]
                {
                    "Internal error: VideoPlayer.GetAudioSampleProvider got provider for track ",
                    audioSampleProvider.trackIndex,
                    " instead of ",
                    trackIndex
                }));
            }
            return(audioSampleProvider);
        }