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

James Almer jamrial at gmail.com
Thu Dec 13 21:52:53 EET 2018


On 12/13/2018 4:15 PM, Paul B Mahol wrote:
> 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)

Include libavcodec/png.h and use PNGSIG instead?

> +        id = AV_CODEC_ID_PNG;
> +
>      st = avformat_new_stream(s, NULL);
>      if (!st) {
>          RETURN_ERROR(AVERROR(ENOMEM));
> 



More information about the ffmpeg-devel mailing list