Skip to content

Commit f3783b5

Browse files
authored
Merge branch 'SineVector241:master' into master
2 parents 3e05ddd + bb59d3e commit f3783b5

28 files changed

+1831
-209
lines changed

OpusSharp.Android/OpusSharp.Android.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<authors>The Opus Audio Codec Authors</authors>
88
<projectUrl>https://opus-codec.org/</projectUrl>
99
<dependencies>
10-
<dependency id="OpusSharp.Core" version="1.0.3" />
10+
<dependency id="OpusSharp.Core" version="1.0.4" />
1111
</dependencies>
1212
</metadata>
1313

OpusSharp.Core/Disposable.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
// paint.net //
3+
// Copyright (C) dotPDN LLC, Rick Brewster, and contributors. //
4+
// All Rights Reserved. //
5+
/////////////////////////////////////////////////////////////////////////////////
6+
7+
using System;
8+
using System.Threading;
9+
10+
namespace OpusSharp.Core
11+
{
12+
/// <summary>
13+
/// Provides a standard implementation of IDisposable and IIsDisposed.
14+
/// </summary>
15+
[Serializable]
16+
public abstract class Disposable : IDisposable
17+
{
18+
private int isDisposed; // 0 for false, 1 for true
19+
20+
public bool IsDisposed
21+
{
22+
get => Volatile.Read(ref this.isDisposed) != 0;
23+
}
24+
25+
protected Disposable()
26+
{
27+
}
28+
29+
~Disposable()
30+
{
31+
int oldIsDisposed = Interlocked.Exchange(ref this.isDisposed, 1);
32+
if (oldIsDisposed == 0)
33+
{
34+
Dispose(false);
35+
}
36+
}
37+
38+
public void Dispose()
39+
{
40+
int oldIsDisposed = Interlocked.Exchange(ref this.isDisposed, 1);
41+
if (oldIsDisposed == 0)
42+
{
43+
try
44+
{
45+
Dispose(true);
46+
}
47+
finally
48+
{
49+
GC.SuppressFinalize(this);
50+
}
51+
}
52+
}
53+
54+
protected virtual void Dispose(bool disposing)
55+
{
56+
throw new NotImplementedException();
57+
}
58+
}
59+
}
60+
61+
// https://gist.github.com/rickbrew/fc3e660c0930747f031e64ab7696c60d

OpusSharp.Core/Enums/Application.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

OpusSharp.Core/Enums/DecoderCtl.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
namespace OpusSharp.Enums
1+
namespace OpusSharp.Core.Enums
22
{
3+
/// <summary>
4+
/// Decoder related Ctl's.
5+
/// </summary>
36
public enum DecoderCtl : int
47
{
5-
SET_GAIN = 4034,
6-
GET_GAIN = 4045, //Someone inside opus made a mistake here, Apparently.
7-
GET_LAST_PACKET_DURATION = 4039,
8-
GET_PITCH = 4033
8+
/// <summary>
9+
/// Configures decoder gain adjustment.
10+
/// </summary>
11+
OPUS_SET_GAIN_REQUEST = 4034,
12+
13+
/// <summary>
14+
/// Gets the decoder's configured gain adjustment.
15+
/// </summary>
16+
OPUS_GET_GAIN_REQUEST = 4045, //Someone inside opus made a mistake here, Apparently.
17+
18+
/// <summary>
19+
/// Gets the duration (in samples) of the last packet successfully decoded or concealed.
20+
/// </summary>
21+
OPUS_GET_LAST_PACKET_DURATION_REQUEST = 4039,
22+
23+
/// <summary>
24+
/// Gets the pitch of the last decoded frame, if available.
25+
/// </summary>
26+
OPUS_GET_PITCH_REQUEST = 4033
927
}
1028
}

OpusSharp.Core/Enums/EncoderCtl.cs

