Mercurial > mplayer.hg
changeset 5212:12f7cbbe7022
add alternative samplerate calculation for files with timescale\!=samplerate
author | atmos4 |
---|---|
date | Wed, 20 Mar 2002 04:22:14 +0000 |
parents | fc9ccaa09006 |
children | b40644bb0e61 |
files | libmpdemux/demux_mov.c |
diffstat | 1 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c Wed Mar 20 03:03:29 2002 +0000 +++ b/libmpdemux/demux_mov.c Wed Mar 20 04:22:14 2002 +0000 @@ -627,12 +627,33 @@ sh->samplesize=char2short(trak->stdata,18)/8; sh->channels=char2short(trak->stdata,16); + /*printf("MOV: timescale: %d samplerate: %d durmap: %d (%d) -> %d (%d)\n", + trak->timescale, char2short(trak->stdata,24), trak->durmap[0].dur, + trak->durmap[0].num, trak->timescale/trak->durmap[0].dur, + char2short(trak->stdata,24)/trak->durmap[0].dur);*/ sh->samplerate=char2short(trak->stdata,24); + if((sh->samplerate < 8000) && trak->durmap) { + switch(char2short(trak->stdata,24)/trak->durmap[0].dur) { + // TODO: add more cases. + case 31: + sh->samplerate = 32000; break; + case 43: + sh->samplerate = 44100; break; + case 47: + sh->samplerate = 48000; break; + default: + mp_msg(MSGT_DEMUX, MSGL_WARN, + "MOV: unable to determine audio samplerate, " + "assuming 44.1kHz (got %d)\n", + char2short(trak->stdata,24)/trak->durmap[0].dur); + sh->samplerate = 44100; + } + } mp_msg(MSGT_DEMUX, MSGL_INFO, "Audio bits: %d chans: %d\n", trak->stdata[19],trak->stdata[17]); mp_msg(MSGT_DEMUX, MSGL_INFO, "Audio sample rate: %d\n", - char2short(trak->stdata,24)); + sh->samplerate/*char2short(trak->stdata,24)*/); if((trak->stdata[9]==0) && trak->stdata_len >= 36) { // version 0 with extra atoms int atom_len = char2int(trak->stdata,28); switch(char2int(trak->stdata,32)) { // atom type