diff --git a/libavcodec/utils.c b/libavcodec/utils.c index df4f6e68ae..06b6a1f63b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1857,6 +1857,13 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, frame = extended_frame; } + /* extract audio service type metadata */ + if (frame) { + AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_AUDIO_SERVICE_TYPE); + if (sd && sd->size >= sizeof(enum AVAudioServiceType)) + avctx->audio_service_type = *(enum AVAudioServiceType*)sd->data; + } + /* check for valid frame size */ if (frame) { if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {