Ejemplo n.º 1
0
        void SetupAssetReaderWriterForAudio(AVAssetTrack audioTrack)
        {
            if (audioTrack == null)
            {
                return;
            }

            // Decompress to Linear PCM with the asset reader
            // To read the media data from a specific asset track in the format in which it was stored, pass null to the settings parameter.
            AVAssetReaderOutput output = AVAssetReaderTrackOutput.Create(audioTrack, (AudioSettings)null);

            if (assetReader.CanAddOutput(output))
            {
                assetReader.AddOutput(output);
            }

            AVAssetWriterInput input = AVAssetWriterInput.Create(audioTrack.MediaType, (AudioSettings)null);

            if (assetWriter.CanAddInput(input))
            {
                assetWriter.AddInput(input);
            }

            // Create and save an instance of ReadWriteSampleBufferChannel,
            // which will coordinate the work of reading and writing sample buffers
            audioSampleBufferChannel = new AudioChannel(output, input);
        }
Ejemplo n.º 2
0
        private void SetupAssetReaderWriterForAudio(AVAssetTrack audioTrack)
        {
            if (audioTrack == null)
            {
                return;
            }

            // Decompress to Linear PCM with the asset reader
            AVAssetReaderOutput output = AVAssetReaderTrackOutput.Create(audioTrack, (AudioSettings)null);

            _assetReader.AddOutput(output);

            AVAssetWriterInput input = AVAssetWriterInput.Create(audioTrack.MediaType, (AudioSettings)null);

            _assetWriter.AddInput(input);

            // Create and save an instance of AAPLRWSampleBufferChannel,
            // which will coordinate the work of reading and writing sample buffers
            _audioSampleBufferChannel = new ReadWriteSampleBufferChannel(output, input, false);
        }