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.

631 lines
20KB

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