Implement mimetype support reporting for MPRIS, start implementation of bulk of getters.

Implemented the following getters for MPRIS:

- CanQuit
- CanRaise
- HasTrackList
- Identity
- DesktopEntry
- SupportedUriSchemas
- SupportedMimeTypes
- Metadata
- CanPlay / CanPause / CanSeek
- CanControl
- PlaybackStatus

Implemented a koto_push_track_info_to_builder function that enables us to easily push KotoIndexedTrack as well as associated album and artist info to a GVariantBuilder for use in a GVariant for various getters.

Implemented a koto_update_mpris_info_for_track function that emits a signal for PropertiesChanged + "Metadata" when our track info changes.
This commit is contained in:
Joshua Strobl 2021-04-06 10:41:15 +03:00
parent b1f4460a2e
commit 07c3c00f1e
17 changed files with 734 additions and 69 deletions

View file

@ -19,33 +19,43 @@
#include <gstreamer-1.0/gst/gst.h>
#include "db/cartographer.h"
#include "db/db.h"
#include "playback/mimes.h"
#include "playback/mpris.h"
#include "koto-config.h"
#include "koto-window.h"
extern guint mpris_bus_id;
extern GDBusNodeInfo *introspection_data;
extern KotoCartographer *koto_maps;
extern sqlite3 *koto_db;
extern GHashTable *supported_mimes_hash;
extern GList *supported_mimes;
GtkApplication *app = NULL;
GtkWindow *main_window;
static void on_activate (GtkApplication *app) {
g_assert(GTK_IS_APPLICATION (app));
GtkWindow *window;
window = gtk_application_get_active_window (app);
if (window == NULL) {
window = g_object_new(KOTO_TYPE_WINDOW, "application", app, "default-width", 1200, "default-height", 675, NULL);
main_window = gtk_application_get_active_window (app);
if (main_window == NULL) {
main_window = g_object_new(KOTO_TYPE_WINDOW, "application", app, "default-width", 1200, "default-height", 675, NULL);
}
gtk_window_present(window);
gtk_window_present(main_window);
}
static void on_shutdown(GtkApplication *app) {
(void) app;
close_db(); // Close the database
g_bus_unown_name(mpris_bus_id);
g_dbus_node_info_unref(introspection_data);
}
int main (int argc, char *argv[]) {
g_autoptr(GtkApplication) app = NULL;
int ret;
/* Set up gettext translations */
@ -56,8 +66,22 @@ int main (int argc, char *argv[]) {
gtk_init();
gst_init(&argc, &argv);
supported_mimes_hash = g_hash_table_new(g_str_hash, g_str_equal);
supported_mimes = NULL; // Ensure our mimes GList is initialized
koto_playback_engine_get_supported_mimetypes(supported_mimes);
g_message("Length: %d", g_list_length(supported_mimes));
koto_maps = koto_cartographer_new(); // Create our new cartographer and their collection of maps
open_db(); // Open our database
setup_mpris_interfaces(); // Set up our MPRIS interfaces
GList *md;
md = NULL;
for (md = supported_mimes; md != NULL; md = md->next) {
g_message("Mimetype: %s", (gchar*) md->data);
}
g_list_free(md);
app = gtk_application_new ("com.github.joshstrobl.koto", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);