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.

672 lines
20KB

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