protected override void SetupWriter(AudioData audio) { var encodingConfig = new CriHcaParameters { Progress = Configuration.Progress, Bitrate = Configuration.Bitrate, LimitBitrate = Configuration.LimitBitrate }; if (Configuration.Quality != CriHcaQuality.NotSet) { encodingConfig.Quality = Configuration.Quality; } var hcaFormat = audio.GetFormat <CriHcaFormat>(encodingConfig); Hca = hcaFormat.Hca; AudioData = hcaFormat.AudioData; if (Configuration.EncryptionKey != null) { CriHcaEncryption.Crypt(Hca, AudioData, Configuration.EncryptionKey, false); Hca.EncryptionType = Configuration.EncryptionKey.KeyType; } }
protected override IAudioFormat ToAudioStream(HcaStructure structure) { if (structure.EncryptionKey != null) { CriHcaEncryption.Crypt(structure.Hca, structure.AudioData, structure.EncryptionKey, true); structure.Hca.EncryptionType = 0; } return(new CriHcaFormatBuilder(structure.AudioData, structure.Hca).Build()); }