diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-01-18 01:48:14 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-01-18 01:48:14 +0000 |
commit | b4097b13d4f290664630df0c05acf4e62e64d5d3 (patch) | |
tree | 206ff5120befb11830c9ddf6d5a9b3b34713d3f2 | |
parent | aa91562501aef7aebe4d1fb7e382b24adf6ad625 (diff) | |
download | ffmpeg-b4097b13d4f290664630df0c05acf4e62e64d5d3.tar.gz |
add jp2 formater in image2 muxer
Originally committed as revision 16664 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/img2.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libavformat/img2.c b/libavformat/img2.c index 421a2c3b15..7e17794411 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -360,6 +360,29 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt) url_fclose(pb[1]); url_fclose(pb[2]); }else{ + if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){ + AVStream *st = s->streams[0]; + if(st->codec->extradata_size > 8 && + AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){ + if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c')) + goto error; + put_be32(pb[0], 12); + put_tag (pb[0], "jP "); + put_be32(pb[0], 0x0D0A870A); // signature + put_be32(pb[0], 20); + put_tag (pb[0], "ftyp"); + put_tag (pb[0], "jp2 "); + put_be32(pb[0], 0); + put_tag (pb[0], "jp2 "); + put_buffer(pb[0], st->codec->extradata, st->codec->extradata_size); + }else if(pkt->size < 8 || + (!st->codec->extradata_size && + AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature + error: + av_log(s, AV_LOG_ERROR, "malformated jpeg2000 codestream\n"); + return -1; + } + } put_buffer(pb[0], pkt->data, pkt->size); } put_flush_packet(pb[0]); @@ -405,7 +428,7 @@ AVOutputFormat image2_muxer = { "image2", NULL_IF_CONFIG_SMALL("image2 sequence"), "", - "bmp,jpeg,jpg,ljpg,pam,pbm,pgm,pgmyuv,png,ppm,sgi,tif,tiff", + "bmp,jpeg,jpg,ljpg,pam,pbm,pgm,pgmyuv,png,ppm,sgi,tif,tiff,jp2", sizeof(VideoData), CODEC_ID_NONE, CODEC_ID_MJPEG, |