Skip to content

Commit

Permalink
Fixed compilation warnings with FFmpeg 6.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Jan 1, 2024
1 parent 1bae89a commit 842a483
Showing 1 changed file with 57 additions and 2 deletions.
59 changes: 57 additions & 2 deletions src/core/recording.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,17 +872,19 @@ static BYTE ffmpeg_video_add_stream_format_mpeg1(void) {

ffmpeg_video_mpeg_quality(video);

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102)
// setto il VBV buffer
{
AVCPBProperties *props = NULL;

props = (AVCPBProperties *)av_stream_new_side_data(video->avs, AV_PKT_DATA_CPB_PROPERTIES, sizeof(*props));
props->buffer_size = 7360 * 1024;
props->buffer_size = 224 * 1024;
props->max_bitrate = 0;
props->min_bitrate = 0;
props->avg_bitrate = 0;
props->vbv_delay = UINT64_MAX;
}
#endif

video->avcc->max_b_frames = 1;
video->avcc->mb_decision = 2;
Expand All @@ -892,6 +894,31 @@ static BYTE ffmpeg_video_add_stream_format_mpeg1(void) {
return (EXIT_ERROR);
}

#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 102)
// setto il VBV buffer ma sol odopo il avcodec_parameters_from_context() che avviene nel ffmpeg_stream_open()
{
const AVPacketSideData *sd = av_packet_side_data_get(video->avs->codecpar->coded_side_data,
video->avs->codecpar->nb_coded_side_data, AV_PKT_DATA_CPB_PROPERTIES);
AVCPBProperties *props = NULL;

if (!sd) {
sd = av_packet_side_data_new(&video->avs->codecpar->coded_side_data,
&video->avs->codecpar->nb_coded_side_data, AV_PKT_DATA_CPB_PROPERTIES, sizeof(*props), 0);
props = (AVCPBProperties *)sd->data;
props->buffer_size = 224 * 1024;
props->max_bitrate = 0;
props->min_bitrate = 0;
props->avg_bitrate = 0;
props->vbv_delay = UINT64_MAX;
} else {
props = (AVCPBProperties *)sd->data;
if (!props->buffer_size) {
props->buffer_size = 224 * 1024;
}
}
}
#endif

return (EXIT_OK);
}
static BYTE ffmpeg_video_add_stream_format_mpeg2(void) {
Expand All @@ -906,17 +933,19 @@ static BYTE ffmpeg_video_add_stream_format_mpeg2(void) {

ffmpeg_video_mpeg_quality(video);

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102)
// setto il VBV buffer
{
AVCPBProperties *props = NULL;

props = (AVCPBProperties *)av_stream_new_side_data(video->avs, AV_PKT_DATA_CPB_PROPERTIES, sizeof(*props));
props->buffer_size = 7360 * 1024;
props->buffer_size = 224 * 1024;
props->max_bitrate = 0;
props->min_bitrate = 0;
props->avg_bitrate = 0;
props->vbv_delay = UINT64_MAX;
}
#endif

video->avcc->max_b_frames = 2;
video->avcc->thread_count = FFMIN(8, gui_hardware_concurrency());
Expand All @@ -925,6 +954,32 @@ static BYTE ffmpeg_video_add_stream_format_mpeg2(void) {
return (EXIT_ERROR);
}

#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 102)
// setto il VBV buffer ma sol odopo il avcodec_parameters_from_context() che avviene nel ffmpeg_stream_open()
{
const AVPacketSideData *sd = av_packet_side_data_get(video->avs->codecpar->coded_side_data,
video->avs->codecpar->nb_coded_side_data, AV_PKT_DATA_CPB_PROPERTIES);
AVCPBProperties *props = NULL;

if (!sd) {
sd = av_packet_side_data_new(&video->avs->codecpar->coded_side_data,
&video->avs->codecpar->nb_coded_side_data, AV_PKT_DATA_CPB_PROPERTIES, sizeof(*props), 0);

props = (AVCPBProperties *)sd->data;
props->buffer_size = 224 * 1024;
props->max_bitrate = 0;
props->min_bitrate = 0;
props->avg_bitrate = 0;
props->vbv_delay = UINT64_MAX;
} else {
props = (AVCPBProperties *)sd->data;
if (!props->buffer_size) {
props->buffer_size = 224 * 1024;
}
}
}
#endif

return (EXIT_OK);
}
static BYTE ffmpeg_video_add_stream_format_mp4(void) {
Expand Down

0 comments on commit 842a483

Please sign in to comment.