summaryrefslogtreecommitdiff
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorSwaraj Hota <swarajhota353@gmail.com>2019-04-06 15:53:43 +0200
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-04-06 15:54:38 +0200
commit208ae228fa129041dc6671dcc45c025a11bf2cc6 (patch)
tree526490b16c46afcc5504d8d98cc31d18fc7d1284 /libavformat/flvdec.c
parentf4f40cbb578a09319f9ddafc80388a5556ec7713 (diff)
lavf/flvdec: added support for KUX container
Fixes ticket #4519. The metadata starting at 0xe00004 is encrypted with the password "meta" but zlib does not support decryption, so no kux metadata is read.
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 445d58d8f7..b531a39adc 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -113,6 +113,20 @@ static int live_flv_probe(const AVProbeData *p)
return probe(p, 1);
}
+static int kux_probe(const AVProbeData *p)
+{
+ const uint8_t *d = p->buf;
+
+ if (d[0] == 'K' &&
+ d[1] == 'D' &&
+ d[2] == 'K' &&
+ d[3] == 0 &&
+ d[4] == 0) {
+ return AVPROBE_SCORE_EXTENSION + 1;
+ }
+ return 0;
+}
+
static void add_keyframes_index(AVFormatContext *s)
{
FLVContext *flv = s->priv_data;
@@ -738,6 +752,10 @@ static int flv_read_header(AVFormatContext *s)
int offset;
int pre_tag_size = 0;
+ /* Actual FLV data at 0xe40000 in KUX file */
+ if(!strcmp(s->iformat->name, "kux"))
+ avio_skip(s->pb, 0xe40000);
+
avio_skip(s->pb, 4);
flags = avio_r8(s->pb);
@@ -1386,3 +1404,23 @@ AVInputFormat ff_live_flv_demuxer = {
.priv_class = &live_flv_class,
.flags = AVFMT_TS_DISCONT
};
+
+static const AVClass kux_class = {
+ .class_name = "kuxdec",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVInputFormat ff_kux_demuxer = {
+ .name = "kux",
+ .long_name = NULL_IF_CONFIG_SMALL("KUX (YouKu)"),
+ .priv_data_size = sizeof(FLVContext),
+ .read_probe = kux_probe,
+ .read_header = flv_read_header,
+ .read_packet = flv_read_packet,
+ .read_seek = flv_read_seek,
+ .read_close = flv_read_close,
+ .extensions = "kux",
+ .priv_class = &kux_class,
+};