mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/iamf: rename Codec Config seek_preroll to audio_roll_distance
The semantics for the field are different than the one in AVCodecParameters, so use the name defined in the IAMF spec to prevent confusion. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
2094f40295
commit
54b8d5e201
|
@ -68,7 +68,7 @@ typedef struct IAMFCodecConfig {
|
|||
enum AVCodecID codec_id;
|
||||
uint32_t codec_tag;
|
||||
unsigned nb_samples;
|
||||
int seek_preroll;
|
||||
int audio_roll_distance;
|
||||
int sample_rate;
|
||||
int extradata_size;
|
||||
uint8_t *extradata;
|
||||
|
|
|
@ -166,7 +166,7 @@ static int codec_config_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
|
|||
uint8_t *buf;
|
||||
enum AVCodecID avcodec_id;
|
||||
unsigned codec_config_id, nb_samples, codec_id;
|
||||
int16_t seek_preroll;
|
||||
int16_t audio_roll_distance;
|
||||
int ret;
|
||||
|
||||
buf = av_malloc(len);
|
||||
|
@ -186,7 +186,7 @@ static int codec_config_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
|
|||
codec_config_id = ffio_read_leb(pbc);
|
||||
codec_id = avio_rb32(pbc);
|
||||
nb_samples = ffio_read_leb(pbc);
|
||||
seek_preroll = avio_rb16(pbc);
|
||||
audio_roll_distance = avio_rb16(pbc);
|
||||
|
||||
switch(codec_id) {
|
||||
case MKBETAG('O','p','u','s'):
|
||||
|
@ -225,7 +225,7 @@ static int codec_config_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
|
|||
codec_config->codec_config_id = codec_config_id;
|
||||
codec_config->codec_id = avcodec_id;
|
||||
codec_config->nb_samples = nb_samples;
|
||||
codec_config->seek_preroll = seek_preroll;
|
||||
codec_config->audio_roll_distance = audio_roll_distance;
|
||||
|
||||
switch(codec_id) {
|
||||
case MKBETAG('O','p','u','s'):
|
||||
|
@ -683,7 +683,7 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
|
|||
substream->codecpar->codec_id = codec_config->codec_id;
|
||||
substream->codecpar->frame_size = codec_config->nb_samples;
|
||||
substream->codecpar->sample_rate = codec_config->sample_rate;
|
||||
substream->codecpar->seek_preroll = -codec_config->seek_preroll * codec_config->nb_samples;
|
||||
substream->codecpar->seek_preroll = -codec_config->audio_roll_distance * codec_config->nb_samples;
|
||||
|
||||
switch(substream->codecpar->codec_id) {
|
||||
case AV_CODEC_ID_AAC:
|
||||
|
|
|
@ -79,10 +79,10 @@ static int populate_audio_roll_distance(IAMFCodecConfig *codec_config)
|
|||
if (!codec_config->nb_samples)
|
||||
return AVERROR(EINVAL);
|
||||
// ceil(3840 / nb_samples)
|
||||
codec_config->seek_preroll = -(1 + ((3840 - 1) / codec_config->nb_samples));
|
||||
codec_config->audio_roll_distance = -(1 + ((3840 - 1) / codec_config->nb_samples));
|
||||
break;
|
||||
case AV_CODEC_ID_AAC:
|
||||
codec_config->seek_preroll = -1;
|
||||
codec_config->audio_roll_distance = -1;
|
||||
break;
|
||||
case AV_CODEC_ID_FLAC:
|
||||
case AV_CODEC_ID_PCM_S16BE:
|
||||
|
@ -91,7 +91,7 @@ static int populate_audio_roll_distance(IAMFCodecConfig *codec_config)
|
|||
case AV_CODEC_ID_PCM_S16LE:
|
||||
case AV_CODEC_ID_PCM_S24LE:
|
||||
case AV_CODEC_ID_PCM_S32LE:
|
||||
codec_config->seek_preroll = 0;
|
||||
codec_config->audio_roll_distance = 0;
|
||||
break;
|
||||
default:
|
||||
return AVERROR(EINVAL);
|
||||
|
@ -455,7 +455,7 @@ static int iamf_write_codec_config(const IAMFContext *iamf,
|
|||
avio_wl32(dyn_bc, codec_config->codec_tag);
|
||||
|
||||
ffio_write_leb(dyn_bc, codec_config->nb_samples);
|
||||
avio_wb16(dyn_bc, codec_config->seek_preroll);
|
||||
avio_wb16(dyn_bc, codec_config->audio_roll_distance);
|
||||
|
||||
switch(codec_config->codec_id) {
|
||||
case AV_CODEC_ID_OPUS:
|
||||
|
|
Loading…
Reference in New Issue