Skip to content

Commit

Permalink
Fix streaming video from named pipe
Browse files Browse the repository at this point in the history
CFile::IoControl(IOCTRL_SEEK_POSSIBLE) should only return true for regular files
When binary video data is streamed from another application using a named pipe, it is not possible to seek,
and data should be read sequentially.
  • Loading branch information
maxnet committed Jan 3, 2013
1 parent ec7ac68 commit 9ef6749
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,14 @@ int CFile::Write(const void* lpBuf, int64_t uiBufSize)

int CFile::IoControl(EIoControl request, void* param)
{
if(request == IOCTRL_SEEK_POSSIBLE)
return 1;
if(request == IOCTRL_SEEK_POSSIBLE && m_pFile)
{
struct stat st;
if (fstat(fileno(m_pFile), &st) == 0)
{
return !S_ISFIFO(st.st_mode);
}
}

return -1;
}

0 comments on commit 9ef6749

Please sign in to comment.