Mercurial > audlegacy-plugins
diff src/madplug/input.c @ 797:19e08e104ba6 trunk
[svn] - madplug: do not call set_info repeatedly in input_process_remote_metadata, only call it when the built title string actually differs from the previous one
| author | giacomo |
|---|---|
| date | Thu, 08 Mar 2007 09:24:04 -0800 |
| parents | 91d2b302f479 |
| children | d200de50a1fc |
line wrap: on
line diff
--- a/src/madplug/input.c Thu Mar 08 04:20:23 2007 -0800 +++ b/src/madplug/input.c Thu Mar 08 09:24:04 2007 -0800 @@ -92,6 +92,7 @@ info->mode = 0; info->title = 0; info->offset = 0; + info->prev_title = NULL; info->replaygain_album_str = 0; info->replaygain_track_str = 0; @@ -485,9 +486,18 @@ else tmp = g_strdup(g_basename(info->filename)); - mad_plugin->set_info(tmp, - -1, // indicate the stream is unseekable - info->bitrate, info->freq, info->channels); + /* call set_info only if tmp is different from prev_tmp */ + if ( ( ( info->prev_title != NULL ) && ( strcmp(info->prev_title,tmp) ) ) || + ( info->prev_title == NULL ) ) + { + mad_plugin->set_info(tmp, + -1, // indicate the stream is unseekable + info->bitrate, info->freq, info->channels); + if (info->prev_title) + g_free(info->prev_title); + info->prev_title = g_strdup(tmp); + } + g_free(tmp); } } @@ -610,6 +620,9 @@ info->tuple = NULL; } + if (info->prev_title) + g_free(info->prev_title); + /* set everything to zero in case it gets used again. */ memset(info, 0, sizeof(struct mad_info_t)); #ifdef DEBUG
