00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "avformat.h"
00023 #include "rawdec.h"
00024
00025
00026 static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
00027 {
00028 int ret, size, w, h, unk1, unk2;
00029
00030 if (avio_rl32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
00031 return AVERROR(EIO);
00032
00033 size = avio_rl32(s->pb);
00034
00035 w = avio_rl16(s->pb);
00036 h = avio_rl16(s->pb);
00037
00038 avio_skip(s->pb, 8);
00039 avio_skip(s->pb, 2);
00040 unk1 = avio_rl16(s->pb);
00041 unk2 = avio_rl16(s->pb);
00042 avio_skip(s->pb, 22);
00043
00044 av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
00045 size, w, h, unk1, unk2);
00046
00047 ret = av_get_packet(s->pb, pkt, size);
00048 if (ret < 0)
00049 return ret;
00050 pkt->stream_index = 0;
00051 return ret;
00052 }
00053
00054 FF_RAWVIDEO_DEMUXER_CLASS(ingenient)
00055
00056 AVInputFormat ff_ingenient_demuxer = {
00057 .name = "ingenient",
00058 .long_name = NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
00059 .priv_data_size = sizeof(FFRawVideoDemuxerContext),
00060 .read_header = ff_raw_video_read_header,
00061 .read_packet = ingenient_read_packet,
00062 .flags = AVFMT_GENERIC_INDEX,
00063 .extensions = "cgi",
00064 .raw_codec_id = AV_CODEC_ID_MJPEG,
00065 .priv_class = &ingenient_demuxer_class,
00066 };