Mercurial > mplayer.hg
changeset 29697:1cd8a8e2c144
Simplify aac_get_sample_rate_index
author | reimar |
---|---|
date | Wed, 30 Sep 2009 07:52:37 +0000 |
parents | d3a6947ca46a |
children | 069c927d20d2 |
files | libmpdemux/demux_mkv.c |
diffstat | 1 files changed, 4 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c Wed Sep 30 07:48:01 2009 +0000 +++ b/libmpdemux/demux_mkv.c Wed Sep 30 07:52:37 2009 +0000 @@ -257,30 +257,10 @@ static int aac_get_sample_rate_index (uint32_t sample_rate) { - if (92017 <= sample_rate) - return 0; - else if (75132 <= sample_rate) - return 1; - else if (55426 <= sample_rate) - return 2; - else if (46009 <= sample_rate) - return 3; - else if (37566 <= sample_rate) - return 4; - else if (27713 <= sample_rate) - return 5; - else if (23004 <= sample_rate) - return 6; - else if (18783 <= sample_rate) - return 7; - else if (13856 <= sample_rate) - return 8; - else if (11502 <= sample_rate) - return 9; - else if (9391 <= sample_rate) - return 10; - else - return 11; + static const int srates[] = {92017, 75132, 55426, 46009, 37566, 27713, 23004, 18783, 13856, 11502, 9391, 0}; + int i = 0; + while (sample_rate < srates[i]) i++; + return i; } /** \brief Free cached demux packets