mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-29 06:50:59 +00:00
spotifyaudiosrc: use Settings Default to define default props
Makes it easier to change one property's default value. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1074>
This commit is contained in:
parent
51d61af863
commit
77e99e92fb
1 changed files with 9 additions and 7 deletions
|
@ -99,43 +99,45 @@ impl ObjectSubclass for SpotifyAudioSrc {
|
||||||
impl ObjectImpl for SpotifyAudioSrc {
|
impl ObjectImpl for SpotifyAudioSrc {
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
|
let default = Settings::default();
|
||||||
|
|
||||||
vec![glib::ParamSpecString::builder("username")
|
vec![glib::ParamSpecString::builder("username")
|
||||||
.nick("Username")
|
.nick("Username")
|
||||||
.blurb("Spotify device username from https://www.spotify.com/us/account/set-device-password/")
|
.blurb("Spotify device username from https://www.spotify.com/us/account/set-device-password/")
|
||||||
.default_value(Some(""))
|
.default_value(Some(default.username.as_str()))
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecString::builder("password")
|
glib::ParamSpecString::builder("password")
|
||||||
.nick("Password")
|
.nick("Password")
|
||||||
.blurb("Spotify device password from https://www.spotify.com/us/account/set-device-password/")
|
.blurb("Spotify device password from https://www.spotify.com/us/account/set-device-password/")
|
||||||
.default_value(Some(""))
|
.default_value(Some(default.password.as_str()))
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecString::builder("cache-credentials")
|
glib::ParamSpecString::builder("cache-credentials")
|
||||||
.nick("Credentials cache")
|
.nick("Credentials cache")
|
||||||
.blurb("Directory where to cache Spotify credentials")
|
.blurb("Directory where to cache Spotify credentials")
|
||||||
.default_value(Some(""))
|
.default_value(Some(default.cache_credentials.as_str()))
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecString::builder("cache-files")
|
glib::ParamSpecString::builder("cache-files")
|
||||||
.nick("Files cache")
|
.nick("Files cache")
|
||||||
.blurb("Directory where to cache downloaded files from Spotify")
|
.blurb("Directory where to cache downloaded files from Spotify")
|
||||||
.default_value(Some(""))
|
.default_value(Some(default.cache_files.as_str()))
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecUInt64::builder("cache-max-size")
|
glib::ParamSpecUInt64::builder("cache-max-size")
|
||||||
.nick("Cache max size")
|
.nick("Cache max size")
|
||||||
.blurb("The max allowed size of the cache, in bytes, or 0 to disable the cache limit")
|
.blurb("The max allowed size of the cache, in bytes, or 0 to disable the cache limit")
|
||||||
.default_value(0)
|
.default_value(default.cache_max_size)
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecString::builder("track")
|
glib::ParamSpecString::builder("track")
|
||||||
.nick("Spotify URI")
|
.nick("Spotify URI")
|
||||||
.blurb("Spotify track URI, in the form 'spotify:track:$SPOTIFY_ID'")
|
.blurb("Spotify track URI, in the form 'spotify:track:$SPOTIFY_ID'")
|
||||||
.default_value(Some(""))
|
.default_value(Some(default.track.as_str()))
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecEnum::builder::<Bitrate>("bitrate")
|
glib::ParamSpecEnum::builder_with_default::<Bitrate>("bitrate", default.bitrate)
|
||||||
.nick("Spotify bitrate")
|
.nick("Spotify bitrate")
|
||||||
.blurb("Spotify audio bitrate in kbit/s")
|
.blurb("Spotify audio bitrate in kbit/s")
|
||||||
.mutable_ready()
|
.mutable_ready()
|
||||||
|
|
Loading…
Reference in a new issue