engine: soundlib: libmpg: add wrappers on top of libc read & lseek in case they don't match internal mpg123 types

(we better migrate to upstream libmpg at some point)
This commit is contained in:
Alibek Omarov 2024-06-02 09:19:14 +03:00
parent 0796c14e79
commit a709f30da9

View file

@ -853,11 +853,21 @@ int open_feed( mpg123_handle_t *fr )
return 0;
}
static mpg_ssize_t read_mpgtypes( int fd, void *buf, size_t count )
{
return read( fd, buf, count );
}
static mpg_off_t lseek_mpgtypes( int fd, mpg_off_t offset, int whence )
{
return lseek( fd, offset, whence );
}
static int default_init( mpg123_handle_t *fr )
{
fr->rdat.fdread = plain_read;
fr->rdat.read = fr->rdat.r_read != NULL ? fr->rdat.r_read : read;
fr->rdat.lseek = fr->rdat.r_lseek != NULL ? fr->rdat.r_lseek : lseek;
fr->rdat.read = fr->rdat.r_read != NULL ? fr->rdat.r_read : read_mpgtypes;
fr->rdat.lseek = fr->rdat.r_lseek != NULL ? fr->rdat.r_lseek : lseek_mpgtypes;
fr->rdat.filelen = get_fileinfo( fr );
fr->rdat.filepos = 0;