Mercurial > hg > xmms-sid
changeset 464:08038c161936
Accomodate the changes in xs_make_titlestring(), xs_tuneinfo_*() and
plrIsOurFile() functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Jan 2007 03:41:04 +0000 |
parents | ad3b2c874780 |
children | ba98fdac6307 |
files | src/xmms-sid.c |
diffstat | 1 files changed, 27 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xmms-sid.c Thu Jan 25 03:40:02 2007 +0000 +++ b/src/xmms-sid.c Thu Jan 25 03:41:04 2007 +0000 @@ -64,8 +64,8 @@ xs_sidplay1_isourfile, xs_sidplay1_init, xs_sidplay1_close, xs_sidplay1_initsong, xs_sidplay1_fillbuffer, - xs_sidplay1_loadsid, xs_sidplay1_deletesid, - xs_sidplay1_getsidinfo + xs_sidplay1_load, xs_sidplay1_delete, + xs_sidplay1_getinfo, xs_sidplay1_updateinfo }, #endif #ifdef HAVE_SIDPLAY2 @@ -73,8 +73,8 @@ xs_sidplay2_isourfile, xs_sidplay2_init, xs_sidplay2_close, xs_sidplay2_initsong, xs_sidplay2_fillbuffer, - xs_sidplay2_loadsid, xs_sidplay2_deletesid, - xs_sidplay2_getsidinfo + xs_sidplay2_load, xs_sidplay2_delete, + xs_sidplay2_getinfo, xs_sidplay2_updateinfo }, #endif }; @@ -254,7 +254,7 @@ /* * Check whether the given file is handled by this plugin */ -gint xs_is_our_file(gchar * pcFilename) +gint xs_is_our_file(gchar *pcFilename) { gchar *pcExt; assert(xs_status.sidPlayer); @@ -264,8 +264,14 @@ return FALSE; /* Try to detect via detection routine, if required */ - if (xs_cfg.detectMagic && xs_status.sidPlayer->plrIsOurFile(pcFilename)) - return TRUE; + if (xs_cfg.detectMagic) { + t_xs_file *f; + if ((f = xs_fopen(pcFilename, "rb")) != NULL) { + if (xs_status.sidPlayer->plrIsOurFile(f)) + return TRUE; + xs_fclose(f); + } + } /* Detect just by checking filename extension */ pcExt = xs_strrchr(pcFilename, '.'); @@ -301,7 +307,7 @@ t_xs_tuneinfo *myTune; gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE; gint audioGot, songLength, i; - gchar *audioBuffer = NULL, *oversampleBuffer = NULL; + gchar *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle; (void) argPointer; @@ -428,13 +434,17 @@ /* Set song information for current subtune */ XSDEBUG("set tune info\n"); - xs_plugin_ip.set_info(myTune->subTunes[myStatus.currSong-1].tuneTitle, + tmpTitle = xs_make_titlestring(myTune, myStatus.currSong); + + xs_plugin_ip.set_info( + tmpTitle, (songLength > 0) ? (songLength * 1000) : 0, - (myTune->subTunes[myStatus.currSong-1].tuneSpeed > 0) ? - (myTune->subTunes[myStatus.currSong-1].tuneSpeed * 1000) : -1, - myStatus.audioFrequency, myStatus.audioChannels); - - + (myTune->subTunes[myStatus.currSong-1].tuneSpeed > 0) ? (myTune->subTunes[myStatus.currSong-1].tuneSpeed * 1000) : -1, + myStatus.audioFrequency, + myStatus.audioChannels); + + g_free(tmpTitle); + XSDEBUG("playing\n"); /* @@ -933,7 +943,7 @@ if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { gint tmpInt; - (*songTitle) = g_strdup(pInfo->subTunes[pInfo->startTune-1].tuneTitle); + (*songTitle) = xs_make_titlestring(pInfo, pInfo->startTune); tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; if (tmpInt < 0) @@ -953,8 +963,7 @@ gint nsubTunes, gint startTune, const gchar * sidName, const gchar * sidComposer, const gchar * sidCopyright, gint loadAddr, gint initAddr, gint playAddr, - gint dataFileLen, const gchar *sidFormat, - gint sidModel, gint songSpeed, gint clockSpeed) + gint dataFileLen, const gchar *sidFormat, gint sidModel) { t_xs_tuneinfo *pResult; t_xs_sldb_node *tmpLength; @@ -1002,8 +1011,6 @@ pResult->sidFormat = g_strdup(sidFormat); pResult->sidModel = sidModel; - pResult->songSpeed = songSpeed; - pResult->clockSpeed = clockSpeed; /* Get length information (NOTE: Do not free this!) */ tmpLength = xs_songlen_get(pcFilename); @@ -1015,7 +1022,7 @@ else pResult->subTunes[i].tuneLength = -1; - pResult->subTunes[i].tuneTitle = xs_make_titlestring(pResult, i); + pResult->subTunes[i].tuneSpeed = -1; } return pResult; @@ -1026,15 +1033,8 @@ */ void xs_tuneinfo_free(t_xs_tuneinfo * pTune) { - gint i; - if (!pTune) return; - for (i = 1; i < pTune->nsubTunes; i++) { - g_free(pTune->subTunes[i].tuneTitle); - pTune->subTunes[i].tuneTitle = NULL; - } - g_free(pTune->subTunes); g_free(pTune->sidFilename); g_free(pTune->sidName);