aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-10-01 23:10:20 +0200
committerdec05eba <dec05eba@protonmail.com>2024-10-01 23:10:20 +0200
commit07a843747c8a1885c0783c3234a145d7e3c5f56e (patch)
tree65e5ef421f9d2947bbec152119d61a1f7f7c5531 /src/main.cpp
parent4f709f0fa62068639102ab98775e06947d05459e (diff)
Comment out vulkan includes for now
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ff44763..d699648 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1349,17 +1349,24 @@ static bool add_hdr_metadata_to_video_stream(gsr_capture *cap, AVStream *video_s
// TODO: More error checking
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102)
- av_stream_add_side_data(video_stream, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, (uint8_t*)light_metadata, light_metadata_size);
+ const bool content_light_level_added = av_stream_add_side_data(video_stream, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, (uint8_t*)light_metadata, light_metadata_size) == 0;
#else
- av_packet_side_data_add(&video_stream->codecpar->coded_side_data, &video_stream->codecpar->nb_coded_side_data, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, light_metadata, light_metadata_size, 0);
+ const bool content_light_level_added = av_packet_side_data_add(&video_stream->codecpar->coded_side_data, &video_stream->codecpar->nb_coded_side_data, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, light_metadata, light_metadata_size, 0) != NULL;
#endif
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102)
- av_stream_add_side_data(video_stream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, (uint8_t*)mastering_display_metadata, mastering_display_metadata_size);
+ const bool mastering_display_metadata_added = av_stream_add_side_data(video_stream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, (uint8_t*)mastering_display_metadata, mastering_display_metadata_size) == 0;
#else
- av_packet_side_data_add(&video_stream->codecpar->coded_side_data, &video_stream->codecpar->nb_coded_side_data, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, mastering_display_metadata, mastering_display_metadata_size, 0);
+ const bool mastering_display_metadata_added = av_packet_side_data_add(&video_stream->codecpar->coded_side_data, &video_stream->codecpar->nb_coded_side_data, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, mastering_display_metadata, mastering_display_metadata_size, 0) != NULL;
#endif
+ if(!content_light_level_added)
+ av_freep(light_metadata);
+
+ if(!mastering_display_metadata_added)
+ av_freep(mastering_display_metadata);
+
+ // Return true even on failure because we dont want to retry adding hdr metadata on failure
return true;
}