Lines changed: 165 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,173 @@
1-
namespace OpusSharp.Enums
1+
namespace OpusSharp.Core.Enums
22
{
33
/// <summary>
44
/// Encoder related CTL's.
55
/// </summary>
66
public enum EncoderCtl : int
77
{
8-
SET_COMPLEXITY = 4010,
9-
GET_COMPLEXITY = 4011,
10-
SET_BITRATE = 4002,
11-
GET_BITRATE = 4003,
12-
SET_VBR = 4006,
13-
GET_VBR = 4007,
14-
SET_VBR_CONSTRAINT = 4020,
15-
GET_VBR_CONSTRAINT = 4021,
16-
SET_FORCE_CHANNELS = 4022,
17-
GET_FORCE_CHANNELS = 4023,
18-
SET_MAX_BANDWIDTH = 4004,
19-
GET_MAX_BANDWIDTH = 4005,
20-
SET_BANDWIDTH = 4008,
21-
SET_SIGNAL = 4024,
22-
GET_SIGNAL = 4025,
23-
SET_APPLICATION = 4000,
24-
GET_APPLICATION = 4001,
25-
GET_LOOKAHEAD = 4027,
26-
SET_INBAND_FEC = 4012,
27-
GET_INBAND_FEC = 4013,
28-
SET_PACKET_LOSS_PERC = 4014,
29-
GET_PACKET_LOSS_PERC = 4015,
30-
SET_DTX = 4016,
31-
GET_DTX = 4017,
32-
SET_LSB_DEPTH = 4036,
33-
GET_LSB_DEPTH = 4037,
34-
SET_EXPERT_FRAME_DURATION = 4040,
35-
GET_EXPERT_FRAME_DURATION = 4041,
36-
SET_PREDICTION_DISABLED = 4042,
37-
GET_PREDICTION_DISABLED = 4043
8+
/// <summary>
9+
/// Configures the encoder's computational complexity.
10+
/// </summary>
11+
OPUS_SET_COMPLEXITY_REQUEST = 4010,
12+
13+
/// <summary>
14+
/// Gets the encoder's complexity configuration.
15+
/// </summary>
16+
OPUS_GET_COMPLEXITY_REQUEST = 4011,
17+
18+
/// <summary>
19+
/// Configures the bitrate in the encoder.
20+
/// </summary>
21+
OPUS_SET_BITRATE_REQUEST = 4002,
22+
23+
/// <summary>
24+
/// Gets the encoder's bitrate configuration.
25+
/// </summary>
26+
OPUS_GET_BITRATE_REQUEST = 4003,
27+
28+
/// <summary>
29+
/// Enables or disables variable bitrate (VBR) in the encoder.
30+
/// </summary>
31+
OPUS_SET_VBR_REQUEST = 4006,
32+
33+
/// <summary>
34+
/// Determine if variable bitrate (VBR) is enabled in the encoder.
35+
/// </summary>
36+
OPUS_GET_VBR_REQUEST = 4007,
37+
38+
/// <summary>
39+
/// Enables or disables variable bitrate (VBR) in the encoder.
40+
/// </summary>
41+
OPUS_SET_VBR_CONSTRAINT_REQUEST = 4020,
42+
43+
/// <summary>
44+
/// Determine if constrained VBR is enabled in the encoder.
45+
/// </summary>
46+
OPUS_GET_VBR_CONSTRAINT_REQUEST = 4021,
47+
48+
/// <summary>
49+
/// Configures mono/stereo forcing in the encoder.
50+
/// </summary>
51+
OPUS_SET_FORCE_CHANNELS_REQUEST = 4022,
52+
53+
/// <summary>
54+
/// Gets the encoder's forced channel configuration.
55+
/// </summary>
56+
OPUS_GET_FORCE_CHANNELS_REQUEST = 4023,
57+
58+
/// <summary>
59+
/// Configures the maximum bandpass that the encoder will select automatically.
60+
/// </summary>
61+
OPUS_SET_MAX_BANDWIDTH_REQUEST = 4004,
62+
63+
/// <summary>
64+
/// Gets the encoder's configured maximum allowed bandpass.
65+
/// </summary>
66+
OPUS_GET_MAX_BANDWIDTH_REQUEST = 4005,
67+
68+
/// <summary>
69+
/// Sets the encoder's bandpass to a specific value.
70+
/// </summary>
71+
OPUS_SET_BANDWIDTH_REQUEST = 4008,
72+
73+
/// <summary>
74+
/// Configures the type of signal being encoded.
75+
/// </summary>
76+
OPUS_SET_SIGNAL_REQUEST = 4024,
77+
78+
/// <summary>
79+
/// Gets the encoder's configured signal type.
80+
/// </summary>
81+
OPUS_GET_SIGNAL_REQUEST = 4025,
82+
83+
/// <summary>
84+
/// Configures the encoder's intended application.
85+
/// </summary>
86+
OPUS_SET_APPLICATION_REQUEST = 4000,
87+
88+
/// <summary>
89+
/// Gets the encoder's configured application.
90+
/// </summary>
91+
OPUS_GET_APPLICATION_REQUEST = 4001,
92+
93+
/// <summary>
94+
/// Gets the total samples of delay added by the entire codec.
95+
/// </summary>
96+
OPUS_GET_LOOKAHEAD_REQUEST = 4027,
97+
98+
/// <summary>
99+
/// Configures the encoder's use of inband forward error correction (FEC).
100+
/// </summary>
101+
OPUS_SET_INBAND_FEC_REQUEST = 4012,
102+
103+
/// <summary>
104+
/// Gets encoder's configured use of inband forward error correction.
105+
/// </summary>
106+
OPUS_GET_INBAND_FEC_REQUEST = 4013,
107+
108+
/// <summary>
109+
/// Configures the encoder's expected packet loss percentage.
110+
/// </summary>
111+
OPUS_SET_PACKET_LOSS_PERC_REQUEST = 4014,
112+
113+
/// <summary>
114+
/// Gets the encoder's configured packet loss percentage.
115+
/// </summary>
116+
OPUS_GET_PACKET_LOSS_PERC_REQUEST = 4015,
117+
118+
/// <summary>
119+
/// Configures the encoder's use of discontinuous transmission (DTX).
120+
/// </summary>
121+
OPUS_SET_DTX_REQUEST = 4016,
122+
123+
/// <summary>
124+
/// Gets encoder's configured use of discontinuous transmission.
125+
/// </summary>
126+
OPUS_GET_DTX_REQUEST = 4017,
127+
128+
/// <summary>
129+
/// Configures the depth of signal being encoded.
130+
/// </summary>
131+
OPUS_SET_LSB_DEPTH_REQUEST = 4036,
132+
133+
/// <summary>
134+
/// Gets the encoder's configured signal depth.
135+
/// </summary>
136+
OPUS_GET_LSB_DEPTH_REQUEST = 4037,
137+
138+
/// <summary>
139+
/// Configures the encoder's use of variable duration frames.
140+
/// </summary>
141+
OPUS_SET_EXPERT_FRAME_DURATION_REQUEST = 4040,
142+
143+
/// <summary>
144+
/// Gets the encoder's configured use of variable duration frames.
145+
/// </summary>
146+
OPUS_GET_EXPERT_FRAME_DURATION_REQUEST = 4041,
147+
148+
/// <summary>
149+
/// If set to 1, disables almost all use of prediction, making frames almost completely independent.
150+
/// </summary>
151+
OPUS_SET_PREDICTION_DISABLED_REQUEST = 4042,
152+
153+
/// <summary>
154+
/// Gets the encoder's configured prediction status.
155+
/// </summary>
156+
OPUS_GET_PREDICTION_DISABLED_REQUEST = 4043,
157+
158+
/// <summary>
159+
/// If non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames.
160+
/// </summary>
161+
OPUS_SET_DRED_DURATION_REQUEST = 4050,
162+
163+
/// <summary>
164+
/// Gets the encoder's configured Deep Redundancy (DRED) maximum number of frames.
165+
/// </summary>
166+
OPUS_GET_DRED_DURATION_REQUEST = 4051,
167+
168+
/// <summary>
169+
/// Provide external DNN weights from binary object (only when explicitly built without the weights).
170+
/// </summary>
171+
OPUS_SET_DNN_BLOB_REQUEST = 4052
38172
}
39173
}

