decoder: removed stream_types
Instead of checking the stream_types bit set, we can simply check whether the methods stream_decode() and file_decode() are implemented.
This commit is contained in:
parent
59c20e5afe
commit
85a7d1a148
@ -579,7 +579,6 @@ const struct decoder_plugin aacPlugin = {
|
|||||||
.stream_decode = aac_stream_decode,
|
.stream_decode = aac_stream_decode,
|
||||||
.file_decode = aac_decode,
|
.file_decode = aac_decode,
|
||||||
.tag_dup = aacTagDup,
|
.tag_dup = aacTagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
|
|
||||||
.suffixes = aac_suffixes,
|
.suffixes = aac_suffixes,
|
||||||
.mime_types = aac_mimeTypes
|
.mime_types = aac_mimeTypes
|
||||||
};
|
};
|
||||||
|
@ -141,6 +141,5 @@ const struct decoder_plugin audiofilePlugin = {
|
|||||||
.name = "audiofile",
|
.name = "audiofile",
|
||||||
.file_decode = audiofile_decode,
|
.file_decode = audiofile_decode,
|
||||||
.tag_dup = audiofileTagDup,
|
.tag_dup = audiofileTagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = audiofileSuffixes,
|
.suffixes = audiofileSuffixes,
|
||||||
};
|
};
|
||||||
|
@ -373,7 +373,6 @@ const struct decoder_plugin ffmpeg_plugin = {
|
|||||||
.try_decode = ffmpeg_try_decode,
|
.try_decode = ffmpeg_try_decode,
|
||||||
.stream_decode = ffmpeg_decode,
|
.stream_decode = ffmpeg_decode,
|
||||||
.tag_dup = ffmpeg_tag,
|
.tag_dup = ffmpeg_tag,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = ffmpeg_suffixes,
|
.suffixes = ffmpeg_suffixes,
|
||||||
.mime_types = ffmpeg_mime_types
|
.mime_types = ffmpeg_mime_types
|
||||||
};
|
};
|
||||||
|
@ -443,7 +443,6 @@ const struct decoder_plugin oggflacPlugin = {
|
|||||||
.try_decode = oggflac_try_decode,
|
.try_decode = oggflac_try_decode,
|
||||||
.stream_decode = oggflac_decode,
|
.stream_decode = oggflac_decode,
|
||||||
.tag_dup = oggflac_tag_dup,
|
.tag_dup = oggflac_tag_dup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = oggflac_suffixes,
|
.suffixes = oggflac_suffixes,
|
||||||
.mime_types = oggflac_mime_types
|
.mime_types = oggflac_mime_types
|
||||||
};
|
};
|
||||||
@ -459,7 +458,6 @@ const struct decoder_plugin flacPlugin = {
|
|||||||
.name = "flac",
|
.name = "flac",
|
||||||
.stream_decode = flac_decode,
|
.stream_decode = flac_decode,
|
||||||
.tag_dup = flacTagDup,
|
.tag_dup = flacTagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = flacSuffixes,
|
.suffixes = flacSuffixes,
|
||||||
.mime_types = flac_mime_types
|
.mime_types = flac_mime_types
|
||||||
};
|
};
|
||||||
|
@ -260,6 +260,5 @@ const struct decoder_plugin modPlugin = {
|
|||||||
.finish = mod_finishMikMod,
|
.finish = mod_finishMikMod,
|
||||||
.file_decode = mod_decode,
|
.file_decode = mod_decode,
|
||||||
.tag_dup = modTagDup,
|
.tag_dup = modTagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = modSuffixes,
|
.suffixes = modSuffixes,
|
||||||
};
|
};
|
||||||
|
@ -1115,7 +1115,6 @@ const struct decoder_plugin mp3Plugin = {
|
|||||||
.init = mp3_plugin_init,
|
.init = mp3_plugin_init,
|
||||||
.stream_decode = mp3_decode,
|
.stream_decode = mp3_decode,
|
||||||
.tag_dup = mp3_tag_dup,
|
.tag_dup = mp3_tag_dup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
|
|
||||||
.suffixes = mp3_suffixes,
|
.suffixes = mp3_suffixes,
|
||||||
.mime_types = mp3_mime_types
|
.mime_types = mp3_mime_types
|
||||||
};
|
};
|
||||||
|
@ -417,7 +417,6 @@ const struct decoder_plugin mp4_plugin = {
|
|||||||
.name = "mp4",
|
.name = "mp4",
|
||||||
.stream_decode = mp4_decode,
|
.stream_decode = mp4_decode,
|
||||||
.tag_dup = mp4_tag_dup,
|
.tag_dup = mp4_tag_dup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
|
|
||||||
.suffixes = mp4_suffixes,
|
.suffixes = mp4_suffixes,
|
||||||
.mime_types = mp4_mime_types,
|
.mime_types = mp4_mime_types,
|
||||||
};
|
};
|
||||||
|
@ -301,6 +301,5 @@ const struct decoder_plugin mpcPlugin = {
|
|||||||
.name = "mpc",
|
.name = "mpc",
|
||||||
.stream_decode = mpc_decode,
|
.stream_decode = mpc_decode,
|
||||||
.tag_dup = mpcTagDup,
|
.tag_dup = mpcTagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = mpcSuffixes,
|
.suffixes = mpcSuffixes,
|
||||||
};
|
};
|
||||||
|
@ -346,7 +346,6 @@ const struct decoder_plugin oggflacPlugin = {
|
|||||||
.try_decode = oggflac_try_decode,
|
.try_decode = oggflac_try_decode,
|
||||||
.stream_decode = oggflac_decode,
|
.stream_decode = oggflac_decode,
|
||||||
.tag_dup = oggflac_TagDup,
|
.tag_dup = oggflac_TagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = oggflac_Suffixes,
|
.suffixes = oggflac_Suffixes,
|
||||||
.mime_types = oggflac_mime_types
|
.mime_types = oggflac_mime_types
|
||||||
};
|
};
|
||||||
|
@ -370,7 +370,6 @@ const struct decoder_plugin oggvorbisPlugin = {
|
|||||||
.try_decode = oggvorbis_try_decode,
|
.try_decode = oggvorbis_try_decode,
|
||||||
.stream_decode = oggvorbis_decode,
|
.stream_decode = oggvorbis_decode,
|
||||||
.tag_dup = oggvorbis_TagDup,
|
.tag_dup = oggvorbis_TagDup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
||||||
.suffixes = oggvorbis_Suffixes,
|
.suffixes = oggvorbis_Suffixes,
|
||||||
.mime_types = oggvorbis_MimeTypes
|
.mime_types = oggvorbis_MimeTypes
|
||||||
};
|
};
|
||||||
|
@ -539,7 +539,6 @@ const struct decoder_plugin wavpack_plugin = {
|
|||||||
.stream_decode = wavpack_streamdecode,
|
.stream_decode = wavpack_streamdecode,
|
||||||
.file_decode = wavpack_filedecode,
|
.file_decode = wavpack_filedecode,
|
||||||
.tag_dup = wavpack_tagdup,
|
.tag_dup = wavpack_tagdup,
|
||||||
.stream_types = INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
|
|
||||||
.suffixes = wavpack_suffixes,
|
.suffixes = wavpack_suffixes,
|
||||||
.mime_types = wavpack_mime_types
|
.mime_types = wavpack_mime_types
|
||||||
};
|
};
|
||||||
|
@ -35,11 +35,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
/* valid values for streamTypes in the InputPlugin struct: */
|
|
||||||
#define INPUT_PLUGIN_STREAM_FILE 0x01
|
|
||||||
#define INPUT_PLUGIN_STREAM_URL 0x02
|
|
||||||
|
|
||||||
|
|
||||||
enum decoder_command {
|
enum decoder_command {
|
||||||
DECODE_COMMAND_NONE = 0,
|
DECODE_COMMAND_NONE = 0,
|
||||||
DECODE_COMMAND_START,
|
DECODE_COMMAND_START,
|
||||||
@ -94,9 +89,6 @@ struct decoder_plugin {
|
|||||||
*/
|
*/
|
||||||
struct tag *(*tag_dup)(const 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;
|
|
||||||
|
|
||||||
/* last element in these arrays must always be a NULL: */
|
/* last element in these arrays must always be a NULL: */
|
||||||
const char *const*suffixes;
|
const char *const*suffixes;
|
||||||
const char *const*mime_types;
|
const char *const*mime_types;
|
||||||
|
@ -108,8 +108,6 @@ static void decoder_run(void)
|
|||||||
while ((plugin = decoder_plugin_from_mime_type(input_stream.mime, next++))) {
|
while ((plugin = decoder_plugin_from_mime_type(input_stream.mime, next++))) {
|
||||||
if (plugin->stream_decode == NULL)
|
if (plugin->stream_decode == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL))
|
|
||||||
continue;
|
|
||||||
if (!decoder_try_decode(plugin, &input_stream))
|
if (!decoder_try_decode(plugin, &input_stream))
|
||||||
continue;
|
continue;
|
||||||
ret = plugin->stream_decode(&decoder, &input_stream);
|
ret = plugin->stream_decode(&decoder, &input_stream);
|
||||||
@ -123,9 +121,6 @@ static void decoder_run(void)
|
|||||||
while ((plugin = decoder_plugin_from_suffix(s, next++))) {
|
while ((plugin = decoder_plugin_from_suffix(s, next++))) {
|
||||||
if (plugin->stream_decode == NULL)
|
if (plugin->stream_decode == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (!(plugin->stream_types &
|
|
||||||
INPUT_PLUGIN_STREAM_URL))
|
|
||||||
continue;
|
|
||||||
if (!decoder_try_decode(plugin, &input_stream))
|
if (!decoder_try_decode(plugin, &input_stream))
|
||||||
continue;
|
continue;
|
||||||
decoder.plugin = plugin;
|
decoder.plugin = plugin;
|
||||||
@ -150,9 +145,6 @@ static void decoder_run(void)
|
|||||||
unsigned int next = 0;
|
unsigned int next = 0;
|
||||||
const char *s = getSuffix(uri);
|
const char *s = getSuffix(uri);
|
||||||
while ((plugin = decoder_plugin_from_suffix(s, next++))) {
|
while ((plugin = decoder_plugin_from_suffix(s, next++))) {
|
||||||
if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!decoder_try_decode(plugin, &input_stream))
|
if (!decoder_try_decode(plugin, &input_stream))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user