X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmm.c;h=c6264f1cb7c191af8d7d4d62c6599dc533036790;hb=4fa0e24736bff7d7fbdfb36ed578a1db166817d4;hp=cb0917a7abdbeec8880c662108f52f6ee1c7fd2e;hpb=ba87f0801d77c21eb1e4891ca1f846500bbb0939;p=ffmpeg diff --git a/libavformat/mm.c b/libavformat/mm.c index cb0917a7abd..c6264f1cb7c 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -84,25 +84,25 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { MmDemuxContext *mm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int type, length; unsigned int frame_rate, width, height; - type = get_le16(pb); - length = get_le32(pb); + type = avio_rl16(pb); + length = avio_rl32(pb); if (type != MM_TYPE_HEADER) return AVERROR_INVALIDDATA; /* read header */ - get_le16(pb); /* total number of chunks */ - frame_rate = get_le16(pb); - get_le16(pb); /* ibm-pc video bios mode */ - width = get_le16(pb); - height = get_le16(pb); - url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */ + avio_rl16(pb); /* total number of chunks */ + frame_rate = avio_rl16(pb); + avio_rl16(pb); /* ibm-pc video bios mode */ + width = avio_rl16(pb); + height = avio_rl16(pb); + avio_skip(pb, length - 10); /* unknown data */ /* video stream */ st = av_new_stream(s, 0); @@ -137,13 +137,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { MmDemuxContext *mm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char preamble[MM_PREAMBLE_SIZE]; unsigned int type, length; while(1) { - if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { + if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { return AVERROR(EIO); } @@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s, if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE)) return AVERROR(ENOMEM); memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE); - if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) + if (avio_read(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) return AVERROR(EIO); pkt->size = length + MM_PREAMBLE_SIZE; pkt->stream_index = 0; @@ -181,14 +181,14 @@ static int read_packet(AVFormatContext *s, default : av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type); - url_fseek(pb, length, SEEK_CUR); + avio_skip(pb, length); } } return 0; } -AVInputFormat mm_demuxer = { +AVInputFormat ff_mm_demuxer = { "mm", NULL_IF_CONFIG_SMALL("American Laser Games MM format"), sizeof(MmDemuxContext),