mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
improve resolution stream-length-in-millisecond calculation
This commit is contained in:
@@ -307,7 +307,7 @@ static void getfileinfo(char *filename, char *title, int *length_in_msec)
|
||||
filename = lastfn_;
|
||||
if (length_in_msec)
|
||||
{
|
||||
*length_in_msec = file_info_.length_in_msec;
|
||||
*length_in_msec = (int)file_info_.length_in_msec;
|
||||
length_in_msec = 0; /* force skip in following code */
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,7 @@ static void getfileinfo(char *filename, char *title, int *length_in_msec)
|
||||
}
|
||||
|
||||
if (length_in_msec)
|
||||
*length_in_msec = (int)(streaminfo.data.stream_info.total_samples*10 / (streaminfo.data.stream_info.sample_rate/100));
|
||||
*length_in_msec = (int)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user