summaryrefslogtreecommitdiff
path: root/libavformat/raw.c
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2003-05-07 19:01:45 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2003-05-07 19:01:45 +0000
commit631670888d4ff9ca08c9d0804082511a1bc587a5 (patch)
tree2bf2601c9204d6d3097f93cda618a25eb0d4bb74 /libavformat/raw.c
parent4e80eb21afd02747592e9fb9cfe2679401b7857e (diff)
* introducing new public interface in imgconvert.c
+ avcodec_get_pix_fmt converts textual representation of pixel format into the actual id. Complements avcodec_get_pix_fmt_name. + avpicture_layout serializes given picture into a flat array. Complements avpicture_fill. * adding a new option -pix_fmt to the ffmpeg, in order to control pixel format for the codecs that do support it, like rawvideo, for example. * reducing complexity of the rawvideo codec by splitting it in two and making it more reliable via hooking up to the avpicture_layout. Plus adding new FourCC as described here: http://www.fourcc.org * A tiny fix for avienc.c that makes avih and video strf consistent regarding codec FourCC. Originally committed as revision 1842 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/raw.c')
-rw-r--r--libavformat/raw.c17
1 files changed, 3 insertions, 14 deletions
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;