Commit 22e8abfa authored by Led's avatar Led

0.11.2

parent 521703d6
ver 0.11.2 (2004/7/5)
1) Work around in computing total time for mp3's whose first valid mpeg frame is not layer III
2) Fix mp3 and mp4 decoders when seeking past the end of the file
3) Fix replaygain for flac and vorbis
4) Fix memory leaks in flac decoder (from normalperson)
5) Fix Several other bugs in playlist.c and directory.c (from normalperson)
ver 0.11.1 (2004/6/24)
1) Fix a bug that caused "popping" at the beginning of mp3's
2) Fix playlistid command
......
0.12
----
*) Optimize read() on cleints
*) directory.c needs some serious cleanup
*) Add libshout && vorbis encoding support
0.12
----
*) add command that only takes file's or url's (no directory's) and returns the songid of the added song
*) allow add commands to specify position to be inserted
*) saved playlist commands for getting the contents of a playlist and appending to a playlist
*) have listallinfo return directories
*) allow find/search commands take arbitrary search pairs
Post-1.0
--------
1) crosslink "list" stuff, for example, artists are crosslinked to alubms and
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for mpd 0.11.1.
# Generated by GNU Autoconf 2.59 for mpd 0.11.2.
#
# Report bugs to <shank@mercury.chem.pitt.edu>.
#
......@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='mpd'
PACKAGE_TARNAME='mpd'
PACKAGE_VERSION='0.11.1'
PACKAGE_STRING='mpd 0.11.1'
PACKAGE_VERSION='0.11.2'
PACKAGE_STRING='mpd 0.11.2'
PACKAGE_BUGREPORT='shank@mercury.chem.pitt.edu'
# Factoring default headers for most tests.
......@@ -955,7 +955,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures mpd 0.11.1 to adapt to many kinds of systems.
\`configure' configures mpd 0.11.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1021,7 +1021,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of mpd 0.11.1:";;
short | recursive ) echo "Configuration of mpd 0.11.2:";;
esac
cat <<\_ACEOF
......@@ -1207,7 +1207,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
mpd configure 0.11.1
mpd configure 0.11.2
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
......@@ -1221,7 +1221,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by mpd $as_me 0.11.1, which was
It was created by mpd $as_me 0.11.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
......@@ -26085,7 +26085,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by mpd $as_me 0.11.1, which was
This file was extended by mpd $as_me 0.11.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -26148,7 +26148,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
mpd config.status 0.11.1
mpd config.status 0.11.2
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
......@@ -2,7 +2,7 @@ dnl AC_INIT(src/main.c)
dnl AM_INIT_AUTOMAKE(mpd, 0.10.0)
AC_PREREQ(2.52)
AC_INIT(mpd, 0.11.1, shank@mercury.chem.pitt.edu)
AC_INIT(mpd, 0.11.2, shank@mercury.chem.pitt.edu)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
dnl MAD wants this stuff
......
......@@ -136,7 +136,7 @@ playlistinfo <int song>
displays list of songs in the playlist
_song_ is optional and species a single song to displa info for
playlistiid <int songid>
playlistid <int songid>
displays list of songs in the playlist
_songid_ is optional and species a single song to display info for
......
bin_PROGRAMS = mpd
SUBDIRS = $(ID3_SUBDIR) $(MAD_SUBDIR) $(MP4FF_SUBDIR)
mpd_inputPlugins = inputPlugins/mp3_plugin.c inputPlugins/ogg_plugin.c \
inputPlugins/flac_plugin.c inputPlugins/audiofile_plugin.c \
inputPlugins/mp4_plugin.c inputPlugins/aac_plugin.c \
inputPlugins/mod_plugin.c
mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
song.h list.h directory.h tables.h utils.h path.h \
tag.h player.h listen.h conf.h volume.h \
audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h \
charConv.h permission.h mpd_types.h pcm_utils.h \
signal_check.h utf8.h inputStream.h \
outputBuffer.h replayGain.h inputStream_file.h inputStream_http.h \
inputPlugin.h metadataChunk.h ack.h
mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
song.c list.c directory.c tables.c utils.c path.c \
tag.c player.c listen.c conf.c volume.c \
audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c \
charConv.c permission.c pcm_utils.c \
signal_check.c utf8.c inputStream.c outputBuffer.c \
replayGain.c inputStream_file.c inputStream_http.c inputPlugin.c \
metadataChunk.c $(mpd_headers) $(mpd_inputPlugins)
mpd_inputPlugins = \
inputPlugins/aac_plugin.c \
inputPlugins/audiofile_plugin.c \
inputPlugins/flac_plugin.c \
inputPlugins/mod_plugin.c \
inputPlugins/mp3_plugin.c \
inputPlugins/mp4_plugin.c \
inputPlugins/ogg_plugin.c
mpd_headers = \
ack.h \
audio.h \
buffer2array.h \
charConv.h \
command.h \
conf.h \
decode.h \
directory.h \
inputPlugin.h \
inputStream.h \
inputStream_file.h \
inputStream_http.h \
interface.h \
list.h \
listen.h \
log.h \
ls.h \
metadataChunk.h \
mpd_types.h \
myfprintf.h \
outputBuffer.h \
path.h \
pcm_utils.h \
permission.h \
player.h \
playerData.h \
playlist.h \
replayGain.h \
signal_check.h \
sig_handlers.h \
song.h \
stats.h \
tag.h \
tables.h \
utf8.h \
utils.h \
volume.h
mpd_SOURCES = \
$(mpd_headers) \
$(mpd_inputPlugins) \
audio.c \
buffer2array.c \
charConv.c \
command.c \
conf.c \
decode.c \
directory.c \
inputPlugin.c \
inputStream.c \
inputStream_file.c \
inputStream_http.c \
interface.c \
list.c \
listen.c \
log.c \
ls.c \
main.c \
metadataChunk.c \
myfprintf.c \
outputBuffer.c \
path.c \
pcm_utils.c \
permission.c \
player.c \
playerData.c \
playlist.c \
replayGain.c \
sig_handlers.c \
signal_check.c \
song.c \
stats.c \
tables.c \
tag.c \
utils.c \
volume.c \
utf8.c
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_LDADD = $(MPD_LIBS) $(ID3_LIB) $(MAD_LIB) $(MP4FF_LIB)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -151,11 +151,11 @@ void directory_sigChldHandler(int pid, int status) {
{
case DIRECTORY_UPDATE_EXIT_UPDATE:
directory_reReadDB = 1;
DEBUG("direcotry_sigChldHandler: "
DEBUG("directory_sigChldHandler: "
"updated db\n");
case DIRECTORY_UPDATE_EXIT_NOUPDATE:
DEBUG("direcotry_sigChldHandler: "
"update exitted succesffully\n");
DEBUG("directory_sigChldHandler: "
"update exited succesffully\n");
break;
default:
ERROR("error updating db\n");
......
......@@ -70,9 +70,11 @@ FLAC__SeekableStreamDecoderLengthStatus flacLength(
FLAC__bool flacEOF(const FLAC__SeekableStreamDecoder *, void *);
int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
FLAC__SeekableStreamDecoder * flacDec;
FLAC__SeekableStreamDecoder * flacDec = NULL;
FlacData data;
int status = 1;
int ret =0;
int streamOpen = 0;
data.chunk_length = 0;
data.time = 0;
......@@ -85,10 +87,15 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
if(openInputStream(&(data.inStream), path)<0) {
ERROR("unable to open flac: %s\n", path);
return -1;
ret = -1;
goto fail;
}
streamOpen = 1;
if(!(flacDec = FLAC__seekable_stream_decoder_new())) return -1;
if(!(flacDec = FLAC__seekable_stream_decoder_new())) {
ret = -1;
goto fail;
}
/*status&=FLAC__file_decoder_set_md5_checking(flacDec,1);*/
status&=FLAC__seekable_stream_decoder_set_read_callback(flacDec,
flacRead);
......@@ -103,6 +110,8 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
flacWrite);
status&=FLAC__seekable_stream_decoder_set_metadata_callback(flacDec,
flacMetadata);
status&=FLAC__seekable_stream_decoder_set_metadata_respond(flacDec,
FLAC__METADATA_TYPE_VORBIS_COMMENT);
status&=FLAC__seekable_stream_decoder_set_error_callback(flacDec,
flacError);
status&=FLAC__seekable_stream_decoder_set_client_data(flacDec,
......@@ -112,8 +121,8 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_delete(flacDec);
return -1;
ret = -1;
goto fail;
}
if(FLAC__seekable_stream_decoder_init(flacDec)!=
......@@ -123,8 +132,8 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_delete(flacDec);
return -1;
ret = -1;
goto fail;
}
if(!FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDec)) {
......@@ -132,8 +141,8 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_delete(flacDec);
return -1;
ret = -1;
goto fail;
}
dc->state = DECODE_STATE_DECODE;
......@@ -168,7 +177,6 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
path);
FLAC__seekable_stream_decoder_finish(flacDec);
}
FLAC__seekable_stream_decoder_delete(flacDec);
/* send last little bit */
if(data.chunk_length>0 && !dc->stop) {
flacSendChunk(&data);
......@@ -186,7 +194,12 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
}
else dc->state = DECODE_STATE_STOP;
return 0;
fail:
if(streamOpen) closeInputStream(&(data.inStream));
if(flacDec) FLAC__seekable_stream_decoder_delete(flacDec);
return ret;
}
FLAC__SeekableStreamDecoderReadStatus flacRead(
......@@ -576,4 +589,3 @@ InputPlugin flacPlugin =
};
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
......@@ -238,7 +238,7 @@ char * modSuffixes[] = {"amf",
InputPlugin modPlugin =
{
"audiofile",
"mod",
NULL,
mod_finishMikMod,
NULL,
......
......@@ -297,6 +297,9 @@ int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag) {
}
}
}
if(data->frame.header.layer != MAD_LAYER_III) {
return DECODE_SKIP;
}
return DECODE_OK;
}
......@@ -706,14 +709,15 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) {
data.elapsedTime,data.bitRate/1000);
}
flushOutputBuffer(cb);
mp3DecodeDataFinalize(&data);
closeInputStream(inStream);
/*if(dc->seek) {
dc->seekError = 1;
if(dc->seek && data.muteFrame == MUTEFRAME_SEEK) {
clearOutputBuffer(cb);
dc->seek = 0;
}*/
}
flushOutputBuffer(cb);
mp3DecodeDataFinalize(&data);
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......
......@@ -112,6 +112,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
long offset;
mpd_uint16 bitRate = 0;
InputStream inStream;
int seeking = 0;
if(openInputStream(&inStream, path) < 0) {
ERROR("failed to open %s\n", path);
......@@ -193,7 +194,9 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
seekTable = malloc(sizeof(float)*numSamples);
for(sampleId=0; sampleId<numSamples && !eof; sampleId++) {
if(dc->seek && seekTableEnd>1 &&
if(dc->seek) seeking = 1;
if(seeking && seekTableEnd>1 &&
seekTable[seekTableEnd]>=dc->seekWhere)
{
int i = 2;
......@@ -215,15 +218,16 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
else dur-=offset;
time+=((float)dur)/scale;
if(dc->seek && time>dc->seekWhere) seekPositionFound = 1;
if(seeking && time>dc->seekWhere) seekPositionFound = 1;
if(dc->seek && seekPositionFound) {
if(seeking && seekPositionFound) {
seekPositionFound = 0;
clearOutputBuffer(cb);
seeking = 0;
dc->seek = 0;
}
if(dc->seek) continue;
if(seeking) continue;
if(mp4ff_read_sample(mp4fh,track,sampleId,&mp4Buffer,
&mp4BufferSize) == 0)
......@@ -287,8 +291,6 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
}
}
flushOutputBuffer(cb);
free(seekTable);
faacDecClose(decoder);
mp4ff_close(mp4fh);
......@@ -297,10 +299,11 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
if(dc->state != DECODE_STATE_DECODE) return -1;
/*if(dc->seek) {
dc->seekError = 1;
if(dc->seek && seeking) {
clearOutputBuffer(cb);
dc->seek = 0;
}*/
}
flushOutputBuffer(cb);
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......
......@@ -157,8 +157,12 @@ float ogg_getReplayGainScale(char ** comments) {
if(albumGainFound) {
return computeReplayGainScale(albumGain,albumPeak);
}
default:
return computeReplayGainScale(trackGain,trackPeak);
case REPLAYGAIN_TRACK:
if(trackGainFound) {
return computeReplayGainScale(trackGain,trackPeak);
}
return computeReplayGainScale(albumGain,albumPeak);
}
return 1.0;
......@@ -313,7 +317,7 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
if((test = ov_bitrate_instant(&vf))>0) {
bitRate = test/1000;
}
doReplayGain(chunk,ret,&(dc->audioFormat),
doReplayGain(chunk,chunkpos,&(dc->audioFormat),
replayGainScale);
sendDataToOutputBuffer(cb, inStream, dc,
inStream->seekable,
......
......@@ -168,11 +168,14 @@ int lsPlaylists(FILE * fp, char * utf8path) {
free(path);
if(list) {
int i;
sortList(list);
dup = malloc(strlen(utf8path)+2);
strcpy(dup,utf8path);
while(dup[strlen(dup)-1]=='/') dup[strlen(dup)-1] = '\0';
for(i = strlen(dup)-1; i >= 0 && dup[i]=='/'; i--) {
dup[i] = '\0';
}
if(strlen(dup)) strcat(dup,"/");
node = list->firstNode;
......
......@@ -31,11 +31,7 @@ static mpd_sint8 currentMetaChunk = -1;
static mpd_sint8 sendMetaChunk = 0;
void clearAllMetaChunkSets(OutputBuffer * cb) {
int i;
for(i=0; i<BUFFERED_METACHUNKS; i++) {
cb->metaChunkSet[i] = 0;
}
memset(cb->metaChunkSet, 0, BUFFERED_METACHUNKS);
}
void clearOutputBuffer(OutputBuffer * cb) {
......
......@@ -480,7 +480,6 @@ Song * playerCurrentDecodeSong() {
memcpy(prev, &(pc->metadataChunk), sizeof(MetadataChunk));
if(song) freeJustSong(song);
song = newNullSong();
if(song->utf8url) free(song->utf8url);
song->utf8url = strdup(pc->currentUrl);
song->tag = metadataChunkToMpdTagDup(prev);
validateUtf8Tag(song->tag);
......
......@@ -65,8 +65,8 @@ typedef struct _Playlist {
/* holds version a song was modified on */
mpd_uint32 * songMod;
int * order;
int * numToId;
int * idToNum;
int * positionToId;
int * idToPosition;
int length;
int current;
int queued;
......@@ -161,9 +161,9 @@ void initPlaylist() {
playlist.songs = malloc(sizeof(Song *)*playlist_max_length);
playlist.songMod = malloc(sizeof(mpd_uint32)*playlist_max_length);
playlist.order = malloc(sizeof(int)*playlist_max_length);
playlist.idToNum = malloc(sizeof(int)*playlist_max_length*
playlist.idToPosition = malloc(sizeof(int)*playlist_max_length*
PLAYLIST_HASH_MULT);
playlist.numToId = malloc(sizeof(int)*playlist_max_length);
playlist.positionToId = malloc(sizeof(int)*playlist_max_length);
memset(playlist.songs,0,sizeof(char *)*playlist_max_length);
......@@ -174,14 +174,14 @@ void initPlaylist() {
}
for(i=0; i<playlist_max_length*PLAYLIST_HASH_MULT; i++) {
playlist.idToNum[i] = -1;
playlist.idToPosition[i] = -1;
}
}
static int getNextId() {
static int cur = 0;
while(playlist.idToNum[cur] != -1) {
while(playlist.idToPosition[cur] != -1) {
cur++;
if(cur >= playlist_max_length*PLAYLIST_HASH_MULT) {
cur = 0;
......@@ -207,10 +207,10 @@ void finishPlaylist() {
playlist.songMod = NULL;
free(playlist.order);
playlist.order = NULL;
free(playlist.idToNum);
playlist.idToNum = NULL;
free(playlist.numToId);
playlist.numToId = NULL;
free(playlist.idToPosition);
playlist.idToPosition = NULL;
free(playlist.positionToId);
playlist.positionToId = NULL;
}
int clearPlaylist(FILE * fp) {
......@@ -222,7 +222,7 @@ int clearPlaylist(FILE * fp) {
if(playlist.songs[i]->type == SONG_TYPE_URL) {
freeJustSong(playlist.songs[i]);
}
playlist.idToNum[playlist.numToId[i]] = -1;
playlist.idToPosition[playlist.positionToId[i]] = -1;
playlist.songs[i] = NULL;
}
playlist.length = 0;
......@@ -425,7 +425,7 @@ void printPlaylistSongInfo(FILE * fp, int song) {
printMpdTag(fp, tag);
}
myfprintf(fp, "Pos: %i\n", song);
myfprintf(fp, "Id: %i\n", playlist.numToId[song]);
myfprintf(fp, "Id: %i\n", playlist.positionToId[song]);
}
int playlistChanges(FILE * fp, mpd_uint32 version) {
......@@ -465,7 +465,7 @@ int playlistInfo(FILE * fp, int song) {
# define checkSongId(id) { \
if(id < 0 || id >= PLAYLIST_HASH_MULT*playlist_max_length || \
playlist.idToNum[id] == -1 ) \
playlist.idToPosition[id] == -1 ) \
{ \
commandError(fp, ACK_ERROR_NO_EXIST, \
"song id doesn't exist: \"%i\"", id); \
......@@ -480,7 +480,7 @@ int playlistId(FILE * fp, int id) {
if(id>=0) {
checkSongId(id);
begin = playlist.idToNum[id];
begin = playlist.idToPosition[id];
end = begin+1;
}
......@@ -500,12 +500,12 @@ void swapSongs(int song1, int song2) {
playlist.songMod[song1] = playlist.version;
playlist.songMod[song2] = playlist.version;
playlist.idToNum[playlist.numToId[song1]] = song2;
playlist.idToNum[playlist.numToId[song2]] = song1;
playlist.idToPosition[playlist.positionToId[song1]] = song2;
playlist.idToPosition[playlist.positionToId[song2]] = song1;
iTemp = playlist.numToId[song1];
playlist.numToId[song1] = playlist.numToId[song2];
playlist.numToId[song2] = iTemp;
iTemp = playlist.positionToId[song1];
playlist.positionToId[song1] = playlist.positionToId[song2];
playlist.positionToId[song2] = iTemp;
}
void queueNextSongInPlaylist() {
......@@ -624,8 +624,8 @@ int addSongToPlaylist(FILE * fp, Song * song) {
playlist.songs[playlist.length] = song;
playlist.songMod[playlist.length] = playlist.version;
playlist.order[playlist.length] = playlist.length;
playlist.numToId[playlist.length] = getNextId();
playlist.idToNum[playlist.numToId[playlist.length]] = playlist.length;
playlist.positionToId[playlist.length] = getNextId();
playlist.idToPosition[playlist.positionToId[playlist.length]] = playlist.length;
playlist.length++;
if(playlist.random) {
......@@ -702,13 +702,13 @@ int swapSongsInPlaylistById(FILE * fp, int id1, int id2) {
checkSongId(id1);
checkSongId(id2);
return swapSongsInPlaylist(fp, playlist.idToNum[id1],
playlist.idToNum[id2]);
return swapSongsInPlaylist(fp, playlist.idToPosition[id1],
playlist.idToPosition[id2]);
}
#define moveSongFromTo(from, to) { \
playlist.idToNum[playlist.numToId[from]] = to; \
playlist.numToId[to] = playlist.numToId[from]; \
playlist.idToPosition[playlist.positionToId[from]] = to; \
playlist.positionToId[to] = playlist.positionToId[from]; \
playlist.songs[to] = playlist.songs[from]; \
playlist.songMod[to] = playlist.version; \
}
......@@ -737,7 +737,7 @@ int deleteFromPlaylist(FILE * fp, int song) {
freeJustSong(playlist.songs[song]);
}
playlist.idToNum[playlist.numToId[song]] = -1;
playlist.idToPosition[playlist.positionToId[song]] = -1;
/* delete song from songs array */
for(i=song;i<playlist.length-1;i++) {
......@@ -784,7 +784,7 @@ int deleteFromPlaylist(FILE * fp, int song) {
int deleteFromPlaylistById(FILE * fp, int id) {
checkSongId(id);
return deleteFromPlaylist(fp, playlist.idToNum[id]);
return deleteFromPlaylist(fp, playlist.idToPosition[id]);
}
void deleteASongFromPlaylist(Song * song) {
......@@ -885,7 +885,7 @@ int playPlaylistById(FILE * fp, int id, int stopOnError) {
checkSongId(id);
return playPlaylist(fp, playlist.idToNum[id], stopOnError);
return playPlaylist(fp, playlist.idToPosition[id], stopOnError);
}
void syncCurrentPlayerDecodeMetadata() {
......@@ -1039,7 +1039,7 @@ int moveSongInPlaylist(FILE * fp, int from, int to) {
}
tmpSong = playlist.songs[from];
tmpId = playlist.numToId[from];
tmpId = playlist.positionToId[from];
/* move songs to one less in from->to */
for(i=from;i<to;i++) {
moveSongFromTo(i+1, i);
......@@ -1049,8 +1049,8 @@ int moveSongInPlaylist(FILE * fp, int from, int to) {
moveSongFromTo(i-1, i);
}
/* put song at _to_ */
playlist.idToNum[tmpId] = to;
playlist.numToId[to] = tmpId;
playlist.idToPosition[tmpId] = to;
playlist.positionToId[to] = tmpId;
playlist.songs[to] = tmpSong;
playlist.songMod[to] = playlist.version;
/* now deal with order */
......@@ -1084,13 +1084,15 @@ int moveSongInPlaylist(FILE * fp, int from, int to) {
int moveSongInPlaylistById(FILE * fp, int id1, int to) {
checkSongId(id1);
return moveSongInPlaylist(fp, playlist.idToNum[id1], to);
return moveSongInPlaylist(fp, playlist.idToPosition[id1], to);
}
void orderPlaylist() {
int i;
playlist.current = playlist.order[playlist.current];
if(playlist.current >= 0 && playlist.current < playlist.length) {
playlist.current = playlist.order[playlist.current];
}
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=0) {
......@@ -1461,9 +1463,9 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
int seekSongInPlaylistById(FILE * fp, int id, float time) {
checkSongId(id);
return seekSongInPlaylist(fp, playlist.idToNum[id], time);
return seekSongInPlaylist(fp, playlist.idToPosition[id], time);
}
int getPlaylistSongId(int song) {
return playlist.numToId[song];
return playlist.positionToId[song];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment