Hi
I'm just starting to poke around at the network code, the first thing I
noticed is that the URL parser is broken wrt URLs with a port number in
them (e.g. http://www.host.com:8090/stream.avi), attached is a patch
which re-enables streaming and fixes the parser so it correctly
identifies URLs like that.
I added the content type "video/x-msvideo" to the list of recognised
types. I don't know at this stage if that is correct or not, but I'm
testing with ffmpeg and that is what it is returning as the mime type
for an avi stream.
I know very little about streaming media and my C++ knowledge is sorely
lacking, however, I am gonna carry on poking and see what I can do with
the current networking code.
(The patch is against the latest CVS)
--
Chris "Ng" Jones
[EMAIL PROTECTED]
www.linuxdude.co.uk
Index: aviread/AsfInputStream.cpp
===================================================================
RCS file: /cvsroot/avifile/avifile-0.6/lib/aviread/AsfInputStream.cpp,v
retrieving revision 1.3
diff -c -r1.3 AsfInputStream.cpp
*** aviread/AsfInputStream.cpp 2001/09/17 19:00:05 1.3
--- aviread/AsfInputStream.cpp 2001/09/17 23:03:48
***************
*** 22,26 ****
}
return new ASFNetworkInputStream(pszFile);
! // return new ASFRedirectInputStream(pszFile);
}
--- 22,26 ----
}
return new ASFNetworkInputStream(pszFile);
! return new ASFRedirectInputStream(pszFile);
}
Index: aviread/AsfNetworkInputStream.cpp
===================================================================
RCS file: /cvsroot/avifile/avifile-0.6/lib/aviread/AsfNetworkInputStream.cpp,v
retrieving revision 1.14
diff -c -r1.14 AsfNetworkInputStream.cpp
*** aviread/AsfNetworkInputStream.cpp 2001/09/04 17:04:26 1.14
--- aviread/AsfNetworkInputStream.cpp 2001/09/17 23:03:50
***************
*** 92,98 ****
throw FATAL("Not an URL");
m_Filename=m_Server.substr(end);
m_Server=m_Server.substr(start, end-start);
! cout<<"Server "<<m_Server<<", filename "<<m_Filename<<endl;
// style hostname:port eg 192.168.10.10:8080
proxyenv=getenv("HTTP_PROXY");
if (proxyenv) {
--- 92,104 ----
throw FATAL("Not an URL");
m_Filename=m_Server.substr(end);
m_Server=m_Server.substr(start, end-start);
! end = m_Server.find(":", start);
! if (end==string::npos) m_Serverport=80;
! else {
! m_Serverport = m_Server.substr(end+1);
! m_Server=m_Server.substr(0,end);
! }
! cout<<"Server "<<m_Server<<", port "<<m_Serverport<<", filename
"<<m_Filename<<endl;
// style hostname:port eg 192.168.10.10:8080
proxyenv=getenv("HTTP_PROXY");
if (proxyenv) {
***************
*** 239,245 ****
char* pcRequest=0;
int seekable_length=strlen(m_pcSeekableRequest) + m_Filename.size() + 2 * 256;
int live_length=strlen(m_pcLiveRequest)+m_Filename.size()+ 2 * 256;
! fd=createSocket();
if(fd<0)goto terminated;
if(gethostname(hostname, 256))
{
--- 245,251 ----
char* pcRequest=0;
int seekable_length=strlen(m_pcSeekableRequest) + m_Filename.size() + 2 * 256;
int live_length=strlen(m_pcLiveRequest)+m_Filename.size()+ 2 * 256;
! fd=createSocket(atoi(m_Serverport.c_str()));
if(fd<0)goto terminated;
if(gethostname(hostname, 256))
{
***************
*** 280,286 ****
while(1)
{
char c;
! fd=createSocket();
if(fd<0)goto terminated;
cout<<"Socket created"<<endl;
switch(m_Ctype)
--- 286,292 ----
while(1)
{
char c;
! fd=createSocket(atoi(m_Serverport.c_str()));
if(fd<0)goto terminated;
cout<<"Socket created"<<endl;
switch(m_Ctype)
***************
*** 688,694 ****
char ContentType[256];
// cout<<"Entered check_content()"<<endl;
write(fd, request, strlen(request));
! //
cout<<"Sent data:"<<endl<<request<<endl;
errorcode = 0;
strcpy(HTTPMessage, "<none>");
--- 694,700 ----
char ContentType[256];
// cout<<"Entered check_content()"<<endl;
write(fd, request, strlen(request));
! cout<<"Sent data:"<<endl<<request<<endl;
errorcode = 0;
strcpy(HTTPMessage, "<none>");
***************
*** 809,814 ****
--- 815,821 ----
(!strcasecmp(ContentType, "video/x-ms-afs")) ||
(!strcasecmp(ContentType, "video/x-ms-wvx")) ||
(!strcasecmp(ContentType, "video/x-ms-wmv")) ||
+ (!strcasecmp(ContentType, "video/x-msvideo")) ||
(!strcasecmp(ContentType, "video/x-ms-wma")) )
{
ctype=Redirect;
Index: aviread/AsfNetworkInputStream.h
===================================================================
RCS file: /cvsroot/avifile/avifile-0.6/lib/aviread/AsfNetworkInputStream.h,v
retrieving revision 1.3
diff -c -r1.3 AsfNetworkInputStream.h
*** aviread/AsfNetworkInputStream.h 2001/04/17 10:54:27 1.3
--- aviread/AsfNetworkInputStream.h 2001/09/17 23:03:50
***************
*** 29,35 ****
std::list<packet*> m_Cache;
int64_t m_lRequest;
pthread_t m_Thread;
! std::string m_File, m_Server, m_Filename;
std::string m_Proxyhost;
std::string m_Proxyport;
bool m_bQuit;
--- 29,35 ----
std::list<packet*> m_Cache;
int64_t m_lRequest;
pthread_t m_Thread;
! std::string m_File, m_Server, m_Serverport, m_Filename;
std::string m_Proxyhost;
std::string m_Proxyport;
bool m_bQuit;