X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=mood.c;h=b3f007b68fe07c46f500d1aaa7dffdfe9503f451;hb=a0cd2ac59b891751067512dce77cf6223104932f;hp=e0d9e2750dd65b53f988e9b7ff06b981300cc31f;hpb=46b9e018548fa7baebe62b6c724d215c84dcb20f;p=paraslash.git diff --git a/mood.c b/mood.c index e0d9e275..b3f007b6 100644 --- a/mood.c +++ b/mood.c @@ -163,6 +163,8 @@ static int load_mood(const struct osl_row *mood_row, struct mood **m, PARA_INFO_LOG("opening mood %s\n", mood_name); ret = mp_init(mood_def.data, mood_def.size, &(*m)->parser_context, errmsg); osl_close_disk_object(&mood_def); + if (ret < 0) + destroy_mood(*m); return ret; } @@ -605,8 +607,7 @@ static void compute_correction_factors(int64_t sse) * * If there is already an open mood, it will be closed first. * - * \return Positive on success, negative on errors. Loading the dummy mood - * always succeeds. + * \return Positive on success, negative on errors. * * \sa struct \ref afs_info::last_played, \ref mp_eval_row(). */ @@ -714,9 +715,17 @@ static int reload_current_mood(void) * \param pb Unused. * \param data Its type depends on the event. * - * This function performs actions required due to the occurrence of the given - * event. Possible actions include reload of the current mood and update of the - * score of an audio file. + * This function updates the score table according to the event that has + * occurred. Two actions are possible: (a) reload the current mood, or (b) + * add/remove/update the row of the score table which corresponds to the audio + * file that has been modified or whose afs info has been changed. It depends + * on the type of the event which action (if any) is performed. + * + * The callbacks of command handlers such as com_add() or com_touch() which + * modify the audio file table call this function. The virtual streaming system + * also calls this after it has updated the afs info of the file it is about to + * stream (the one with the highest score). If the file stays admissible, its + * score is recomputed so that a different file is picked next time. * * \return Standard. */