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.

726 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. AVPacket *avpkt)
  369. {
  370. const uint8_t *buf = avpkt->data;
  371. int buf_size = avpkt->size;
  372. AMRContext *s = avctx->priv_data;
  373. const uint8_t*amrData=buf;
  374. static const uint8_t block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
  375. enum Mode dec_mode;
  376. int packet_size;
  377. /* av_log(NULL,AV_LOG_DEBUG,"amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",buf,buf_size,s->frameCount); */
  378. dec_mode = (buf[0] >> 3) & 0x000F;
  379. packet_size = block_size[dec_mode]+1;
  380. if(packet_size > buf_size) {
  381. av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size);
  382. return -1;
  383. }
  384. s->frameCount++;
  385. /* 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]); */
  386. /* call decoder */
  387. Decoder_Interface_Decode(s->decState, amrData, data, 0);
  388. *data_size=160*2;
  389. return packet_size;
  390. }
  391. static int amr_nb_encode_frame(AVCodecContext *avctx,
  392. unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
  393. {
  394. AMRContext *s = avctx->priv_data;
  395. int written;
  396. if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0)
  397. {
  398. av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
  399. return -1;
  400. }
  401. written = Encoder_Interface_Encode(s->enstate,
  402. s->enc_bitrate,
  403. data,
  404. frame,
  405. 0);
  406. /* 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] ); */
  407. return written;
  408. }
  409. #endif
  410. #if CONFIG_LIBAMR_NB || CONFIG_LIBAMR_NB_FIXED
  411. AVCodec libamr_nb_decoder =
  412. {
  413. "libamr_nb",
  414. CODEC_TYPE_AUDIO,
  415. CODEC_ID_AMR_NB,
  416. sizeof(AMRContext),
  417. amr_nb_decode_init,
  418. NULL,
  419. amr_nb_decode_close,
  420. amr_nb_decode_frame,
  421. .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
  422. };
  423. AVCodec libamr_nb_encoder =
  424. {
  425. "libamr_nb",
  426. CODEC_TYPE_AUDIO,
  427. CODEC_ID_AMR_NB,
  428. sizeof(AMRContext),
  429. amr_nb_encode_init,
  430. amr_nb_encode_frame,
  431. amr_nb_encode_close,
  432. NULL,
  433. .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
  434. .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
  435. };
  436. #endif
  437. /* -----------AMR wideband ------------*/
  438. #if CONFIG_LIBAMR_WB
  439. #ifdef _TYPEDEF_H
  440. //To avoid duplicate typedefs from typedef in amr-nb
  441. #define typedef_h
  442. #endif
  443. #include <amrwb/enc_if.h>
  444. #include <amrwb/dec_if.h>
  445. #include <amrwb/if_rom.h>
  446. /* Common code for fixed and float version*/
  447. typedef struct AMRWB_bitrates
  448. {
  449. int rate;
  450. int mode;
  451. } AMRWB_bitrates;
  452. static int getWBBitrateMode(int bitrate)
  453. {
  454. /* make the correspondance between bitrate and mode */
  455. AMRWB_bitrates rates[]={ {6600,0},
  456. {8850,1},
  457. {12650,2},
  458. {14250,3},
  459. {15850,4},
  460. {18250,5},
  461. {19850,6},
  462. {23050,7},
  463. {23850,8},
  464. };
  465. int i;
  466. for(i=0;i<9;i++)
  467. {
  468. if(rates[i].rate==bitrate)
  469. {
  470. return rates[i].mode;
  471. }
  472. }
  473. /* no bitrate matching, return an error */
  474. return -1;
  475. }
  476. typedef struct AMRWBContext {
  477. int frameCount;
  478. void *state;
  479. int mode;
  480. Word16 allow_dtx;
  481. } AMRWBContext;
  482. static int amr_wb_encode_init(AVCodecContext * avctx)
  483. {
  484. AMRWBContext *s = avctx->priv_data;
  485. s->frameCount=0;
  486. if(avctx->sample_rate!=16000)
  487. {
  488. av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n");
  489. return -1;
  490. }
  491. if(avctx->channels!=1)
  492. {
  493. av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
  494. return -1;
  495. }
  496. if((s->mode=getWBBitrateMode(avctx->bit_rate))<0)
  497. {
  498. av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
  499. return -1;
  500. }
  501. avctx->frame_size=320;
  502. avctx->coded_frame= avcodec_alloc_frame();
  503. s->state = E_IF_init();
  504. s->allow_dtx=0;
  505. return 0;
  506. }
  507. static int amr_wb_encode_close(AVCodecContext * avctx)
  508. {
  509. AMRWBContext *s = avctx->priv_data;
  510. E_IF_exit(s->state);
  511. av_freep(&avctx->coded_frame);
  512. s->frameCount++;
  513. return 0;
  514. }
  515. static int amr_wb_encode_frame(AVCodecContext *avctx,
  516. unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
  517. {
  518. AMRWBContext *s = avctx->priv_data;
  519. int size;
  520. if((s->mode=getWBBitrateMode(avctx->bit_rate))<0)
  521. {
  522. av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
  523. return -1;
  524. }
  525. size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
  526. return size;
  527. }
  528. static int amr_wb_decode_init(AVCodecContext * avctx)
  529. {
  530. AMRWBContext *s = avctx->priv_data;
  531. s->frameCount=0;
  532. s->state = D_IF_init();
  533. amr_decode_fix_avctx(avctx);
  534. if(avctx->channels > 1)
  535. {
  536. av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n");
  537. return -1;
  538. }
  539. return 0;
  540. }
  541. static int amr_wb_decode_frame(AVCodecContext * avctx,
  542. void *data, int *data_size,
  543. AVPacket *avpkt)
  544. {
  545. const uint8_t *buf = avpkt->data;
  546. int buf_size = avpkt->size;
  547. AMRWBContext *s = avctx->priv_data;
  548. const uint8_t*amrData=buf;
  549. int mode;
  550. int packet_size;
  551. static const uint8_t block_size[16] = {18, 23, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
  552. if(buf_size==0) {
  553. /* nothing to do */
  554. return 0;
  555. }
  556. mode = (amrData[0] >> 3) & 0x000F;
  557. packet_size = block_size[mode];
  558. if(packet_size > buf_size) {
  559. av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size+1);
  560. return -1;
  561. }
  562. s->frameCount++;
  563. D_IF_decode( s->state, amrData, data, _good_frame);
  564. *data_size=320*2;
  565. return packet_size;
  566. }
  567. static int amr_wb_decode_close(AVCodecContext * avctx)
  568. {
  569. AMRWBContext *s = avctx->priv_data;
  570. D_IF_exit(s->state);
  571. return 0;
  572. }
  573. AVCodec libamr_wb_decoder =
  574. {
  575. "libamr_wb",
  576. CODEC_TYPE_AUDIO,
  577. CODEC_ID_AMR_WB,
  578. sizeof(AMRWBContext),
  579. amr_wb_decode_init,
  580. NULL,
  581. amr_wb_decode_close,
  582. amr_wb_decode_frame,
  583. .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
  584. };
  585. AVCodec libamr_wb_encoder =
  586. {
  587. "libamr_wb",
  588. CODEC_TYPE_AUDIO,
  589. CODEC_ID_AMR_WB,
  590. sizeof(AMRWBContext),
  591. amr_wb_encode_init,
  592. amr_wb_encode_frame,
  593. amr_wb_encode_close,
  594. NULL,
  595. .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
  596. .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
  597. };
  598. #endif //CONFIG_LIBAMR_WB