ffmpeg | branch: release/7.0 | James Almer <jamr...@gmail.com> | Thu Jul 18 
18:56:54 2024 -0300| [5fc5b33319902ca151246d40a9853d238cb230ef] | committer: 
James Almer

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 <jamr...@gmail.com>
(cherry picked from commit 54b8d5e201c97464625cfb6cfd851ed80976aa44)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5fc5b33319902ca151246d40a9853d238cb230ef
---

 libavformat/iamf.h        | 2 +-
 libavformat/iamf_parse.c  | 8 ++++----
 libavformat/iamf_writer.c | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/iamf.h b/libavformat/iamf.h
index 68f05c635b..fd8b57a096 100644
--- a/libavformat/iamf.h
+++ b/libavformat/iamf.h
@@ -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;
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index d1511c3470..ce463f00e6 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -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:
diff --git a/libavformat/iamf_writer.c b/libavformat/iamf_writer.c
index 94bfffa95b..c955e1ecaf 100644
--- a/libavformat/iamf_writer.c
+++ b/libavformat/iamf_writer.c
@@ -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:

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to