Index: include/opus.h |
diff --git a/include/opus.h b/include/opus.h |
index 38817b405ab2bfb6e9cc69ace97e05fc29d7a31f..93a53a2ffcd0ae66623cca699f37a535ab50409f 100644 |
--- a/include/opus.h |
+++ b/include/opus.h |
@@ -911,6 +911,64 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_nb_frames(OpusRepa |
*/ |
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1); |
+/** Pads a given Opus packet to a larger size (possibly changing the TOC sequence). |
+ * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the |
+ * packet to pad. |
+ * @param len <tt>opus_int32</tt>: The size of the packet. |
+ * This must be at least 1. |
+ * @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding. |
+ * This must be at least as large as len. |
+ * @returns an error code |
+ * @retval #OPUS_OK \a on success. |
+ * @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len. |
+ * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. |
+ */ |
+OPUS_EXPORT int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len); |
+ |
+/** Remove all padding from a given Opus packet and rewrite the TOC sequence to |
+ * minimize space usage. |
+ * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the |
+ * packet to strip. |
+ * @param len <tt>opus_int32</tt>: The size of the packet. |
+ * This must be at least 1. |
+ * @returns The new size of the output packet on success, or an error code |
+ * on failure. |
+ * @retval #OPUS_BAD_ARG \a len was less than 1. |
+ * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. |
+ */ |
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_packet_unpad(unsigned char *data, opus_int32 len); |
+ |
+/** Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence). |
+ * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the |
+ * packet to pad. |
+ * @param len <tt>opus_int32</tt>: The size of the packet. |
+ * This must be at least 1. |
+ * @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding. |
+ * This must be at least 1. |
+ * @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet. |
+ * This must be at least as large as len. |
+ * @returns an error code |
+ * @retval #OPUS_OK \a on success. |
+ * @retval #OPUS_BAD_ARG \a len was less than 1. |
+ * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. |
+ */ |
+OPUS_EXPORT int opus_multistream_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len, int nb_streams); |
+ |
+/** Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to |
+ * minimize space usage. |
+ * @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the |
+ * packet to strip. |
+ * @param len <tt>opus_int32</tt>: The size of the packet. |
+ * This must be at least 1. |
+ * @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet. |
+ * This must be at least 1. |
+ * @returns The new size of the output packet on success, or an error code |
+ * on failure. |
+ * @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len. |
+ * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet. |
+ */ |
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, int nb_streams); |
+ |
/**@}*/ |
#ifdef __cplusplus |