summaryrefslogtreecommitdiff
path: root/libavformat/swfdec.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2020-10-07 22:21:27 +0200
committerMarton Balint <cus@passwd.hu>2021-01-23 20:10:05 +0100
commitdaac7f4d9cbbaa85abc37d3e079dd23e531a709b (patch)
treebdc0b33e5d0e9da0d7aac080258a95c7238825da /libavformat/swfdec.c
parent8d5f2a005d46f67f5d4e0b2da6c728b91ccdec3e (diff)
downloadffmpeg-daac7f4d9cbbaa85abc37d3e079dd23e531a709b.tar.gz
avformat/swf: add support for reading and writing VP6A and Flash Screen Video codecs
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/swfdec.c')
-rw-r--r--libavformat/swfdec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 1463f0ad4d..9416187803 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -33,6 +33,7 @@
#include "libavutil/intreadwrite.h"
#include "libavcodec/get_bits.h"
#include "swf.h"
+#include "flv.h"
typedef struct SWFDecContext {
int samples_per_frame;
@@ -307,15 +308,24 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for(i=0; i<s->nb_streams; i++) {
st = s->streams[i];
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
+ int pkt_flags = 0;
frame = avio_rl16(pb);
len -= 2;
if (len <= 0)
goto skip;
+ if (st->codecpar->codec_id == AV_CODEC_ID_FLASHSV) {
+ unsigned flags = avio_r8(pb);
+ len--;
+ if (len <= 0)
+ goto skip;
+ pkt_flags |= (flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ? AV_PKT_FLAG_KEY : 0;
+ }
if ((res = av_get_packet(pb, pkt, len)) < 0)
return res;
pkt->pos = pos;
pkt->pts = frame;
pkt->stream_index = st->index;
+ pkt->flags |= pkt_flags;
return pkt->size;
}
}