mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-31 09:43:45 -04: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
|
#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
|
void
|
||||||
db_files_update_songartistid(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
|
int
|
||||||
db_files_get_count_bymatch(char *path);
|
db_files_get_count_bymatch(char *path);
|
||||||
|
|
||||||
int
|
|
||||||
db_file_get_seekpos(uint32_t id);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
db_files_update_songartistid(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)
|
playback_start_item(void *arg, int *retval)
|
||||||
{
|
{
|
||||||
struct db_queue_item *queue_item = arg;
|
struct db_queue_item *queue_item = arg;
|
||||||
|
struct media_file_info *mfi;
|
||||||
struct output_device *device;
|
struct output_device *device;
|
||||||
struct player_source *ps;
|
struct player_source *ps;
|
||||||
int seek_ms;
|
int seek_ms;
|
||||||
@ -2316,16 +2317,22 @@ playback_start_item(void *arg, int *retval)
|
|||||||
|
|
||||||
ps = source_new(queue_item);
|
ps = source_new(queue_item);
|
||||||
if (!ps)
|
if (!ps)
|
||||||
{
|
{
|
||||||
playback_abort();
|
playback_abort();
|
||||||
*retval = -1;
|
*retval = -1;
|
||||||
return COMMAND_END;
|
return COMMAND_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seek_ms = 0;
|
||||||
if (queue_item->file_id > 0)
|
if (queue_item->file_id > 0)
|
||||||
seek_ms = db_file_get_seekpos(queue_item->file_id);
|
{
|
||||||
else
|
mfi = db_file_fetch_byid(queue_item->file_id);
|
||||||
seek_ms = 0;
|
if (mfi)
|
||||||
|
{
|
||||||
|
seek_ms = mfi->seek;
|
||||||
|
free_mfi(mfi, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = source_open(ps, last_rtptime + AIRTUNES_V2_PACKET_SAMPLES, seek_ms);
|
ret = source_open(ps, last_rtptime + AIRTUNES_V2_PACKET_SAMPLES, seek_ms);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user