Browse Source

audiofile mp3: calculate seek points when loading file

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC1
falkTX 3 years ago
parent
commit
785d59be6b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      source/modules/audio_decoder/ad_dr_mp3.c

+ 7
- 0
source/modules/audio_decoder/ad_dr_mp3.c View File

@@ -28,12 +28,16 @@

#define DR_MP3_FLOAT_OUTPUT
#define DR_MP3_IMPLEMENTATION
#define DRMP3_DATA_CHUNK_SIZE DRMP3_MIN_DATA_CHUNK_SIZE*40
#include "dr_mp3.h"

/* internal abstraction */

#define DR_MP3_MAX_SEEK_POINTS 500

typedef struct {
drmp3 mp3;
drmp3_seek_point seekPoints[DR_MP3_MAX_SEEK_POINTS];
} drmp3_audio_decoder;

static int ad_info_dr_mp3(void *sf, struct adinfo *nfo) {
@@ -60,6 +64,9 @@ static void *ad_open_dr_mp3(const char *filename, struct adinfo *nfo) {
free (priv);
return NULL;
}
drmp3_uint32 seekPointCount = DR_MP3_MAX_SEEK_POINTS;
drmp3_calculate_seek_points (&priv->mp3, &seekPointCount, priv->seekPoints);
drmp3_bind_seek_table (&priv->mp3, seekPointCount, priv->seekPoints);
ad_info_dr_mp3 (priv, nfo);
return (void*) priv;
}


Loading…
Cancel
Save