fix unused variable warning
[fdkaac.git] / src / m4af.c
index 11650f352525271d2f9f631e50283f55b3eae5fc..bdcae5f68912dc81abf7a440dbd02ab6a65e968e 100644 (file)
@@ -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);
@@ -861,17 +864,15 @@ void m4af_write_sbgp_box(m4af_ctx_t *ctx, uint32_t track_idx)
 static
 void m4af_write_sgpd_box(m4af_ctx_t *ctx, uint32_t track_idx)
 {
-    m4af_track_t *track = &ctx->track[track_idx];
     m4af_write(ctx,
-               "\0\0\0\032"  /* size               */
+               "\0\0\0\026"  /* size: 22           */
                "sgpd"        /* type               */
-               "\001"        /* version            */
+               "\0"          /* version            */
                "\0\0\0"      /* flags              */
                "roll"        /* grouping_type      */
-               "\0\0\0\002"  /* default_length: 2  */
                "\0\0\0\001"  /* entry_count: 1     */
                "\377\377"    /* payload_data: -1   */
-               , 26);
+               , 22);
 }
 
 static
@@ -1048,7 +1049,6 @@ void m4af_write_elst_box(m4af_ctx_t *ctx, uint32_t track_idx)
 static
 void m4af_write_edts_box(m4af_ctx_t *ctx, uint32_t track_idx)
 {
-    m4af_track_t *track = &ctx->track[track_idx];
     int64_t pos = m4af_tell(ctx);
     m4af_write(ctx, "\0\0\0\0edts", 8);
     m4af_write_elst_box(ctx, track_idx);
This page took 0.010502 seconds and 4 git commands to generate.