You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

724 lines
18KB

  1. /*
  2. * AMR Audio decoder stub
  3. * Copyright (c) 2003 the ffmpeg project
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /** @file
  22. * Adaptive Multi-Rate (AMR) Audio decoder stub.
  23. *
  24. * This code implements both an AMR-NarrowBand (AMR-NB) and an AMR-WideBand
  25. * (AMR-WB) audio encoder/decoder through external reference code from
  26. * http://www.3gpp.org/. The license of the code from 3gpp is unclear so you
  27. * have to download the code separately. Two versions exists: One fixed-point
  28. * and one floating-point. For some reason the float encoder is significantly
  29. * faster at least on a P4 1.5GHz (0.9s instead of 9.9s on a 30s audio clip
  30. * at MR102). Both float and fixed point are supported for AMR-NB, but only
  31. * float for AMR-WB.
  32. *
  33. * \section AMR-NB
  34. *
  35. * \subsection Float
  36. * The float version (default) can be downloaded from:
  37. * http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip
  38. *
  39. * \subsection Fixed-point
  40. * The fixed-point (TS26.073) can be downloaded from:
  41. * http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-600.zip
  42. *
  43. * \subsection Specification
  44. * The specification for AMR-NB can be found in TS 26.071
  45. * (http://www.3gpp.org/ftp/Specs/html-info/26071.htm) and some other
  46. * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
  47. *
  48. * \section AMR-WB
  49. *
  50. * \subsection Float
  51. * The reference code can be downloaded from:
  52. * http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip
  53. *
  54. * \subsection Fixed-point
  55. * If someone wants to use the fixed point version it can be downloaded from:
  56. * http://www.3gpp.org/ftp/Specs/archive/26_series/26.173/26173-571.zip.
  57. *
  58. * \subsection Specification
  59. * The specification for AMR-WB can be found in TS 26.171
  60. * (http://www.3gpp.org/ftp/Specs/html-info/26171.htm) and some other
  61. * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm.
  62. *
  63. */
  64. #include "avcodec.h"
  65. #if CONFIG_LIBAMR_NB_FIXED
  66. #define MMS_IO
  67. #include "amr/sp_dec.h"
  68. #include "amr/d_homing.h"
  69. #include "amr/typedef.h"
  70. #include "amr/sp_enc.h"
  71. #include "amr/sid_sync.h"
  72. #include "amr/e_homing.h"
  73. #else
  74. #include <amrnb/interf_dec.h>
  75. #include <amrnb/interf_enc.h>
  76. #endif
  77. static const char nb_bitrate_unsupported[] =
  78. "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n";
  79. static const char wb_bitrate_unsupported[] =
  80. "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n";
  81. /* Common code for fixed and float version*/
  82. typedef struct AMR_bitrates
  83. {
  84. int rate;
  85. enum Mode mode;
  86. } AMR_bitrates;
  87. /* Match desired bitrate */
  88. static int getBitrateMode(int bitrate)
  89. {
  90. /* make the correspondance between bitrate and mode */
  91. AMR_bitrates rates[]={ {4750,MR475},
  92. {5150,MR515},
  93. {5900,MR59},
  94. {6700,MR67},
  95. {7400,MR74},
  96. {7950,MR795},
  97. {10200,MR102},
  98. {12200,MR122},
  99. };
  100. int i;
  101. for(i=0;i<8;i++)
  102. {
  103. if(rates[i].rate==bitrate)
  104. {
  105. return rates[i].mode;
  106. }
  107. }
  108. /* no bitrate matching, return an error */
  109. return -1;
  110. }
  111. static void amr_decode_fix_avctx(AVCodecContext * avctx)
  112. {
  113. const int is_amr_wb = 1 + (avctx->codec_id == CODEC_ID_AMR_WB);
  114. if(avctx->sample_rate == 0)
  115. {
  116. avctx->sample_rate = 8000 * is_amr_wb;
  117. }
  118. if(avctx->channels == 0)
  119. {
  120. avctx->channels = 1;
  121. }
  122. avctx->frame_size = 160 * is_amr_wb;
  123. avctx->sample_fmt = SAMPLE_FMT_S16;
  124. }
  125. #if CONFIG_LIBAMR_NB_FIXED
  126. /* fixed point version*/
  127. /* frame size in serial bitstream file (frame type + serial stream + flags) */
  128. #define SERIAL_FRAMESIZE (1+MAX_SERIAL_SIZE+5)
  129. typedef struct AMRContext {
  130. int frameCount;
  131. Speech_Decode_FrameState *speech_decoder_state;
  132. enum RXFrameType rx_type;
  133. enum Mode mode;
  134. Word16 reset_flag;
  135. Word16 reset_flag_old;
  136. int enc_bitrate;
  137. Speech_Encode_FrameState *enstate;
  138. sid_syncState *sidstate;
  139. enum TXFrameType tx_frametype;
  140. } AMRContext;
  141. static av_cold int amr_nb_decode_init(AVCodecContext * avctx)
  142. {
  143. AMRContext *s = avctx->priv_data;
  144. s->frameCount=0;
  145. s->speech_decoder_state=NULL;
  146. s->rx_type = (enum RXFrameType)0;
  147. s->mode= (enum Mode)0;
  148. s->reset_flag=0;
  149. s->reset_flag_old=1;
  150. if(Speech_Decode_Frame_init(&s->speech_decoder_state, "Decoder"))
  151. {
  152. av_log(avctx, AV_LOG_ERROR, "Speech_Decode_Frame_init error\n");
  153. return -1;
  154. }
  155. amr_decode_fix_avctx(avctx);
  156. if(avctx->channels > 1)
  157. {
  158. av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
  159. return -1;
  160. }
  161. return 0;
  162. }
  163. static av_cold int amr_nb_encode_init(AVCodecContext * avctx)
  164. {
  165. AMRContext *s = avctx->priv_data;
  166. s->frameCount=0;
  167. s->speech_decoder_state=NULL;
  168. s->rx_type = (enum RXFrameType)0;
  169. s->mode= (enum Mode)0;
  170. s->reset_flag=0;
  171. s->reset_flag_old=1;
  172. if(avctx->sample_rate!=8000)
  173. {
  174. av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
  175. return -1;
  176. }
  177. if(avctx->channels!=1)
  178. {
  179. av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
  180. return -1;
  181. }
  182. avctx->frame_size=160;
  183. avctx->coded_frame= avcodec_alloc_frame();
  184. if(Speech_Encode_Frame_init(&s->enstate, 0, "encoder") || sid_sync_init (&s->sidstate))
  185. {
  186. av_log(avctx, AV_LOG_ERROR, "Speech_Encode_Frame_init error\n");
  187. return -1;
  188. }
  189. if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
  190. {
  191. av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
  192. return -1;
  193. }
  194. return 0;
  195. }
  196. static av_cold int amr_nb_encode_close(AVCodecContext * avctx)
  197. {
  198. AMRContext *s = avctx->priv_data;
  199. Speech_Encode_Frame_exit(&s->enstate);
  200. sid_sync_exit (&s->sidstate);
  201. av_freep(&avctx->coded_frame);
  202. return 0;
  203. }
  204. static av_cold int amr_nb_decode_close(AVCodecContext * avctx)
  205. {
  206. AMRContext *s = avctx->priv_data;
  207. Speech_Decode_Frame_exit(&s->speech_decoder_state);
  208. return 0;
  209. }
  210. static int amr_nb_decode_frame(AVCodecContext * avctx,
  211. void *data, int *data_size,
  212. AVPacket *avpkt)
  213. {
  214. const uint8_t *buf = avpkt->data;
  215. int buf_size = avpkt->size;
  216. AMRContext *s = avctx->priv_data;
  217. const uint8_t*amrData=buf;
  218. int offset=0;
  219. UWord8 toc, q, ft;
  220. Word16 serial[SERIAL_FRAMESIZE]; /* coded bits */
  221. Word16 *synth;
  222. UWord8 *packed_bits;
  223. static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
  224. int i;
  225. //printf("amr_decode_frame data_size=%i buf=0x%X buf_size=%d frameCount=%d!!\n",*data_size,buf,buf_size,s->frameCount);
  226. synth=data;
  227. toc=amrData[offset];
  228. /* read rest of the frame based on ToC byte */
  229. q = (toc >> 2) & 0x01;
  230. ft = (toc >> 3) & 0x0F;
  231. //printf("offset=%d, packet_size=%d amrData= 0x%X %X %X %X\n",offset,packed_size[ft],amrData[offset],amrData[offset+1],amrData[offset+2],amrData[offset+3]);
  232. offset++;
  233. packed_bits=amrData+offset;
  234. offset+=packed_size[ft];
  235. //Unsort and unpack bits
  236. s->rx_type = UnpackBits(q, ft, packed_bits, &s->mode, &serial[1]);
  237. //We have a new frame
  238. s->frameCount++;
  239. if (s->rx_type == RX_NO_DATA)
  240. {
  241. s->mode = s->speech_decoder_state->prev_mode;
  242. }
  243. else {
  244. s->speech_decoder_state->prev_mode = s->mode;
  245. }
  246. /* if homed: check if this frame is another homing frame */
  247. if (s->reset_flag_old == 1)
  248. {
  249. /* only check until end of first subframe */
  250. s->reset_flag = decoder_homing_frame_test_first(&serial[1], s->mode);
  251. }
  252. /* produce encoder homing frame if homed & input=decoder homing frame */
  253. if ((s->reset_flag != 0) && (s->reset_flag_old != 0))
  254. {
  255. for (i = 0; i < L_FRAME; i++)
  256. {
  257. synth[i] = EHF_MASK;
  258. }
  259. }
  260. else
  261. {
  262. /* decode frame */
  263. Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth);
  264. }
  265. //Each AMR-frame results in 160 16-bit samples
  266. *data_size=160*2;
  267. /* if not homed: check whether current frame is a homing frame */
  268. if (s->reset_flag_old == 0)
  269. {
  270. /* check whole frame */
  271. s->reset_flag = decoder_homing_frame_test(&serial[1], s->mode);
  272. }
  273. /* reset decoder if current frame is a homing frame */
  274. if (s->reset_flag != 0)
  275. {
  276. Speech_Decode_Frame_reset(s->speech_decoder_state);
  277. }
  278. s->reset_flag_old = s->reset_flag;
  279. return offset;
  280. }
  281. static int amr_nb_encode_frame(AVCodecContext *avctx,
  282. unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
  283. {
  284. short serial_data[250] = {0};
  285. AMRContext *s = avctx->priv_data;
  286. int written;
  287. s->reset_flag = encoder_homing_frame_test(data);
  288. Speech_Encode_Frame(s->enstate, s->enc_bitrate, data, &serial_data[1], &s->mode);
  289. /* add frame type and mode */
  290. sid_sync (s->sidstate, s->mode, &s->tx_frametype);
  291. written = PackBits(s->mode, s->enc_bitrate, s->tx_frametype, &serial_data[1], frame);
  292. if (s->reset_flag != 0)
  293. {
  294. Speech_Encode_Frame_reset(s->enstate);
  295. sid_sync_reset(s->sidstate);
  296. }
  297. return written;
  298. }
  299. #elif CONFIG_LIBAMR_NB /* Float point version*/
  300. typedef struct AMRContext {
  301. int frameCount;
  302. void * decState;
  303. int *enstate;
  304. int enc_bitrate;
  305. } AMRContext;
  306. static av_cold int amr_nb_decode_init(AVCodecContext * avctx)
  307. {
  308. AMRContext *s = avctx->priv_data;
  309. s->frameCount=0;
  310. s->decState=Decoder_Interface_init();
  311. if(!s->decState)
  312. {
  313. av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
  314. return -1;
  315. }
  316. amr_decode_fix_avctx(avctx);
  317. if(avctx->channels > 1)
  318. {
  319. av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
  320. return -1;
  321. }
  322. return 0;
  323. }
  324. static av_cold int amr_nb_encode_init(AVCodecContext * avctx)
  325. {
  326. AMRContext *s = avctx->priv_data;
  327. s->frameCount=0;
  328. if(avctx->sample_rate!=8000)
  329. {
  330. av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
  331. return -1;
  332. }
  333. if(avctx->channels!=1)
  334. {
  335. av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
  336. return -1;
  337. }
  338. avctx->frame_size=160;
  339. avctx->coded_frame= avcodec_alloc_frame();
  340. s->enstate=Encoder_Interface_init(0);
  341. if(!s->enstate)
  342. {
  343. av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
  344. return -1;
  345. }
  346. if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
  347. {
  348. av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
  349. return -1;
  350. }
  351. return 0;
  352. }
  353. static av_cold int amr_nb_decode_close(AVCodecContext * avctx)
  354. {
  355. AMRContext *s = avctx->priv_data;
  356. Decoder_Interface_exit(s->decState);
  357. return 0;
  358. }
  359. static av_cold int amr_nb_encode_close(AVCodecContext * avctx)
  360. {
  361. AMRContext *s = avctx->priv_data;
  362. Encoder_Interface_exit(s->enstate);
  363. av_freep(&avctx->coded_frame);
  364. return 0;
  365. }
  366. static int amr_nb_decode_frame(AVCodecContext * avctx,
  367. void *data, int *data_size,
  368. const uint8_t * buf, int buf_size)
  369. {
  370. AMRContext *s = avctx->priv_data;
  371. const uint8_t*amrData=buf;
  372. static const uint8_t block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
  373. enum Mode dec_mode;
  374. int packet_size;
  375. /* av_log(NULL,AV_LOG_DEBUG,"amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",buf,buf_size,s->frameCount); */
  376. dec_mode = (buf[0] >> 3) & 0x000F;
  377. packet_size = block_size[dec_mode]+1;
  378. if(packet_size > buf_size) {
  379. av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size);
  380. return -1;
  381. }
  382. s->frameCount++;
  383. /* av_log(NULL,AV_LOG_DEBUG,"packet_size=%d amrData= 0x%X %X %X %X\n",packet_size,amrData[0],amrData[1],amrData[2],amrData[3]); */
  384. /* call decoder */
  385. Decoder_Interface_Decode(s->decState, amrData, data, 0);
  386. *data_size=160*2;
  387. return packet_size;
  388. }
  389. static int amr_nb_encode_frame(AVCodecContext *avctx,
  390. unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
  391. {
  392. AMRContext *s = avctx->priv_data;
  393. int written;
  394. if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
  395. {
  396. av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
  397. return -1;
  398. }
  399. written = Encoder_Interface_Encode(s->enstate,
  400. s->enc_bitrate,
  401. data,
  402. frame,
  403. 0);
  404. /* av_log(NULL,AV_LOG_DEBUG,"amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",written, s->enc_bitrate, frame[0] ); */
  405. return written;
  406. }
  407. #endif
  408. #if CONFIG_LIBAMR_NB || CONFIG_LIBAMR_NB_FIXED
  409. AVCodec libamr_nb_decoder =
  410. {
  411. "libamr_nb",
  412. CODEC_TYPE_AUDIO,
  413. CODEC_ID_AMR_NB,
  414. sizeof(AMRContext),
  415. amr_nb_decode_init,
  416. NULL,
  417. amr_nb_decode_close,
  418. amr_nb_decode_frame,
  419. .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
  420. };
  421. AVCodec libamr_nb_encoder =
  422. {
  423. "libamr_nb",
  424. CODEC_TYPE_AUDIO,
  425. CODEC_ID_AMR_NB,
  426. sizeof(AMRContext),
  427. amr_nb_encode_init,
  428. amr_nb_encode_frame,
  429. amr_nb_encode_close,
  430. NULL,
  431. .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
  432. .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
  433. };
  434. #endif
  435. /* -----------AMR wideband ------------*/
  436. #if CONFIG_LIBAMR_WB
  437. #ifdef _TYPEDEF_H
  438. //To avoid duplicate typedefs from typedef in amr-nb
  439. #define typedef_h
  440. #endif
  441. #include <amrwb/enc_if.h>
  442. #include <amrwb/dec_if.h>
  443. #include <amrwb/if_rom.h>
  444. /* Common code for fixed and float version*/
  445. typedef struct AMRWB_bitrates
  446. {
  447. int rate;
  448. int mode;
  449. } AMRWB_bitrates;
  450. static int getWBBitrateMode(int bitrate)
  451. {
  452. /* make the correspondance between bitrate and mode */
  453. AMRWB_bitrates rates[]={ {6600,0},
  454. {8850,1},
  455. {12650,2},
  456. {14250,3},
  457. {15850,4},
  458. {18250,5},
  459. {19850,6},
  460. {23050,7},
  461. {23850,8},
  462. };
  463. int i;
  464. for(i=0;i<9;i++)
  465. {
  466. if(rates[i].rate==bitrate)
  467. {
  468. return rates[i].mode;
  469. }
  470. }
  471. /* no bitrate matching, return an error */
  472. return -1;
  473. }
  474. typedef struct AMRWBContext {
  475. int frameCount;
  476. void *state;
  477. int mode;
  478. Word16 allow_dtx;
  479. } AMRWBContext;
  480. static int amr_wb_encode_init(AVCodecContext * avctx)
  481. {
  482. AMRWBContext *s = avctx->priv_data;
  483. s->frameCount=0;
  484. if(avctx->sample_rate!=16000)
  485. {
  486. av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n");
  487. return -1;
  488. }
  489. if(avctx->channels!=1)
  490. {
  491. av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
  492. return -1;
  493. }
  494. if((s->mode=getWBBitrateMode(avctx->bit_rate))<0)
  495. {
  496. av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
  497. return -1;
  498. }
  499. avctx->frame_size=320;
  500. avctx->coded_frame= avcodec_alloc_frame();
  501. s->state = E_IF_init();
  502. s->allow_dtx=0;
  503. return 0;
  504. }
  505. static int amr_wb_encode_close(AVCodecContext * avctx)
  506. {
  507. AMRWBContext *s = avctx->priv_data;
  508. E_IF_exit(s->state);
  509. av_freep(&avctx->coded_frame);
  510. s->frameCount++;
  511. return 0;
  512. }
  513. static int amr_wb_encode_frame(AVCodecContext *avctx,
  514. unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
  515. {
  516. AMRWBContext *s = avctx->priv_data;
  517. int size;
  518. if((s->mode=getWBBitrateMode(avctx->bit_rate))<0)
  519. {
  520. av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
  521. return -1;
  522. }
  523. size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
  524. return size;
  525. }
  526. static int amr_wb_decode_init(AVCodecContext * avctx)
  527. {
  528. AMRWBContext *s = avctx->priv_data;
  529. s->frameCount=0;
  530. s->state = D_IF_init();
  531. amr_decode_fix_avctx(avctx);
  532. if(avctx->channels > 1)
  533. {
  534. av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n");
  535. return -1;
  536. }
  537. return 0;
  538. }
  539. static int amr_wb_decode_frame(AVCodecContext * avctx,
  540. void *data, int *data_size,
  541. AVPacket *avpkt)
  542. {
  543. const uint8_t *buf = avpkt->data;
  544. int buf_size = avpkt->size;
  545. AMRWBContext *s = avctx->priv_data;
  546. const uint8_t*amrData=buf;
  547. int mode;
  548. int packet_size;
  549. static const uint8_t block_size[16] = {18, 23, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
  550. if(buf_size==0) {
  551. /* nothing to do */
  552. return 0;
  553. }
  554. mode = (amrData[0] >> 3) & 0x000F;
  555. packet_size = block_size[mode];
  556. if(packet_size > buf_size) {
  557. av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size+1);
  558. return -1;
  559. }
  560. s->frameCount++;
  561. D_IF_decode( s->state, amrData, data, _good_frame);
  562. *data_size=320*2;
  563. return packet_size;
  564. }
  565. static int amr_wb_decode_close(AVCodecContext * avctx)
  566. {
  567. AMRWBContext *s = avctx->priv_data;
  568. D_IF_exit(s->state);
  569. return 0;
  570. }
  571. AVCodec libamr_wb_decoder =
  572. {
  573. "libamr_wb",
  574. CODEC_TYPE_AUDIO,
  575. CODEC_ID_AMR_WB,
  576. sizeof(AMRWBContext),
  577. amr_wb_decode_init,
  578. NULL,
  579. amr_wb_decode_close,
  580. amr_wb_decode_frame,
  581. .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
  582. };
  583. AVCodec libamr_wb_encoder =
  584. {
  585. "libamr_wb",
  586. CODEC_TYPE_AUDIO,
  587. CODEC_ID_AMR_WB,
  588. sizeof(AMRWBContext),
  589. amr_wb_encode_init,
  590. amr_wb_encode_frame,
  591. amr_wb_encode_close,
  592. NULL,
  593. .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
  594. .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
  595. };
  596. #endif //CONFIG_LIBAMR_WB