decoder_api: pass constant path pointers
This commit is contained in:
parent
6d6e615825
commit
78448fe1a5
|
@ -246,7 +246,7 @@ static void aac_parse_header(AacBuffer * b, float *length)
|
|||
}
|
||||
}
|
||||
|
||||
static float getAacFloatTotalTime(char *file)
|
||||
static float getAacFloatTotalTime(const char *file)
|
||||
{
|
||||
AacBuffer b;
|
||||
float length;
|
||||
|
@ -290,7 +290,7 @@ static float getAacFloatTotalTime(char *file)
|
|||
return length;
|
||||
}
|
||||
|
||||
static int getAacTotalTime(char *file)
|
||||
static int getAacTotalTime(const char *file)
|
||||
{
|
||||
int file_time = -1;
|
||||
float length;
|
||||
|
@ -435,7 +435,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
|
|||
|
||||
|
||||
static bool
|
||||
aac_decode(struct decoder *mpd_decoder, char *path)
|
||||
aac_decode(struct decoder *mpd_decoder, const char *path)
|
||||
{
|
||||
float file_time;
|
||||
float totalTime;
|
||||
|
@ -569,7 +569,7 @@ aac_decode(struct decoder *mpd_decoder, char *path)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct tag *aacTagDup(char *file)
|
||||
static struct tag *aacTagDup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
int file_time = getAacTotalTime(file);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
|
||||
#define CHUNK_SIZE 1020
|
||||
|
||||
static int getAudiofileTotalTime(char *file)
|
||||
static int getAudiofileTotalTime(const char *file)
|
||||
{
|
||||
int total_time;
|
||||
AFfilehandle af_fp = afOpenFile(file, "r", NULL);
|
||||
|
@ -42,7 +42,7 @@ static int getAudiofileTotalTime(char *file)
|
|||
}
|
||||
|
||||
static bool
|
||||
audiofile_decode(struct decoder *decoder, char *path)
|
||||
audiofile_decode(struct decoder *decoder, const char *path)
|
||||
{
|
||||
int fs, frame_count;
|
||||
AFfilehandle af_fp;
|
||||
|
@ -115,7 +115,7 @@ audiofile_decode(struct decoder *decoder, char *path)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct tag *audiofileTagDup(char *file)
|
||||
static struct tag *audiofileTagDup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
int total_time = getAudiofileTotalTime(file);
|
||||
|
|
|
@ -325,7 +325,7 @@ static bool ffmpeg_tag_internal(BasePtrs *base)
|
|||
}
|
||||
|
||||
//no tag reading in ffmpeg, check if playable
|
||||
static struct tag *ffmpeg_tag(char *file)
|
||||
static struct tag *ffmpeg_tag(const char *file)
|
||||
{
|
||||
struct input_stream input;
|
||||
BasePtrs base;
|
||||
|
|
|
@ -220,7 +220,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
|
|||
}
|
||||
|
||||
static struct tag *
|
||||
flacMetadataDup(char *file, bool *vorbisCommentFound)
|
||||
flacMetadataDup(const char *file, bool *vorbisCommentFound)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
FLAC__Metadata_SimpleIterator *it;
|
||||
|
@ -278,7 +278,7 @@ flacMetadataDup(char *file, bool *vorbisCommentFound)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct tag *flacTagDup(char *file)
|
||||
static struct tag *flacTagDup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
bool foundVorbisComment = false;
|
||||
|
@ -386,7 +386,7 @@ flac_decode(struct decoder * decoder, struct input_stream *inStream)
|
|||
|
||||
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
|
||||
!defined(HAVE_OGGFLAC)
|
||||
static struct tag *oggflac_tag_dup(char *file)
|
||||
static struct tag *oggflac_tag_dup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
FLAC__Metadata_Iterator *it;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "../utils.h"
|
||||
#include "../log.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <mikmod.h>
|
||||
|
||||
/* this is largely copied from alsaplayer */
|
||||
|
@ -136,12 +137,17 @@ typedef struct _mod_Data {
|
|||
SBYTE *audio_buffer;
|
||||
} mod_Data;
|
||||
|
||||
static mod_Data *mod_open(char *path)
|
||||
static mod_Data *mod_open(const char *path)
|
||||
{
|
||||
char *path2;
|
||||
MODULE *moduleHandle;
|
||||
mod_Data *data;
|
||||
|
||||
if (!(moduleHandle = Player_Load(path, 128, 0)))
|
||||
path2 = g_strdup(path);
|
||||
moduleHandle = Player_Load(path2, 128, 0);
|
||||
g_free(path2);
|
||||
|
||||
if (moduleHandle == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Prevent module from looping forever */
|
||||
|
@ -166,7 +172,7 @@ static void mod_close(mod_Data * data)
|
|||
}
|
||||
|
||||
static bool
|
||||
mod_decode(struct decoder *decoder, char *path)
|
||||
mod_decode(struct decoder *decoder, const char *path)
|
||||
{
|
||||
mod_Data *data;
|
||||
struct audio_format audio_format;
|
||||
|
@ -218,8 +224,9 @@ mod_decode(struct decoder *decoder, char *path)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct tag *modTagDup(char *file)
|
||||
static struct tag *modTagDup(const char *file)
|
||||
{
|
||||
char *path2;
|
||||
struct tag *ret = NULL;
|
||||
MODULE *moduleHandle;
|
||||
char *title;
|
||||
|
@ -229,7 +236,11 @@ static struct tag *modTagDup(char *file)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(moduleHandle = Player_Load(file, 128, 0))) {
|
||||
path2 = g_strdup(file);
|
||||
moduleHandle = Player_Load(path2, 128, 0);
|
||||
g_free(path2);
|
||||
|
||||
if (moduleHandle == NULL) {
|
||||
DEBUG("modTagDup: Failed to open file: %s\n", file);
|
||||
MikMod_Exit();
|
||||
return NULL;
|
||||
|
@ -240,7 +251,10 @@ static struct tag *modTagDup(char *file)
|
|||
ret = tag_new();
|
||||
|
||||
ret->time = 0;
|
||||
title = xstrdup(Player_LoadTitle(file));
|
||||
|
||||
path2 = g_strdup(file);
|
||||
title = xstrdup(Player_LoadTitle(path2));
|
||||
g_free(path2);
|
||||
if (title)
|
||||
tag_add_item(ret, TAG_ITEM_TITLE, title);
|
||||
|
||||
|
|
|
@ -791,7 +791,7 @@ static void mp3_data_finish(struct mp3_data *data)
|
|||
}
|
||||
|
||||
/* this is primarily used for getting total time for tags */
|
||||
static int mp3_total_file_time(char *file)
|
||||
static int mp3_total_file_time(const char *file)
|
||||
{
|
||||
struct input_stream input_stream;
|
||||
struct mp3_data data;
|
||||
|
@ -1123,7 +1123,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct tag *mp3_tag_dup(char *file)
|
||||
static struct tag *mp3_tag_dup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
int total_time;
|
||||
|
|
|
@ -301,7 +301,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
|
||||
static struct tag *mp4DataDup(const char *file, int *mp4MetadataFound)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
struct input_stream inStream;
|
||||
|
@ -390,7 +390,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct tag *mp4TagDup(char *file)
|
||||
static struct tag *mp4TagDup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
int mp4MetadataFound = 0;
|
||||
|
|
|
@ -236,7 +236,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
|
|||
return true;
|
||||
}
|
||||
|
||||
static float mpcGetTime(char *file)
|
||||
static float mpcGetTime(const char *file)
|
||||
{
|
||||
struct input_stream inStream;
|
||||
float total_time = -1;
|
||||
|
@ -274,7 +274,7 @@ static float mpcGetTime(char *file)
|
|||
return total_time;
|
||||
}
|
||||
|
||||
static struct tag *mpcTagDup(char *file)
|
||||
static struct tag *mpcTagDup(const char *file)
|
||||
{
|
||||
struct tag *ret = NULL;
|
||||
float total_time = mpcGetTime(file);
|
||||
|
|
|
@ -254,7 +254,7 @@ fail:
|
|||
}
|
||||
|
||||
/* public functions: */
|
||||
static struct tag *oggflac_TagDup(char *file)
|
||||
static struct tag *oggflac_TagDup(const char *file)
|
||||
{
|
||||
struct input_stream inStream;
|
||||
OggFLAC__SeekableStreamDecoder *decoder;
|
||||
|
|
|
@ -329,7 +329,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
|
|||
return true;
|
||||
}
|
||||
|
||||
static struct tag *oggvorbis_TagDup(char *file)
|
||||
static struct tag *oggvorbis_TagDup(const char *file)
|
||||
{
|
||||
struct tag *ret;
|
||||
FILE *fp;
|
||||
|
|
|
@ -277,7 +277,7 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
|
|||
/*
|
||||
* Reads metainfo from the specified file.
|
||||
*/
|
||||
static struct tag *wavpack_tagdup(char *fname)
|
||||
static struct tag *wavpack_tagdup(const char *fname)
|
||||
{
|
||||
WavpackContext *wpc;
|
||||
struct tag *tag;
|
||||
|
@ -533,7 +533,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
|
|||
* Decodes a file.
|
||||
*/
|
||||
static bool
|
||||
wavpack_filedecode(struct decoder *decoder, char *fname)
|
||||
wavpack_filedecode(struct decoder *decoder, const char *fname)
|
||||
{
|
||||
char error[ERRORLEN];
|
||||
WavpackContext *wpc;
|
||||
|
|
|
@ -86,13 +86,13 @@ struct decoder_plugin {
|
|||
*
|
||||
* returns -1 on error, 0 on success
|
||||
*/
|
||||
bool (*file_decode)(struct decoder *, char *path);
|
||||
bool (*file_decode)(struct decoder *, const char *path);
|
||||
|
||||
/**
|
||||
* file should be the full path! Returns NULL if a tag cannot
|
||||
* be found or read
|
||||
*/
|
||||
struct tag *(*tag_dup)(char *file);
|
||||
struct tag *(*tag_dup)(const char *file);
|
||||
|
||||
/* one or more of the INPUT_PLUGIN_STREAM_* values OR'd together */
|
||||
unsigned char stream_types;
|
||||
|
|
Loading…
Reference in New Issue