]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flac.h
configure: Die if gas is unavailable under aarch64 as well as ARM
[ffmpeg] / libavcodec / flac.h
index 6ec8a3752de87fc2149b8bf11b0a307fbc96c42a..fbd34a18b19a96506541feffdbcdb7793b423351 100644 (file)
@@ -28,6 +28,7 @@
 #define AVCODEC_FLAC_H
 
 #include "avcodec.h"
+#include "bytestream.h"
 #include "get_bits.h"
 
 #define FLAC_STREAMINFO_SIZE   34
 #define FLAC_MIN_FRAME_SIZE    11
 
 enum {
-    FLAC_CHMODE_INDEPENDENT =  0,
-    FLAC_CHMODE_LEFT_SIDE   =  8,
-    FLAC_CHMODE_RIGHT_SIDE  =  9,
-    FLAC_CHMODE_MID_SIDE    = 10,
+    FLAC_CHMODE_INDEPENDENT = 0,
+    FLAC_CHMODE_LEFT_SIDE   = 1,
+    FLAC_CHMODE_RIGHT_SIDE  = 2,
+    FLAC_CHMODE_MID_SIDE    = 3,
 };
 
 enum {
@@ -95,8 +96,8 @@ typedef struct FLACFrameInfo {
  * @param[out] s       where parsed information is stored
  * @param[in]  buffer  pointer to start of 34-byte streaminfo data
  */
-void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
-                              const uint8_t *buffer);
+void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
+                                  const uint8_t *buffer);
 
 /**
  * Validate the FLAC extradata.
@@ -105,19 +106,14 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
  * @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);
+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
- */
-void ff_flac_parse_block_header(const uint8_t *block_header,
-                                int *last, int *type, int *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.
@@ -137,4 +133,26 @@ int ff_flac_get_max_frame_size(int blocksize, int ch, int bps);
  */
 int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
                                 FLACFrameInfo *fi, int log_level_offset);
+
+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 */