*/
/**
- * @file ipmovie.c
+ * @file libavformat/ipmovie.c
* Interplay MVE file demuxer
* by Mike Melanson (melanson@pcisys.net)
* For more information regarding the Interplay MVE file format, visit:
* up and sending out the chunks.
*/
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
unsigned int audio_bits;
unsigned int audio_channels;
unsigned int audio_sample_rate;
- unsigned int audio_type;
+ enum CodecID audio_type;
unsigned int audio_frame_count;
int video_stream_index;
int audio_stream_index;
- offset_t audio_chunk_offset;
+ int64_t audio_chunk_offset;
int audio_chunk_size;
- offset_t video_chunk_offset;
+ int64_t video_chunk_offset;
int video_chunk_size;
- offset_t decode_map_chunk_offset;
+ int64_t decode_map_chunk_offset;
int decode_map_chunk_size;
- offset_t next_chunk_offset;
+ int64_t next_chunk_offset;
AVPaletteControl palette_control;
last_color = first_color + AV_RL16(&scratch[2]) - 1;
/* sanity check (since they are 16 bit values) */
if ((first_color > 0xFF) || (last_color > 0xFF)) {
- debug_ipmovie("demux_ipmovie: set_palette indices out of range (%d -> %d)\n",
+ debug_ipmovie("demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
first_color, last_color);
chunk_type = CHUNK_BAD;
break;
AVFormatParameters *ap)
{
IPMVEContext *ipmovie = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVPacket pkt;
AVStream *st;
unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
* it; if it is the first video chunk, this is a silent file */
if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE)
- return AVERROR_IO;
+ return AVERROR(EIO);
chunk_type = AV_RL16(&chunk_preamble[2]);
url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
if (chunk_type == CHUNK_VIDEO)
- ipmovie->audio_type = 0; /* no audio */
+ ipmovie->audio_type = CODEC_ID_NONE; /* no audio */
else if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_AUDIO)
return AVERROR_INVALIDDATA;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = ipmovie->audio_channels;
st->codec->sample_rate = ipmovie->audio_sample_rate;
- st->codec->bits_per_sample = ipmovie->audio_bits;
+ st->codec->bits_per_coded_sample = ipmovie->audio_bits;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
- st->codec->bits_per_sample;
+ st->codec->bits_per_coded_sample;
if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
st->codec->bit_rate /= 2;
- st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
+ st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
}
return 0;
AVPacket *pkt)
{
IPMVEContext *ipmovie = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret;
ret = process_ipmovie_chunk(ipmovie, pb, pkt);
if (ret == CHUNK_BAD)
ret = AVERROR_INVALIDDATA;
else if (ret == CHUNK_EOF)
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
else if (ret == CHUNK_NOMEM)
ret = AVERROR(ENOMEM);
else if (ret == CHUNK_VIDEO)
return ret;
}
-static int ipmovie_read_close(AVFormatContext *s)
-{
-// IPMVEContext *ipmovie = s->priv_data;
-
- return 0;
-}
-
AVInputFormat ipmovie_demuxer = {
"ipmovie",
- "Interplay MVE format",
+ NULL_IF_CONFIG_SMALL("Interplay MVE format"),
sizeof(IPMVEContext),
ipmovie_probe,
ipmovie_read_header,
ipmovie_read_packet,
- ipmovie_read_close,
};