]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/sbcenc.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / sbcenc.c
index a0064c0e8c722bf74000ea0108883220a1e9e864..e87c623d4bc227c587f4719f9255626cbb0b7be4 100644 (file)
@@ -30,7 +30,6 @@
  * SBC encoder implementation
  */
 
-#include <stdbool.h>
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "internal.h"
@@ -95,7 +94,7 @@ static int sbc_analyze_audio(SBCDSPContext *s, struct sbc_frame *frame)
  * Returns the length of the packed frame.
  */
 static size_t sbc_pack_frame(AVPacket *avpkt, struct sbc_frame *frame,
-                             int joint, bool msbc)
+                             int joint, int msbc)
 {
     PutBitContext pb;
 
@@ -156,7 +155,7 @@ static size_t sbc_pack_frame(AVPacket *avpkt, struct sbc_frame *frame,
     if (crc_pos % 8)
         crc_header[crc_pos >> 3] <<= 8 - (crc_pos % 8);
 
-    avpkt->data[3] = sbc_crc8(frame->crc_ctx, crc_header, crc_pos);
+    avpkt->data[3] = ff_sbc_crc8(frame->crc_ctx, crc_header, crc_pos);
 
     ff_sbc_calculate_bits(frame, bits);
 
@@ -189,7 +188,7 @@ static size_t sbc_pack_frame(AVPacket *avpkt, struct sbc_frame *frame,
 
     flush_put_bits(&pb);
 
-    return (put_bits_count(&pb) + 7) / 8;
+    return put_bytes_output(&pb);
 }
 
 static int sbc_encode_init(AVCodecContext *avctx)
@@ -331,6 +330,7 @@ static const AVOption options[] = {
       OFFSET(max_delay), AV_OPT_TYPE_DURATION, {.i64 = 13000}, 1000,13000, AE },
     { "msbc",      "use mSBC mode (wideband speech mono SBC)",
       OFFSET(msbc),      AV_OPT_TYPE_BOOL,     {.i64 = 0},        0,    1, AE },
+    FF_AVCTX_PROFILE_OPTION("msbc", NULL, AUDIO, FF_PROFILE_SBC_MSBC)
     { NULL },
 };
 
@@ -341,7 +341,7 @@ static const AVClass sbc_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-AVCodec ff_sbc_encoder = {
+const AVCodec ff_sbc_encoder = {
     .name                  = "sbc",
     .long_name             = NULL_IF_CONFIG_SMALL("SBC (low-complexity subband codec)"),
     .type                  = AVMEDIA_TYPE_AUDIO,