Skip to content

Fixes for mod_av related to signalwire/freeswitch#2202 #2681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Korynkai
Copy link

This is refactored from the patch listed in #2202 to guard against the exact library versions these changes occurred at.
The changes are as follows:

  • AVOutputFormat::priv_data_size is marked private and no longer exists in the public API as of FFMPEG 6.0, but found hidden in AVOutputFormat as part of FFOutputFormat.
  • AVCodecContext::ticks_per_frame was deprecated as of FFMPEG 6.1.
  • libavcodec notes 'do not use avcodec_close()' as of FFMPEG 3.1, use avcodec_free_context() instead.
  • AVFrame::key_frame was deprecated as of FFMPEG 6.1, use AVFrame::flags instead.
  • AVInputFormat::read_seek and AVInputFormat::read_seek2 no longer exists as of FFMPEG 7.0. This seems to only be used for logging purposes, so guard this functionality accordingly.

AVOutputFormat::priv_data_size is marked private and no longer exists in the public API as of FFMPEG 6.0, but found hidden in AVOutputFormat as part of FFOutputFormat.
AVCodecContext::ticks_per_frame was deprecated as of FFMPEG 6.1.
libavcodec notes 'do not use avcodec_close()' as of FFMPEG 3.1, use avcodec_free_context() instead.
AVFrame::key_frame was deprecated as of FFMPEG 6.1, use AVFrame::flags instead.
AVInputFormat::read_seek and AVInputFormat::read_seek2 no longer exists as of FFMPEG 7.0. This seems to only be used for logging purposes, so guard this functionality accordingly.
@arduent
Copy link

arduent commented Apr 30, 2025

This seems to work for me with FFMpeg 7, but also need a few other changes i think.. (but also make sure it works with old versions of FFMpeg too, i suppose...

# ffmpeg -version
ffmpeg version N-119396-g48c0dba23b Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 12 (Debian 12.2.0-14)
libavutil      60.  2.100 / 60.  2.100
libavcodec     62.  1.102 / 62.  1.102
libavformat    62.  0.102 / 62.  0.102
libavdevice    62.  0.100 / 62.  0.100
libavfilter    11.  0.100 / 11.  0.100
libswscale      9.  0.100 /  9.  0.100
libswresample   6.  0.100 /  6.  0.100
libpostproc    59.  1.100 / 59.  1.100

add_stream() around line 525 in src/mod/applications/mod_av/avformat.c

add_stream(arg,arg,arg,arg,,,,) {

const enum AVSampleFormat *sample_fmts;
int ret;

...etc...
c = av_get_codec_context(mst);

ret = avcodec_get_supported_config(c, *codec, AV_CODEC_CONFIG_SAMPLE_FORMAT,
                                                0, (const void **) &sample_fmts, NULL);
if (ret<0) {
	return status; //no sample formats!
}

/* i suppose we want sample_fmts[0] but maybe this 
    needs re-worked.. ie not return if ret<0... in this case 
    c->sample_fmt will never be set to AV_SAMPLE_FMT_FLTP
*/
switch ((*codec)->type) {
		case AVMEDIA_TYPE_AUDIO:
			c->sample_fmt  = sample_fmts ? sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
			c->bit_rate    = 128000;
			
			...

also need to change some constants in avcodec.c:

src/mod/applications/mod_av/avcodec.c

FF_PROFILE_H264_BASELINE becomes AV_PROFILE_H264_BASELINE
FF_PROFILE_H264_MAIN becomes AV_PROFILE_H264_MAIN
FF_PROFILE_H264_HIGH becomes AV_PROFILE_H264_HIGH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants