uint32_t bufferSizeDB;
uint32_t maxBitrate;
uint32_t avgBitrate;
+ int is_vbr;
m4af_sample_entry_t *sample_table;
uint32_t num_samples;
return ctx->last_error;
}
+void m4af_set_vbr_mode(m4af_ctx_t *ctx, uint32_t track_idx, int is_vbr)
+{
+ m4af_track_t *track = &ctx->track[track_idx];
+ track->is_vbr = is_vbr;
+}
+
void m4af_set_priming(m4af_ctx_t *ctx, uint32_t track_idx,
uint32_t encoder_delay, uint32_t padding)
{
, 2);
m4af_write24(ctx, track->bufferSizeDB);
m4af_write32(ctx, track->maxBitrate);
-#if 0
- m4af_write32(ctx, track->avgBitrate);
-#else
- m4af_write32(ctx, 0);
-#endif
+ m4af_write32(ctx, track->is_vbr ? 0: track->avgBitrate);
/* DecoderSpecificInfo */
m4af_write_descriptor(ctx, 5, track->decSpecificInfoSize);
m4af_write(ctx, track->decSpecificInfo, track->decSpecificInfoSize);
int m4af_set_decoder_specific_info(m4af_ctx_t *ctx, uint32_t track_idx,
uint8_t *data, uint32_t size);
+void m4af_set_vbr_mode(m4af_ctx_t *ctx, uint32_t track_idx, int is_vbr);
+
void m4af_set_priming(m4af_ctx_t *ctx, uint32_t track_idx,
uint32_t encoder_delay, uint32_t padding);
aacinfo.confSize);
m4af_set_fixed_frame_duration(m4af, 0,
framelen >> downsampled_timescale);
+ m4af_set_vbr_mode(m4af, 0, params.bitrate_mode);
m4af_set_priming_mode(m4af, params.gapless_mode + 1);
m4af_begin_write(m4af);
}