mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-06 06:50:43 +09:00
Comment out vulkan includes for now
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <xf86drm.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
//#include <vulkan/vulkan.h>
|
||||
|
||||
#define MAX_PHYSICAL_DEVICES 32
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/hwcontext_vaapi.h>
|
||||
#include <libavutil/intreadwrite.h>
|
||||
|
||||
#include <va/va_drmcommon.h>
|
||||
|
||||
@@ -168,8 +169,28 @@ static bool gsr_video_encoder_vaapi_start(gsr_video_encoder *encoder, AVCodecCon
|
||||
}
|
||||
}
|
||||
|
||||
if(video_codec_context->width != frame->width || video_codec_context->height != frame->height) {
|
||||
const int crop_top = (video_codec_context->height - frame->height) / 2;
|
||||
const int crop_left = (video_codec_context->width - frame->width) / 2;
|
||||
if(crop_top != 0 || crop_left != 0) {
|
||||
fprintf(stderr, "gsr warning: gsr_video_encoder_vaapi_start: black bars have been added to the video because of a bug in AMD drivers/hardware. Record with h264 codec instead (-k h264) to get around this issue\n");
|
||||
#if 0
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 10, 100)
|
||||
const int crop_bottom = crop_top;
|
||||
const int crop_right = crop_left;
|
||||
fprintf(stderr, "gsr info: cropping metadata has been added to the file to try and workaround this issue. Video players that support this will remove the black bars when the video is playing\n");
|
||||
const int frame_cropping_data_size = 4 * sizeof(uint32_t);
|
||||
uint8_t *frame_cropping = av_malloc(frame_cropping_data_size);
|
||||
if(frame_cropping) {
|
||||
AV_WL32(frame_cropping + 0, crop_top);
|
||||
AV_WL32(frame_cropping + 4, crop_bottom);
|
||||
AV_WL32(frame_cropping + 8, crop_left);
|
||||
AV_WL32(frame_cropping + 12, crop_right);
|
||||
const bool sidedata_added = av_packet_side_data_add(&video_stream->codecpar->coded_side_data, &video_stream->codecpar->nb_coded_side_data, AV_PKT_DATA_FRAME_CROPPING, frame_cropping, frame_cropping_data_size, 0) != NULL;
|
||||
if(!sidedata_added)
|
||||
av_free(frame_cropping);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
frame->width = video_codec_context->width;
|
||||
|
||||
15
src/main.cpp
15
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user