aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-09-21 16:51:13 +0300
committerMartin Storsjö <martin@martin.st>2011-09-23 20:59:48 +0300
commitbafff1668c6bc4d1cb3b7e4b9dac85b8b52e4765 (patch)
tree929e4b7a788c05b502b0db8c536558edca1e8fb2
parente1b1015581afd5c65f4456c29cc0f059c52a5612 (diff)
downloadffmpeg-bafff1668c6bc4d1cb3b7e4b9dac85b8b52e4765.tar.gz
flvdec: Ignore the index if it's from a creator known to be different
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/flvdec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index cafbeb5c4b..569d7343c3 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -140,6 +140,18 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
int64_t *filepositions = NULL;
int ret = AVERROR(ENOSYS);
int64_t initial_pos = avio_tell(ioc);
+ AVDictionaryEntry *creator = av_dict_get(s->metadata, "metadatacreator",
+ NULL, 0);
+
+ if (creator && !strcmp(creator->value, "MEGA")) {
+ /* Files with this metadatacreator tag seem to have filepositions
+ * pointing at the 4 trailer bytes of the previous packet,
+ * which isn't the norm (nor what we expect here, nor what
+ * jwplayer + lighttpd expect, nor what flvtool2 produces).
+ * Just ignore the index in this case, instead of risking trying
+ * to adjust it to something that might or might not work. */
+ return 0;
+ }
while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
int64_t* current_array;