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.

626 lines
20KB

  1. /*
  2. * Interplay MVE File Demuxer
  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. /**
  22. * @file ipmovie.c
  23. * Interplay MVE file demuxer
  24. * by Mike Melanson (melanson@pcisys.net)
  25. * For more information regarding the Interplay MVE file format, visit:
  26. * http://www.pcisys.net/~melanson/codecs/
  27. * The aforementioned site also contains a command line utility for parsing
  28. * IP MVE files so that you can get a good idea of the typical structure of
  29. * such files. This demuxer is not the best example to use if you are trying
  30. * to write your own as it uses a rather roundabout approach for splitting
  31. * up and sending out the chunks.
  32. */
  33. #include "avformat.h"
  34. /* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
  35. * verbose information about the demux process */
  36. #define DEBUG_IPMOVIE 0
  37. #if DEBUG_IPMOVIE
  38. #define debug_ipmovie printf
  39. #else
  40. static inline void debug_ipmovie(const char *format, ...) { }
  41. #endif
  42. #define IPMOVIE_SIGNATURE "Interplay MVE File\x1A\0"
  43. #define IPMOVIE_SIGNATURE_SIZE 20
  44. #define CHUNK_PREAMBLE_SIZE 4
  45. #define OPCODE_PREAMBLE_SIZE 4
  46. #define CHUNK_INIT_AUDIO 0x0000
  47. #define CHUNK_AUDIO_ONLY 0x0001
  48. #define CHUNK_INIT_VIDEO 0x0002
  49. #define CHUNK_VIDEO 0x0003
  50. #define CHUNK_SHUTDOWN 0x0004
  51. #define CHUNK_END 0x0005
  52. /* these last types are used internally */
  53. #define CHUNK_DONE 0xFFFC
  54. #define CHUNK_NOMEM 0xFFFD
  55. #define CHUNK_EOF 0xFFFE
  56. #define CHUNK_BAD 0xFFFF
  57. #define OPCODE_END_OF_STREAM 0x00
  58. #define OPCODE_END_OF_CHUNK 0x01
  59. #define OPCODE_CREATE_TIMER 0x02
  60. #define OPCODE_INIT_AUDIO_BUFFERS 0x03
  61. #define OPCODE_START_STOP_AUDIO 0x04
  62. #define OPCODE_INIT_VIDEO_BUFFERS 0x05
  63. #define OPCODE_UNKNOWN_06 0x06
  64. #define OPCODE_SEND_BUFFER 0x07
  65. #define OPCODE_AUDIO_FRAME 0x08
  66. #define OPCODE_SILENCE_FRAME 0x09
  67. #define OPCODE_INIT_VIDEO_MODE 0x0A
  68. #define OPCODE_CREATE_GRADIENT 0x0B
  69. #define OPCODE_SET_PALETTE 0x0C
  70. #define OPCODE_SET_PALETTE_COMPRESSED 0x0D
  71. #define OPCODE_UNKNOWN_0E 0x0E
  72. #define OPCODE_SET_DECODING_MAP 0x0F
  73. #define OPCODE_UNKNOWN_10 0x10
  74. #define OPCODE_VIDEO_DATA 0x11
  75. #define OPCODE_UNKNOWN_12 0x12
  76. #define OPCODE_UNKNOWN_13 0x13
  77. #define OPCODE_UNKNOWN_14 0x14
  78. #define OPCODE_UNKNOWN_15 0x15
  79. #define PALETTE_COUNT 256
  80. typedef struct IPMVEContext {
  81. unsigned char *buf;
  82. int buf_size;
  83. float fps;
  84. int frame_pts_inc;
  85. unsigned int video_width;
  86. unsigned int video_height;
  87. int64_t video_pts;
  88. unsigned int audio_bits;
  89. unsigned int audio_channels;
  90. unsigned int audio_sample_rate;
  91. unsigned int audio_type;
  92. unsigned int audio_frame_count;
  93. int video_stream_index;
  94. int audio_stream_index;
  95. offset_t audio_chunk_offset;
  96. int audio_chunk_size;
  97. offset_t video_chunk_offset;
  98. int video_chunk_size;
  99. offset_t decode_map_chunk_offset;
  100. int decode_map_chunk_size;
  101. offset_t next_chunk_offset;
  102. AVPaletteControl palette_control;
  103. } IPMVEContext;
  104. static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
  105. AVPacket *pkt) {
  106. int chunk_type;
  107. int64_t audio_pts = 0;
  108. if (s->audio_chunk_offset) {
  109. /* adjust for PCM audio by skipping chunk header */
  110. if (s->audio_type != CODEC_ID_INTERPLAY_DPCM) {
  111. s->audio_chunk_offset += 6;
  112. s->audio_chunk_size -= 6;
  113. }
  114. url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
  115. s->audio_chunk_offset = 0;
  116. /* figure out the audio pts */
  117. audio_pts = 90000;
  118. audio_pts *= s->audio_frame_count;
  119. audio_pts /= s->audio_sample_rate;
  120. if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
  121. return CHUNK_EOF;
  122. pkt->stream_index = s->audio_stream_index;
  123. pkt->pts = audio_pts;
  124. /* audio frame maintenance */
  125. if (s->audio_type != CODEC_ID_INTERPLAY_DPCM)
  126. s->audio_frame_count +=
  127. (s->audio_chunk_size / s->audio_channels / (s->audio_bits / 8));
  128. else
  129. s->audio_frame_count +=
  130. (s->audio_chunk_size - 6) / s->audio_channels;
  131. debug_ipmovie("sending audio frame with pts %"PRId64" (%d audio frames)\n",
  132. audio_pts, s->audio_frame_count);
  133. chunk_type = CHUNK_VIDEO;
  134. } else if (s->decode_map_chunk_offset) {
  135. /* send both the decode map and the video data together */
  136. if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
  137. return CHUNK_NOMEM;
  138. pkt->pos= s->decode_map_chunk_offset;
  139. url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
  140. s->decode_map_chunk_offset = 0;
  141. if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
  142. s->decode_map_chunk_size) {
  143. av_free_packet(pkt);
  144. return CHUNK_EOF;
  145. }
  146. url_fseek(pb, s->video_chunk_offset, SEEK_SET);
  147. s->video_chunk_offset = 0;
  148. if (get_buffer(pb, pkt->data + s->decode_map_chunk_size,
  149. s->video_chunk_size) != s->video_chunk_size) {
  150. av_free_packet(pkt);
  151. return CHUNK_EOF;
  152. }
  153. pkt->stream_index = s->video_stream_index;
  154. pkt->pts = s->video_pts;
  155. debug_ipmovie("sending video frame with pts %"PRId64"\n",
  156. pkt->pts);
  157. s->video_pts += s->frame_pts_inc;
  158. chunk_type = CHUNK_VIDEO;
  159. } else {
  160. url_fseek(pb, s->next_chunk_offset, SEEK_SET);
  161. chunk_type = CHUNK_DONE;
  162. }
  163. return chunk_type;
  164. }
  165. /* This function loads and processes a single chunk in an IP movie file.
  166. * It returns the type of chunk that was processed. */
  167. static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
  168. AVPacket *pkt)
  169. {
  170. unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
  171. int chunk_type;
  172. int chunk_size;
  173. unsigned char opcode_preamble[OPCODE_PREAMBLE_SIZE];
  174. unsigned char opcode_type;
  175. unsigned char opcode_version;
  176. int opcode_size;
  177. unsigned char scratch[1024];
  178. int i, j;
  179. int first_color, last_color;
  180. int audio_flags;
  181. unsigned char r, g, b;
  182. /* see if there are any pending packets */
  183. chunk_type = load_ipmovie_packet(s, pb, pkt);
  184. if (chunk_type != CHUNK_DONE)
  185. return chunk_type;
  186. /* read the next chunk, wherever the file happens to be pointing */
  187. if (url_feof(pb))
  188. return CHUNK_EOF;
  189. if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
  190. CHUNK_PREAMBLE_SIZE)
  191. return CHUNK_BAD;
  192. chunk_size = AV_RL16(&chunk_preamble[0]);
  193. chunk_type = AV_RL16(&chunk_preamble[2]);
  194. debug_ipmovie("chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size);
  195. switch (chunk_type) {
  196. case CHUNK_INIT_AUDIO:
  197. debug_ipmovie("initialize audio\n");
  198. break;
  199. case CHUNK_AUDIO_ONLY:
  200. debug_ipmovie("audio only\n");
  201. break;
  202. case CHUNK_INIT_VIDEO:
  203. debug_ipmovie("initialize video\n");
  204. break;
  205. case CHUNK_VIDEO:
  206. debug_ipmovie("video (and audio)\n");
  207. break;
  208. case CHUNK_SHUTDOWN:
  209. debug_ipmovie("shutdown\n");
  210. break;
  211. case CHUNK_END:
  212. debug_ipmovie("end\n");
  213. break;
  214. default:
  215. debug_ipmovie("invalid chunk\n");
  216. chunk_type = CHUNK_BAD;
  217. break;
  218. }
  219. while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) {
  220. /* read the next chunk, wherever the file happens to be pointing */
  221. if (url_feof(pb)) {
  222. chunk_type = CHUNK_EOF;
  223. break;
  224. }
  225. if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
  226. CHUNK_PREAMBLE_SIZE) {
  227. chunk_type = CHUNK_BAD;
  228. break;
  229. }
  230. opcode_size = AV_RL16(&opcode_preamble[0]);
  231. opcode_type = opcode_preamble[2];
  232. opcode_version = opcode_preamble[3];
  233. chunk_size -= OPCODE_PREAMBLE_SIZE;
  234. chunk_size -= opcode_size;
  235. if (chunk_size < 0) {
  236. debug_ipmovie("chunk_size countdown just went negative\n");
  237. chunk_type = CHUNK_BAD;
  238. break;
  239. }
  240. debug_ipmovie(" opcode type %02X, version %d, 0x%04X bytes: ",
  241. opcode_type, opcode_version, opcode_size);
  242. switch (opcode_type) {
  243. case OPCODE_END_OF_STREAM:
  244. debug_ipmovie("end of stream\n");
  245. url_fseek(pb, opcode_size, SEEK_CUR);
  246. break;
  247. case OPCODE_END_OF_CHUNK:
  248. debug_ipmovie("end of chunk\n");
  249. url_fseek(pb, opcode_size, SEEK_CUR);
  250. break;
  251. case OPCODE_CREATE_TIMER:
  252. debug_ipmovie("create timer\n");
  253. if ((opcode_version > 0) || (opcode_size > 6)) {
  254. debug_ipmovie("bad create_timer opcode\n");
  255. chunk_type = CHUNK_BAD;
  256. break;
  257. }
  258. if (get_buffer(pb, scratch, opcode_size) !=
  259. opcode_size) {
  260. chunk_type = CHUNK_BAD;
  261. break;
  262. }
  263. s->fps = 1000000.0 / (AV_RL32(&scratch[0]) * AV_RL16(&scratch[4]));
  264. s->frame_pts_inc = 90000 / s->fps;
  265. debug_ipmovie(" %.2f frames/second (timer div = %d, subdiv = %d)\n",
  266. s->fps, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
  267. break;
  268. case OPCODE_INIT_AUDIO_BUFFERS:
  269. debug_ipmovie("initialize audio buffers\n");
  270. if ((opcode_version > 1) || (opcode_size > 10)) {
  271. debug_ipmovie("bad init_audio_buffers opcode\n");
  272. chunk_type = CHUNK_BAD;
  273. break;
  274. }
  275. if (get_buffer(pb, scratch, opcode_size) !=
  276. opcode_size) {
  277. chunk_type = CHUNK_BAD;
  278. break;
  279. }
  280. s->audio_sample_rate = AV_RL16(&scratch[4]);
  281. audio_flags = AV_RL16(&scratch[2]);
  282. /* bit 0 of the flags: 0 = mono, 1 = stereo */
  283. s->audio_channels = (audio_flags & 1) + 1;
  284. /* bit 1 of the flags: 0 = 8 bit, 1 = 16 bit */
  285. s->audio_bits = (((audio_flags >> 1) & 1) + 1) * 8;
  286. /* bit 2 indicates compressed audio in version 1 opcode */
  287. if ((opcode_version == 1) && (audio_flags & 0x4))
  288. s->audio_type = CODEC_ID_INTERPLAY_DPCM;
  289. else if (s->audio_bits == 16)
  290. s->audio_type = CODEC_ID_PCM_S16LE;
  291. else
  292. s->audio_type = CODEC_ID_PCM_U8;
  293. debug_ipmovie("audio: %d bits, %d Hz, %s, %s format\n",
  294. s->audio_bits,
  295. s->audio_sample_rate,
  296. (s->audio_channels == 2) ? "stereo" : "mono",
  297. (s->audio_type == CODEC_ID_INTERPLAY_DPCM) ?
  298. "Interplay audio" : "PCM");
  299. break;
  300. case OPCODE_START_STOP_AUDIO:
  301. debug_ipmovie("start/stop audio\n");
  302. url_fseek(pb, opcode_size, SEEK_CUR);
  303. break;
  304. case OPCODE_INIT_VIDEO_BUFFERS:
  305. debug_ipmovie("initialize video buffers\n");
  306. if ((opcode_version > 2) || (opcode_size > 8)) {
  307. debug_ipmovie("bad init_video_buffers opcode\n");
  308. chunk_type = CHUNK_BAD;
  309. break;
  310. }
  311. if (get_buffer(pb, scratch, opcode_size) !=
  312. opcode_size) {
  313. chunk_type = CHUNK_BAD;
  314. break;
  315. }
  316. s->video_width = AV_RL16(&scratch[0]) * 8;
  317. s->video_height = AV_RL16(&scratch[2]) * 8;
  318. debug_ipmovie("video resolution: %d x %d\n",
  319. s->video_width, s->video_height);
  320. break;
  321. case OPCODE_UNKNOWN_06:
  322. case OPCODE_UNKNOWN_0E:
  323. case OPCODE_UNKNOWN_10:
  324. case OPCODE_UNKNOWN_12:
  325. case OPCODE_UNKNOWN_13:
  326. case OPCODE_UNKNOWN_14:
  327. case OPCODE_UNKNOWN_15:
  328. debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type);
  329. url_fseek(pb, opcode_size, SEEK_CUR);
  330. break;
  331. case OPCODE_SEND_BUFFER:
  332. debug_ipmovie("send buffer\n");
  333. url_fseek(pb, opcode_size, SEEK_CUR);
  334. break;
  335. case OPCODE_AUDIO_FRAME:
  336. debug_ipmovie("audio frame\n");
  337. /* log position and move on for now */
  338. s->audio_chunk_offset = url_ftell(pb);
  339. s->audio_chunk_size = opcode_size;
  340. url_fseek(pb, opcode_size, SEEK_CUR);
  341. break;
  342. case OPCODE_SILENCE_FRAME:
  343. debug_ipmovie("silence frame\n");
  344. url_fseek(pb, opcode_size, SEEK_CUR);
  345. break;
  346. case OPCODE_INIT_VIDEO_MODE:
  347. debug_ipmovie("initialize video mode\n");
  348. url_fseek(pb, opcode_size, SEEK_CUR);
  349. break;
  350. case OPCODE_CREATE_GRADIENT:
  351. debug_ipmovie("create gradient\n");
  352. url_fseek(pb, opcode_size, SEEK_CUR);
  353. break;
  354. case OPCODE_SET_PALETTE:
  355. debug_ipmovie("set palette\n");
  356. /* check for the logical maximum palette size
  357. * (3 * 256 + 4 bytes) */
  358. if (opcode_size > 0x304) {
  359. debug_ipmovie("demux_ipmovie: set_palette opcode too large\n");
  360. chunk_type = CHUNK_BAD;
  361. break;
  362. }
  363. if (get_buffer(pb, scratch, opcode_size) != opcode_size) {
  364. chunk_type = CHUNK_BAD;
  365. break;
  366. }
  367. /* load the palette into internal data structure */
  368. first_color = AV_RL16(&scratch[0]);
  369. last_color = first_color + AV_RL16(&scratch[2]) - 1;
  370. /* sanity check (since they are 16 bit values) */
  371. if ((first_color > 0xFF) || (last_color > 0xFF)) {
  372. debug_ipmovie("demux_ipmovie: set_palette indices out of range (%d -> %d)\n",
  373. first_color, last_color);
  374. chunk_type = CHUNK_BAD;
  375. break;
  376. }
  377. j = 4; /* offset of first palette data */
  378. for (i = first_color; i <= last_color; i++) {
  379. /* the palette is stored as a 6-bit VGA palette, thus each
  380. * component is shifted up to a 8-bit range */
  381. r = scratch[j++] * 4;
  382. g = scratch[j++] * 4;
  383. b = scratch[j++] * 4;
  384. s->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
  385. }
  386. /* indicate a palette change */
  387. s->palette_control.palette_changed = 1;
  388. break;
  389. case OPCODE_SET_PALETTE_COMPRESSED:
  390. debug_ipmovie("set palette compressed\n");
  391. url_fseek(pb, opcode_size, SEEK_CUR);
  392. break;
  393. case OPCODE_SET_DECODING_MAP:
  394. debug_ipmovie("set decoding map\n");
  395. /* log position and move on for now */
  396. s->decode_map_chunk_offset = url_ftell(pb);
  397. s->decode_map_chunk_size = opcode_size;
  398. url_fseek(pb, opcode_size, SEEK_CUR);
  399. break;
  400. case OPCODE_VIDEO_DATA:
  401. debug_ipmovie("set video data\n");
  402. /* log position and move on for now */
  403. s->video_chunk_offset = url_ftell(pb);
  404. s->video_chunk_size = opcode_size;
  405. url_fseek(pb, opcode_size, SEEK_CUR);
  406. break;
  407. default:
  408. debug_ipmovie("*** unknown opcode type\n");
  409. chunk_type = CHUNK_BAD;
  410. break;
  411. }
  412. }
  413. /* make a note of where the stream is sitting */
  414. s->next_chunk_offset = url_ftell(pb);
  415. /* dispatch the first of any pending packets */
  416. if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY))
  417. chunk_type = load_ipmovie_packet(s, pb, pkt);
  418. return chunk_type;
  419. }
  420. static int ipmovie_probe(AVProbeData *p)
  421. {
  422. if (strncmp(p->buf, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0)
  423. return 0;
  424. return AVPROBE_SCORE_MAX;
  425. }
  426. static int ipmovie_read_header(AVFormatContext *s,
  427. AVFormatParameters *ap)
  428. {
  429. IPMVEContext *ipmovie = s->priv_data;
  430. ByteIOContext *pb = &s->pb;
  431. AVPacket pkt;
  432. AVStream *st;
  433. unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
  434. int chunk_type;
  435. /* initialize private context members */
  436. ipmovie->video_pts = ipmovie->audio_frame_count = 0;
  437. ipmovie->audio_chunk_offset = ipmovie->video_chunk_offset =
  438. ipmovie->decode_map_chunk_offset = 0;
  439. /* on the first read, this will position the stream at the first chunk */
  440. ipmovie->next_chunk_offset = IPMOVIE_SIGNATURE_SIZE + 6;
  441. /* process the first chunk which should be CHUNK_INIT_VIDEO */
  442. if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO)
  443. return AVERROR_INVALIDDATA;
  444. /* peek ahead to the next chunk-- if it is an init audio chunk, process
  445. * it; if it is the first video chunk, this is a silent file */
  446. if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
  447. CHUNK_PREAMBLE_SIZE)
  448. return AVERROR(EIO);
  449. chunk_type = AV_RL16(&chunk_preamble[2]);
  450. url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
  451. if (chunk_type == CHUNK_VIDEO)
  452. ipmovie->audio_type = 0; /* no audio */
  453. else if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_AUDIO)
  454. return AVERROR_INVALIDDATA;
  455. /* initialize the stream decoders */
  456. st = av_new_stream(s, 0);
  457. if (!st)
  458. return AVERROR(ENOMEM);
  459. av_set_pts_info(st, 33, 1, 90000);
  460. ipmovie->video_stream_index = st->index;
  461. st->codec->codec_type = CODEC_TYPE_VIDEO;
  462. st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
  463. st->codec->codec_tag = 0; /* no fourcc */
  464. st->codec->width = ipmovie->video_width;
  465. st->codec->height = ipmovie->video_height;
  466. /* palette considerations */
  467. st->codec->palctrl = &ipmovie->palette_control;
  468. if (ipmovie->audio_type) {
  469. st = av_new_stream(s, 0);
  470. if (!st)
  471. return AVERROR(ENOMEM);
  472. av_set_pts_info(st, 33, 1, 90000);
  473. ipmovie->audio_stream_index = st->index;
  474. st->codec->codec_type = CODEC_TYPE_AUDIO;
  475. st->codec->codec_id = ipmovie->audio_type;
  476. st->codec->codec_tag = 0; /* no tag */
  477. st->codec->channels = ipmovie->audio_channels;
  478. st->codec->sample_rate = ipmovie->audio_sample_rate;
  479. st->codec->bits_per_sample = ipmovie->audio_bits;
  480. st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
  481. st->codec->bits_per_sample;
  482. if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
  483. st->codec->bit_rate /= 2;
  484. st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
  485. }
  486. return 0;
  487. }
  488. static int ipmovie_read_packet(AVFormatContext *s,
  489. AVPacket *pkt)
  490. {
  491. IPMVEContext *ipmovie = s->priv_data;
  492. ByteIOContext *pb = &s->pb;
  493. int ret;
  494. ret = process_ipmovie_chunk(ipmovie, pb, pkt);
  495. if (ret == CHUNK_BAD)
  496. ret = AVERROR_INVALIDDATA;
  497. else if (ret == CHUNK_EOF)
  498. ret = AVERROR(EIO);
  499. else if (ret == CHUNK_NOMEM)
  500. ret = AVERROR(ENOMEM);
  501. else if (ret == CHUNK_VIDEO)
  502. ret = 0;
  503. else
  504. ret = -1;
  505. return ret;
  506. }
  507. static int ipmovie_read_close(AVFormatContext *s)
  508. {
  509. // IPMVEContext *ipmovie = s->priv_data;
  510. return 0;
  511. }
  512. AVInputFormat ipmovie_demuxer = {
  513. "ipmovie",
  514. "Interplay MVE format",
  515. sizeof(IPMVEContext),
  516. ipmovie_probe,
  517. ipmovie_read_header,
  518. ipmovie_read_packet,
  519. ipmovie_read_close,
  520. };