summaryrefslogtreecommitdiff
path: root/libavcodec/flac.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-28 12:33:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-28 12:33:49 +0200
commit40beec6a431d5590aa42e5e5e3c10fe9a16fc9ed (patch)
treeca643d04291fcbfc5e857007a86a03463462f836 /libavcodec/flac.h
parent61301ca7860fb044995c71a0cd432cb3d833eb3b (diff)
parent5fdaf312c5541b77b6364db8b49d6abb416a25c0 (diff)
Merge commit '5fdaf312c5541b77b6364db8b49d6abb416a25c0'
* commit '5fdaf312c5541b77b6364db8b49d6abb416a25c0': flac: make avpriv_flac_parse_block_header() inline Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flac.h')
-rw-r--r--libavcodec/flac.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/libavcodec/flac.h b/libavcodec/flac.h
index 13e863b87e..b4f28cfcbd 100644
--- a/libavcodec/flac.h
+++ b/libavcodec/flac.h
@@ -28,6 +28,7 @@
#define AVCODEC_FLAC_H
#include "avcodec.h"
+#include "bytestream.h"
#include "get_bits.h"
#define FLAC_STREAMINFO_SIZE 34
@@ -109,15 +110,10 @@ int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
enum FLACExtradataFormat *format,
uint8_t **streaminfo_start);
-/**
- * Parse the metadata block parameters from the header.
- * @param[in] block_header header data, at least 4 bytes
- * @param[out] last indicator for last metadata block
- * @param[out] type metadata block type
- * @param[out] size metadata block size
- */
+#if LIBAVCODEC_VERSION_MAJOR < 56
void avpriv_flac_parse_block_header(const uint8_t *block_header,
int *last, int *type, int *size);
+#endif
/**
* Calculate an estimate for the maximum frame size based on verbatim mode.
@@ -140,4 +136,23 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
void ff_flac_set_channel_layout(AVCodecContext *avctx);
+/**
+ * Parse the metadata block parameters from the header.
+ * @param[in] block_header header data, at least 4 bytes
+ * @param[out] last indicator for last metadata block
+ * @param[out] type metadata block type
+ * @param[out] size metadata block size
+ */
+static av_always_inline void flac_parse_block_header(const uint8_t *block_header,
+ int *last, int *type, int *size)
+{
+ int tmp = bytestream_get_byte(&block_header);
+ if (last)
+ *last = tmp & 0x80;
+ if (type)
+ *type = tmp & 0x7F;
+ if (size)
+ *size = bytestream_get_be24(&block_header);
+}
+
#endif /* AVCODEC_FLAC_H */