mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[player/db] Remove function "db_file_get_seekpos"
This commit is contained in:
parent
d339f5bcd2
commit
2d1e5f6d60
25
src/db.c
25
src/db.c
@ -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)
|
||||
{
|
||||
|
3
src/db.h
3
src/db.h
@ -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);
|
||||
|
||||
|
15
src/player.c
15
src/player.c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user