Start cleanup of KotoLibrary logic and decoupling other components like Music Local from a specific library.

Fix the displaying of discs and tracks in an album on initial index due to missing cartographer add track call.

Cleanup lots of double empty newlines. Updated ptr spacing in uncrustify config to enforce consistency in pointer char (`*`) spacing.
This commit is contained in:
Joshua Strobl 2021-05-27 16:58:28 +03:00
parent 8334323af8
commit bfe4891620
33 changed files with 146 additions and 623 deletions

View file

@ -275,7 +275,6 @@ void koto_playback_engine_apply_configuration_state(
void koto_playback_engine_backwards(KotoPlaybackEngine * self) {
KotoPlaylist * playlist = koto_current_playlist_get_playlist(current_playlist); // Get the current playlist
if (!KOTO_IS_PLAYLIST(playlist)) { // If we do not have a playlist currently
return;
}
@ -338,7 +337,6 @@ KotoTrack * koto_playback_engine_get_current_track(KotoPlaybackEngine * self) {
gint64 koto_playback_engine_get_duration(KotoPlaybackEngine * self) {
gint64 duration = 0;
if (gst_element_query(self->player, self->duration_query)) { // Able to query our duration
gst_query_parse_duration(self->duration_query, NULL, &duration); // Get the duration
duration = duration / GST_SECOND; // Divide by NS to get seconds
@ -351,7 +349,6 @@ gdouble koto_playback_engine_get_progress(KotoPlaybackEngine * self) {
gdouble progress = 0.0;
gint64 gstprog = 0;
if (gst_element_query(self->playbin, self->position_query)) { // Able to get our position
gst_query_parse_position(self->position_query, NULL, &gstprog); // Get the progress
@ -389,7 +386,6 @@ gboolean koto_playback_engine_monitor_changed(
(void) bus;
KotoPlaybackEngine * self = user_data;
switch (GST_MESSAGE_TYPE(msg)) {
case GST_MESSAGE_ASYNC_DONE:
case GST_MESSAGE_DURATION_CHANGED: { // Duration changed
@ -575,7 +571,6 @@ void koto_playback_engine_stop(KotoPlaybackEngine * self) {
gst_element_set_state(self->player, GST_STATE_NULL);
GstPad * pad = gst_element_get_static_pad(self->player, "sink"); // Get the static pad of the audio element
if (!GST_IS_PAD(pad)) {
return;
}
@ -595,7 +590,6 @@ void koto_playback_engine_toggle(KotoPlaybackEngine * self) {
gboolean koto_playback_engine_tick_duration(gpointer user_data) {
KotoPlaybackEngine * self = user_data;
if (self->is_playing) { // Is playing
g_signal_emit(self, playback_engine_signals[SIGNAL_TICK_DURATION], 0); // Emit our 1s track tick
} else { // Not playing so exiting timer

View file

@ -91,7 +91,6 @@ void handle_media_keys_signal(
gchar * application_name = NULL;
gchar * key = NULL;
g_variant_get(parameters, "(ss)", &application_name, &key);
if (g_strcmp0(application_name, koto_rev_dns) != 0) { // Not for Koto
@ -140,7 +139,6 @@ void release_media_keys() {
GVariant * params = g_variant_new_string(g_strdup(koto_rev_dns));
g_dbus_proxy_call(
media_keys_proxy,
"ReleaseMediaPlayerKeys",
@ -160,7 +158,6 @@ void setup_mediakeys_interface() {
GDBusConnection * bus;
GError * error = NULL;
bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
if (bus == NULL) { // Failed to get session bus
@ -196,7 +193,6 @@ void setup_mediakeys_interface() {
GtkEventController * focus_controller = gtk_event_controller_focus_new(); // Create a new focus controller
g_signal_connect(focus_controller, "enter", G_CALLBACK(handle_window_enter), NULL);
g_signal_connect(focus_controller, "leave", G_CALLBACK(handle_window_leave), NULL);
gtk_widget_add_controller(GTK_WIDGET(main_window), focus_controller);

View file

@ -15,7 +15,6 @@
* limitations under the License.
*/
#include <glib-2.0/glib.h>
#include <gstreamer-1.0/gst/gst.h>
#include "../koto-utils.h"
@ -32,7 +31,6 @@ gboolean koto_playback_engine_gst_caps_iter(
(void) user_data;
gchar * caps_name = (gchar*) gst_structure_get_name(structure); // Get the name, typically a mimetype
if (g_str_has_prefix(caps_name, "unknown")) { // Is unknown
return TRUE;
}
@ -55,7 +53,6 @@ void koto_playback_engine_gst_pad_iter(
(void) user_data;
GstStaticPadTemplate * templ = list_data;
if (templ->direction == GST_PAD_SINK) { // Is a sink pad
GstCaps * capabilities = gst_static_pad_template_get_caps(templ); // Get the capabilities
gst_caps_foreach(capabilities, koto_playback_engine_gst_caps_iter, NULL); // Iterate over and add to mimes
@ -70,7 +67,6 @@ void koto_playback_engine_get_supported_mimetypes() {
GList * ele;
for (ele = elements; ele != NULL; ele = ele->next) { // For each of the elements
// GList of GstStaticPadTemplate
GList * static_pads = (GList*) gst_element_factory_get_static_pad_templates(ele->data); // Get the pads

View file

@ -164,7 +164,6 @@ GVariant * handle_get_property(
(void) user_data;
GVariant * ret;
ret = NULL;
if (g_strcmp0(property_name, "CanQuit") == 0) { // If property is CanQuit
@ -298,7 +297,6 @@ gboolean handle_set_property(
void koto_update_mpris_playback_state(GstState state) {
GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);
if (state == GST_STATE_PLAYING) {
g_variant_builder_add(builder, "{sv}", "PlaybackStatus", g_variant_new_string("Playing"));
} else if (state == GST_STATE_PAUSED) {
@ -325,7 +323,6 @@ void koto_update_mpris_info_for_track(KotoTrack * track) {
GVariant * metadata = koto_track_get_metadata_vardict(track); // Get the GVariantBuilder variable dict for the metadata
koto_update_mpris_info_for_track_with_metadata(track, metadata);
}
@ -339,7 +336,6 @@ void koto_update_mpris_info_for_track_with_metadata(
GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);
g_variant_builder_add(builder, "{sv}", "Metadata", metadata);
g_dbus_connection_emit_signal(