Esempio n. 1
0
File: queue.c Progetto: pes0/spop
void queue_remove_tracks(gboolean notif, int idx, int nb) {
    int len;
    int i;

    g_debug("Removing %d tracks from queue, starting at %d.", nb, idx);

    if ((idx < 0) || (nb < 0))
        return;

    len = g_queue_get_length(&g_queue);

    if (idx < len) {
        if (idx + nb >= len)
            nb = len - idx;

        for (i=0; i < nb; i++)
            sp_track_release(g_queue_pop_nth(&g_queue, idx));

        /* Was the current track removed too? */
        if (g_current_track >= idx) {
            if (g_current_track < idx+nb) {
                queue_stop(FALSE);
                g_current_track = -1;
            }
            else
                g_current_track -= nb;
        }
    }

    if (g_shuffle) queue_setup_shuffle();
    g_shuffle_first = g_current_track;

    if (notif) queue_notify();
}
Esempio n. 2
0
File: queue.c Progetto: pes0/spop
void queue_clear(gboolean notif) {
    queue_stop(FALSE);
    g_queue_foreach(&g_queue, cb_queue_track_release, NULL);
    g_queue_clear(&g_queue);
    g_current_track = -1;

    if (notif) queue_notify();
}
Esempio n. 3
0
File: queue.c Progetto: pes0/spop
void queue_goto(gboolean notif, int idx, gboolean reset_shuffle_first) {
    int len = g_queue_get_length(&g_queue);
    queue_status s = g_status;

    if (idx == g_current_track) {
        g_debug("New track == current_track == %d: doing nothing.", g_current_track);
        return;
    }

    queue_stop(FALSE);

    if (idx < 0) {
        g_debug("Reached beginning of queue, stopping playback.");
        g_current_track = -1;
    }
    else if (idx >= len) {
        g_debug("Reached end of queue, stopping playback.");
        g_current_track = -1;
    }
    else {
        g_debug("Switching to track %d.", idx);
        g_current_track = idx;
        if (reset_shuffle_first)
            g_shuffle_first = idx;
        if (s == PAUSED) {
            sp_track* track;
            track = g_queue_peek_nth(&g_queue, g_current_track);
            if (!track)
                g_error("Can't peek track.");
            session_load(track);
            g_status = PAUSED;
        }
        else
            queue_play(FALSE);
    }

    if (notif) queue_notify();
}
Esempio n. 4
0
void socket_stub_close_connection(void)
{
    queue_stop(&qinput);
    queue_start(&qinput);
}
Esempio n. 5
0
void event_loop_stop(EventQueue* queue)
{
  queue_stop(queue);
}
Esempio n. 6
0
gboolean spop_mpris2_player_stop(Mpris2Player* obj, GDBusMethodInvocation* invoc) {
    g_debug("mpris2: stop");
    queue_stop(TRUE);
    mpris2_player_complete_stop(obj, invoc);
    return TRUE;
}