Serranya / deadbeef-mpris2-plugin

A rewrite of the seemingly orphaned deadbeef-mpris-plugin originally written by HuangCongyu
GNU General Public License v2.0
65 stars 8 forks source link

Fix emitSeeked in SetPosition #21

Closed saivert closed 7 years ago

saivert commented 7 years ago

gets rid of erratic seekbar behavior in clients.

saivert commented 7 years ago

Basically what happened when I dragged the seekbar was that in a brief moment the seekbar "seeked" to the end of the track and then snapped back to the right location again.

Serranya commented 7 years ago

The seeked signal is part of the MPRIS https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Signal:Seeked so it needs to be implemented.

Also I think the signal is working correctly.

The signal is supposed to emit the current microsecond seeked to. It does that with the current implementation.

Or am I missing something?

saivert commented 7 years ago

Yes and your emitSeeked function is already multiplying by 1000000.0.

void emitSeeked(float position) {
    int64_t positionInMicroseconds = position * 1000000.0;
    debug("Seeked to %" PRId64, positionInMicroseconds);

    g_dbus_connection_emit_signal(globalConnection, NULL, OBJECT_NAME, PLAYER_INTERFACE, "Seeked",
                                  g_variant_new("(x)", positionInMicroseconds), NULL);
}
Serranya commented 7 years ago

Ahh yes. You are right.