Example #1
0
gboolean spop_mpris2_player_seek(Mpris2Player* obj,  GDBusMethodInvocation* invoc, gint64 arg_Offset) {
    g_debug("mpris2: seek");
    guint pos = session_play_time() + (arg_Offset / 1000);
    session_seek(pos);
    mpris2_player_emit_seeked(obj, pos * 1000);
    mpris2_player_complete_seek(obj, invoc);
    return TRUE;
}
Example #2
0
gboolean spop_mpris2_player_set_position(Mpris2Player* obj, GDBusMethodInvocation* invoc, const gchar* arg_TrackId, gint64 arg_Position) {
    g_debug("mpris2: set_position");
    int pos = arg_Position / 1000;
    sp_track* track = NULL;
    queue_get_status(&track, NULL, NULL);

    if ((track != NULL) && (pos >= 0) && (pos <= sp_track_duration(track))) {
        // TODO: check arg_TrackId
        session_seek(pos);
        mpris2_player_emit_seeked(obj, pos * 1000);
    }
    mpris2_player_complete_set_position(obj, invoc);
    return TRUE;
}
Example #3
0
File: queue.c Project: pes0/spop
void queue_seek(guint pos) {
    sp_track* track;
    int dur;

    switch(g_status) {
    case PLAYING:
    case PAUSED:
        track = g_queue_peek_nth(&g_queue, g_current_track);
        dur = sp_track_duration(track);

        if (dur <= 0)
            g_warning("Can't get track duration.");
        else if ((pos < 0) || ((pos) >= dur))
            g_info("Can't seek: value is out of range.");
        else
            session_seek(pos);
        break;
    case STOPPED:
        g_debug("Seek: stopped, doing nothing.");
    }
}