]> iEval git - fdkaac.git/blobdiff - src/main.c
Imported Upstream version 0.6.2
[fdkaac.git] / src / main.c
index 9e104a493cc671eefdc3debc2f949c0479bfab04..6ffb7b197cc6228a6fbc5d18d2f9f5fd0433ac98 100644 (file)
@@ -563,11 +563,20 @@ int encode(aacenc_param_ex_t *params, pcm_reader_t *reader,
             ++encoded;
             if (encoded == 1 || encoded == 3)
                 continue;
-            obp = &obuf[flip];
-            if (write_sample(params->output_fp, m4af, obp) < 0)
+
+            if (write_sample(params->output_fp, m4af, &obuf[flip]) < 0)
                 goto END;
             ++frames_written;
         } while (remaining > 0);
+        /*
+         * When interrupted, we haven't pulled out last extrapolated frames
+         * from the reader. Therefore, we have to write the final outcome.
+         */
+        if (g_interrupted) {
+            if (write_sample(params->output_fp, m4af, &obp[flip^1]) < 0)
+                goto END;
+            ++frames_written;
+        }
     }
 DONE:
     if (!params->silent)
@@ -824,6 +833,7 @@ int main(int argc, char **argv)
         if ((m4af = m4af_create(M4AF_CODEC_MP4A, scale, &m4af_io,
                                 params.output_fp)) < 0)
             goto END;
+        m4af_set_num_channels(m4af, 0, sample_format->channels_per_frame);
         m4af_set_decoder_specific_info(m4af, 0,
                                        aacinfo.confBuf, aacinfo.confSize);
         m4af_set_fixed_frame_duration(m4af, 0, framelen >> scale_shift);
This page took 0.019577 seconds and 4 git commands to generate.