<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
<div class="moz-text-flowed"
style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">Hi, <br>
<br>
we have an Apollo MPEG-2 encoder that only has windows driver. <br>
So we implemented a windows named pipe into vls code. <br>
<br>
Apollo writes in the pipe (e.g. \\.\pipe\vls) and <br>
vls (compiled for windows using msys+mingw) reads it and streams to network.
<br>
<br>
We had success !!! <img src="chrome://editor/content/images/smile_n.gif"
alt=":-)" class="moz-txt-smily" height="19" width="19" align="middle">
<img src="chrome://editor/content/images/smile_n.gif" alt=":-)"
class="moz-txt-smily" height="19" width="19" align="middle">
<img src="chrome://editor/content/images/smile_n.gif" alt=":-)"
class="moz-txt-smily" height="19" width="19" align="middle">
<br>
<br>
It is enough to configure the input.cfg <br>
<br>
BEGIN "1" Name = "mytest" <br>
FileName = "\\.\pipe\vls" <br>
Type = "Mpeg1-PS" <br>
END <br>
<br>
<br>
In file.h we added: <br>
<br>
private: <br>
HANDLE m_hHd; // <----- new !!! <br>
<br>
The main changes in vls source code were made in file.cpp: <br>
<br>
#ifdef _WIN32 <br>
#include <windows.h> <br>
#endif <br>
<br>
... <br>
... <br>
... <br>
<br>
void C_File::Open(const C_String& strMode, int iPermissions) <br>
{ <br>
#ifdef _WIN32 <br>
char *strPipeName; <br>
<br>
if((strPipeName = strstr(m_strPath.GetString(),"\\\\.\\pipe\\")) != NULL)
<br>
{ <br>
#define BUFFER_IN_LEN 1000 <br>
#define BUFFER_OUT_LEN 1000 <br>
<br>
if ( (m_hHd = CreateNamedPipe( <br>
strPipeName;, <br>
PIPE_ACCESS_INBOUND, <br>
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, <br>
1, BUFFER_OUT_LEN, <br>
BUFFER_IN_LEN, <br>
30000, // time-out <br>
NULL <br>
)) == INVALID_HANDLE_VALUE ) <br>
{ <br>
printf("Error creating pipe\n" ); <br>
} <br>
<br>
printf("Waiting client to connect with %s (buffer in=%d out=%d\n", <br>
strPipeName;, BUFFER_IN_LEN, BUFFER_OUT_LEN ); <br>
<br>
if( ConnectNamedPipe( m_hHd, NULL ) == FALSE ) <br>
printf("Error connecting pipe\n" ); <br>
return; <br>
} <br>
else <br>
#endif <br>
m_hFd = fopen(m_strPath.GetString(), strMode.GetString()); <br>
<br>
... <br>
... <br>
... <br>
<br>
int C_File::Read(byte* pBuff, int iSize) <br>
{ <br>
ASSERT(pBuff); <br>
ASSERT(iSize > 0); <br>
<br>
int iRc = 0; <br>
<br>
#ifdef _WIN32 <br>
if(m_hHd) // pipe? <br>
{ <br>
DWORD cbRead; <br>
<br>
do <br>
{ <br>
if( !ReadFile( m_hHd, pBuff + iRc, iSize - iRc, &cbRead, NULL) )
<br>
{ <br>
printf("Error reading pipe\n"); <br>
return FILE_EOF; <br>
} <br>
<br>
iRc += cbRead; <br>
<br>
if(iRc < iSize) <br>
Sleep(0); <br>
<br>
} while(iRc < iSize); <br>
} <br>
else <br>
#endif <br>
{ <br>
ASSERT(m_hFd ); // Make sure that the file has been opened <br>
iRc = fread(pBuff, sizeof(byte), iSize, m_hFd); <br>
} <br>
<br>
... <br>
... <br>
... <br>
<br>
int C_File::Seek(s64 iOffset, int iStartPos) <br>
{ <br>
int iRc; <br>
<br>
#ifdef _WIN32 <br>
if(m_hHd) // pipe? <br>
iRc = 0; <br>
else <br>
#endif <br>
{ <br>
ASSERT(m_hFd); <br>
iRc = fseek(m_hFd, iOffset, iStartPos); <br>
} <br>
<br>
... <br>
... <br>
... <br>
<br>
I hope the report of our experience helps somebody. <br>
<br>
Carlos Montez <br>
<br>
<br>
<br>
</div>
</body>
</html>