mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-13 10:37:42 +00:00
[mod_av] Add support for FFmpeg 6.1
This commit is contained in:
parent
0a594435b8
commit
58776f3eed
@ -1557,7 +1557,11 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
||||
}
|
||||
|
||||
avframe->pict_type = AV_PICTURE_TYPE_I;
|
||||
#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_6_V && LIBAVCODEC_VERSION_MINOR >= LIBAVCODEC_61_V)
|
||||
avframe->flags |= AV_FRAME_FLAG_KEY;
|
||||
#else
|
||||
avframe->key_frame = 1;
|
||||
#endif
|
||||
context->last_keyframe_request = switch_time_now();
|
||||
}
|
||||
|
||||
@ -1600,9 +1604,14 @@ GCC_DIAG_ON(deprecated-declarations)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_6_V && LIBAVCODEC_VERSION_MINOR >= LIBAVCODEC_61_V)
|
||||
if (context->need_key_frame && (avframe->flags & AV_FRAME_FLAG_KEY)) {
|
||||
avframe->flags &= ~AV_FRAME_FLAG_KEY;
|
||||
#else
|
||||
if (context->need_key_frame && avframe->key_frame == 1) {
|
||||
avframe->pict_type = 0;
|
||||
avframe->key_frame = 0;
|
||||
#endif
|
||||
avframe->pict_type = 0;
|
||||
context->need_key_frame = 0;
|
||||
}
|
||||
|
||||
|
@ -623,8 +623,13 @@ static switch_status_t add_stream(av_file_context_t *context, MediaStream *mst,
|
||||
c->rc_initial_buffer_occupancy = buffer_bytes * 8;
|
||||
|
||||
if (codec_id == AV_CODEC_ID_H264) {
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_6_V && LIBAVFORMAT_VERSION_MINOR >= LIBAVFORMAT_61_V)
|
||||
GCC_DIAG_OFF(deprecated-declarations)
|
||||
#endif
|
||||
c->ticks_per_frame = 2;
|
||||
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_6_V && LIBAVFORMAT_VERSION_MINOR >= LIBAVFORMAT_61_V)
|
||||
GCC_DIAG_ON(deprecated-declarations)
|
||||
#endif
|
||||
|
||||
c->flags|=AV_CODEC_FLAG_LOOP_FILTER; // flags=+loop
|
||||
c->me_cmp|= 1; // cmp=+chroma, where CHROMA = 1
|
||||
@ -3212,6 +3217,9 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
|
||||
|
||||
if ((c = av_get_codec_context(mst)) && c->time_base.num) {
|
||||
cp = av_stream_get_parser(st);
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_6_V && LIBAVFORMAT_VERSION_MINOR >= LIBAVFORMAT_61_V)
|
||||
GCC_DIAG_OFF(deprecated-declarations)
|
||||
#endif
|
||||
ticks = cp ? cp->repeat_pict + 1 : c->ticks_per_frame;
|
||||
// mst->next_pts += ((int64_t)AV_TIME_BASE * st->codec->time_base.num * ticks) / st->codec->time_base.den;
|
||||
}
|
||||
@ -3221,6 +3229,9 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
|
||||
context->video_start_time, ticks, c ? c->ticks_per_frame : -1, st->time_base.num, st->time_base.den, c ? c->time_base.num : -1, c ? c->time_base.den : -1,
|
||||
st->start_time, st->duration == AV_NOPTS_VALUE ? context->fc->duration / AV_TIME_BASE * 1000 : st->duration, st->nb_frames, av_q2d(st->time_base));
|
||||
}
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR >= LIBAVFORMAT_6_V && LIBAVFORMAT_VERSION_MINOR >= LIBAVFORMAT_61_V)
|
||||
GCC_DIAG_ON(deprecated-declarations)
|
||||
#endif
|
||||
|
||||
again:
|
||||
|
||||
|
@ -40,10 +40,13 @@
|
||||
#ifndef MOD_AV_H
|
||||
#define MOD_AV_H
|
||||
|
||||
#define LIBAVCODEC_V 59
|
||||
#define LIBAVFORMAT_V 59
|
||||
#define LIBAVFORMAT_6_V 60
|
||||
#define LIBAVUTIL_V 57
|
||||
#define LIBAVCODEC_V 59 /* FFmpeg version >= 5.1 */
|
||||
#define LIBAVCODEC_6_V 60 /* FFmpeg version >= 6.0 */
|
||||
#define LIBAVCODEC_61_V 31 /* FFmpeg version >= 6.1 */
|
||||
#define LIBAVFORMAT_V 59 /* FFmpeg version >= 5.1 */
|
||||
#define LIBAVFORMAT_6_V 60 /* FFmpeg version >= 6.0 */
|
||||
#define LIBAVFORMAT_61_V 16 /* FFmpeg version >= 6.1 */
|
||||
#define LIBAVUTIL_V 57 /* FFmpeg version >= 5.1 */
|
||||
|
||||
struct mod_av_globals {
|
||||
int debug;
|
||||
|
Loading…
x
Reference in New Issue
Block a user