History

lavu: add support for Content Light Level side metadata

As found in HEVC.

Steve Lhomme committed 9 years ago

Commit b378f5b1 parent 2a512f86 files · +75 −1Browse files

Unified · Split

6 files
  1. doc/APIchanges +5 −0
  2. libavutil/frame.c +1 −0
  3. libavutil/frame.h +6 −0
  4. libavutil/mastering_display_metadata.c +23 −0
  5. libavutil/mastering_display_metadata.h +39 −0
  6. libavutil/version.h +1 −1
doc/APIchanges+5−0
@@ -15,6 +15,11 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2016-04-06 - xxxxxxx - lavu 55.60.100 - mastering_display_metadata.h
19+ Add AV_FRAME_DATA_CONTENT_LIGHT_LEVEL value, av_content_light_metadata_alloc()
20+ and av_content_light_metadata_create_side_data() API, and AVContentLightMetadata
21+ type to export content light level video properties.
22+
1823 2017-03-31 - xxxxxxx - lavu 55.57.100 - spherical.h
1924 Add av_spherical_projection_name().
2025 Add av_spherical_from_name().
libavutil/frame.c+1−0
@@ -772,6 +772,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) · 771 unmodified lines
772772 case AV_FRAME_DATA_SKIP_SAMPLES: return "Skip samples";
773773 case AV_FRAME_DATA_AUDIO_SERVICE_TYPE: return "Audio service type";
774774 case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";
775+ case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
775776 case AV_FRAME_DATA_GOP_TIMECODE: return "GOP timecode";
776777 }
777778 return NULL;
libavutil/frame.h+6−0
@@ -127,6 +127,12 @@ enum AVFrameSideDataType { · 126 unmodified lines
127127 * libavutil/spherical.h.
128128 */
129129 AV_FRAME_DATA_SPHERICAL,
130+
131+ /**
132+ * Content light level (based on CTA-861.3). This payload contains data in
133+ * the form of the AVContentLightMetadata struct.
134+ */
135+ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
130136 };
131137
132138 enum AVActiveFormatDescription {
libavutil/mastering_display_metadata.c+23−0
@@ -41,3 +41,26 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFra · 40 unmodified lines
4141
4242 return (AVMasteringDisplayMetadata *)side_data->data;
4343 }
44+
45+AVContentLightMetadata *av_content_light_metadata_alloc(size_t *size)
46+{
47+ AVContentLightMetadata *metadata = av_mallocz(sizeof(AVContentLightMetadata));
48+
49+ if (size)
50+ *size = sizeof(*metadata);
51+
52+ return metadata;
53+}
54+
55+AVContentLightMetadata *av_content_light_metadata_create_side_data(AVFrame *frame)
56+{
57+ AVFrameSideData *side_data = av_frame_new_side_data(frame,
58+ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
59+ sizeof(AVContentLightMetadata));
60+ if (!side_data)
61+ return NULL;
62+
63+ memset(side_data->data, 0, sizeof(AVContentLightMetadata));
64+
65+ return (AVContentLightMetadata *)side_data->data;
66+}
libavutil/mastering_display_metadata.h+39−0
@@ -86,4 +86,43 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); · 85 unmodified lines
8686 */
8787 AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);
8888
89+/**
90+ * Content light level needed by to transmit HDR over HDMI (CTA-861.3).
91+ *
92+ * To be used as payload of a AVFrameSideData or AVPacketSideData with the
93+ * appropriate type.
94+ *
95+ * @note The struct should be allocated with av_content_light_metadata_alloc()
96+ * and its size is not a part of the public ABI.
97+ */
98+typedef struct AVContentLightMetadata {
99+ /**
100+ * Max content light level (cd/m^2).
101+ */
102+ unsigned MaxCLL;
103+
104+ /**
105+ * Max average light level per frame (cd/m^2).
106+ */
107+ unsigned MaxFALL;
108+} AVContentLightMetadata;
109+
110+/**
111+ * Allocate an AVContentLightMetadata structure and set its fields to
112+ * default values. The resulting struct can be freed using av_freep().
113+ *
114+ * @return An AVContentLightMetadata filled with default values or NULL
115+ * on failure.
116+ */
117+AVContentLightMetadata *av_content_light_metadata_alloc(size_t *size);
118+
119+/**
120+ * Allocate a complete AVContentLightMetadata and add it to the frame.
121+ *
122+ * @param frame The frame which side data is added to.
123+ *
124+ * @return The AVContentLightMetadata structure to be filled by caller.
125+ */
126+AVContentLightMetadata *av_content_light_metadata_create_side_data(AVFrame *frame);
127+
89128 #endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 55
82−#define LIBAVUTIL_VERSION_MINOR 59
82+#define LIBAVUTIL_VERSION_MINOR 60
8383 #define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t