You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lib.rs
+27
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,33 @@ pub mod formats;
10
10
pubstructLawEncoder;
11
11
12
12
implLawEncoder{
13
+
///Encodes audio data from one format to another, writing the encoded data into the provided output buffer.
14
+
///
15
+
///#### Parameters:
16
+
///
17
+
///- `input_format`: An `InputFormat` enum specifying the format of the input data.
18
+
///- `input_data`: A slice of `u8` representing the audio data to be encoded. This data should conform to the format specified by `input_format`.
19
+
///- `output_format`: An `OutputFormat` enum specifying the desired format of the output data.
20
+
///- `output_buffer`: A mutable slice of `u8` where the encoded data will be stored. The buffer must be large enough to hold the encoded data; otherwise, an error is returned.
21
+
///#### Returns:
22
+
///- A `Result<usize, EncodeError>` indicating the outcome of the encoding operation. On success, it returns `Ok(num_bytes)`, where `num_bytes` is the number of bytes written to `output_buffer`. On failure, it returns `Err(EncodeError)`, indicating the nature of the error.
23
+
///#### Errors:
24
+
///- `EncodeError::OutputBufferTooSmall`: This error indicates that the provided `output_buffer` is not large enough to contain the encoded data. The size of the output buffer must be at least half the size of the input data, reflecting the specific encoding algorithm's requirements.
///- The exact size requirement for `output_buffer` may vary depending on the input and output formats. It is generally recommended to allocate the output buffer with at least half the size of the input data to accommodate the encoded data.
0 commit comments