Commit 6120635f authored by Max Kellermann's avatar Max Kellermann

added decoder_plugin_register()

With the functions decoder_plugin_register() and decoder_plugin_unregister(), decoder plugins can register a "secondary" plugin, like the flac input plugin does this for "oggflac".
parent a68ef497
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "decoder_internal.h" #include "decoder_internal.h"
#include "decoder_list.h"
#include "audio.h" #include "audio.h"
#include "utils.h" #include "utils.h"
...@@ -25,6 +26,16 @@ ...@@ -25,6 +26,16 @@
#include "playerData.h" #include "playerData.h"
#include "gcc.h" #include "gcc.h"
void decoder_plugin_register(struct decoder_plugin *plugin)
{
decoder_plugin_load(plugin);
}
void decoder_plugin_unregister(struct decoder_plugin *plugin)
{
decoder_plugin_unload(plugin);
}
void decoder_initialized(struct decoder * decoder, void decoder_initialized(struct decoder * decoder,
const AudioFormat * audio_format, const AudioFormat * audio_format,
float total_time) float total_time)
......
...@@ -87,6 +87,10 @@ struct decoder_plugin { ...@@ -87,6 +87,10 @@ struct decoder_plugin {
}; };
void decoder_plugin_register(struct decoder_plugin *plugin);
void decoder_plugin_unregister(struct decoder_plugin *plugin);
/** /**
* Opaque handle which the decoder plugin passes to the functions in * Opaque handle which the decoder plugin passes to the functions in
* this header. * this header.
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "../utils.h" #include "../utils.h"
#include "../log.h" #include "../log.h"
#include "../decoder_list.h"
/* this code was based on flac123, from flac-tools */ /* this code was based on flac123, from flac-tools */
...@@ -533,7 +532,7 @@ static int flac_plugin_init(void) ...@@ -533,7 +532,7 @@ static int flac_plugin_init(void)
INPUT_PLUGIN_STREAM_FILE; INPUT_PLUGIN_STREAM_FILE;
oggflacPlugin.suffixes = oggflac_suffixes; oggflacPlugin.suffixes = oggflac_suffixes;
oggflacPlugin.mime_types = oggflac_mime_types; oggflacPlugin.mime_types = oggflac_mime_types;
decoder_plugin_load(&oggflacPlugin); decoder_plugin_register(&oggflacPlugin);
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment