Compare commits
No commits in common. "72c85071261b94c1a9aa1953e1ed2f90f4161d64" and "749b66417d59a41080cb1d9a97fd6ecef3cf2dec" have entirely different histories.
72c8507126
...
749b66417d
2 changed files with 17 additions and 47 deletions
|
@ -4,6 +4,15 @@ enum PlaybinState {
|
||||||
PLAYING,
|
PLAYING,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SourceFuncWrapper {
|
||||||
|
public SourceFunc inner;
|
||||||
|
|
||||||
|
public SourceFuncWrapper () {
|
||||||
|
this.inner = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Playbin : GLib.Object {
|
class Playbin : GLib.Object {
|
||||||
private Mpv.Handle mpv = new Mpv.Handle ();
|
private Mpv.Handle mpv = new Mpv.Handle ();
|
||||||
|
|
||||||
|
@ -13,12 +22,8 @@ class Playbin : GLib.Object {
|
||||||
public int volume {
|
public int volume {
|
||||||
get { return _volume; }
|
get { return _volume; }
|
||||||
set {
|
set {
|
||||||
var ret = mpv.set_property_int64 ("volume", value);
|
|
||||||
if (ret >= 0) {
|
|
||||||
_volume = value;
|
_volume = value;
|
||||||
} else {
|
assert (mpv.set_property_int64 ("volume", value) >= 0);
|
||||||
warning ("failed to set volume: %s", ret.to_string ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +31,8 @@ class Playbin : GLib.Object {
|
||||||
public bool mute {
|
public bool mute {
|
||||||
get { return _mute; }
|
get { return _mute; }
|
||||||
set {
|
set {
|
||||||
var ret = mpv.set_property_flag ("mute", value);
|
|
||||||
if (ret >= 0) {
|
|
||||||
_mute = value;
|
_mute = value;
|
||||||
} else {
|
assert (mpv.set_property_flag ("mute", value) >= 0);
|
||||||
warning ("failed to set mute status: %s", ret.to_string ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,13 +131,6 @@ class Playbin : GLib.Object {
|
||||||
this.now_playing ();
|
this.now_playing ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Mpv.EventId.END_FILE:
|
|
||||||
var data = event.parse_end_file ();
|
|
||||||
if (data.error < 0) {
|
|
||||||
warning ("playback of track aborted: %s", data.error.to_string ());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// ignore by default
|
// ignore by default
|
||||||
break;
|
break;
|
||||||
|
@ -168,7 +162,7 @@ class Playbin : GLib.Object {
|
||||||
// TODO: abstract away this handling around mpv api a bit for auto debug printing
|
// TODO: abstract away this handling around mpv api a bit for auto debug printing
|
||||||
var ret = this.mpv.set_property_flag("pause", true);
|
var ret = this.mpv.set_property_flag("pause", true);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
GLib.debug ("failed to set state to paused (%d): %s", ret, ret.to_string());
|
GLib.debug ("failed to set state to paused (%d): %s\n", ret, ret.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +172,7 @@ class Playbin : GLib.Object {
|
||||||
GLib.debug ("setting state to playing");
|
GLib.debug ("setting state to playing");
|
||||||
var ret = this.mpv.set_property_flag("pause", false);
|
var ret = this.mpv.set_property_flag("pause", false);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
GLib.debug ("failed to set state to playing (%d): %s", ret, ret.to_string());
|
GLib.debug ("failed to set state to playing (%d): %s\n", ret, ret.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Mpv {
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (cname = "mpv_set_property")]
|
[CCode (cname = "mpv_set_property")]
|
||||||
private Error set_property (string name, Format format, void *data);
|
public Error set_property (string name, Format format, void *data);
|
||||||
|
|
||||||
[CCode (cname = "mpv_set_property_string")]
|
[CCode (cname = "mpv_set_property_string")]
|
||||||
public Error set_property_string (string name, string value);
|
public Error set_property_string (string name, string value);
|
||||||
|
@ -115,14 +115,7 @@ namespace Mpv {
|
||||||
requires (event_id == EventId.PROPERTY_CHANGE)
|
requires (event_id == EventId.PROPERTY_CHANGE)
|
||||||
requires (error >= 0)
|
requires (error >= 0)
|
||||||
{
|
{
|
||||||
return (EventProperty?) data;
|
return (Mpv.EventProperty?) data;
|
||||||
}
|
|
||||||
|
|
||||||
public unowned EventEndFile? parse_end_file ()
|
|
||||||
requires (event_id == EventId.END_FILE)
|
|
||||||
requires (error >= 0)
|
|
||||||
{
|
|
||||||
return (EventEndFile?) data;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,21 +138,4 @@ namespace Mpv {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (cname = "mpv_event_end_file", destroy_function = "", has_type_id = false, has_copy_function = false)]
|
|
||||||
public struct EventEndFile {
|
|
||||||
EndFileReason reason;
|
|
||||||
Error error;
|
|
||||||
int64 playlist_entry_id;
|
|
||||||
int playlist_insert_num_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
[CCode (cname = "mpv_end_file_reason", cprefix = "MPV_END_FILE_REASON_", has_type_id = false)]
|
|
||||||
public enum EndFileReason {
|
|
||||||
EOF,
|
|
||||||
STOP,
|
|
||||||
QUIT,
|
|
||||||
ERROR,
|
|
||||||
REDIRECT,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue