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.

638 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/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_end - d < 8 || 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_end - d < 1 || 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_end - d < chainlen)
  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 (dest_end - pd < l || 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 (dest_end - pd < i || 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] = 0xFFU << 24 | (r << 16) | (g << 8) | (b);
  228. palette32[i] |= palette32[i] >> 6 & 0x30303;
  229. }
  230. }
  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, "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, "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, "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. avcodec_get_frame_defaults(&s->prev_frame);
  347. return 0;
  348. }
  349. static int vmdvideo_decode_frame(AVCodecContext *avctx,
  350. void *data, int *got_frame,
  351. AVPacket *avpkt)
  352. {
  353. const uint8_t *buf = avpkt->data;
  354. int buf_size = avpkt->size;
  355. VmdVideoContext *s = avctx->priv_data;
  356. AVFrame *frame = data;
  357. int ret;
  358. s->buf = buf;
  359. s->size = buf_size;
  360. if (buf_size < 16)
  361. return buf_size;
  362. if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
  363. return ret;
  364. vmd_decode(s, frame);
  365. /* make the palette available on the way out */
  366. memcpy(frame->data[1], s->palette, PALETTE_COUNT * 4);
  367. /* shuffle frames */
  368. av_frame_unref(&s->prev_frame);
  369. if ((ret = av_frame_ref(&s->prev_frame, frame)) < 0)
  370. return ret;
  371. *got_frame = 1;
  372. /* report that the buffer was completely consumed */
  373. return buf_size;
  374. }
  375. static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
  376. {
  377. VmdVideoContext *s = avctx->priv_data;
  378. av_frame_unref(&s->prev_frame);
  379. av_free(s->unpack_buffer);
  380. return 0;
  381. }
  382. /*
  383. * Audio Decoder
  384. */
  385. #define BLOCK_TYPE_AUDIO 1
  386. #define BLOCK_TYPE_INITIAL 2
  387. #define BLOCK_TYPE_SILENCE 3
  388. typedef struct VmdAudioContext {
  389. int out_bps;
  390. int chunk_size;
  391. } VmdAudioContext;
  392. static const uint16_t vmdaudio_table[128] = {
  393. 0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080,
  394. 0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120,
  395. 0x130, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1A0, 0x1B0, 0x1C0,
  396. 0x1D0, 0x1E0, 0x1F0, 0x200, 0x208, 0x210, 0x218, 0x220, 0x228, 0x230,
  397. 0x238, 0x240, 0x248, 0x250, 0x258, 0x260, 0x268, 0x270, 0x278, 0x280,
  398. 0x288, 0x290, 0x298, 0x2A0, 0x2A8, 0x2B0, 0x2B8, 0x2C0, 0x2C8, 0x2D0,
  399. 0x2D8, 0x2E0, 0x2E8, 0x2F0, 0x2F8, 0x300, 0x308, 0x310, 0x318, 0x320,
  400. 0x328, 0x330, 0x338, 0x340, 0x348, 0x350, 0x358, 0x360, 0x368, 0x370,
  401. 0x378, 0x380, 0x388, 0x390, 0x398, 0x3A0, 0x3A8, 0x3B0, 0x3B8, 0x3C0,
  402. 0x3C8, 0x3D0, 0x3D8, 0x3E0, 0x3E8, 0x3F0, 0x3F8, 0x400, 0x440, 0x480,
  403. 0x4C0, 0x500, 0x540, 0x580, 0x5C0, 0x600, 0x640, 0x680, 0x6C0, 0x700,
  404. 0x740, 0x780, 0x7C0, 0x800, 0x900, 0xA00, 0xB00, 0xC00, 0xD00, 0xE00,
  405. 0xF00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x3000, 0x4000
  406. };
  407. static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
  408. {
  409. VmdAudioContext *s = avctx->priv_data;
  410. if (avctx->channels < 1 || avctx->channels > 2) {
  411. av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
  412. return AVERROR(EINVAL);
  413. }
  414. if (avctx->block_align < 1 || avctx->block_align % avctx->channels) {
  415. av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
  416. return AVERROR(EINVAL);
  417. }
  418. avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO :
  419. AV_CH_LAYOUT_STEREO;
  420. if (avctx->bits_per_coded_sample == 16)
  421. avctx->sample_fmt = AV_SAMPLE_FMT_S16;
  422. else
  423. avctx->sample_fmt = AV_SAMPLE_FMT_U8;
  424. s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt);
  425. s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2);
  426. av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
  427. "block align = %d, sample rate = %d\n",
  428. avctx->channels, avctx->bits_per_coded_sample, avctx->block_align,
  429. avctx->sample_rate);
  430. return 0;
  431. }
  432. static void decode_audio_s16(int16_t *out, const uint8_t *buf, int buf_size,
  433. int channels)
  434. {
  435. int ch;
  436. const uint8_t *buf_end = buf + buf_size;
  437. int predictor[2];
  438. int st = channels - 1;
  439. /* decode initial raw sample */
  440. for (ch = 0; ch < channels; ch++) {
  441. predictor[ch] = (int16_t)AV_RL16(buf);
  442. buf += 2;
  443. *out++ = predictor[ch];
  444. }
  445. /* decode DPCM samples */
  446. ch = 0;
  447. while (buf < buf_end) {
  448. uint8_t b = *buf++;
  449. if (b & 0x80)
  450. predictor[ch] -= vmdaudio_table[b & 0x7F];
  451. else
  452. predictor[ch] += vmdaudio_table[b];
  453. predictor[ch] = av_clip_int16(predictor[ch]);
  454. *out++ = predictor[ch];
  455. ch ^= st;
  456. }
  457. }
  458. static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
  459. int *got_frame_ptr, AVPacket *avpkt)
  460. {
  461. AVFrame *frame = data;
  462. const uint8_t *buf = avpkt->data;
  463. const uint8_t *buf_end;
  464. int buf_size = avpkt->size;
  465. VmdAudioContext *s = avctx->priv_data;
  466. int block_type, silent_chunks, audio_chunks;
  467. int ret;
  468. uint8_t *output_samples_u8;
  469. int16_t *output_samples_s16;
  470. if (buf_size < 16) {
  471. av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n");
  472. *got_frame_ptr = 0;
  473. return buf_size;
  474. }
  475. block_type = buf[6];
  476. if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) {
  477. av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type);
  478. return AVERROR(EINVAL);
  479. }
  480. buf += 16;
  481. buf_size -= 16;
  482. /* get number of silent chunks */
  483. silent_chunks = 0;
  484. if (block_type == BLOCK_TYPE_INITIAL) {
  485. uint32_t flags;
  486. if (buf_size < 4) {
  487. av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
  488. return AVERROR(EINVAL);
  489. }
  490. flags = AV_RB32(buf);
  491. silent_chunks = av_popcount(flags);
  492. buf += 4;
  493. buf_size -= 4;
  494. } else if (block_type == BLOCK_TYPE_SILENCE) {
  495. silent_chunks = 1;
  496. buf_size = 0; // should already be zero but set it just to be sure
  497. }
  498. /* ensure output buffer is large enough */
  499. audio_chunks = buf_size / s->chunk_size;
  500. /* get output buffer */
  501. frame->nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) /
  502. avctx->channels;
  503. if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
  504. return ret;
  505. output_samples_u8 = frame->data[0];
  506. output_samples_s16 = (int16_t *)frame->data[0];
  507. /* decode silent chunks */
  508. if (silent_chunks > 0) {
  509. int silent_size = avctx->block_align * silent_chunks;
  510. if (s->out_bps == 2) {
  511. memset(output_samples_s16, 0x00, silent_size * 2);
  512. output_samples_s16 += silent_size;
  513. } else {
  514. memset(output_samples_u8, 0x80, silent_size);
  515. output_samples_u8 += silent_size;
  516. }
  517. }
  518. /* decode audio chunks */
  519. if (audio_chunks > 0) {
  520. buf_end = buf + buf_size;
  521. while (buf_end - buf >= s->chunk_size) {
  522. if (s->out_bps == 2) {
  523. decode_audio_s16(output_samples_s16, buf, s->chunk_size,
  524. avctx->channels);
  525. output_samples_s16 += avctx->block_align;
  526. } else {
  527. memcpy(output_samples_u8, buf, s->chunk_size);
  528. output_samples_u8 += avctx->block_align;
  529. }
  530. buf += s->chunk_size;
  531. }
  532. }
  533. *got_frame_ptr = 1;
  534. return avpkt->size;
  535. }
  536. /*
  537. * Public Data Structures
  538. */
  539. AVCodec ff_vmdvideo_decoder = {
  540. .name = "vmdvideo",
  541. .type = AVMEDIA_TYPE_VIDEO,
  542. .id = AV_CODEC_ID_VMDVIDEO,
  543. .priv_data_size = sizeof(VmdVideoContext),
  544. .init = vmdvideo_decode_init,
  545. .close = vmdvideo_decode_end,
  546. .decode = vmdvideo_decode_frame,
  547. .capabilities = CODEC_CAP_DR1,
  548. .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
  549. };
  550. AVCodec ff_vmdaudio_decoder = {
  551. .name = "vmdaudio",
  552. .type = AVMEDIA_TYPE_AUDIO,
  553. .id = AV_CODEC_ID_VMDAUDIO,
  554. .priv_data_size = sizeof(VmdAudioContext),
  555. .init = vmdaudio_decode_init,
  556. .decode = vmdaudio_decode_frame,
  557. .capabilities = CODEC_CAP_DR1,
  558. .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"),
  559. };