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.

641 lines
20KB

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