The attached patch allows compilation of comskip against ffmpeg 7
diff -Nru comskip-0.82.009+git20230112.d0cc422+ds.1.orig/mpeg2dec.c comskip-0.82.009+git20230112.d0cc422+ds.1/mpeg2dec.c --- comskip-0.82.009+git20230112.d0cc422+ds.1.orig/mpeg2dec.c 2024-09-13 11:02:56.126573122 -0400 +++ comskip-0.82.009+git20230112.d0cc422+ds.1/mpeg2dec.c 2024-09-13 11:45:21.052285653 -0400 @@ -560,7 +560,7 @@ { if (format == AV_SAMPLE_FMT_FLTP) { - for (l=0;l < is->audio_st->codecpar->channels;l++ ) + for (l=0;l < is->audio_st->codecpar->ch_layout.nb_channels;l++ ) { fb[l] = (float*)b[l]; } @@ -568,16 +568,16 @@ { volume = 0; if (planar) - for (l=0;l < is->audio_st->codecpar->channels;l++ ) volume += *((fb[l])++) * 64000; + for (l=0;l < is->audio_st->codecpar->ch_layout.nb_channels;l++ ) volume += *((fb[l])++) * 64000; else - for (l=0;l < is->audio_st->codecpar->channels;l++ ) volume += *((fb[0])++) * 64000; - *audio_buffer_ptr++ = volume / is->audio_st->codecpar->channels; - avg_volume += abs(volume / is->audio_st->codecpar->channels); + for (l=0;l < is->audio_st->codecpar->ch_layout.nb_channels;l++ ) volume += *((fb[0])++) * 64000; + *audio_buffer_ptr++ = volume / is->audio_st->codecpar->ch_layout.nb_channels; + avg_volume += abs(volume / is->audio_st->codecpar->ch_layout.nb_channels); } } else { - for (l=0;l < is->audio_st->codecpar->channels;l++ ) + for (l=0;l < is->audio_st->codecpar->ch_layout.nb_channels;l++ ) { sb[l] = (short*)b[l]; } @@ -585,11 +585,11 @@ { volume = 0; if (planar) - for (l=0;l < is->audio_st->codecpar->channels;l++ ) volume += *((sb[l])++); + for (l=0;l < is->audio_st->codecpar->ch_layout.nb_channels;l++ ) volume += *((sb[l])++); else - for (l=0;l < is->audio_st->codecpar->channels;l++ ) volume += *((sb[0])++); - *audio_buffer_ptr++ = volume / is->audio_st->codecpar->channels; - avg_volume += abs(volume / is->audio_st->codecpar->channels); + for (l=0;l < is->audio_st->codecpar->ch_layout.nb_channels;l++ ) volume += *((sb[0])++); + *audio_buffer_ptr++ = volume / is->audio_st->codecpar->ch_layout.nb_channels; + avg_volume += abs(volume / is->audio_st->codecpar->ch_layout.nb_channels); } } } @@ -766,15 +766,15 @@ - data_size = av_samples_get_buffer_size(NULL, is->frame->channels, + data_size = av_samples_get_buffer_size(NULL, is->frame->ch_layout.nb_channels, is->frame->nb_samples, is->frame->format, 1); if (data_size > 0) { - sound_to_frames(is, (short **)is->frame->data, is->frame->nb_samples ,is->frame->channels, is->frame->format); + sound_to_frames(is, (short **)is->frame->data, is->frame->nb_samples ,is->frame->ch_layout.nb_channels, is->frame->format); } is->audio_clock += (double)data_size / - (is->frame->channels * is->frame->sample_rate * av_get_bytes_per_sample(is->frame->format)); + (is->frame->ch_layout.nb_channels * is->frame->sample_rate * av_get_bytes_per_sample(is->frame->format)); av_frame_unref(is->frame); } @@ -1029,12 +1029,8 @@ if(ret < 0) { char *error_text; - if (is->pFormatCtx->iformat->read_seek) - { - error_text = "Format specific"; - } - else if(is->pFormatCtx->iformat->read_timestamp) - { + if (is->pFormatCtx->iformat->flags & AVFMT_NOTIMESTAMPS) + { error_text = "Frame binary"; } else