aboutsummaryrefslogtreecommitdiffstats
path: root/libav/raw.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2001-08-15 13:06:33 +0000
committerFabrice Bellard <fabrice@bellard.org>2001-08-15 13:06:33 +0000
commit27e084bd61c9aea372876bdc543732c2dc5e056a (patch)
tree37803d2677fb142b36c4d7c5b527ad66ce602278 /libav/raw.c
parent13a7d16ede6a841fb67a7e857b134ec9cf05f26b (diff)
downloadffmpeg-27e084bd61c9aea372876bdc543732c2dc5e056a.tar.gz
added raw mjpeg
Originally committed as revision 94 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/raw.c')
-rw-r--r--libav/raw.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/libav/raw.c b/libav/raw.c
index ecdce89492..7e4965e9ef 100644
--- a/libav/raw.c
+++ b/libav/raw.c
@@ -76,11 +76,10 @@ static int raw_read_header(AVFormatContext *s,
st->codec.height = ap->height;
break;
default:
- abort();
- break;
+ return -1;
}
} else {
- abort();
+ return -1;
}
return 0;
}
@@ -130,9 +129,7 @@ static int mp3_read_header(AVFormatContext *s,
st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_MP2;
- /* XXX: read the first frame and extract rate and channels */
- st->codec.sample_rate = 44100;
- st->codec.channels = 2;
+ /* the parameters will be extracted from the compressed bitstream */
return 0;
}
@@ -150,6 +147,14 @@ static int video_read_header(AVFormatContext *s,
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = s->format->video_codec;
+ /* for mjpeg, specify frame rate */
+ if (st->codec.codec_id == CODEC_ID_MJPEG) {
+ if (ap) {
+ st->codec.frame_rate = ap->frame_rate;
+ } else {
+ st->codec.frame_rate = 25 * FRAME_RATE_BASE;
+ }
+ }
return 0;
}
@@ -211,6 +216,21 @@ AVFormat mpeg1video_format = {
raw_read_close,
};
+AVFormat mjpeg_format = {
+ "mjpeg",
+ "MJPEG video",
+ "video/x-mjpeg",
+ "mjpg,mjpeg",
+ 0,
+ CODEC_ID_MJPEG,
+ raw_write_header,
+ raw_write_packet,
+ raw_write_trailer,
+ video_read_header,
+ raw_read_packet,
+ raw_read_close,
+};
+
AVFormat pcm_format = {
"pcm",
"pcm raw format",