summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avienc.c2
-rw-r--r--libavformat/raw.c17
2 files changed, 4 insertions, 15 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 72e9825234..b3c7c26aaf 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -211,7 +211,7 @@ void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags
put_le16(pb, enc->bits_per_sample ? enc->bits_per_sample : 24); /* depth */
/* compression type */
- put_le32(pb, for_asf ? codec_get_asf_tag(tags, enc->codec_id) : codec_get_tag(tags, enc->codec_id));
+ put_le32(pb, for_asf ? codec_get_asf_tag(tags, enc->codec_id) : enc->codec_tag);
put_le32(pb, enc->width * enc->height * 3);
put_le32(pb, 0);
put_le32(pb, 0);
diff --git a/libavformat/raw.c b/libavformat/raw.c
index b254124943..1c528c17a0 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -65,6 +65,7 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec.frame_rate_base = ap->frame_rate_base;
st->codec.width = ap->width;
st->codec.height = ap->height;
+ st->codec.pix_fmt = ap->pix_fmt;
break;
default:
return -1;
@@ -455,21 +456,9 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
width = st->codec.width;
height = st->codec.height;
- switch(st->codec.pix_fmt) {
- case PIX_FMT_YUV420P:
- packet_size = (width * height * 3) / 2;
- break;
- case PIX_FMT_YUV422:
- packet_size = (width * height * 2);
- break;
- case PIX_FMT_BGR24:
- case PIX_FMT_RGB24:
- packet_size = (width * height * 3);
- break;
- default:
+ packet_size = avpicture_get_size(st->codec.pix_fmt, width, height);
+ if (packet_size < 0)
av_abort();
- break;
- }
if (av_new_packet(pkt, packet_size) < 0)
return -EIO;