aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/swf.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-01-14 01:57:43 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-01-14 01:57:43 +0000
commita0dc1ccd29faab422a26b78985b83d4038c7403d (patch)
treeb3d907a8e795a5cd815aceb9611e0a10a812bdc3 /libavformat/swf.c
parent655254f0017d423fe74b945bdfb7296c990dec32 (diff)
downloadffmpeg-a0dc1ccd29faab422a26b78985b83d4038c7403d.tar.gz
enable mjpeg in swf
Originally committed as revision 7458 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/swf.c')
-rw-r--r--libavformat/swf.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavformat/swf.c b/libavformat/swf.c
index f8b7c2675d..21588fc012 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -833,6 +833,16 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (len > 4)
url_fskip(pb,len-4);
+ } else if (tag == TAG_JPEG2 && !vst) {
+ vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */
+ av_set_pts_info(vst, 24, 1, 1000); /* 24 bit pts in ms */
+ vst->codec->codec_type = CODEC_TYPE_VIDEO;
+ vst->codec->codec_id = CODEC_ID_MJPEG;
+ if (swf->samples_per_frame) {
+ vst->codec->time_base.den = 1000. / swf->ms_per_frame;
+ vst->codec->time_base.num = 1;
+ }
+ url_fskip(pb, len);
} else {
url_fskip(pb, len);
}
@@ -874,6 +884,24 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = st->index;
return pkt->size;
}
+ } else if (tag == TAG_JPEG2) {
+ for (i=0; i<s->nb_streams; i++) {
+ st = s->streams[i];
+ if (st->id == -2) {
+ get_le16(pb); /* BITMAP_ID */
+ av_new_packet(pkt, len-2);
+ get_buffer(pb, pkt->data, 4);
+ if (BE_32(pkt->data) == 0xffd8ffd9) {
+ /* old SWF files containing SOI/EOI as data start */
+ pkt->size -= 4;
+ get_buffer(pb, pkt->data, pkt->size);
+ } else {
+ get_buffer(pb, pkt->data + 4, pkt->size - 4);
+ }
+ pkt->stream_index = st->index;
+ return pkt->size;
+ }
+ }
}
url_fskip(pb, len);
}