static void test_search_default (void) { task_cnt++; OlMetadata *metadata = ol_metadata_new (); ol_metadata_set_title (metadata, "Heal the world"); OlLyricSourceSearchTask *task = ol_lyric_source_search_default (source, metadata); g_signal_connect (G_OBJECT (task), "complete", (GCallback) search_complete_cb, (gpointer) OL_LYRIC_SOURCE_STATUS_SUCCESS); g_signal_connect (G_OBJECT (task), "started", (GCallback) search_started_cb, NULL); ol_metadata_free (metadata); }
static void test_empty_source (void) { task_cnt++; OlMetadata *metadata = ol_metadata_new (); ol_metadata_set_title (metadata, "empty"); OlLyricSourceSearchTask *task = ol_lyric_source_search (source, metadata, NULL); g_signal_connect (G_OBJECT (task), "complete", (GCallback) search_complete_cb, (gpointer)OL_LYRIC_SOURCE_STATUS_FALIURE); g_signal_connect (G_OBJECT (task), "started", (GCallback) search_started_cb, NULL); ol_lyric_source_task_cancel (OL_LYRIC_SOURCE_TASK (task)); ol_metadata_free (metadata); }
static void test_search_cancel (void) { task_cnt++; OlMetadata *metadata = ol_metadata_new (); ol_metadata_set_title (metadata, "放弃"); GList *ids = get_default_sourcid_list (); OlLyricSourceSearchTask *task = ol_lyric_source_search (source, metadata, ids); g_signal_connect (G_OBJECT (task), "complete", (GCallback) search_complete_cb, (gpointer) OL_LYRIC_SOURCE_STATUS_CANCELLED); g_signal_connect (G_OBJECT (task), "started", (GCallback) search_started_cb, NULL); ol_lyric_source_task_cancel (OL_LYRIC_SOURCE_TASK (task)); ol_metadata_free (metadata); free_sourceid_list (ids); }
static OlOsdModule* ol_osd_module_new (struct OlDisplayModule *module, OlPlayer *player) { ol_log_func (); OlOsdModule *data = g_new (OlOsdModule, 1); g_object_ref (player); data->player = player; data->window = NULL; data->lrc = NULL; data->lrc_id = -1; data->lrc_next_id = -1; data->current_line = 0; data->message_source = 0; data->metadata = ol_metadata_new (); data->config_bindings = NULL; ol_osd_module_init_osd (data); g_signal_connect (player, "track-changed", G_CALLBACK (_metadata_changed_cb), data); _update_metadata (data); return data; }
OlScrollModule* ol_scroll_module_new (struct OlDisplayModule *module, OlPlayer *player) { OlScrollModule *priv = g_new (OlScrollModule, 1); g_object_ref (player); priv->player = player; priv->scroll = NULL; priv->lrc = NULL; priv->metadata = ol_metadata_new (); priv->config_bindings = NULL; ol_scroll_module_init_scroll (priv); g_signal_connect (player, "track-changed", G_CALLBACK (_metadata_changed_cb), priv); _update_metadata (priv); g_signal_connect (player, "caps-changed", G_CALLBACK (_caps_changed_cb), priv); _update_caps (priv); return priv; }