[Live-devel] Trouble with Amino STB
Анатолий Ремнев
rtc_ru at mail.ru
Thu Nov 22 09:25:15 PST 2007
Hi, all!
I have a problem with AMINO STB. In original version of
LiveMediaServer files are in the same folder that a exe-file.
I have modified code of DynamicRTSPServer.cpp for read folder list
form config.ini file and getting unique file from this folder list.
============================cut here=================================
static ServerMediaSession* createNewSMS(UsageEnvironment& env,
char const* fileName, FILE* fid); // forward
char fullname[512];
ServerMediaSession*
DynamicRTSPServer::lookupServerMediaSession(char const *streamName) {
// First, check whether the specified "streamName" exists as a local file:
/*
GetPrivateProfileString("programs", "dir_files", "", dir_files, sizeof(dir_files), ".\\config.ini");
memset(dir_files, '\0', sizeof(dir_files));
memset(targetFile, '\0', sizeof(targetFile));
targetFile[0] = '.';
targetFile[1] == '\\';
strcat(targetFile, dir_files);
strcat(targetFile, "\\");
strcat(targetFile, streamName);
*/
//////Here we read folder list from config file
//////for example: dir_files=C:\testdir1;C:\testdir2;C:\testdir1\test;
char strName[512];
memset(strName, '\0', 512);
strcat(strName, streamName);
char* tmp = strName;
char* file = strName;
while(true)
{
tmp = strchr(file, '\\');
if(tmp == 0)
break;
else
{
tmp+=1;
file = tmp;
}
}
// in *file* we have real file name without path (full path have been deleted in previous block
char name[8192];
GetPrivateProfileString("programs", "dir_files", "", name, sizeof(name), "config.ini");
char **dirs;
int nameLen = strlen(name);
int semicolonCount = 0;
for(int i = 0; i < nameLen; i++)
{
if(name[i] == ';')
{
semicolonCount++;
}
}
dirs = new char*[semicolonCount]; // folder's array
for(int i = 0; i < semicolonCount; i++)
{
dirs[i] = new char[512]; // max length of full name
memset(dirs[i], '\0', 512);
}
int i = 0;
for(int j = 0; j < nameLen; j++)
{
if(name[j] == ';')
{
i++;
}
else
{
dirs[i][strlen(dirs[i])] = name[j];
}
}
///////////now in dirs we have folder list///////////////////////
///////////and search requested file there/////////////////////////
FILE* fid; // our file
for(int i = 0; i < semicolonCount; i++)
{
memset(fullname, '\0', 512);
strcpy(fullname, dirs[i]);
strcat(fullname, "\\");
strcat(fullname, file); // in *fullname* stored full file name (with path) which one may be presented in folders
// if file exists - break the cycle
fid = fopen(fullname, "rb");
if(fid)
{
break;
}
}
//////////////////////////////////////////////////////////////////////////
Boolean fileExists = fid != NULL;
============================cut here=================================
NOW!
The VLC Player perfectly reads files - so server starts thread for it.
BUT!!!!
AMINO STB can't request any file - so server not to start any thread
for it
I've view some logs and have seen that AMINO don't send DESCRIBE
command therefore VLC do it.
Which mistake I have done and how to solve my problem?
With best regards, Anatoliy
p.S. Sorry for my bad English
More information about the live-devel
mailing list