avformat/iamf_writer: constify some variables

Signed-off-by: James Almer <jamrial@gmail.com>
release/7.0
James Almer 8 months ago
parent 988e3a061a
commit 79c6ba9007
  1. 21
      libavformat/iamf_writer.c

@ -277,7 +277,7 @@ int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void
if (iamf_audio_element->demixing_info) { if (iamf_audio_element->demixing_info) {
AVIAMFParamDefinition *param = iamf_audio_element->demixing_info; AVIAMFParamDefinition *param = iamf_audio_element->demixing_info;
IAMFParamDefinition *param_definition = ff_iamf_get_param_definition(iamf, param->parameter_id); const IAMFParamDefinition *param_definition = ff_iamf_get_param_definition(iamf, param->parameter_id);
if (param->nb_subblocks != 1) { if (param->nb_subblocks != 1) {
av_log(log_ctx, AV_LOG_ERROR, "nb_subblocks in demixing_info for stream group %u is not 1\n", stg->index); av_log(log_ctx, AV_LOG_ERROR, "nb_subblocks in demixing_info for stream group %u is not 1\n", stg->index);
@ -293,7 +293,7 @@ int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void
} }
if (iamf_audio_element->recon_gain_info) { if (iamf_audio_element->recon_gain_info) {
AVIAMFParamDefinition *param = iamf_audio_element->recon_gain_info; AVIAMFParamDefinition *param = iamf_audio_element->recon_gain_info;
IAMFParamDefinition *param_definition = ff_iamf_get_param_definition(iamf, param->parameter_id); const IAMFParamDefinition *param_definition = ff_iamf_get_param_definition(iamf, param->parameter_id);
if (param->nb_subblocks != 1) { if (param->nb_subblocks != 1) {
av_log(log_ctx, AV_LOG_ERROR, "nb_subblocks in recon_gain_info for stream group %u is not 1\n", stg->index); av_log(log_ctx, AV_LOG_ERROR, "nb_subblocks in recon_gain_info for stream group %u is not 1\n", stg->index);
@ -495,7 +495,7 @@ static int scalable_channel_layout_config(const IAMFAudioElement *audio_element,
flush_put_bits(&pb); flush_put_bits(&pb);
avio_write(dyn_bc, header, put_bytes_count(&pb, 1)); avio_write(dyn_bc, header, put_bytes_count(&pb, 1));
for (int i = 0; i < element->nb_layers; i++) { for (int i = 0; i < element->nb_layers; i++) {
AVIAMFLayer *layer = element->layers[i]; const AVIAMFLayer *layer = element->layers[i];
int layout; int layout;
for (layout = 0; layout < FF_ARRAY_ELEMS(ff_iamf_scalable_ch_layouts); layout++) { for (layout = 0; layout < FF_ARRAY_ELEMS(ff_iamf_scalable_ch_layouts); layout++) {
if (!av_channel_layout_compare(&layer->ch_layout, &ff_iamf_scalable_ch_layouts[layout])) if (!av_channel_layout_compare(&layer->ch_layout, &ff_iamf_scalable_ch_layouts[layout]))
@ -524,7 +524,7 @@ static int ambisonics_config(const IAMFAudioElement *audio_element,
AVIOContext *dyn_bc) AVIOContext *dyn_bc)
{ {
const AVIAMFAudioElement *element = audio_element->celement; const AVIAMFAudioElement *element = audio_element->celement;
AVIAMFLayer *layer = element->layers[0]; const AVIAMFLayer *layer = element->layers[0];
ffio_write_leb(dyn_bc, 0); // ambisonics_mode ffio_write_leb(dyn_bc, 0); // ambisonics_mode
ffio_write_leb(dyn_bc, layer->ch_layout.nb_channels); // output_channel_count ffio_write_leb(dyn_bc, layer->ch_layout.nb_channels); // output_channel_count
@ -857,7 +857,7 @@ static int write_parameter_block(const IAMFContext *iamf, AVIOContext *pb,
const AVIAMFParamDefinition *param, void *log_ctx) const AVIAMFParamDefinition *param, void *log_ctx)
{ {
uint8_t header[MAX_IAMF_OBU_HEADER_SIZE]; uint8_t header[MAX_IAMF_OBU_HEADER_SIZE];
IAMFParamDefinition *param_definition = ff_iamf_get_param_definition(iamf, param->parameter_id); const IAMFParamDefinition *param_definition = ff_iamf_get_param_definition(iamf, param->parameter_id);
PutBitContext pbc; PutBitContext pbc;
AVIOContext *dyn_bc; AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL; uint8_t *dyn_buf = NULL;
@ -1034,7 +1034,8 @@ int ff_iamf_write_audio_frame(const IAMFContext *iamf, AVIOContext *pb,
uint8_t header[MAX_IAMF_OBU_HEADER_SIZE]; uint8_t header[MAX_IAMF_OBU_HEADER_SIZE];
PutBitContext pbc; PutBitContext pbc;
AVIOContext *dyn_bc; AVIOContext *dyn_bc;
uint8_t *side_data, *dyn_buf = NULL; const uint8_t *side_data;
uint8_t *dyn_buf = NULL;
unsigned int skip_samples = 0, discard_padding = 0; unsigned int skip_samples = 0, discard_padding = 0;
size_t side_data_size; size_t side_data_size;
int dyn_size, type = audio_substream_id <= 17 ? int dyn_size, type = audio_substream_id <= 17 ?
@ -1042,12 +1043,12 @@ int ff_iamf_write_audio_frame(const IAMFContext *iamf, AVIOContext *pb,
int ret; int ret;
if (!pkt->size) { if (!pkt->size) {
IAMFAudioElement *audio_element; const IAMFAudioElement *audio_element;
IAMFCodecConfig *codec_config; IAMFCodecConfig *codec_config;
size_t new_extradata_size; size_t new_extradata_size;
uint8_t *new_extradata = av_packet_get_side_data(pkt, const uint8_t *new_extradata = av_packet_get_side_data(pkt,
AV_PKT_DATA_NEW_EXTRADATA, AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size); &new_extradata_size);
if (!new_extradata) if (!new_extradata)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;

Loading…
Cancel
Save