X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=src%2Fmain.c;h=e97c6118c9e013c93577c5434606a766e2bbb7cc;hb=7b1f2136183f13cfdc83cc387134688ad07325f5;hp=4ee94871aa99cce8ad07e30d3572f8a46f0dd36b;hpb=c5c459082afba4fe4350851c7ac3774f80c0ee56;p=fdkaac.git diff --git a/src/main.c b/src/main.c index 4ee9487..e97c611 100644 --- a/src/main.c +++ b/src/main.c @@ -108,7 +108,7 @@ PROGNAME " %s\n" " transport layer\n" "\n" " -o Output filename\n" -" --ignore-length Ignore length of WAV header\n" +" --ignorelength Ignore length of WAV header\n" "\n" "Options for raw (headerless) input:\n" " -R, --raw Treat input as raw (by default WAV is\n" @@ -212,7 +212,7 @@ int parse_options(int argc, char **argv, aacenc_param_ex_t *params) { "adts-crc-check", no_argument, 0, 'C' }, { "header-period", required_argument, 0, 'P' }, - { "ignore-length", no_argument, 0, 'I' }, + { "ignorelength", no_argument, 0, 'I' }, { "raw", no_argument, 0, 'R' }, { "raw-channels", required_argument, 0, OPT_RAW_CHANNELS }, @@ -233,6 +233,7 @@ int parse_options(int argc, char **argv, aacenc_param_ex_t *params) { "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; @@ -357,6 +358,14 @@ int parse_options(int argc, char **argv, aacenc_param_ex_t *params) } *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) { @@ -470,7 +479,7 @@ END: } static -int put_tag_entry(m4af_writer_t *m4af, const aacenc_tag_entry_t *tag) +void put_tag_entry(m4af_writer_t *m4af, const aacenc_tag_entry_t *tag) { unsigned m, n = 0; @@ -567,6 +576,7 @@ int put_tag_entry(m4af_writer_t *m4af, const aacenc_tag_entry_t *tag) case M4AF_FOURCC('t','v','e','n'): case M4AF_FOURCC('t','v','n','n'): case M4AF_FOURCC('t','v','s','h'): + case M4AF_FOURCC('x','i','d',' '): case M4AF_FOURCC('\xa9','e','n','c'): case M4AF_FOURCC('\xa9','s','t','3'): { @@ -628,17 +638,6 @@ int finalize_m4a(m4af_writer_t *m4af, const aacenc_param_ex_t *params, return 0; } -static -const char *basename(const char *filename) -{ - char *p = strrchr(filename, '/'); -#ifdef _WIN32 - char *q = strrchr(filename, '\\'); - if (p < q) p = q; -#endif - return p ? p + 1 : filename; -} - static char *generate_output_filename(const char *filename, const char *ext) { @@ -649,7 +648,7 @@ char *generate_output_filename(const char *filename, const char *ext) p = malloc(ext_len + 6); sprintf(p, "stdin%s", ext); } else { - const char *base = basename(filename); + const char *base = aacenc_basename(filename); size_t ilen = strlen(base); const char *ext_org = strrchr(base, '.'); if (ext_org) ilen = ext_org - base; @@ -771,10 +770,10 @@ int main(int argc, char **argv) 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; @@ -788,7 +787,7 @@ int main(int argc, char **argv) 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,