MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / getBytesPerSample

Method getBytesPerSample

src/audio_encoder.ts:433–449  ·  view source on GitHub ↗
(format: AVSampleFormat)

Source from the content-addressed store, hash-verified

431 }
432
433 private getBytesPerSample(format: AVSampleFormat): number {
434 switch (format) {
435 case AV_SAMPLE_FMT_U8:
436 case AV_SAMPLE_FMT_U8P:
437 return 1;
438 case AV_SAMPLE_FMT_S16:
439 case AV_SAMPLE_FMT_S16P:
440 return 2;
441 case AV_SAMPLE_FMT_S32:
442 case AV_SAMPLE_FMT_S32P:
443 case AV_SAMPLE_FMT_FLT:
444 case AV_SAMPLE_FMT_FLTP:
445 return 4;
446 default:
447 return 4; // Default to 4 bytes
448 }
449 }
450
451 private formatIsPlanar(format: AVSampleFormat): boolean {
452 switch (format) {

Callers 2

createOutputBuffersMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected