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;
/* see if there are any pending packets */
chunk_type = load_ipmovie_packet(s, pb, pkt);
- if ((chunk_type == CHUNK_VIDEO) && (chunk_type != CHUNK_DONE))
+ if (chunk_type != CHUNK_DONE)
return chunk_type;
/* read the next chunk, wherever the file happens to be pointing */
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;
static int ipmovie_probe(AVProbeData *p)
{
- if (p->buf_size < IPMOVIE_SIGNATURE_SIZE)
- return 0;
if (strncmp(p->buf, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0)
return 0;
static int ipmovie_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- IPMVEContext *ipmovie = (IPMVEContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ IPMVEContext *ipmovie = s->priv_data;
+ 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;
/* initialize the stream decoders */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, 90000);
ipmovie->video_stream_index = st->index;
st->codec->codec_type = CODEC_TYPE_VIDEO;
if (ipmovie->audio_type) {
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, 90000);
ipmovie->audio_stream_index = st->index;
st->codec->codec_type = CODEC_TYPE_AUDIO;
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;
static int ipmovie_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
- IPMVEContext *ipmovie = (IPMVEContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ IPMVEContext *ipmovie = s->priv_data;
+ 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_NOMEM;
- else
+ ret = AVERROR(ENOMEM);
+ else if (ret == CHUNK_VIDEO)
ret = 0;
+ else
+ ret = -1;
return ret;
}
-static int ipmovie_read_close(AVFormatContext *s)
-{
-// IPMVEContext *ipmovie = (IPMVEContext *)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,
};