input/soup: new input plugin based on libsoup
To demonstrate the new I/O thread. libsoup is well-integrated into the GLib main loop, which made this plugin pretty easy to write. As a side effect, we have to initialize the I/O thread in all debug programs that use the input API.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "io_thread.h"
|
||||
#include "input_init.h"
|
||||
#include "input_stream.h"
|
||||
#include "tag_pool.h"
|
||||
@@ -30,6 +31,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void
|
||||
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
|
||||
@@ -73,6 +75,13 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
io_thread_init();
|
||||
if (!io_thread_start(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!input_stream_global_init(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
@@ -150,6 +159,7 @@ int main(int argc, char **argv)
|
||||
input_stream_close(is);
|
||||
playlist_list_global_finish();
|
||||
input_stream_global_finish();
|
||||
io_thread_deinit();
|
||||
config_global_finish();
|
||||
tag_pool_deinit();
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "io_thread.h"
|
||||
#include "decoder_list.h"
|
||||
#include "decoder_api.h"
|
||||
#include "input_init.h"
|
||||
@@ -32,6 +33,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
@@ -164,6 +166,13 @@ int main(int argc, char **argv)
|
||||
decoder_name = argv[1];
|
||||
path = argv[2];
|
||||
|
||||
io_thread_init();
|
||||
if (!io_thread_start(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!input_stream_global_init(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
@@ -195,6 +204,8 @@ int main(int argc, char **argv)
|
||||
|
||||
decoder_plugin_deinit_all();
|
||||
input_stream_global_finish();
|
||||
io_thread_deinit();
|
||||
|
||||
if (tag == NULL) {
|
||||
g_printerr("Failed to read tags\n");
|
||||
return 1;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "io_thread.h"
|
||||
#include "decoder_list.h"
|
||||
#include "decoder_api.h"
|
||||
#include "input_init.h"
|
||||
@@ -31,6 +32,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void
|
||||
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
|
||||
@@ -180,6 +182,13 @@ int main(int argc, char **argv)
|
||||
|
||||
g_log_set_default_handler(my_log_func, NULL);
|
||||
|
||||
io_thread_init();
|
||||
if (!io_thread_start(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!input_stream_global_init(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
@@ -222,6 +231,7 @@ int main(int argc, char **argv)
|
||||
|
||||
decoder_plugin_deinit_all();
|
||||
input_stream_global_finish();
|
||||
io_thread_deinit();
|
||||
|
||||
if (!decoder.initialized) {
|
||||
g_printerr("Decoding failed\n");
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "io_thread.h"
|
||||
#include "input_init.h"
|
||||
#include "input_stream.h"
|
||||
#include "tag_pool.h"
|
||||
@@ -32,6 +33,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void
|
||||
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
|
||||
@@ -122,6 +124,13 @@ int main(int argc, char **argv)
|
||||
tag_pool_init();
|
||||
config_global_init();
|
||||
|
||||
io_thread_init();
|
||||
if (!io_thread_start(&error)) {
|
||||
g_warning("%s", error->message);
|
||||
g_error_free(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ARCHIVE
|
||||
archive_plugin_init_all();
|
||||
#endif
|
||||
@@ -155,6 +164,8 @@ int main(int argc, char **argv)
|
||||
archive_plugin_deinit_all();
|
||||
#endif
|
||||
|
||||
io_thread_deinit();
|
||||
|
||||
config_global_finish();
|
||||
tag_pool_deinit();
|
||||
|
||||
|
Reference in New Issue
Block a user