Esempio n. 1
0
 private static void CheckError(OpusError error)
 {
     if (error < 0)
     {
         throw new Exception($"Opus Error: {error}");
     }
 }
Esempio n. 2
0
 protected static void CheckError(OpusError error)
 {
     if ((int)error < 0)
     {
         throw new Exception($"Opus Error: {error}");
     }
 }
Esempio n. 3
0
 protected void CheckError(OpusError error)
 {
     if (error < OpusError.OK)
     {
         throw new OpusException(error);
     }
 }
Esempio n. 4
0
 private void CheckForError(OpusError err)
 {
     if (err < 0)
     {
         throw new Exception(string.Concat("Opus returned an error: ", err.ToString()));
     }
 }
Esempio n. 5
0
        private static string GetMessage(OpusError error)
        {
            switch (error)
            {
            case OpusError.BadArg:
                return("One or more invalid/out of range arguments.");

            case OpusError.BufferTooSmall:
                return("Not enough bytes allocated in the buffer.");

            case OpusError.InternalError:
                return("An internal error was detected.");

            case OpusError.InvalidPacket:
                return("The compressed data passed is corrupted.");

            case OpusError.Unimplemented:
                return("Invalid/unsupported request number.");

            case OpusError.InvalidState:
                return("An encoder or decoder structure is invalid or already freed.");

            case OpusError.AllocFail:
                return("Memory allocation has failed.");

            default:
                return("An unknown error has occurred.");
            }
        }
Esempio n. 6
0
        // Token: 0x0600015E RID: 350 RVA: 0x0000476C File Offset: 0x0000296C
        public unsafe static int OpusDecode(IntPtr decoder, int frameSize, Span <byte> pcm)
        {
            int num;

            fixed(byte *pinnableReference = pcm.GetPinnableReference())
            {
                byte *data = pinnableReference;

                num = Interop._OpusDecode(decoder, null, 0, data, frameSize, 1);
            }

            if (num < 0)
            {
                OpusError opusError = (OpusError)num;
                throw new Exception(string.Format("Could not decode PCM data from Opus: {0} ({1}).", opusError, (int)opusError));
            }
            return(num);
        }
Esempio n. 7
0
        // Token: 0x0600015D RID: 349 RVA: 0x000046FC File Offset: 0x000028FC
        public unsafe static int OpusDecode(IntPtr decoder, ReadOnlySpan <byte> opus, int frameSize, Span <byte> pcm, bool useFec)
        {
            int num;

            fixed(byte *pinnableReference = opus.GetPinnableReference())
            {
                byte *opusData = pinnableReference;

                fixed(byte *pinnableReference2 = pcm.GetPinnableReference())
                {
                    byte *data = pinnableReference2;

                    num = Interop._OpusDecode(decoder, opusData, opus.Length, data, frameSize, useFec ? 1 : 0);
                }
            }

            if (num < 0)
            {
                OpusError opusError = (OpusError)num;
                throw new Exception(string.Format("Could not decode PCM data from Opus: {0} ({1}).", opusError, (int)opusError));
            }
            return(num);
        }
Esempio n. 8
0
        // Token: 0x0600015B RID: 347 RVA: 0x00004648 File Offset: 0x00002848
        public unsafe static void OpusEncode(IntPtr encoder, ReadOnlySpan <byte> pcm, int frameSize, ref Span <byte> opus)
        {
            int num;

            fixed(byte *pinnableReference = pcm.GetPinnableReference())
            {
                byte *pcmData = pinnableReference;

                fixed(byte *pinnableReference2 = opus.GetPinnableReference())
                {
                    byte *data = pinnableReference2;

                    num = Interop._OpusEncode(encoder, pcmData, frameSize, data, opus.Length);
                }
            }

            if (num < 0)
            {
                OpusError opusError = (OpusError)num;
                throw new Exception(string.Format("Could not encode PCM data to Opus: {0} ({1}).", opusError, (int)opusError));
            }
            opus = opus.Slice(0, num);
        }
Esempio n. 9
0
 public static extern IntPtr CreateEncoder(int Fs, int channels, int application, out OpusError error);
Esempio n. 10
0
 public static extern IntPtr CreateDecoder(int Fs, int channels, out OpusError error);
Esempio n. 11
0
 private static extern IntPtr _OpusCreateDecoder(int sampleRate, int channels, out OpusError error);
Esempio n. 12
0
 IntPtr IOpusConverter.CreateDecoder(int Fs, int channels, out OpusError error)
 {
     return(CreateDecoder(Fs, channels, out error));
 }
Esempio n. 13
0
 IntPtr IOpusConverter.CreateEncoder(int Fs, int channels, int application, out OpusError error)
 {
     return(CreateEncoder(Fs, channels, application, out error));
 }
Esempio n. 14
0
 static extern IntPtr op_open_callbacks(IntPtr source, ref _OpusFileCallbacks cb, IntPtr initial_data, IntPtr initial_bytes, out OpusError error);
Esempio n. 15
0
 private static extern IntPtr CreateEncoder(int Fs, int channels, int application, out OpusError error);
Esempio n. 16
0
 public OpusException(OpusError error) : base(error.ToString())
 {
 }
Esempio n. 17
0
 public static extern IntPtr CreateDecoder(int Fs, int channels, out OpusError error);
Esempio n. 18
0
 public OpusException(OpusError error)
     : base(error.ToString())
 {
 }
Esempio n. 19
0
 internal static extern IntPtr opus_encoder_create(int sampleRate, int channels, int application,
                                                   out OpusError error);
Esempio n. 20
0
 static extern IntPtr op_open_callbacks(IntPtr source, ref _OpusFileCallbacks cb, IntPtr initial_data, IntPtr initial_bytes, out OpusError error);
Esempio n. 21
0
 private static extern IntPtr OpusCreateEncoder(int sampleRate, int channels, int application,
                                                out OpusError error);
Esempio n. 22
0
 internal static extern IntPtr opus_decoder_create(int sampleRate, int channels, out OpusError error);