Add support for PCM codecs in MP4, add 64-bit float PCM support

This commit is contained in:
Vanilagy
2025-06-16 10:49:55 +02:00
parent 0ca1425036
commit 05881ff1f5
12 changed files with 254 additions and 64 deletions
+14 -2
View File
@@ -16,7 +16,7 @@ import {
VideoCodec,
} from './codec';
import { OutputAudioTrack, OutputSubtitleTrack, OutputTrack, OutputVideoTrack } from './output';
import { assert, CallSerializer, clamp, setInt24, setUint24 } from './misc';
import { assert, assertNever, CallSerializer, clamp, setInt24, setUint24 } from './misc';
import { Muxer } from './muxer';
import { SubtitleParser } from './subtitles';
import { toAlaw, toUlaw } from './pcm';
@@ -1083,7 +1083,19 @@ class AudioEncoderWrapper {
} else {
assert(false);
}
}
}; break;
case 8: {
if (dataType === 'float') {
this.writeOutputValue = (view, byteOffset, value) =>
view.setFloat64(byteOffset, value, littleEndian);
} else {
assert(false);
}
}; break;
default: {
assertNever(sampleSize);
assert(false);
};
}
}