static void mp3_calc_length ( struct audio_file fd  )  [static]

Calculate the length of the current audio file.

Definition at line 299 of file audio_format_mp3.c.

00300 {
00301         struct mp3_drv_data *data = fd->drv_data;
00302         off_t curpos;
00303 
00304         /* Go to the end of the file */
00305         do {
00306                 if (mp3_read_frame(fd) != 0) {
00307                         /* Short track */
00308                         fd->time_len = data->mtimer.seconds;
00309                         data->flen = ftello(fd->fp);
00310                         goto done;
00311                 }
00312         } while (data->mtimer.seconds < 100);
00313 
00314         /* Extrapolate the time. Not really accurate, but good enough */
00315         curpos = ftello(fd->fp);
00316         fseek(fd->fp, 0, SEEK_END);
00317         data->flen = ftello(fd->fp);
00318 
00319         fd->time_len = ((double)data->flen / curpos) *
00320             data->mtimer.seconds;
00321 done:
00322         /* Go back to the start */
00323         mp3_rewind(fd);
00324 }

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Defines
Generated on Mon Mar 15 04:45:04 2010 for herrie by  doxygen 1.6.3