1
0
mirror of https://github.com/nu774/fdkaac.git synced 2025-06-05 23:29:14 +02:00

5 Commits

Author SHA1 Message Date
cdfb81d7c6 bump 2022-07-13 20:59:03 +09:00
4ec1422bd9 wav/caf parser: ensure fmt/desc chunk
fixes https://github.com/nu774/fdkaac/issues/52
2022-07-13 20:56:49 +09:00
53fe239bf6 vcxproj: support Visual Studio 2022 2021-11-15 01:18:51 +09:00
347e995cfc bump 2021-04-23 22:57:27 +09:00
9d65d3b3bf m4af: fix mvhd/tkhd duration
According to 14496-12, duration of mvhd/tkhd shall be the sum of
duration of edits
2021-04-23 22:53:46 +09:00
5 changed files with 17 additions and 8 deletions

View File

@ -24,6 +24,7 @@
<RootNamespace>fdkaac</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(MSBuildToolsVersion)' == '17.0'">v143</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(MSBuildToolsVersion)' == '16.0'">v142</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(MSBuildToolsVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(MSBuildToolsVersion)' == '14.0'">v140_xp</PlatformToolset>

View File

@ -172,6 +172,7 @@ int caf_parse(caf_reader_t *reader, int64_t *data_length)
{
uint32_t fcc;
int64_t chunk_size;
int desc_seen = 0;
*data_length = 0;
@ -181,9 +182,10 @@ int caf_parse(caf_reader_t *reader, int64_t *data_length)
TRY_IO(pcm_skip(&reader->io, 4)); /* mFileVersion, mFileFlags */
while ((fcc = caf_next_chunk(reader, &chunk_size)) != 0) {
if (fcc == M4AF_FOURCC('d','e','s','c'))
if (fcc == M4AF_FOURCC('d','e','s','c')) {
desc_seen = 1;
TRY_IO(caf_desc(reader, chunk_size));
else if (fcc == M4AF_FOURCC('i','n','f','o'))
} else if (fcc == M4AF_FOURCC('i','n','f','o'))
TRY_IO(caf_info(reader, chunk_size));
else if (fcc == M4AF_FOURCC('c','h','a','n')) {
ENSURE(reader->sample_format.channels_per_frame);
@ -199,7 +201,7 @@ int caf_parse(caf_reader_t *reader, int64_t *data_length)
TRY_IO(pcm_skip(&reader->io, chunk_size));
}
ENSURE(reader->sample_format.channels_per_frame);
ENSURE(fcc == M4AF_FOURCC('d','a','t','a'));
ENSURE(desc_seen && fcc == M4AF_FOURCC('d','a','t','a'));
return 0;
FAIL:
return -1;

View File

@ -1103,8 +1103,10 @@ void m4af_write_tkhd_box(m4af_ctx_t *ctx, uint32_t track_idx)
{
m4af_track_t *track = &ctx->track[track_idx];
int64_t pos = m4af_tell(ctx);
int64_t duration =
(double)track->duration / track->timescale * ctx->timescale + .5;
int64_t duration = track->duration;
if (ctx->priming_mode & M4AF_PRIMING_MODE_EDTS)
duration -= (track->encoder_delay + track->padding);
duration = (double)duration / track->timescale * ctx->timescale + .5;
uint8_t version = (track->creation_time > UINT32_MAX ||
track->modification_time > UINT32_MAX ||
duration > UINT32_MAX);
@ -1169,6 +1171,8 @@ int64_t m4af_movie_duration(m4af_ctx_t *ctx)
unsigned i;
for (i = 0; i < ctx->num_tracks; ++i) {
double x = ctx->track[i].duration;
if (ctx->priming_mode & M4AF_PRIMING_MODE_EDTS)
x -= (ctx->track[i].encoder_delay + ctx->track[i].padding);
int64_t duration = x / ctx->track[i].timescale * ctx->timescale + .5;
if (duration > movie_duration)
movie_duration = duration;

View File

@ -155,6 +155,7 @@ static
int wav_parse(wav_reader_t *reader, int64_t *data_length)
{
uint32_t container, fcc, chunk_size;
int fmt_seen = 0;
*data_length = 0;
container = riff_next_chunk(reader, &chunk_size);
@ -167,6 +168,7 @@ int wav_parse(wav_reader_t *reader, int64_t *data_length)
riff_ds64(reader, data_length);
while ((fcc = riff_next_chunk(reader, &chunk_size)) != 0) {
if (fcc == RIFF_FOURCC('f','m','t',' ')) {
fmt_seen = 1;
if (wav_fmt(reader, chunk_size) < 0)
goto FAIL;
} else if (fcc == RIFF_FOURCC('d','a','t','a')) {
@ -178,8 +180,8 @@ int wav_parse(wav_reader_t *reader, int64_t *data_length)
TRY_IO(pcm_skip(&reader->io, (chunk_size + 1) & ~1));
}
}
if (fcc == RIFF_FOURCC('d','a','t','a'))
return 0;
ENSURE(fmt_seen && fcc == RIFF_FOURCC('d', 'a', 't', 'a'));
return 0;
FAIL:
return -1;
}

View File

@ -1,4 +1,4 @@
#ifndef VERSION_H
#define VERSION_H
const char *fdkaac_version = "1.0.1";
const char *fdkaac_version = "1.0.3";
#endif