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