aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_levels.h
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-09-18 23:30:57 +0100
committerMark Thompson <sw@jkqxz.net>2018-09-23 14:42:34 +0100
commitcc549149d3bcb653976193eb56aedb3589e7347e (patch)
tree22934d63c6a1fb09f6fbdfbc8e3e2560f291fd32 /libavcodec/h264_levels.h
parent40724026b7055c9951b579393e2c4178598f1194 (diff)
downloadffmpeg-cc549149d3bcb653976193eb56aedb3589e7347e.tar.gz
lavc/h264: Add common code for level handling
Including a unit test.
Diffstat (limited to 'libavcodec/h264_levels.h')
-rw-r--r--libavcodec/h264_levels.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/libavcodec/h264_levels.h b/libavcodec/h264_levels.h
new file mode 100644
index 0000000000..4189fc61c2
--- /dev/null
+++ b/libavcodec/h264_levels.h
@@ -0,0 +1,53 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_H264_LEVELS_H
+#define AVCODEC_H264_LEVELS_H
+
+
+#include <stdint.h>
+
+typedef struct H264LevelDescriptor {
+ const char *name;
+ uint8_t level_idc;
+ uint8_t constraint_set3_flag;
+ uint32_t max_mbps;
+ uint32_t max_fs;
+ uint32_t max_dpb_mbs;
+ uint32_t max_br;
+ uint32_t max_cpb;
+ uint16_t max_v_mv_r;
+ uint8_t min_cr;
+ uint8_t max_mvs_per_2mb;
+} H264LevelDescriptor;
+
+const H264LevelDescriptor *ff_h264_get_level(int level_idc,
+ int constraint_set3_flag);
+
+/**
+ * Guess the level of a stream from some parameters.
+ *
+ * Unknown parameters may be zero, in which case they are ignored.
+ */
+const H264LevelDescriptor *ff_h264_guess_level(int profile_idc,
+ int64_t bitrate,
+ int width, int height,
+ int max_dec_frame_buffering);
+
+
+#endif /* AVCODEC_H264_LEVELS_H */