Unreliable determining seekability in ogg123
In vorbis-tools/ogg123/file_transport.c, the input is considered not to be seekable if "-" (stdin) is specified as input file.
In Unix, you can actually seek in stdin if it comes from a regular file (instead of from a pipe).
Seekable stdin: ogg123 - < file.ogg
Non-seekable standard-specified file: mkfifo fifo.ogg ogg123 fifo.ogg
I propose to correctly determine the seekability by stat()ing the descriptor.
bool isSeekable(int fd) {
struct stat sb;
int res = fstat(fd, &sb);
if (res < 0) {
perror("fstat");
return -1;
}
return S_ISREG(sb.st_mode) !=0;
}
and then doing something like
private->seekable = isSeekable(fileno(private->fp));