[FFmpeg-devel] [PATCH] avformat/flvdec: added support for KUX container
swarajhota353 at gmail.com
swarajhota353 at gmail.com
Tue Mar 19 19:11:32 EET 2019
From: Swaraj Hota <swarajhota353 at gmail.com>
Fixes ticket #4519.
---
This is my qualification task for GSoC 2019.
Please suggest any more changes if required.
Signed-off-by: Swaraj Hota <swarajhota353 at gmail.com>
---
Changelog | 1 +
libavformat/allformats.c | 1 +
libavformat/flvdec.c | 38 ++++++++++++++++++++++++++++++++++++++
libavformat/version.h | 4 ++--
4 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/Changelog b/Changelog
index 4d80e5b54f..8ec6b88d66 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version <next>:
- ARBC decoder
- libaribb24 based ARIB STD-B24 caption support (profiles A and C)
- Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
+- KUX demuxer
version 4.1:
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 06844986f3..a7bea4efe2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -210,6 +210,7 @@ extern AVInputFormat ff_ivr_demuxer;
extern AVInputFormat ff_jacosub_demuxer;
extern AVOutputFormat ff_jacosub_muxer;
extern AVInputFormat ff_jv_demuxer;
+extern AVInputFormat ff_kux_demuxer;
extern AVOutputFormat ff_latm_muxer;
extern AVInputFormat ff_lmlm4_demuxer;
extern AVInputFormat ff_loas_demuxer;
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 972e333313..090de3db5c 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -106,6 +106,20 @@ static int live_flv_probe(AVProbeData *p)
return probe(p, 1);
}
+static int kux_probe(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_MAX;
+ }
+ return 0;
+}
+
static void add_keyframes_index(AVFormatContext *s)
{
FLVContext *flv = s->priv_data;
@@ -718,6 +732,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);
@@ -1366,3 +1384,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,
+};
diff --git a/libavformat/version.h b/libavformat/version.h
index 2e83eb4f23..7efc774b7d 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
-#define LIBAVFORMAT_VERSION_MINOR 26
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 27
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
--
2.21.0
More information about the ffmpeg-devel
mailing list