[FFmpeg-devel] [PATCH] avformat/flac_picture: try to guess PNG by actual picture data

Paul B Mahol onemda at gmail.com
Thu Dec 13 21:15:02 EET 2018


Fixes #5028.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/flac_picture.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index 38982b960d..6698d4ea6a 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/avassert.h"
+#include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "flac_picture.h"
 #include "id3v2.h"
@@ -119,6 +120,9 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
         goto fail;
     }
 
+    if (AV_RB64(data->data) == 0x89504e470d0a1a0a)
+        id = AV_CODEC_ID_PNG;
+
     st = avformat_new_stream(s, NULL);
     if (!st) {
         RETURN_ERROR(AVERROR(ENOMEM));
-- 
2.17.1



More information about the ffmpeg-devel mailing list