aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/img2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-04-13 01:07:30 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-04-13 01:07:30 +0000
commit2c34596ff7fcf4699b70243dfefc6a1fb67909cc (patch)
treeda9aa75512c57734af14d8ffe48ca4692576a38c /libavformat/img2.c
parentf40487c282d7dff3aada1e8186f95dbacac2c8c1 (diff)
downloadffmpeg-2c34596ff7fcf4699b70243dfefc6a1fb67909cc.tar.gz
non 4:2:0 foobar.{Y,U,V} support
Originally committed as revision 4125 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/img2.c')
-rw-r--r--libavformat/img2.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 4cfd9eb6ba..0a53a5b824 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -222,6 +222,8 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = av_str2id(img_tags, s->path);
}
+ if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt)
+ st->codec.pix_fmt = ap->pix_fmt;
return 0;
}
@@ -336,10 +338,10 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if(codec->codec_id == CODEC_ID_RAWVIDEO){
- int size = (codec->width * codec->height)>>2;
- put_buffer(pb[0], pkt->data , 4*size);
- put_buffer(pb[1], pkt->data + 4*size, size);
- put_buffer(pb[2], pkt->data + 5*size, size);
+ int ysize = codec->width * codec->height;
+ put_buffer(pb[0], pkt->data , ysize);
+ put_buffer(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
+ put_buffer(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
put_flush_packet(pb[1]);
put_flush_packet(pb[2]);
url_fclose(pb[1]);