// uri changed externally
this._uri = this.playbin.uri;
this.notify_property("uri");
+ this.metadata = this.generate_basic_didl ();
}
}
}
private void on_uri_notify (ParamSpec pspec) {
this.uri_update_hint = true;
}
+
+ /**
+ * Generate basic DIDLLite information.
+ *
+ * This is used when the URI gets changed externally. DLNA requires that a
+ * minimum DIDLLite is always present if the URI is not empty.
+ */
+ private string generate_basic_didl () {
+ var writer = new DIDLLiteWriter (null);
+ var item = writer.add_item ();
+ item.id = "1";
+ item.parent_id = "-1";
+ item.upnp_class = "object.item";
+ var resource = item.add_resource ();
+ resource.uri = this._uri;
+ var file = File.new_for_uri (this.uri);
+ item.title = file.get_basename ();
+
+ return writer.get_string ();
+ }
}
set {
this._metadata = value;
this.player.metadata = value;
- this.changelog.log ("CurrentTrackMetadata", this.metadata);
}
}
this.player.notify["playback-state"].connect (this.notify_state_cb);
this.player.notify["duration"].connect (this.notify_duration_cb);
this.player.notify["uri"].connect (this.notify_uri_cb);
+ this.player.notify["metadata"].connect (this.notify_meta_data_cb);
this.session = new SessionAsync ();
}
this.changelog.log ("CurrentTrackURI", this.uri);
this.changelog.log ("AVTransportURI", this.uri);
}
+
+ private void notify_meta_data_cb (Object player, ParamSpec p) {
+ this._metadata = this.player.metadata;
+ this.changelog.log ("CurrentTrackMetadata", this.metadata);
+ }
}