decoder: return const decoder_plugin structs
The decoder_plugin structs must never change. Don't work with non-const pointers.
This commit is contained in:
parent
83f6222ae7
commit
5036368f54
@ -23,7 +23,7 @@
|
|||||||
#include "pcm_utils.h"
|
#include "pcm_utils.h"
|
||||||
|
|
||||||
struct decoder {
|
struct decoder {
|
||||||
struct decoder_plugin *plugin;
|
const struct decoder_plugin *plugin;
|
||||||
|
|
||||||
struct pcm_convert_state conv_state;
|
struct pcm_convert_state conv_state;
|
||||||
|
|
||||||
|
@ -65,12 +65,12 @@ static int stringFoundInStringArray(const char *const*array, const char *suffix)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct decoder_plugin *decoder_plugin_from_suffix(const char *suffix,
|
const struct decoder_plugin *
|
||||||
unsigned int next)
|
decoder_plugin_from_suffix(const char *suffix, unsigned int next)
|
||||||
{
|
{
|
||||||
static ListNode *pos;
|
static ListNode *pos;
|
||||||
ListNode *node;
|
ListNode *node;
|
||||||
struct decoder_plugin *plugin;
|
const struct decoder_plugin *plugin;
|
||||||
|
|
||||||
if (suffix == NULL)
|
if (suffix == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -95,8 +95,8 @@ struct decoder_plugin *decoder_plugin_from_suffix(const char *suffix,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct decoder_plugin *decoder_plugin_from_mime_type(const char *mimeType,
|
const struct decoder_plugin *
|
||||||
unsigned int next)
|
decoder_plugin_from_mime_type(const char *mimeType, unsigned int next)
|
||||||
{
|
{
|
||||||
static ListNode *pos;
|
static ListNode *pos;
|
||||||
ListNode *node;
|
ListNode *node;
|
||||||
@ -119,13 +119,14 @@ struct decoder_plugin *decoder_plugin_from_mime_type(const char *mimeType,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct decoder_plugin *decoder_plugin_from_name(const char *name)
|
const struct decoder_plugin *
|
||||||
|
decoder_plugin_from_name(const char *name)
|
||||||
{
|
{
|
||||||
void *plugin = NULL;
|
void *plugin = NULL;
|
||||||
|
|
||||||
findInList(inputPlugin_list, name, &plugin);
|
findInList(inputPlugin_list, name, &plugin);
|
||||||
|
|
||||||
return (struct decoder_plugin *) plugin;
|
return (const struct decoder_plugin *) plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void decoder_plugin_print_all_suffixes(FILE * fp)
|
void decoder_plugin_print_all_suffixes(FILE * fp)
|
||||||
|
@ -24,18 +24,19 @@
|
|||||||
struct decoder_plugin;
|
struct decoder_plugin;
|
||||||
|
|
||||||
/* individual functions to load/unload plugins */
|
/* individual functions to load/unload plugins */
|
||||||
void decoder_plugin_load(struct decoder_plugin * inputPlugin);
|
void decoder_plugin_load(struct decoder_plugin *inputPlugin);
|
||||||
void decoder_plugin_unload(struct decoder_plugin * inputPlugin);
|
void decoder_plugin_unload(struct decoder_plugin *inputPlugin);
|
||||||
|
|
||||||
/* interface for using plugins */
|
/* interface for using plugins */
|
||||||
|
|
||||||
struct decoder_plugin *decoder_plugin_from_suffix(const char *suffix,
|
const struct decoder_plugin *
|
||||||
unsigned int next);
|
decoder_plugin_from_suffix(const char *suffix, unsigned int next);
|
||||||
|
|
||||||
struct decoder_plugin *decoder_plugin_from_mime_type(const char *mimeType,
|
const struct decoder_plugin *
|
||||||
unsigned int next);
|
decoder_plugin_from_mime_type(const char *mimeType, unsigned int next);
|
||||||
|
|
||||||
struct decoder_plugin *decoder_plugin_from_name(const char *name);
|
const struct decoder_plugin *
|
||||||
|
decoder_plugin_from_name(const char *name);
|
||||||
|
|
||||||
void decoder_plugin_print_all_suffixes(FILE * fp);
|
void decoder_plugin_print_all_suffixes(FILE * fp);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ static void decodeStart(void)
|
|||||||
int ret;
|
int ret;
|
||||||
bool close_instream = true;
|
bool close_instream = true;
|
||||||
struct input_stream inStream;
|
struct input_stream inStream;
|
||||||
struct decoder_plugin *plugin = NULL;
|
const struct decoder_plugin *plugin;
|
||||||
|
|
||||||
if (song_is_file(song))
|
if (song_is_file(song))
|
||||||
uri = map_song_fs(song, buffer);
|
uri = map_song_fs(song, buffer);
|
||||||
|
5
src/ls.c
5
src/ls.c
@ -113,9 +113,10 @@ const char *getSuffix(const char *utf8file)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next)
|
const struct decoder_plugin *
|
||||||
|
hasMusicSuffix(const char *utf8file, unsigned int next)
|
||||||
{
|
{
|
||||||
struct decoder_plugin *ret = NULL;
|
const struct decoder_plugin *ret = NULL;
|
||||||
|
|
||||||
const char *s = getSuffix(utf8file);
|
const char *s = getSuffix(utf8file);
|
||||||
if (s) {
|
if (s) {
|
||||||
|
3
src/ls.h
3
src/ls.h
@ -32,7 +32,8 @@ int isValidRemoteUtf8Url(const char *utf8url);
|
|||||||
|
|
||||||
int isRemoteUrl(const char *url);
|
int isRemoteUrl(const char *url);
|
||||||
|
|
||||||
struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next);
|
const struct decoder_plugin *
|
||||||
|
hasMusicSuffix(const char *utf8file, unsigned int next);
|
||||||
|
|
||||||
int printRemoteUrlHandlers(struct client *client);
|
int printRemoteUrlHandlers(struct client *client);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ song_file_update(struct song *song)
|
|||||||
{
|
{
|
||||||
char buffer[MPD_PATH_MAX];
|
char buffer[MPD_PATH_MAX];
|
||||||
const char *path_fs;
|
const char *path_fs;
|
||||||
struct decoder_plugin *plugin;
|
const struct decoder_plugin *plugin;
|
||||||
unsigned int next = 0;
|
unsigned int next = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user