*/
/**
- * @file libavformat/electronicarts.c
+ * @file
* Electronic Arts Multimedia file demuxer (WVE/UV2/etc.)
* by Robin Kay (komadori at gekkou.co.uk)
*/
ea->sample_rate = -1;
ea->num_channels = 1;
- while (inHeader) {
+ while (!url_feof(pb) && inHeader) {
int inSubheader;
uint8_t byte;
byte = get_byte(pb);
case 0xFD:
av_log (s, AV_LOG_DEBUG, "entered audio subheader\n");
inSubheader = 1;
- while (inSubheader) {
+ while (!url_feof(pb) && inSubheader) {
uint8_t subbyte;
subbyte = get_byte(pb);
if (i == 0)
ea->big_endian = size > 0x000FFFFF;
if (ea->big_endian)
- size = bswap_32(size);
+ size = av_bswap32(size);
switch (blockid) {
case ISNh_TAG:
if (!st)
return AVERROR(ENOMEM);
ea->video_stream_index = st->index;
- st->codec->codec_type = CODEC_TYPE_VIDEO;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ea->video_codec;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->time_base = ea->time_base;
}
if (ea->audio_codec) {
+ if (ea->num_channels <= 0) {
+ av_log(s, AV_LOG_WARNING, "Unsupported number of channels: %d\n", ea->num_channels);
+ ea->audio_codec = 0;
+ return 1;
+ }
+ if (ea->sample_rate <= 0) {
+ av_log(s, AV_LOG_ERROR, "Unsupported sample rate: %d\n", ea->sample_rate);
+ ea->audio_codec = 0;
+ return 1;
+ }
+
/* initialize the audio decoder stream */
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
av_set_pts_info(st, 33, 1, ea->sample_rate);
- st->codec->codec_type = CODEC_TYPE_AUDIO;
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = ea->audio_codec;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = ea->num_channels;
case pQGT_TAG:
case TGQs_TAG:
case MADk_TAG:
- key = PKT_FLAG_KEY;
+ key = AV_PKT_FLAG_KEY;
case MVIf_TAG:
case fVGT_TAG:
case MADm_TAG:
case MV0K_TAG:
case MPCh_TAG:
case pIQT_TAG:
- key = PKT_FLAG_KEY;
+ key = AV_PKT_FLAG_KEY;
case MV0F_TAG:
get_video_packet:
ret = av_get_packet(pb, pkt, chunk_size);
return ret;
}
-AVInputFormat ea_demuxer = {
+AVInputFormat ff_ea_demuxer = {
"ea",
NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia Format"),
sizeof(EaDemuxContext),