diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2006-09-09 17:19:37 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2006-09-09 17:19:37 +0000 |
commit | 5ce117c37c9b1ff5ed121f372e972e9eb3d83d23 (patch) | |
tree | a4683c31766798c4744296327234feb443c3ede7 /libavformat | |
parent | 34a8dcd031d637273cdea021e5a79cf720c4c51c (diff) | |
download | ffmpeg-streaming-5ce117c37c9b1ff5ed121f372e972e9eb3d83d23.zip ffmpeg-streaming-5ce117c37c9b1ff5ed121f372e972e9eb3d83d23.tar.gz |
VP5 and VP6 video decoder
Originally committed as revision 6213 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/flvdec.c | 5 | ||||
-rw-r--r-- | libavformat/nsvdec.c | 6 | ||||
-rw-r--r-- | libavformat/riff.c | 2 | ||||
-rw-r--r-- | libavformat/swf.c | 33 |
4 files changed, 33 insertions, 13 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index d234f54..0746fff 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -184,6 +184,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) switch(flags & 0xF){ case 2: st->codec->codec_id = CODEC_ID_FLV1; break; case 3: st->codec->codec_id = CODEC_ID_FLASHSV; break; + case 4: + st->codec->codec_id = CODEC_ID_VP6F; + get_byte(&s->pb); /* width and height adjustment */ + size--; + break; default: av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flags & 0xf); st->codec->codec_tag= flags & 0xF; diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index e4c7c9f..a2a3f40 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -182,15 +182,15 @@ static const CodecTag nsv_codec_video_tags[] = { { CODEC_ID_VP3, MKTAG('V', 'P', '3', ' ') }, { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') }, { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') }, + { CODEC_ID_VP5, MKTAG('V', 'P', '5', ' ') }, + { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') }, + { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') }, /* { CODEC_ID_VP4, MKTAG('V', 'P', '4', ' ') }, { CODEC_ID_VP4, MKTAG('V', 'P', '4', '0') }, - { CODEC_ID_VP5, MKTAG('V', 'P', '5', ' ') }, - { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') }, { CODEC_ID_VP6, MKTAG('V', 'P', '6', ' ') }, { CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') }, { CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') }, - { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') }, */ { CODEC_ID_XVID, MKTAG('X', 'V', 'I', 'D') }, /* cf sample xvid decoder from nsv_codec_sdk.zip */ { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', '3') }, diff --git a/libavformat/riff.c b/libavformat/riff.c index cc21139..1317d45 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -114,6 +114,8 @@ const CodecTag codec_bmp_tags[] = { { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') }, { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') }, { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') }, + { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') }, + { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') }, { CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') }, { CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') }, { CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') }, diff --git a/libavformat/swf.c b/libavformat/swf.c index 67a6330..ecffbda 100644 --- a/libavformat/swf.c +++ b/libavformat/swf.c @@ -19,6 +19,7 @@ */ #include "avformat.h" #include "bitstream.h" +#include "riff.h" /* for CodecTag */ /* should have a generic way to indicate probable size */ #define DUMMY_FILE_SIZE (100 * 1024 * 1024) @@ -45,8 +46,6 @@ #define FLAG_SETFILL0 0x02 #define FLAG_SETFILL1 0x04 -#define SWF_VIDEO_CODEC_FLV1 0x02 - #define AUDIO_FIFO_SIZE 65536 /* character id used */ @@ -80,6 +79,12 @@ typedef struct { int audio_type; } SWFContext; +static const CodecTag swf_codec_tags[] = { + {CODEC_ID_FLV1, 0x02}, + {CODEC_ID_VP6F, 0x04}, + {0, 0}, +}; + static const int sSampleRates[3][4] = { {44100, 48000, 32000, 0}, {22050, 24000, 16000, 0}, @@ -328,10 +333,12 @@ static int swf_write_header(AVFormatContext *s) if (enc->codec_type == CODEC_TYPE_AUDIO) audio_enc = enc; else { - if ( enc->codec_id == CODEC_ID_FLV1 || enc->codec_id == CODEC_ID_MJPEG ) { + if ( enc->codec_id == CODEC_ID_VP6F || + enc->codec_id == CODEC_ID_FLV1 || + enc->codec_id == CODEC_ID_MJPEG ) { video_enc = enc; } else { - av_log(enc, AV_LOG_ERROR, "SWF only supports FLV1 and MJPEG\n"); + av_log(enc, AV_LOG_ERROR, "SWF only supports VP6, FLV1 and MJPEG\n"); return -1; } } @@ -361,7 +368,9 @@ static int swf_write_header(AVFormatContext *s) } put_tag(pb, "FWS"); - if ( video_enc && video_enc->codec_id == CODEC_ID_FLV1 ) { + if ( video_enc && video_enc->codec_id == CODEC_ID_VP6F ) { + put_byte(pb, 8); /* version (version 8 and above support VP6 codec) */ + } else if ( video_enc && video_enc->codec_id == CODEC_ID_FLV1 ) { put_byte(pb, 6); /* version (version 6 and above support FLV1 codec) */ } else { put_byte(pb, 4); /* version (should use 4 for mpeg audio support) */ @@ -375,7 +384,8 @@ static int swf_write_header(AVFormatContext *s) put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ /* define a shape with the jpeg inside */ - if ( video_enc && video_enc->codec_id == CODEC_ID_FLV1 ) { + if ( video_enc && (video_enc->codec_id == CODEC_ID_VP6F || + video_enc->codec_id == CODEC_ID_FLV1 )) { } else if ( video_enc && video_enc->codec_id == CODEC_ID_MJPEG ) { put_swf_tag(s, TAG_DEFINESHAPE); @@ -512,7 +522,8 @@ retry_swf_audio_packet: } } - if ( swf->video_type == CODEC_ID_FLV1 ) { + if ( swf->video_type == CODEC_ID_VP6F || + swf->video_type == CODEC_ID_FLV1 ) { if ( swf->video_frame_number == 0 ) { /* create a new video object */ put_swf_tag(s, TAG_VIDEOSTREAM); @@ -521,7 +532,7 @@ retry_swf_audio_packet: put_le16(pb, enc->width); put_le16(pb, enc->height); put_byte(pb, 0); - put_byte(pb, SWF_VIDEO_CODEC_FLV1); + put_byte(pb,codec_get_tag(swf_codec_tags,swf->video_type)); put_swf_end_tag(s); /* place the video object for the first time */ @@ -784,18 +795,20 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_IO; } if ( tag == TAG_VIDEOSTREAM && !vst) { + int codec_id; swf->ch_id = get_le16(pb); get_le16(pb); get_le16(pb); get_le16(pb); get_byte(pb); /* Check for FLV1 */ - if ( get_byte(pb) == SWF_VIDEO_CODEC_FLV1 ) { + codec_id = codec_get_id(swf_codec_tags, get_byte(pb)); + if ( codec_id ) { vst = av_new_stream(s, 0); 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_FLV1; + vst->codec->codec_id = codec_id; if ( swf->samples_per_frame ) { vst->codec->time_base.den = 1000. / swf->ms_per_frame; vst->codec->time_base.num = 1; |