OpusSharp.Core/Enums/GenericCtl.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
namespace OpusSharp.Core.Enums
2+
{
3+
/// <summary>
4+
/// These macros are used with the Decoder and Encoder CTL calls to generate a particular request.
5+
/// </summary>
6+
public enum GenericCtl : int
7+
{
8+
/// <summary>
9+
/// Resets the codec state to be equivalent to a freshly initialized state.
10+
/// </summary>
11+
OPUS_RESET_STATE = 4028,
12+
13+
/// <summary>
14+
/// Gets the final state of the codec's entropy coder.
15+
/// </summary>
16+
OPUS_GET_FINAL_RANGE_REQUEST = 4031,
17+
18+
/// <summary>
19+
/// Gets the encoder's configured bandpass or the decoder's last bandpass.
20+
/// </summary>
21+
OPUS_GET_BANDWIDTH_REQUEST = 4009,
22+
23+
/// <summary>
24+
/// Gets the sampling rate the encoder or decoder was initialized with.
25+
/// </summary>
26+
OPUS_GET_SAMPLE_RATE_REQUEST = 4029,
27+
28+
/// <summary>
29+
/// If set to 1, disables the use of phase inversion for intensity stereo, improving the quality of mono downmixes, but slightly reducing normal stereo quality.
30+
/// </summary>
31+
OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST = 4046,
32+
33+
/// <summary>
34+
/// Gets the encoder's configured phase inversion status.
35+
/// </summary>
36+
OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST = 4047,
37+
38+
/// <summary>
39+
/// Gets the DTX state of the encoder.
40+
/// </summary>
41+
OPUS_GET_IN_DTX_REQUEST = 4049
42+
}
43+
}

OpusSharp.Core/Enums/OpusError.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
namespace OpusSharp.Enums
1+
namespace OpusSharp.Core.Enums
22
{
33
/// <summary>
44
/// Specifies the type of opus error.
55
/// </summary>
66
public enum OpusError : int
77
{
88
/// <summary>
9-
/// No error.
9+
/// No error. This does not throw the <seealso cref="OpusException"/>
1010
/// </summary>
1111
OK = 0,
1212
/// <summary>

0 commit comments

Comments
 (0)