Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Vorbis tools Vorbis tools
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 63
    • Issues 63
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Xiph.OrgXiph.Org
  • Vorbis toolsVorbis tools
  • Issues
  • #2195
Closed
Open
Issue created Apr 23, 2015 by Raúl Salinas-Monteagudo@raulsalinas

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));
Assignee
Assign to
Time tracking