Mercurial > audlegacy-plugins
changeset 1567:8c705c0bafcd
automated merge
author | mf0102 <0102@gmx.at> |
---|---|
date | Mon, 03 Sep 2007 01:02:31 +0200 |
parents | f6a052cfa2bb (current diff) 4b2c76a8dda7 (diff) |
children | 8a4fbe599b05 |
files | src/sid/xs_title.c src/sid/xs_title.h |
diffstat | 8 files changed, 59 insertions(+), 340 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sid/Makefile Mon Sep 03 01:01:34 2007 +0200 +++ b/src/sid/Makefile Mon Sep 03 01:02:31 2007 +0200 @@ -30,7 +30,6 @@ xs_glade.c \ xs_interface.c \ xs_stil.c \ - xs_title.c \ xs_fileinfo.c \ xs_filter.c \ xs_sidplay1.cc \
--- a/src/sid/xmms-sid.c Mon Sep 03 01:01:34 2007 +0200 +++ b/src/sid/xmms-sid.c Mon Sep 03 01:02:31 2007 +0200 @@ -33,7 +33,6 @@ #include "xs_config.h" #include "xs_length.h" #include "xs_stil.h" -#include "xs_title.h" #include "xs_filter.h" #include "xs_fileinfo.h" #include "xs_interface.h" @@ -324,7 +323,8 @@ t_xs_tuneinfo *myTune; gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE; gint audioGot, songLength, i; - gchar *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle; + gchar *audioBuffer = NULL, *oversampleBuffer = NULL; + Tuple *tmpTitle; (void) argPointer; @@ -449,6 +449,7 @@ /* Set song information for current subtune */ XSDEBUG("set tune info\n"); myStatus.sidPlayer->plrUpdateSIDInfo(&myStatus); +/* tmpTitle = xs_make_titlestring(myTune, myStatus.currSong); xs_plugin_ip.set_info( @@ -459,7 +460,7 @@ myStatus.audioChannels); g_free(tmpTitle); - +*/ XSDEBUG("playing\n"); /* @@ -931,6 +932,7 @@ } +#ifndef AUDACIOUS_PLUGIN /* Return song information: called by XMMS when initially loading the playlist. * Subsequent changes to information are made by the player thread, * which uses xs_plugin_ip.set_info(); @@ -966,48 +968,54 @@ XS_MUTEX_UNLOCK(xs_status); } +#else -t_xs_tuple * xs_get_song_tuple(gchar *songFilename) +Tuple * xs_get_song_tuple(gchar *songFilename) { t_xs_tuneinfo *pInfo; - t_xs_tuple *pResult = NULL; + Tuple *pResult; + gchar *tmpStr; XS_MUTEX_LOCK(xs_status); + pResult = tuple_new_from_filename(songFilename); + /* Get tune information from emulation engine */ pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); if (!pInfo) { XS_MUTEX_UNLOCK(xs_status); - return NULL; + return pResult; } + tuple_associate_string(pResult, "title", pInfo->sidName); + tuple_associate_string(pResult, "artist", pInfo->sidComposer); + tuple_associate_int(pResult, "track-number", pInfo->startTune); + tuple_associate_string(pResult, "genre", "SID-tune"); + tuple_associate_string(pResult, "copyright", pInfo->sidCopyright); + tuple_associate_string(pResult, "format", pInfo->sidFormat); + tuple_associate_int(pResult, "subtunes", pInfo->nsubTunes); + + switch (pInfo->sidModel) { + case XS_SIDMODEL_6581: tmpStr = "6581"; break; + case XS_SIDMODEL_8580: tmpStr = "8580"; break; + case XS_SIDMODEL_ANY: tmpStr = "ANY"; break; + default: tmpStr = "?"; break; + } + tuple_associate_string(pResult, "sid-model", tmpStr); + /* Get sub-tune information, if available */ if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { - gint tmpInt; + gint tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; + tuple_associate_int(pResult, "length", (tmpInt < 0) ? -1 : tmpInt * 1000); - pResult = xs_make_titletuple(pInfo, pInfo->startTune); - - tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; -#ifdef AUDACIOUS_PLUGIN - if (tmpInt < 0) - tuple_associate_int(pResult, "length", -1); - else - tuple_associate_int(pResult, "length", tmpInt * 1000); -#else - if (tmpInt < 0) - pResult->length = -1; - else - pResult->length = (tmpInt * 1000); -#endif } /* Free tune information */ xs_tuneinfo_free(pInfo); - XS_MUTEX_UNLOCK(xs_status); - return pResult; } +#endif /* Allocate a new tune information structure
--- a/src/sid/xmms-sid.h Mon Sep 03 01:01:34 2007 +0200 +++ b/src/sid/xmms-sid.h Mon Sep 03 01:02:31 2007 +0200 @@ -30,29 +30,6 @@ #endif /* - * Standard gettext macros. - */ -#ifdef ENABLE_NLS -# include <libintl.h> -# undef _ -# define _(String) dgettext (PACKAGE, String) -# ifdef gettext_noop -# define N_(String) gettext_noop (String) -# else -# define N_(String) (String) -# endif -#else -# define textdomain(String) (String) -# define gettext(String) (String) -# define dgettext(Domain,Message) (Message) -# define dcgettext(Domain,Message,Type) (Message) -# define bindtextdomain(Domain,Directory) (Domain) -# define _(String) (String) -# define N_(String) (String) -#endif - - -/* * Some constants and defines */ /* #define to enable spurious debugging messages for development @@ -188,8 +165,7 @@ void xs_pause(InputPlayback *, short); void xs_seek(InputPlayback *, gint); gint xs_get_time(InputPlayback *); -void xs_get_song_info(gchar *, gchar **, gint *); -t_xs_tuple *xs_get_song_tuple(gchar *); +Tuple * xs_get_song_tuple(gchar *); void xs_about(void);
--- a/src/sid/xs_config.c Mon Sep 03 01:01:34 2007 +0200 +++ b/src/sid/xs_config.c Mon Sep 03 01:02:31 2007 +0200 @@ -551,7 +551,7 @@ gint i; gfloat tmpValue; gint tmpInt; - gchar *tmpStr; + const gchar *tmpStr; /* Get lock on configuration */ XS_MUTEX_LOCK(xs_cfg);
--- a/src/sid/xs_init.c Mon Sep 03 01:01:34 2007 +0200 +++ b/src/sid/xs_init.c Mon Sep 03 01:02:31 2007 +0200 @@ -48,14 +48,16 @@ NULL, /* OBSOLETE! */ NULL, /* Send data to Visualization plugin */ NULL, NULL, /* FILLED BY XMMS */ - xs_get_song_info, /* Get song title and length */ + NULL, /* Get song title and length */ xs_fileinfo, /* Show file-information dialog */ NULL, /* FILLED BY XMMS */ - xs_get_song_tuple, /* Tuple */ - NULL, /* Tuple */ + xs_get_song_tuple, /* Get Tuple */ + NULL, /* Set Tuple */ NULL, /* Buffering status */ xs_is_our_file_vfs, /* VFS */ - xs_sid_fmts /* File ext assist */ + xs_sid_fmts, /* File ext assist */ + NULL, /* ms accurate seek, mseek() */ + NULL /* Probe for tuple */ }; InputPlugin *sid_iplist[] = { &xs_plugin_ip, NULL };
--- a/src/sid/xs_support.h Mon Sep 03 01:01:34 2007 +0200 +++ b/src/sid/xs_support.h Mon Sep 03 01:02:31 2007 +0200 @@ -43,13 +43,29 @@ #endif -/* Metadata structures */ -#ifdef AUDACIOUS_PLUGIN -#define t_xs_tuple Tuple +/* Standard gettext macros + */ +#ifdef ENABLE_NLS +# include <libintl.h> +# undef _ +# define _(String) dgettext (PACKAGE, String) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif #else -#define t_xs_tuple TitleInput +# define _LIBINTL_H +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define N_(String) (String) #endif + /* VFS replacement functions */ #ifdef __AUDACIOUS_NEWVFS__
--- a/src/sid/xs_title.c Mon Sep 03 01:01:34 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/* - XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) - - Titlestring handling - - Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> - (C) Copyright 1999-2007 Tecnic Software productions (TNSP) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include "xs_title.h" -#include "xs_support.h" -#include "xs_config.h" - -static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt) -{ - gchar *tmpStr; - - /* Split the filename into path */ - *tmpFilePath = g_strdup(path); - tmpStr = xs_strrchr(*tmpFilePath, '/'); - if (tmpStr) tmpStr[1] = 0; - - /* Filename */ - *tmpFilename = xs_strrchr(path, '/'); - if (*tmpFilename) - *tmpFilename = g_strdup(*tmpFilename + 1); - else - *tmpFilename = g_strdup(path); - - tmpStr = xs_strrchr(*tmpFilename, '.'); - tmpStr[0] = 0; - - /* Extension */ - *tmpFileExt = xs_strrchr(path, '.'); -} - - -#if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN) -/* Tuple support - */ -static t_xs_tuple * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath, - gchar *tmpFileExt, t_xs_tuneinfo *p, gint subTune) -{ - t_xs_tuple *pResult; - -#ifdef AUDACIOUS_PLUGIN - pResult = tuple_new(); - tuple_associate_string(pResult, "title", p->sidName); - tuple_associate_string(pResult, "artist", p->sidComposer); - tuple_associate_string(pResult, "file-name", tmpFilename); - tuple_associate_string(pResult, "file-ext", tmpFileExt); - tuple_associate_string(pResult, "file-path", tmpFilePath); - tuple_associate_int(pResult, "track-number", subTune); - tuple_associate_string(pResult, "genre", "SID-tune"); - tuple_associate_string(pResult, "comment", p->sidCopyright); -#else - pResult = (TitleInput *) g_malloc0(sizeof(TitleInput)); - pResult->__size = XMMS_TITLEINPUT_SIZE; - pResult->__version = XMMS_TITLEINPUT_VERSION; - - /* Create the input fields */ - pResult->file_name = tmpFilename; - pResult->file_ext = tmpFileExt; - pResult->file_path = tmpFilePath; - - pResult->track_name = g_strdup(p->sidName); - pResult->track_number = subTune; - pResult->album_name = NULL; - pResult->performer = g_strdup(p->sidComposer); - pResult->date = g_strdup((p->sidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580"); - - pResult->year = 0; - pResult->genre = g_strdup("SID-tune"); - pResult->comment = g_strdup(p->sidCopyright); -#endif - return pResult; -} - -#ifdef AUDACIOUS_PLUGIN -t_xs_tuple * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune) -{ - gchar *tmpFilename, *tmpFilePath, *tmpFileExt; - - xs_path_split(p->sidFilename, &tmpFilename, &tmpFilePath, &tmpFileExt); - - return xs_get_titletuple(tmpFilename, tmpFilePath, tmpFileExt, p, subTune); -} -#endif -#endif - - -/* - * Create a title string based on given information and settings. - */ -#define VPUTCH(MCH) \ - if (iIndex < XS_BUF_SIZE) tmpBuf[iIndex++] = MCH; - -#define VPUTSTR(MSTR) { \ - if (MSTR) { \ - if ((iIndex + strlen(MSTR) + 1) < XS_BUF_SIZE) { \ - strcpy(&tmpBuf[iIndex], MSTR); \ - iIndex += strlen(MSTR); \ - } else \ - iIndex = XS_BUF_SIZE; \ - } \ -} - - -gchar *xs_make_titlestring(t_xs_tuneinfo *p, gint subTune) -{ - gchar *tmpFilename, *tmpFilePath, *tmpFileExt, - *pcStr, *pcResult, tmpStr[XS_BUF_SIZE], tmpBuf[XS_BUF_SIZE]; - t_xs_subtuneinfo *subInfo; - gint iIndex; - - /* Get filename parts */ - xs_path_split(p->sidFilename, &tmpFilename, - &tmpFilePath, &tmpFileExt); - - /* Get sub-tune information */ - if ((subTune > 0) && (subTune <= p->nsubTunes)) { - subInfo = &(p->subTunes[subTune - 1]); - } else - subInfo = NULL; - - - /* Check if the titles are overridden or not */ -#if defined(AUDACIOUS_PLUGIN) - if (!xs_cfg.titleOverride) { - t_xs_tuple *pTuple = xs_get_titletuple( - tmpFilename, tmpFilePath, tmpFileExt, p, subTune); - pcResult = tuple_formatter_make_title_string(pTuple, get_gentitle_format()); - tuple_free(pTuple); - } else -#elif defined(HAVE_XMMSEXTRA) - if (!xs_cfg.titleOverride) { - t_xs_tuple *pTuple = xs_get_titletuple( - tmpFilename, tmpFilePath, tmpFileExt, p, subTune); - - pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple); - - g_free(pTuple->track_name); - g_free(pTuple->album_name); - g_free(pTuple->performer); - g_free(pTuple->date); - g_free(pTuple->genre); - g_free(pTuple->comment); - g_free(pTuple); - } else -#endif - { - /* Create the string */ - pcStr = xs_cfg.titleFormat; - iIndex = 0; - while (*pcStr && (iIndex < XS_BUF_SIZE)) { - if (*pcStr == '%') { - pcStr++; - switch (*pcStr) { - case '%': - VPUTCH('%'); - break; - case 'f': - VPUTSTR(tmpFilename); - break; - case 'F': - VPUTSTR(tmpFilePath); - break; - case 'e': - VPUTSTR(tmpFileExt); - break; - case 'p': - VPUTSTR(p->sidComposer); - break; - case 't': - VPUTSTR(p->sidName); - break; - case 'c': - VPUTSTR(p->sidCopyright); - break; - case 's': - VPUTSTR(p->sidFormat); - break; - case 'm': - switch (p->sidModel) { - case XS_SIDMODEL_6581: - VPUTSTR("6581"); - break; - case XS_SIDMODEL_8580: - VPUTSTR("8580"); - break; - case XS_SIDMODEL_ANY: - VPUTSTR("ANY"); - break; - default: - VPUTSTR("?"); - break; - } - break; - case 'C': - if (subInfo && (subInfo->tuneSpeed > 0)) { - switch (subInfo->tuneSpeed) { - case XS_CLOCK_PAL: - VPUTSTR("PAL"); - break; - case XS_CLOCK_NTSC: - VPUTSTR("NTSC"); - break; - case XS_CLOCK_ANY: - VPUTSTR("ANY"); - break; - case XS_CLOCK_VBI: - VPUTSTR("VBI"); - break; - case XS_CLOCK_CIA: - VPUTSTR("CIA"); - break; - default: - g_snprintf(tmpStr, XS_BUF_SIZE, - "%iHz", subInfo->tuneSpeed); - VPUTSTR(tmpStr); - } - } else - VPUTSTR("?"); - break; - case 'n': - g_snprintf(tmpStr, XS_BUF_SIZE, "%i", subTune); - VPUTSTR(tmpStr); - break; - case 'N': - g_snprintf(tmpStr, XS_BUF_SIZE, "%i", p->nsubTunes); - VPUTSTR(tmpStr); - break; - } - } else - VPUTCH(*pcStr); - - pcStr++; - } - - tmpBuf[iIndex] = 0; - - /* Make resulting string */ - pcResult = g_strdup(tmpBuf); - } - - /* Free temporary strings */ - g_free(tmpFilename); - g_free(tmpFilePath); - - return pcResult; -}
--- a/src/sid/xs_title.h Mon Sep 03 01:01:34 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#ifndef XS_TITLE_H -#define XS_TITLE_H - -#include "xmms-sid.h" - -#ifdef __cplusplus -extern "C" { -#endif - -gchar *xs_make_titlestring(t_xs_tuneinfo *, gint); -#ifdef AUDACIOUS_PLUGIN -t_xs_tuple *xs_make_titletuple(t_xs_tuneinfo *p, gint subTune); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* XS_TITLE_H */