output: make "struct audio_output" opaque for output plugins
We have eliminated direct accesses to the audio_output struct from the all output plugins. Make it opaque for them, and move its real declaration to output_internal.h, similar to decoder_internal.h. Pass the opaque structure to plugin.init() only, which will return the plugin's data pointer on success, and NULL on failure. This data pointer will be passed to all other methods instead of the audio_output struct.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "output_control.h"
|
||||
#include "output_api.h"
|
||||
#include "output_internal.h"
|
||||
#include "output_list.h"
|
||||
#include "log.h"
|
||||
#include "audio.h"
|
||||
@@ -102,7 +103,8 @@ int audio_output_init(struct audio_output *ao, ConfigParam * param)
|
||||
notify_init(&ao->notify);
|
||||
ao->command = AO_COMMAND_NONE;
|
||||
|
||||
if (plugin->init(ao, format ? &ao->reqAudioFormat : NULL, param) != 0)
|
||||
ao->data = plugin->init(ao, format ? &ao->reqAudioFormat : NULL, param);
|
||||
if (ao->data == NULL)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user