Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Egan <paulegan@mail.com>2008-01-20 21:30:04 +0300
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-01-20 21:30:04 +0300
commitdfb400a8eade1fad66b2af78498ccb7b555ceca3 (patch)
treee2b79964a11f904cda5a19a84dd417207ad3da41 /libavformat
parent76e4864583be6fd03c72a54f1cad42b543922c82 (diff)
new avm2 (flash 9) muxer, patch by Paul Egan, paulegan at mail dot com
Originally committed as revision 11574 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile1
-rw-r--r--libavformat/allformats.c1
-rw-r--r--libavformat/avformat.h4
-rw-r--r--libavformat/swf.c29
4 files changed, 32 insertions, 3 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 903751c803..43f8c27d55 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -29,6 +29,7 @@ OBJS-$(CONFIG_AU_MUXER) += au.o
OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o riff.o
OBJS-$(CONFIG_AVI_MUXER) += avienc.o riff.o
OBJS-$(CONFIG_AVISYNTH) += avisynth.o
+OBJS-$(CONFIG_AVM2_MUXER) += swf.o
OBJS-$(CONFIG_AVS_DEMUXER) += avs.o vocdec.o voc.o
OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o
OBJS-$(CONFIG_C93_DEMUXER) += c93.o vocdec.o voc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index c1575eb3af..4988c6a160 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -148,6 +148,7 @@ void av_register_all(void)
REGISTER_DEMUXER (SOL, sol);
REGISTER_DEMUXER (STR, str);
REGISTER_MUXDEMUX (SWF, swf);
+ REGISTER_MUXER (AVM2, avm2);
REGISTER_MUXER (TG2, tg2);
REGISTER_MUXER (TGP, tgp);
REGISTER_DEMUXER (THP, thp);
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index de622312a9..cb6024500f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -21,8 +21,8 @@
#ifndef FFMPEG_AVFORMAT_H
#define FFMPEG_AVFORMAT_H
-#define LIBAVFORMAT_VERSION_INT ((52<<16)+(4<<8)+0)
-#define LIBAVFORMAT_VERSION 52.4.0
+#define LIBAVFORMAT_VERSION_INT ((52<<16)+(5<<8)+0)
+#define LIBAVFORMAT_VERSION 52.5.0
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
diff --git a/libavformat/swf.c b/libavformat/swf.c
index 087e1c7d7a..405fb6867b 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -40,6 +40,7 @@
#define TAG_STREAMHEAD2 45
#define TAG_VIDEOSTREAM 60
#define TAG_VIDEOFRAME 61
+#define TAG_FILEATTRIBUTES 69
#define TAG_LONG 0x100
@@ -249,6 +250,7 @@ static int swf_write_header(AVFormatContext *s)
PutBitContext p;
uint8_t buf1[256];
int i, width, height, rate, rate_base;
+ int is_avm2;
swf->audio_in_pos = 0;
swf->sound_samples = 0;
@@ -305,8 +307,12 @@ static int swf_write_header(AVFormatContext *s)
swf->samples_per_frame = (audio_enc->sample_rate * rate_base) / rate;
}
+ is_avm2 = !strcmp("avm2", s->oformat->name);
+
put_tag(pb, "FWS");
- if (video_enc && video_enc->codec_id == CODEC_ID_VP6F) {
+ if (is_avm2) {
+ put_byte(pb, 9);
+ } else 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) */
@@ -321,6 +327,13 @@ static int swf_write_header(AVFormatContext *s)
swf->duration_pos = url_ftell(pb);
put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
+ /* avm2/swf v9 (also v8?) files require a file attribute tag */
+ if (is_avm2) {
+ put_swf_tag(s, TAG_FILEATTRIBUTES);
+ put_le32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */
+ put_swf_end_tag(s);
+ }
+
/* define a shape with the jpeg inside */
if (video_enc && (video_enc->codec_id == CODEC_ID_VP6F ||
video_enc->codec_id == CODEC_ID_FLV1)) {
@@ -787,3 +800,17 @@ AVOutputFormat swf_muxer = {
swf_write_trailer,
};
#endif
+#ifdef CONFIG_AVM2_MUXER
+AVOutputFormat avm2_muxer = {
+ "avm2",
+ "Flash 9 (AVM2) format",
+ "application/x-shockwave-flash",
+ "swf",
+ sizeof(SWFContext),
+ CODEC_ID_MP3,
+ CODEC_ID_FLV1,
+ swf_write_header,
+ swf_write_packet,
+ swf_write_trailer,
+};
+#endif