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.

679 lines
21KB

  1. /*
  2. * Sierra VMD Audio & Video Decoders
  3. * Copyright (C) 2004 the ffmpeg project
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * Sierra VMD audio & video decoders
  24. * by Vladimir "VAG" Gneushev (vagsoft at mail.ru)
  25. * for more information on the Sierra VMD format, visit:
  26. * http://www.pcisys.net/~melanson/codecs/
  27. *
  28. * The video decoder outputs PAL8 colorspace data. The decoder expects
  29. * a 0x330-byte VMD file header to be transmitted via extradata during
  30. * codec initialization. Each encoded frame that is sent to this decoder
  31. * is expected to be prepended with the appropriate 16-byte frame
  32. * information record from the VMD file.
  33. *
  34. * The audio decoder, like the video decoder, expects each encoded data
  35. * chunk to be prepended with the appropriate 16-byte frame information
  36. * record from the VMD file. It does not require the 0x330-byte VMD file
  37. * header, but it does need the audio setup parameters passed in through
  38. * normal libavcodec API means.
  39. */
  40. #include <stdio.h>
  41. #include <stdlib.h>
  42. #include <string.h>
  43. #include "libavutil/channel_layout.h"
  44. #include "libavutil/common.h"
  45. #include "libavutil/intreadwrite.h"
  46. #include "avcodec.h"
  47. #define VMD_HEADER_SIZE 0x330
  48. #define PALETTE_COUNT 256
  49. /*
  50. * Video Decoder
  51. */
  52. typedef struct VmdVideoContext {
  53. AVCodecContext *avctx;
  54. AVFrame frame;
  55. AVFrame prev_frame;
  56. const unsigned char *buf;
  57. int size;
  58. unsigned char palette[PALETTE_COUNT * 4];
  59. unsigned char *unpack_buffer;
  60. int unpack_buffer_size;
  61. int x_off, y_off;
  62. } VmdVideoContext;
  63. #define QUEUE_SIZE 0x1000
  64. #define QUEUE_MASK 0x0FFF
  65. static void lz_unpack(const unsigned char *src, int src_len,
  66. unsigned char *dest, int dest_len)
  67. {
  68. const unsigned char *s;
  69. unsigned int s_len;
  70. unsigned char *d;
  71. unsigned char *d_end;
  72. unsigned char queue[QUEUE_SIZE];
  73. unsigned int qpos;
  74. unsigned int dataleft;
  75. unsigned int chainofs;
  76. unsigned int chainlen;
  77. unsigned int speclen;
  78. unsigned char tag;
  79. unsigned int i, j;
  80. s = src;
  81. s_len = src_len;
  82. d = dest;
  83. d_end = d + dest_len;
  84. dataleft = AV_RL32(s);
  85. s += 4; s_len -= 4;
  86. memset(queue, 0x20, QUEUE_SIZE);
  87. if (s_len < 4)
  88. return;
  89. if (AV_RL32(s) == 0x56781234) {
  90. s += 4; s_len -= 4;
  91. qpos = 0x111;
  92. speclen = 0xF + 3;
  93. } else {
  94. qpos = 0xFEE;
  95. speclen = 100; /* no speclen */
  96. }
  97. while (dataleft > 0 && s_len > 0) {
  98. tag = *s++; s_len--;
  99. if ((tag == 0xFF) && (dataleft > 8)) {
  100. if (d + 8 > d_end || s_len < 8)
  101. return;
  102. for (i = 0; i < 8; i++) {
  103. queue[qpos++] = *d++ = *s++;
  104. qpos &= QUEUE_MASK;
  105. }
  106. s_len -= 8;
  107. dataleft -= 8;
  108. } else {
  109. for (i = 0; i < 8; i++) {
  110. if (dataleft == 0)
  111. break;
  112. if (tag & 0x01) {
  113. if (d + 1 > d_end || s_len < 1)
  114. return;
  115. queue[qpos++] = *d++ = *s++;
  116. qpos &= QUEUE_MASK;
  117. dataleft--;
  118. s_len--;
  119. } else {
  120. if (s_len < 2)
  121. return;
  122. chainofs = *s++;
  123. chainofs |= ((*s & 0xF0) << 4);
  124. chainlen = (*s++ & 0x0F) + 3;
  125. s_len -= 2;
  126. if (chainlen == speclen) {
  127. if (s_len < 1)
  128. return;
  129. chainlen = *s++ + 0xF + 3;
  130. s_len--;
  131. }
  132. if (d + chainlen > d_end)
  133. return;
  134. for (j = 0; j < chainlen; j++) {
  135. *d = queue[chainofs++ & QUEUE_MASK];
  136. queue[qpos++] = *d++;
  137. qpos &= QUEUE_MASK;
  138. }
  139. dataleft -= chainlen;
  140. }
  141. tag >>= 1;
  142. }
  143. }
  144. }
  145. }
  146. static int rle_unpack(const unsigned char *src, unsigned char *dest,
  147. int src_count, int src_size, int dest_len)
  148. {
  149. const unsigned char *ps;
  150. unsigned char *pd;
  151. int i, l;
  152. unsigned char *dest_end = dest + dest_len;
  153. ps = src;
  154. pd = dest;
  155. if (src_count & 1) {
  156. if (src_size < 1)
  157. return 0;
  158. *pd++ = *ps++;
  159. src_size--;
  160. }
  161. src_count >>= 1;
  162. i = 0;
  163. do {
  164. if (src_size < 1)
  165. break;
  166. l = *ps++;
  167. src_size--;
  168. if (l & 0x80) {
  169. l = (l & 0x7F) * 2;
  170. if (pd + l > dest_end || src_size < l)
  171. return ps - src;
  172. memcpy(pd, ps, l);
  173. ps += l;
  174. src_size -= l;
  175. pd += l;
  176. } else {
  177. if (pd + i > dest_end || src_size < 2)
  178. return ps - src;
  179. for (i = 0; i < l; i++) {
  180. *pd++ = ps[0];
  181. *pd++ = ps[1];
  182. }
  183. ps += 2;
  184. src_size -= 2;
  185. }
  186. i += l;
  187. } while (i < src_count);
  188. return ps - src;
  189. }
  190. static void vmd_decode(VmdVideoContext *s)
  191. {
  192. int i;
  193. unsigned int *palette32;
  194. unsigned char r, g, b;
  195. /* point to the start of the encoded data */
  196. const unsigned char *p = s->buf + 16;
  197. const unsigned char *pb;
  198. unsigned int pb_size;
  199. unsigned char meth;
  200. unsigned char *dp; /* pointer to current frame */
  201. unsigned char *pp; /* pointer to previous frame */
  202. unsigned char len;
  203. int ofs;
  204. int frame_x, frame_y;
  205. int frame_width, frame_height;
  206. frame_x = AV_RL16(&s->buf[6]);
  207. frame_y = AV_RL16(&s->buf[8]);
  208. frame_width = AV_RL16(&s->buf[10]) - frame_x + 1;
  209. frame_height = AV_RL16(&s->buf[12]) - frame_y + 1;
  210. if (frame_x < 0 || frame_width < 0 ||
  211. frame_x >= s->avctx->width ||
  212. frame_width > s->avctx->width ||
  213. frame_x + frame_width > s->avctx->width)
  214. return;
  215. if (frame_y < 0 || frame_height < 0 ||
  216. frame_y >= s->avctx->height ||
  217. frame_height > s->avctx->height ||
  218. frame_y + frame_height > s->avctx->height)
  219. return;
  220. if ((frame_width == s->avctx->width && frame_height == s->avctx->height) &&
  221. (frame_x || frame_y)) {
  222. s->x_off = frame_x;
  223. s->y_off = frame_y;
  224. }
  225. frame_x -= s->x_off;
  226. frame_y -= s->y_off;
  227. /* if only a certain region will be updated, copy the entire previous
  228. * frame before the decode */
  229. if (s->prev_frame.data[0] &&
  230. (frame_x || frame_y || (frame_width != s->avctx->width) ||
  231. (frame_height != s->avctx->height))) {
  232. memcpy(s->frame.data[0], s->prev_frame.data[0],
  233. s->avctx->height * s->frame.linesize[0]);
  234. }
  235. /* check if there is a new palette */
  236. if (s->buf[15] & 0x02) {
  237. p += 2;
  238. palette32 = (unsigned int *)s->palette;
  239. for (i = 0; i < PALETTE_COUNT; i++) {
  240. r = *p++ * 4;
  241. g = *p++ * 4;
  242. b = *p++ * 4;
  243. palette32[i] = (r << 16) | (g << 8) | (b);
  244. }
  245. s->size -= (256 * 3 + 2);
  246. }
  247. if (s->size > 0) {
  248. /* originally UnpackFrame in VAG's code */
  249. pb = p;
  250. pb_size = s->buf + s->size - pb;
  251. if (pb_size < 1)
  252. return;
  253. meth = *pb++; pb_size--;
  254. if (meth & 0x80) {
  255. lz_unpack(pb, pb_size,
  256. s->unpack_buffer, s->unpack_buffer_size);
  257. meth &= 0x7F;
  258. pb = s->unpack_buffer;
  259. pb_size = s->unpack_buffer_size;
  260. }
  261. dp = &s->frame.data[0][frame_y * s->frame.linesize[0] + frame_x];
  262. pp = &s->prev_frame.data[0][frame_y * s->prev_frame.linesize[0] + frame_x];
  263. switch (meth) {
  264. case 1:
  265. for (i = 0; i < frame_height; i++) {
  266. ofs = 0;
  267. do {
  268. if (pb_size < 1)
  269. return;
  270. len = *pb++;
  271. pb_size--;
  272. if (len & 0x80) {
  273. len = (len & 0x7F) + 1;
  274. if (ofs + len > frame_width || pb_size < len)
  275. return;
  276. memcpy(&dp[ofs], pb, len);
  277. pb += len;
  278. pb_size -= len;
  279. ofs += len;
  280. } else {
  281. /* interframe pixel copy */
  282. if (ofs + len + 1 > frame_width || !s->prev_frame.data[0])
  283. return;
  284. memcpy(&dp[ofs], &pp[ofs], len + 1);
  285. ofs += len + 1;
  286. }
  287. } while (ofs < frame_width);
  288. if (ofs > frame_width) {
  289. av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
  290. ofs, frame_width);
  291. break;
  292. }
  293. dp += s->frame.linesize[0];
  294. pp += s->prev_frame.linesize[0];
  295. }
  296. break;
  297. case 2:
  298. for (i = 0; i < frame_height; i++) {
  299. if (pb_size < frame_width)
  300. return;
  301. memcpy(dp, pb, frame_width);
  302. pb += frame_width;
  303. pb_size -= frame_width;
  304. dp += s->frame.linesize[0];
  305. pp += s->prev_frame.linesize[0];
  306. }
  307. break;
  308. case 3:
  309. for (i = 0; i < frame_height; i++) {
  310. ofs = 0;
  311. do {
  312. if (pb_size < 1)
  313. return;
  314. len = *pb++;
  315. pb_size--;
  316. if (len & 0x80) {
  317. len = (len & 0x7F) + 1;
  318. if (pb_size < 1)
  319. return;
  320. if (*pb++ == 0xFF)
  321. len = rle_unpack(pb, &dp[ofs], len, pb_size, frame_width - ofs);
  322. else {
  323. if (pb_size < len)
  324. return;
  325. memcpy(&dp[ofs], pb, len);
  326. }
  327. pb += len;
  328. pb_size -= 1 + len;
  329. ofs += len;
  330. } else {
  331. /* interframe pixel copy */
  332. if (ofs + len + 1 > frame_width || !s->prev_frame.data[0])
  333. return;
  334. memcpy(&dp[ofs], &pp[ofs], len + 1);
  335. ofs += len + 1;
  336. }
  337. } while (ofs < frame_width);
  338. if (ofs > frame_width) {
  339. av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
  340. ofs, frame_width);
  341. }
  342. dp += s->frame.linesize[0];
  343. pp += s->prev_frame.linesize[0];
  344. }
  345. break;
  346. }
  347. }
  348. }
  349. static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
  350. {
  351. VmdVideoContext *s = avctx->priv_data;
  352. int i;
  353. unsigned int *palette32;
  354. int palette_index = 0;
  355. unsigned char r, g, b;
  356. unsigned char *vmd_header;
  357. unsigned char *raw_palette;
  358. s->avctx = avctx;
  359. avctx->pix_fmt = AV_PIX_FMT_PAL8;
  360. /* make sure the VMD header made it */
  361. if (s->avctx->extradata_size != VMD_HEADER_SIZE) {
  362. av_log(s->avctx, AV_LOG_ERROR, "VMD video: expected extradata size of %d\n",
  363. VMD_HEADER_SIZE);
  364. return -1;
  365. }
  366. vmd_header = (unsigned char *)avctx->extradata;
  367. s->unpack_buffer_size = AV_RL32(&vmd_header[800]);
  368. s->unpack_buffer = av_malloc(s->unpack_buffer_size);
  369. if (!s->unpack_buffer)
  370. return -1;
  371. /* load up the initial palette */
  372. raw_palette = &vmd_header[28];
  373. palette32 = (unsigned int *)s->palette;
  374. for (i = 0; i < PALETTE_COUNT; i++) {
  375. r = raw_palette[palette_index++] * 4;
  376. g = raw_palette[palette_index++] * 4;
  377. b = raw_palette[palette_index++] * 4;
  378. palette32[i] = (r << 16) | (g << 8) | (b);
  379. }
  380. return 0;
  381. }
  382. static int vmdvideo_decode_frame(AVCodecContext *avctx,
  383. void *data, int *data_size,
  384. AVPacket *avpkt)
  385. {
  386. const uint8_t *buf = avpkt->data;
  387. int buf_size = avpkt->size;
  388. VmdVideoContext *s = avctx->priv_data;
  389. s->buf = buf;
  390. s->size = buf_size;
  391. if (buf_size < 16)
  392. return buf_size;
  393. s->frame.reference = 1;
  394. if (avctx->get_buffer(avctx, &s->frame)) {
  395. av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
  396. return -1;
  397. }
  398. vmd_decode(s);
  399. /* make the palette available on the way out */
  400. memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4);
  401. /* shuffle frames */
  402. FFSWAP(AVFrame, s->frame, s->prev_frame);
  403. if (s->frame.data[0])
  404. avctx->release_buffer(avctx, &s->frame);
  405. *data_size = sizeof(AVFrame);
  406. *(AVFrame*)data = s->prev_frame;
  407. /* report that the buffer was completely consumed */
  408. return buf_size;
  409. }
  410. static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
  411. {
  412. VmdVideoContext *s = avctx->priv_data;
  413. if (s->prev_frame.data[0])
  414. avctx->release_buffer(avctx, &s->prev_frame);
  415. av_free(s->unpack_buffer);
  416. return 0;
  417. }
  418. /*
  419. * Audio Decoder
  420. */
  421. #define BLOCK_TYPE_AUDIO 1
  422. #define BLOCK_TYPE_INITIAL 2
  423. #define BLOCK_TYPE_SILENCE 3
  424. typedef struct VmdAudioContext {
  425. AVFrame frame;
  426. int out_bps;
  427. int chunk_size;
  428. } VmdAudioContext;
  429. static const uint16_t vmdaudio_table[128] = {
  430. 0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080,
  431. 0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120,
  432. 0x130, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1A0, 0x1B0, 0x1C0,
  433. 0x1D0, 0x1E0, 0x1F0, 0x200, 0x208, 0x210, 0x218, 0x220, 0x228, 0x230,
  434. 0x238, 0x240, 0x248, 0x250, 0x258, 0x260, 0x268, 0x270, 0x278, 0x280,
  435. 0x288, 0x290, 0x298, 0x2A0, 0x2A8, 0x2B0, 0x2B8, 0x2C0, 0x2C8, 0x2D0,
  436. 0x2D8, 0x2E0, 0x2E8, 0x2F0, 0x2F8, 0x300, 0x308, 0x310, 0x318, 0x320,
  437. 0x328, 0x330, 0x338, 0x340, 0x348, 0x350, 0x358, 0x360, 0x368, 0x370,
  438. 0x378, 0x380, 0x388, 0x390, 0x398, 0x3A0, 0x3A8, 0x3B0, 0x3B8, 0x3C0,
  439. 0x3C8, 0x3D0, 0x3D8, 0x3E0, 0x3E8, 0x3F0, 0x3F8, 0x400, 0x440, 0x480,
  440. 0x4C0, 0x500, 0x540, 0x580, 0x5C0, 0x600, 0x640, 0x680, 0x6C0, 0x700,
  441. 0x740, 0x780, 0x7C0, 0x800, 0x900, 0xA00, 0xB00, 0xC00, 0xD00, 0xE00,
  442. 0xF00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x3000, 0x4000
  443. };
  444. static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
  445. {
  446. VmdAudioContext *s = avctx->priv_data;
  447. if (avctx->channels < 1 || avctx->channels > 2) {
  448. av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
  449. return AVERROR(EINVAL);
  450. }
  451. if (avctx->block_align < 1) {
  452. av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
  453. return AVERROR(EINVAL);
  454. }
  455. avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO :
  456. AV_CH_LAYOUT_STEREO;
  457. if (avctx->bits_per_coded_sample == 16)
  458. avctx->sample_fmt = AV_SAMPLE_FMT_S16;
  459. else
  460. avctx->sample_fmt = AV_SAMPLE_FMT_U8;
  461. s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt);
  462. s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2);
  463. avcodec_get_frame_defaults(&s->frame);
  464. avctx->coded_frame = &s->frame;
  465. av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
  466. "block align = %d, sample rate = %d\n",
  467. avctx->channels, avctx->bits_per_coded_sample, avctx->block_align,
  468. avctx->sample_rate);
  469. return 0;
  470. }
  471. static void decode_audio_s16(int16_t *out, const uint8_t *buf, int buf_size,
  472. int channels)
  473. {
  474. int ch;
  475. const uint8_t *buf_end = buf + buf_size;
  476. int predictor[2];
  477. int st = channels - 1;
  478. /* decode initial raw sample */
  479. for (ch = 0; ch < channels; ch++) {
  480. predictor[ch] = (int16_t)AV_RL16(buf);
  481. buf += 2;
  482. *out++ = predictor[ch];
  483. }
  484. /* decode DPCM samples */
  485. ch = 0;
  486. while (buf < buf_end) {
  487. uint8_t b = *buf++;
  488. if (b & 0x80)
  489. predictor[ch] -= vmdaudio_table[b & 0x7F];
  490. else
  491. predictor[ch] += vmdaudio_table[b];
  492. predictor[ch] = av_clip_int16(predictor[ch]);
  493. *out++ = predictor[ch];
  494. ch ^= st;
  495. }
  496. }
  497. static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
  498. int *got_frame_ptr, AVPacket *avpkt)
  499. {
  500. const uint8_t *buf = avpkt->data;
  501. const uint8_t *buf_end;
  502. int buf_size = avpkt->size;
  503. VmdAudioContext *s = avctx->priv_data;
  504. int block_type, silent_chunks, audio_chunks;
  505. int ret;
  506. uint8_t *output_samples_u8;
  507. int16_t *output_samples_s16;
  508. if (buf_size < 16) {
  509. av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n");
  510. *got_frame_ptr = 0;
  511. return buf_size;
  512. }
  513. block_type = buf[6];
  514. if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) {
  515. av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type);
  516. return AVERROR(EINVAL);
  517. }
  518. buf += 16;
  519. buf_size -= 16;
  520. /* get number of silent chunks */
  521. silent_chunks = 0;
  522. if (block_type == BLOCK_TYPE_INITIAL) {
  523. uint32_t flags;
  524. if (buf_size < 4) {
  525. av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
  526. return AVERROR(EINVAL);
  527. }
  528. flags = AV_RB32(buf);
  529. silent_chunks = av_popcount(flags);
  530. buf += 4;
  531. buf_size -= 4;
  532. } else if (block_type == BLOCK_TYPE_SILENCE) {
  533. silent_chunks = 1;
  534. buf_size = 0; // should already be zero but set it just to be sure
  535. }
  536. /* ensure output buffer is large enough */
  537. audio_chunks = buf_size / s->chunk_size;
  538. /* get output buffer */
  539. s->frame.nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) / avctx->channels;
  540. if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
  541. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  542. return ret;
  543. }
  544. output_samples_u8 = s->frame.data[0];
  545. output_samples_s16 = (int16_t *)s->frame.data[0];
  546. /* decode silent chunks */
  547. if (silent_chunks > 0) {
  548. int silent_size = avctx->block_align * silent_chunks;
  549. if (s->out_bps == 2) {
  550. memset(output_samples_s16, 0x00, silent_size * 2);
  551. output_samples_s16 += silent_size;
  552. } else {
  553. memset(output_samples_u8, 0x80, silent_size);
  554. output_samples_u8 += silent_size;
  555. }
  556. }
  557. /* decode audio chunks */
  558. if (audio_chunks > 0) {
  559. buf_end = buf + buf_size;
  560. while (buf < buf_end) {
  561. if (s->out_bps == 2) {
  562. decode_audio_s16(output_samples_s16, buf, s->chunk_size,
  563. avctx->channels);
  564. output_samples_s16 += avctx->block_align;
  565. } else {
  566. memcpy(output_samples_u8, buf, s->chunk_size);
  567. output_samples_u8 += avctx->block_align;
  568. }
  569. buf += s->chunk_size;
  570. }
  571. }
  572. *got_frame_ptr = 1;
  573. *(AVFrame *)data = s->frame;
  574. return avpkt->size;
  575. }
  576. /*
  577. * Public Data Structures
  578. */
  579. AVCodec ff_vmdvideo_decoder = {
  580. .name = "vmdvideo",
  581. .type = AVMEDIA_TYPE_VIDEO,
  582. .id = AV_CODEC_ID_VMDVIDEO,
  583. .priv_data_size = sizeof(VmdVideoContext),
  584. .init = vmdvideo_decode_init,
  585. .close = vmdvideo_decode_end,
  586. .decode = vmdvideo_decode_frame,
  587. .capabilities = CODEC_CAP_DR1,
  588. .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
  589. };
  590. AVCodec ff_vmdaudio_decoder = {
  591. .name = "vmdaudio",
  592. .type = AVMEDIA_TYPE_AUDIO,
  593. .id = AV_CODEC_ID_VMDAUDIO,
  594. .priv_data_size = sizeof(VmdAudioContext),
  595. .init = vmdaudio_decode_init,
  596. .decode = vmdaudio_decode_frame,
  597. .capabilities = CODEC_CAP_DR1,
  598. .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"),
  599. };