aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/dovi_meta.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-03-23 13:14:04 +0100
committerNiklas Haas <git@haasn.dev>2024-04-03 16:16:25 +0200
commit4f55e16f2bc1b861ecc6ce29f151beac357f181c (patch)
tree22c81c719993c1169a266e0fb10ff7e1dce7b501 /libavutil/dovi_meta.c
parent78076ede2960debdba4e12aca594897ab11e5417 (diff)
downloadffmpeg-4f55e16f2bc1b861ecc6ce29f151beac357f181c.tar.gz
avutil/dovi_meta: add dolby vision extension blocks
As well as accessors plus a function for allocating this struct with extension blocks, Definitions generously taken from quietvoid/dovi_tool, which is assembled as a collection of various patent fragments, as well as output by the official Dolby Vision bitstream verifier tool.
Diffstat (limited to 'libavutil/dovi_meta.c')
-rw-r--r--libavutil/dovi_meta.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/libavutil/dovi_meta.c b/libavutil/dovi_meta.c
index 9c50da561e..dfa4a438ed 100644
--- a/libavutil/dovi_meta.c
+++ b/libavutil/dovi_meta.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "dovi_meta.h"
#include "mem.h"
@@ -39,6 +41,7 @@ typedef struct AVDOVIMetadataInternal {
AVDOVIRpuDataHeader header;
AVDOVIDataMapping mapping;
AVDOVIColorMetadata color;
+ AVDOVIDmData ext_blocks[AV_DOVI_MAX_EXT_BLOCKS];
} AVDOVIMetadataInternal;
AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size)
@@ -51,10 +54,23 @@ AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size)
*size = sizeof(*dovi);
dovi->metadata = (struct AVDOVIMetadata) {
- .header_offset = offsetof(AVDOVIMetadataInternal, header),
- .mapping_offset = offsetof(AVDOVIMetadataInternal, mapping),
- .color_offset = offsetof(AVDOVIMetadataInternal, color),
+ .header_offset = offsetof(AVDOVIMetadataInternal, header),
+ .mapping_offset = offsetof(AVDOVIMetadataInternal, mapping),
+ .color_offset = offsetof(AVDOVIMetadataInternal, color),
+ .ext_block_offset = offsetof(AVDOVIMetadataInternal, ext_blocks),
+ .ext_block_size = sizeof(AVDOVIDmData),
};
return &dovi->metadata;
}
+
+AVDOVIDmData *av_dovi_find_level(const AVDOVIMetadata *data, uint8_t level)
+{
+ for (int i = 0; i < data->num_ext_blocks; i++) {
+ AVDOVIDmData *ext = av_dovi_get_ext(data, i);
+ if (ext->level == level)
+ return ext;
+ }
+
+ return NULL;
+}