" transport layer\n"
"\n"
" -o <filename> Output filename\n"
-" --ignore-length Ignore length of WAV header\n"
+" --ignorelength Ignore length of WAV header\n"
+" -S, --silent Don't print progress messages\n"
"\n"
"Options for raw (headerless) input:\n"
" -R, --raw Treat input as raw (by default WAV is\n"
char *input_filename;
char *output_filename;
unsigned ignore_length;
+ int silent;
int is_raw;
unsigned raw_channels;
{ "adts-crc-check", no_argument, 0, 'C' },
{ "header-period", required_argument, 0, 'P' },
- { "ignore-length", no_argument, 0, 'I' },
+ { "ignorelength", no_argument, 0, 'I' },
+ { "silent", no_argument, 0, 'S' },
{ "raw", no_argument, 0, 'R' },
{ "raw-channels", required_argument, 0, OPT_RAW_CHANNELS },
{ "tempo", required_argument, 0, M4AF_TAG_TEMPO },
{ "tag", required_argument, 0, OPT_SHORT_TAG },
{ "long-tag", required_argument, 0, OPT_LONG_TAG },
+ { 0, 0, 0, 0 },
};
params->afterburner = 1;
aacenc_getmainargs(&argc, &argv);
- while ((ch = getopt_long(argc, argv, "hp:b:m:w:a:Ls:f:CP:Io:R",
+ while ((ch = getopt_long(argc, argv, "hp:b:m:w:a:Ls:f:CP:Io:SR",
long_options, 0)) != EOF) {
switch (ch) {
case 'h':
case 'I':
params->ignore_length = 1;
break;
+ case 'S':
+ params->silent = 1;
+ break;
case 'R':
params->is_raw = 1;
break;
}
*val++ = '\0';
if (ch == OPT_SHORT_TAG) {
+ /*
+ * take care of U+00A9(COPYRIGHT SIGN).
+ * 1) if length of fcc is 3, we prepend '\xa9'.
+ * 2) U+00A9 becomes "\xc2\xa9" in UTF-8. Therefore
+ * we remove first '\xc2'.
+ */
+ if (optarg[0] == '\xc2')
+ ++optarg;
if ((klen = strlen(optarg))== 3)
fcc = 0xa9;
else if (klen != 4) {
static
int encode(wav_reader_t *wavf, HANDLE_AACENCODER encoder,
- uint32_t frame_length, FILE *ofp, m4af_writer_t *m4af)
+ uint32_t frame_length, FILE *ofp, m4af_writer_t *m4af,
+ int show_progress)
{
uint8_t *ibuf = 0;
int16_t *pcmbuf = 0;
goto END;
}
}
- aacenc_progress_update(&progress, wav_get_position(wavf),
- format->sample_rate * 2);
+ if (show_progress)
+ aacenc_progress_update(&progress, wav_get_position(wavf),
+ format->sample_rate * 2);
}
if ((consumed = aac_encode_frame(encoder, format, pcmbuf, nread,
&obuf, &olen, &osize)) < 0)
++frames_written;
}
} while (nread > 0 || olen > 0);
- aacenc_progress_finish(&progress, wav_get_position(wavf));
+
+ if (show_progress)
+ aacenc_progress_finish(&progress, wav_get_position(wavf));
rc = frames_written;
END:
if (ibuf) free(ibuf);
if (!params.transport_format) {
uint32_t scale;
unsigned framelen = aacinfo.frameLength;
- int sbr_mode = aacenc_is_sbr_active((aacenc_param_t*)¶ms);
- int sig_mode = aacEncoder_GetParam(encoder, AACENC_SIGNALING_MODE);
- if (sbr_mode && !sig_mode)
- downsampled_timescale = 1;
+ int sbr_mode = aacenc_is_sbr_active((aacenc_param_t*)¶ms);
+ int sig_mode = aacEncoder_GetParam(encoder, AACENC_SIGNALING_MODE);
+ if (sbr_mode && !sig_mode)
+ downsampled_timescale = 1;
scale = sample_format->sample_rate >> downsampled_timescale;
if ((m4af = m4af_create(M4AF_CODEC_MP4A, scale, &m4af_io, ofp)) < 0)
goto END;
framelen >> downsampled_timescale);
m4af_begin_write(m4af);
}
- frame_count = encode(wavf, encoder, aacinfo.frameLength, ofp, m4af);
+ frame_count = encode(wavf, encoder, aacinfo.frameLength, ofp, m4af,
+ !params.silent);
if (frame_count < 0)
goto END;
if (m4af) {
uint32_t delay = aacinfo.encoderDelay;
- int64_t frames_read = wav_get_position(wavf);
+ int64_t frames_read = wav_get_position(wavf);
uint32_t padding = frame_count * aacinfo.frameLength
- frames_read - aacinfo.encoderDelay;
m4af_set_priming(m4af, 0, delay >> downsampled_timescale,