diff options
author | wm4 <wm4@nowhere> | 2015-03-10 17:11:38 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-03-10 17:11:38 +0100 |
commit | eb482140d9bd441d6ee519ffdace35058704ff5f (patch) | |
tree | 5bd34eef728ddc56c6f62bfa9c7fd776be6a1b7f /audio/format.c | |
parent | 69c61a882d29c19103a1b0d7d0cd8ba846519d9b (diff) | |
download | mpv-eb482140d9bd441d6ee519ffdace35058704ff5f.tar.bz2 mpv-eb482140d9bd441d6ee519ffdace35058704ff5f.tar.xz |
audio: fix spdif packet size unit
In commit 5f8b060e I blindly assumed that the packet sizes were in
pseudo-samples, but they were actually in bytes. Oops.
(The effect was that cutting the audio was a bit less precise than it
can be.)
Also remove the packet size from ad_spdif.c; it didn't actually use it,
and simply takes what the spdif "muxer" returns.
Diffstat (limited to 'audio/format.c')
-rw-r--r-- | audio/format.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/audio/format.c b/audio/format.c index c2b29b62ad..7f9cb1477e 100644 --- a/audio/format.c +++ b/audio/format.c @@ -228,16 +228,18 @@ int af_format_conversion_score(int dst_format, int src_format) return score; } +// Return the number of samples that make up one frame in this format. +// You get the byte size by multiplying them with sample size and channel count. int af_format_sample_alignment(int format) { switch (format) { - case AF_FORMAT_S_AAC: return 16384; - case AF_FORMAT_S_AC3: return 6144; - case AF_FORMAT_S_DTSHD: return 32768; - case AF_FORMAT_S_DTS: return 32768; - case AF_FORMAT_S_EAC3: return 24576; - case AF_FORMAT_S_MP3: return 4608; - case AF_FORMAT_S_TRUEHD: return 61440; + case AF_FORMAT_S_AAC: return 16384 / 4; + case AF_FORMAT_S_AC3: return 6144 / 4; + case AF_FORMAT_S_DTSHD: return 32768 / 16; + case AF_FORMAT_S_DTS: return 2048 / 4; + case AF_FORMAT_S_EAC3: return 24576 / 4; + case AF_FORMAT_S_MP3: return 4608 / 4; + case AF_FORMAT_S_TRUEHD: return 61440 / 16; default: return 1; } } |