mirror of https://github.com/nu774/fdkaac.git
improve handling of avgBitrate
This commit is contained in:
parent
0c502d30e5
commit
2f6fc566cc
13
src/m4af.c
13
src/m4af.c
|
@ -53,6 +53,7 @@ typedef struct m4af_track_t {
|
|||
uint32_t bufferSizeDB;
|
||||
uint32_t maxBitrate;
|
||||
uint32_t avgBitrate;
|
||||
int is_vbr;
|
||||
|
||||
m4af_sample_entry_t *sample_table;
|
||||
uint32_t num_samples;
|
||||
|
@ -278,6 +279,12 @@ DONE:
|
|||
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)
|
||||
{
|
||||
|
@ -771,11 +778,7 @@ void m4af_write_esds_box(m4af_ctx_t *ctx, uint32_t track_idx)
|
|||
, 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);
|
||||
|
|
|
@ -97,6 +97,8 @@ int m4af_write_sample(m4af_ctx_t *ctx, uint32_t track_idx, const void *data,
|
|||
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);
|
||||
|
||||
|
|
|
@ -738,6 +738,7 @@ int main(int argc, char **argv)
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue