diff options
author | Max Kellermann <max@duempel.org> | 2012-08-08 22:18:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-08-08 22:54:49 +0200 |
commit | d488d796f45a89eb20ef1f8dba6824706e1384d9 (patch) | |
tree | 5c46fe1ed382a6863566c0b1092938c45cfa9d93 /src/player_control.h | |
parent | f794b1e1aac61fd2e6f4758e0cebfcd8d15706be (diff) | |
download | mpd-d488d796f45a89eb20ef1f8dba6824706e1384d9.tar.gz mpd-d488d796f45a89eb20ef1f8dba6824706e1384d9.tar.xz mpd-d488d796f45a89eb20ef1f8dba6824706e1384d9.zip |
player_control: add GError attribute
Rewrite of the pc_get_error_message() function, now using a GError
object instead of the complicated "errored_song" attribute.
Diffstat (limited to 'src/player_control.h')
-rw-r--r-- | src/player_control.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/player_control.h b/src/player_control.h index 228da90fa..8be6c4694 100644 --- a/src/player_control.h +++ b/src/player_control.h @@ -111,12 +111,19 @@ struct player_control { enum player_error error_type; + /** + * The error that occurred in the player thread. This + * attribute is only valid if #error is not + * #PLAYER_ERROR_NONE. The object must be freed when this + * object transitions back to #PLAYER_ERROR_NONE. + */ + GError *error; + uint16_t bit_rate; struct audio_format audio_format; float total_time; float elapsed_time; struct song *next_song; - const struct song *errored_song; double seek_where; float cross_fade_seconds; float mixramp_db; @@ -191,14 +198,6 @@ player_lock_signal(struct player_control *pc) player_unlock(pc); } -/** - * Call this function when the specified song pointer is about to be - * invalidated. This makes sure that player_control.errored_song does - * not point to an invalid pointer. - */ -void -pc_song_deleted(struct player_control *pc, const struct song *song); - void pc_play(struct player_control *pc, struct song *song); @@ -226,6 +225,19 @@ pc_get_state(struct player_control *pc) return pc->state; } +/** + * Set the error. Discards any previous error condition. + * + * Caller must lock the object. + * + * @param type the error type; must not be #PLAYER_ERROR_NONE + * @param error detailed error information; must not be NULL; the + * #player_control takes over ownership of this #GError instance + */ +void +pc_set_error(struct player_control *pc, enum player_error type, + GError *error); + void pc_clear_error(struct player_control *pc); |