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 static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
00026 {
00027 int packet_size, ret, width, height;
00028 AVStream *st = s->streams[0];
00029
00030 width = st->codec->width;
00031 height = st->codec->height;
00032
00033 packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
00034 if (packet_size < 0)
00035 return -1;
00036
00037 ret= av_get_packet(s->pb, pkt, packet_size);
00038 pkt->pts=
00039 pkt->dts= pkt->pos / packet_size;
00040
00041 pkt->stream_index = 0;
00042 if (ret < 0)
00043 return ret;
00044 return 0;
00045 }
00046
00047 AVInputFormat ff_rawvideo_demuxer = {
00048 "rawvideo",
00049 NULL_IF_CONFIG_SMALL("raw video format"),
00050 sizeof(FFRawVideoDemuxerContext),
00051 NULL,
00052 ff_raw_read_header,
00053 rawvideo_read_packet,
00054 .flags= AVFMT_GENERIC_INDEX,
00055 .extensions = "yuv,cif,qcif,rgb",
00056 .value = CODEC_ID_RAWVIDEO,
00057 .priv_class = &ff_rawvideo_demuxer_class,
00058 };