• R/O
  • HTTP
  • SSH
  • HTTPS

PeerCastIM: Commit


Commit MetaInfo

Revisão0a55e16b1466333c8372b7d60f4f1072cc2ded44 (tree)
Hora2016-01-11 21:37:12
Autoreru <eru01@user...>
Commitereru

Mensagem de Log

FLVの視聴・リレーに対応。

Mudança Sumário

Diff

--- a/core/common/channel.cpp
+++ b/core/common/channel.cpp
@@ -2101,7 +2101,7 @@ void Channel::getStreamPath(char *str)
21012101
21022102 getIDStr(idStr);
21032103
2104- sprintf(str,"/stream/%s%s",idStr,info.getTypeExt(info.contentType));
2104+ sprintf(str,"/stream/%s%s",idStr,info.getTypeExt());
21052105 }
21062106
21072107
@@ -2506,9 +2506,9 @@ bool Channel::writeVariable(Stream &out, const String &var, int index)
25062506 strcpy(buf,uptime.cstr());
25072507 }
25082508 else if (var == "type")
2509- sprintf(buf,"%s",ChanInfo::getTypeStr(info.contentType));
2509+ sprintf(buf,"%s",info.getTypeStr());
25102510 else if (var == "ext")
2511- sprintf(buf,"%s",ChanInfo::getTypeExt(info.contentType));
2511+ sprintf(buf,"%s",info.getTypeExt());
25122512 else if (var == "proto") {
25132513 switch(info.contentType) {
25142514 case ChanInfo::T_WMA:
@@ -3952,6 +3952,36 @@ unsigned int ChanHitList::getSeq()
39523952 }
39533953
39543954 // -----------------------------------
3955+const char *ChanInfo::getTypeStr()
3956+{
3957+ if (contentTypeStr.isEmpty()) {
3958+ return getTypeStr(contentType);
3959+ }
3960+ else {
3961+ return contentTypeStr.cstr();
3962+ }
3963+}
3964+// -----------------------------------
3965+const char *ChanInfo::getTypeExt()
3966+{
3967+ if (streamExt.isEmpty()) {
3968+ return getTypeExt(contentType);
3969+ }
3970+ else {
3971+ return streamExt.cstr();
3972+ }
3973+}
3974+// -----------------------------------
3975+const char *ChanInfo::getMIMEType()
3976+{
3977+ if (streamType.isEmpty()) {
3978+ return getMIMEType(contentType);
3979+ }
3980+ else {
3981+ return streamType.cstr();
3982+ }
3983+}
3984+// -----------------------------------
39553985 const char *ChanInfo::getTypeStr(TYPE t)
39563986 {
39573987 switch (t)
@@ -4027,6 +4057,33 @@ const char *ChanInfo::getTypeExt(TYPE t)
40274057 }
40284058 }
40294059 // -----------------------------------
4060+const char *ChanInfo::getMIMEType(TYPE t)
4061+{
4062+ switch(t)
4063+ {
4064+ case ChanInfo::T_OGG:
4065+ return MIME_XOGG;
4066+ case ChanInfo::T_OGM:
4067+ return MIME_XOGG;
4068+ case ChanInfo::T_MP3:
4069+ return MIME_MP3;
4070+ case ChanInfo::T_MOV:
4071+ return MIME_MOV;
4072+ case ChanInfo::T_MPG:
4073+ return MIME_MPG;
4074+ case ChanInfo::T_NSV:
4075+ return MIME_NSV;
4076+ case ChanInfo::T_ASX:
4077+ return MIME_ASX;
4078+ case ChanInfo::T_WMA:
4079+ return MIME_WMA;
4080+ case ChanInfo::T_WMV:
4081+ return MIME_WMV;
4082+ default:
4083+ return "application/octet-stream";
4084+ }
4085+}
4086+// -----------------------------------
40304087 ChanInfo::TYPE ChanInfo::getTypeFromStr(const char *str)
40314088 {
40324089 if (stricmp(str,"MP3")==0)
@@ -4195,6 +4252,24 @@ bool ChanInfo::update(ChanInfo &info)
41954252 changed = true;
41964253 }
41974254
4255+ if (!contentTypeStr.isSame(info.contentTypeStr))
4256+ {
4257+ contentTypeStr = info.contentTypeStr;
4258+ changed = true;
4259+ }
4260+
4261+ if (!streamType.isSame(info.streamType))
4262+ {
4263+ streamType = info.streamType;
4264+ changed = true;
4265+ }
4266+
4267+ if (!streamExt.isSame(info.streamExt))
4268+ {
4269+ streamExt = info.streamExt;
4270+ changed = true;
4271+ }
4272+
41984273 if(ppFlags != info.ppFlags) //JP-MOD
41994274 {
42004275 ppFlags = info.ppFlags;
@@ -4253,6 +4328,9 @@ void ChanInfo::init()
42534328 name.clear();
42544329 bitrate = 0;
42554330 contentType = T_UNKNOWN;
4331+ contentTypeStr.clear();
4332+ streamType.clear();
4333+ streamExt.clear();
42564334 srcProtocol = SP_UNKNOWN;
42574335 id.clear();
42584336 url.clear();
@@ -4346,6 +4424,13 @@ void ChanInfo::readInfoAtoms(AtomStream &atom,int numc)
43464424 char type[16];
43474425 atom.readString(type,sizeof(type),d);
43484426 contentType = ChanInfo::getTypeFromStr(type);
4427+ contentTypeStr = type;
4428+ }else if (id == PCP_CHAN_INFO_STREAMTYPE)
4429+ {
4430+ atom.readString(streamType.data,sizeof(streamType.data),d);
4431+ }else if (id == PCP_CHAN_INFO_STREAMEXT)
4432+ {
4433+ atom.readString(streamExt.data,sizeof(streamExt.data),d);
43494434 }else if (id == PCP_CHAN_INFO_PPFLAGS) //JP-MOD
43504435 {
43514436 ppFlags = (unsigned int)atom.readInt();
@@ -4364,7 +4449,11 @@ void ChanInfo::writeInfoAtoms(AtomStream &atom)
43644449 atom.writeString(PCP_CHAN_INFO_URL,url.cstr());
43654450 atom.writeString(PCP_CHAN_INFO_DESC,desc.cstr());
43664451 atom.writeString(PCP_CHAN_INFO_COMMENT,comment.cstr());
4367- atom.writeString(PCP_CHAN_INFO_TYPE,getTypeStr(contentType));
4452+ atom.writeString(PCP_CHAN_INFO_TYPE,getTypeStr());
4453+ if (!streamType.isEmpty())
4454+ atom.writeString(PCP_CHAN_INFO_STREAMTYPE,streamType.cstr());
4455+ if (!streamExt.isEmpty())
4456+ atom.writeString(PCP_CHAN_INFO_STREAMEXT,streamExt.cstr());
43684457 if(ppFlags)
43694458 atom.writeInt(PCP_CHAN_INFO_PPFLAGS,ppFlags); //JP-MOD
43704459
@@ -4409,7 +4498,7 @@ XML::Node *ChanInfo::createChannelXML()
44094498 nameUNI.cstr(),
44104499 idStr,
44114500 bitrate,
4412- getTypeStr(contentType),
4501+ getTypeStr(),
44134502 genreUNI.cstr(),
44144503 descUNI.cstr(),
44154504 urlUNI.cstr(),
@@ -4533,9 +4622,10 @@ void ChanInfo::updateFromXML(XML::Node *n)
45334622 }
45344623
45354624 readXMLString(typeStr,n,"type");
4536- if (!typeStr.isEmpty())
4537- contentType = getTypeFromStr(typeStr.cstr());
4538-
4625+ if (!typeStr.isEmpty()) {
4626+ contentType = getTypeFromStr(typeStr.cstr());
4627+ contentTypeStr = typeStr;
4628+ }
45394629
45404630 readXMLString(idStr,n,"id");
45414631 if (!idStr.isEmpty())
@@ -4729,7 +4819,7 @@ void PlayList::addChannel(const char *path, ChanInfo &info)
47294819 info.id.toStr(idStr);
47304820 char *nid = info.id.isSet()?idStr:info.name.cstr();
47314821
4732- sprintf(url.cstr(),"%s/stream/%s%s",path,nid,ChanInfo::getTypeExt(info.contentType));
4822+ sprintf(url.cstr(),"%s/stream/%s%s",path,nid,info.getTypeExt());
47334823 addURL(url.cstr(),info.name,info.url);
47344824 }
47354825
--- a/core/common/channel.h
+++ b/core/common/channel.h
@@ -148,9 +148,13 @@ public:
148148 unsigned int getAge();
149149 bool isActive() {return id.isSet();}
150150 bool isPrivate() {return bcID.getFlags() & 1;}
151+ const char *getTypeStr();
152+ const char *getTypeExt();
153+ const char *getMIMEType();
151154 static const char *getTypeStr(TYPE);
152155 static const char *getProtocolStr(PROTOCOL);
153156 static const char *getTypeExt(TYPE);
157+ static const char *getMIMEType(TYPE);
154158 static TYPE getTypeFromStr(const char *str);
155159 static PROTOCOL getProtocolFromStr(const char *str);
156160
@@ -158,6 +162,7 @@ public:
158162 GnuID id,bcID;
159163 int bitrate;
160164 TYPE contentType;
165+ ::String contentTypeStr,streamType,streamExt;
161166 PROTOCOL srcProtocol;
162167 unsigned int lastPlayStart,lastPlayEnd;
163168 unsigned int numSkips;
--- a/core/common/pcp.h
+++ b/core/common/pcp.h
@@ -109,6 +109,8 @@ static const ID4 PCP_CHAN_PKT_META = "meta";
109109
110110 static const ID4 PCP_CHAN_INFO = "info";
111111 static const ID4 PCP_CHAN_INFO_TYPE = "type";
112+static const ID4 PCP_CHAN_INFO_STREAMTYPE = "styp";
113+static const ID4 PCP_CHAN_INFO_STREAMEXT = "sext";
112114 static const ID4 PCP_CHAN_INFO_BITRATE = "bitr";
113115 static const ID4 PCP_CHAN_INFO_GENRE = "gnre";
114116 static const ID4 PCP_CHAN_INFO_NAME = "name";
--- a/core/common/servent.cpp
+++ b/core/common/servent.cpp
@@ -1294,33 +1294,12 @@ bool Servent::handshakeStream(ChanInfo &chanInfo)
12941294 {
12951295 switch (chanInfo.contentType)
12961296 {
1297- case ChanInfo::T_OGG:
1298- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_XOGG);
1299- break;
1300- case ChanInfo::T_MP3:
1301- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_MP3);
1302- break;
13031297 case ChanInfo::T_MOV:
13041298 sock->writeLine("Connection: close");
13051299 sock->writeLine("Content-Length: 10000000");
1306- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_MOV);
1307- break;
1308- case ChanInfo::T_MPG:
1309- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_MPG);
1310- break;
1311- case ChanInfo::T_NSV:
1312- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_NSV);
1313- break;
1314- case ChanInfo::T_ASX:
1315- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_ASX);
1316- break;
1317- case ChanInfo::T_WMA:
1318- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_WMA);
1319- break;
1320- case ChanInfo::T_WMV:
1321- sock->writeLineF("%s %s",HTTP_HS_CONTENT,MIME_WMV);
13221300 break;
13231301 }
1302+ sock->writeLineF("%s %s",HTTP_HS_CONTENT,chanInfo.getMIMEType());
13241303 } else if (outputProtocol == ChanInfo::SP_MMS)
13251304 {
13261305 sock->writeLine("Server: Rex/9.0.0.2980");
--- a/core/common/servhs.cpp
+++ b/core/common/servhs.cpp
@@ -1893,7 +1893,7 @@ void Servent::handshakeICY(Channel::SRC_TYPE type, bool isHTTP)
18931893 info.id = chanMgr->broadcastID;
18941894 info.id.encode(NULL,info.name.cstr(),loginMount.cstr(),info.bitrate);
18951895
1896- LOG_DEBUG("Incoming source: %s : %s",info.name.cstr(),ChanInfo::getTypeStr(info.contentType));
1896+ LOG_DEBUG("Incoming source: %s : %s",info.name.cstr(),info.getTypeStr());
18971897
18981898
18991899 if (isHTTP)
--- a/core/common/servmgr.cpp
+++ b/core/common/servmgr.cpp
@@ -1217,7 +1217,7 @@ void ServMgr::saveSettings(const char *fn)
12171217 if (!c->sourceURL.isEmpty())
12181218 iniFile.writeStrValue("sourceURL",c->sourceURL.cstr());
12191219 iniFile.writeStrValue("sourceProtocol",ChanInfo::getProtocolStr(c->info.srcProtocol));
1220- iniFile.writeStrValue("contentType",ChanInfo::getTypeStr(c->info.contentType));
1220+ iniFile.writeStrValue("contentType",c->info.getTypeStr());
12211221 iniFile.writeIntValue("bitrate",c->info.bitrate);
12221222 iniFile.writeStrValue("contactURL",c->info.url.cstr());
12231223 iniFile.writeStrValue("id",idstr);
--- a/core/common/version2.h
+++ b/core/common/version2.h
@@ -44,9 +44,9 @@ extern int version_ex; // VERSION_EX
4444 #if 1 /* for VP extend version */
4545 //#define VERSION_EX 1
4646 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
47-static const int PCP_CLIENT_VERSION_EX_NUMBER = 45;
48-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0045)";
49-static const char *PCX_VERSTRING_EX = "v0.1218(IM0045)";
47+static const int PCP_CLIENT_VERSION_EX_NUMBER = 50;
48+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0050)";
49+static const char *PCX_VERSTRING_EX = "v0.1218(IM0050)";
5050
5151 static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/";
5252 static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net";
Show on old repository browser