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
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182016-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
182017-03-31 - xxxxxxx - lavu 55.57.100 - spherical.h232017-03-31 - xxxxxxx - lavu 55.57.100 - spherical.h
19 Add av_spherical_projection_name().24 Add av_spherical_projection_name().
20 Add av_spherical_from_name().25 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
772 case AV_FRAME_DATA_SKIP_SAMPLES: return "Skip samples";772 case AV_FRAME_DATA_SKIP_SAMPLES: return "Skip samples";
773 case AV_FRAME_DATA_AUDIO_SERVICE_TYPE: return "Audio service type";773 case AV_FRAME_DATA_AUDIO_SERVICE_TYPE: return "Audio service type";
774 case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";774 case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";
775 case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
775 case AV_FRAME_DATA_GOP_TIMECODE: return "GOP timecode";776 case AV_FRAME_DATA_GOP_TIMECODE: return "GOP timecode";
776 }777 }
777 return NULL;778 return NULL;
libavutil/frame.h+6−0
@@ -127,6 +127,12 @@ enum AVFrameSideDataType { · 126 unmodified lines
127 * libavutil/spherical.h.127 * libavutil/spherical.h.
128 */128 */
129 AV_FRAME_DATA_SPHERICAL,129 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,
130};136};
131 137
132enum AVActiveFormatDescription {138enum AVActiveFormatDescription {
libavutil/mastering_display_metadata.c+23−0
@@ -41,3 +41,26 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFra · 40 unmodified lines
41 41
42 return (AVMasteringDisplayMetadata *)side_data->data;42 return (AVMasteringDisplayMetadata *)side_data->data;
43}43}
44
45AVContentLightMetadata *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
55AVContentLightMetadata *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
86 */86 */
87AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);87AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);
88 88
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 */
98typedef 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 */
117AVContentLightMetadata *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 */
126AVContentLightMetadata *av_content_light_metadata_create_side_data(AVFrame *frame);
127
89#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */128#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5581#define LIBAVUTIL_VERSION_MAJOR 55
82#define LIBAVUTIL_VERSION_MINOR 5982#define LIBAVUTIL_VERSION_MINOR 60
83#define LIBAVUTIL_VERSION_MICRO 10083#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#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