[player/db] Remove function "db_file_get_seekpos"

This commit is contained in:
chme 2016-12-04 17:48:35 +01:00
parent d339f5bcd2
commit 2d1e5f6d60
3 changed files with 11 additions and 32 deletions

View File

@ -2024,31 +2024,6 @@ db_files_get_count_bymatch(char *path)
#undef Q_TMPL
}
int
db_file_get_seekpos(uint32_t id)
{
#define Q_TMPL "SELECT seek FROM files f WHERE f.id = %d;"
char *query;
int seek_ms;
query = sqlite3_mprintf(Q_TMPL, id);
if (!query)
{
DPRINTF(E_LOG, L_DB, "Out of memory making seekpos query string.\n");
return -1;
}
seek_ms = db_get_count(query);
sqlite3_free(query);
if (seek_ms < 0)
seek_ms = 0;
return seek_ms;
#undef Q_TMPL
}
void
db_files_update_songartistid(void)
{

View File

@ -498,9 +498,6 @@ db_files_get_album_count(void);
int
db_files_get_count_bymatch(char *path);
int
db_file_get_seekpos(uint32_t id);
void
db_files_update_songartistid(void);

View File

@ -2280,6 +2280,7 @@ static enum command_state
playback_start_item(void *arg, int *retval)
{
struct db_queue_item *queue_item = arg;
struct media_file_info *mfi;
struct output_device *device;
struct player_source *ps;
int seek_ms;
@ -2316,16 +2317,22 @@ playback_start_item(void *arg, int *retval)
ps = source_new(queue_item);
if (!ps)
{
{
playback_abort();
*retval = -1;
return COMMAND_END;
}
seek_ms = 0;
if (queue_item->file_id > 0)
seek_ms = db_file_get_seekpos(queue_item->file_id);
else
seek_ms = 0;
{
mfi = db_file_fetch_byid(queue_item->file_id);
if (mfi)
{
seek_ms = mfi->seek;
free_mfi(mfi, 0);
}
}
ret = source_open(ps, last_rtptime + AIRTUNES_V2_PACKET_SAMPLES, seek_ms);
if (ret < 0)