From 59c6178a54c414fd19e064f0077d00b82a1eb812 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 26 Feb 2009 02:29:24 +0000 Subject: Use a shared function to validate FLAC extradata. Originally committed as revision 17602 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/flac.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libavcodec/flac.h') diff --git a/libavcodec/flac.h b/libavcodec/flac.h index 9a4f820831..8af79f2bd8 100644 --- a/libavcodec/flac.h +++ b/libavcodec/flac.h @@ -42,6 +42,11 @@ enum { FLAC_METADATA_TYPE_INVALID = 127 }; +enum FLACExtradataFormat { + FLAC_EXTRADATA_FORMAT_STREAMINFO = 0, + FLAC_EXTRADATA_FORMAT_FULL_HEADER = 1 +}; + /** * Data needed from the Streaminfo header for use by the raw FLAC demuxer * and/or the FLAC decoder. @@ -68,4 +73,15 @@ typedef struct FLACStreaminfo { void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer); +/** + * Validate the FLAC extradata. + * @param[in] avctx codec context containing the extradata. + * @param[out] format extradata format. + * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data. + * @return 1 if valid, 0 if not valid. + */ +int ff_flac_is_extradata_valid(AVCodecContext *avctx, + enum FLACExtradataFormat *format, + uint8_t **streaminfo_start); + #endif /* AVCODEC_FLAC_H */ -- cgit v1.2.3