Révision | 2b4cb967c4d0f48ad2a65cf832f94694866bd0b5 (tree) |
---|---|
l'heure | 2017-01-15 21:20:45 |
Auteur | eru <eru01@user...> |
Commiter | eru |
FLV配信用パッチをマージ。(github:niwakazoider/peercast@21998fef7e24f437ef8d50e17562ba95eb5c1843)
VS2008でビルドが通らないのでパッチを一部修正。
消えていたREADMEを復旧。
@@ -0,0 +1,180 @@ | ||
1 | +PeerCast IM0051 (released on 20160115 by えるー) | |
2 | +based on PeerCast IM7651 by Trill, Original: (c) 2005-2007 giles/peercast.org | |
3 | + | |
4 | + | |
5 | += 概要 | |
6 | + IM7651に以下の機能修正を施した物。 | |
7 | + | |
8 | + - 直下を取っているチャンネルのBump時に確認メッセージを表示。 | |
9 | + | |
10 | + - 起動時に自動でGUIを開く機能(オプション) | |
11 | + | |
12 | + - GUI表示時に自動で最前面とする機能(オプション) | |
13 | + | |
14 | + - チャンネル毎にリレー数の上限を設定できる機能。 | |
15 | + + チャンネル情報ダイアログより変更できます。 | |
16 | + + 0に設定した場合には既定値が利用されます。 | |
17 | + + index.txtについては設定画面で個別設定が可能なので | |
18 | + チャンネル情報からは変更できません。 | |
19 | + | |
20 | + - トラフィックモニタ | |
21 | + + PeerCastの再起動でリセット。 | |
22 | + | |
23 | + - エラー落ち時のログダンプ機能 | |
24 | + + 強制終了した際、ぴあかすのインストールディレクトリに | |
25 | + dump.html、dump.dmpというファイルが生成されます。 | |
26 | + そのログを渡して貰えると喜びますが、事前に4種類のログ全てを | |
27 | + 記録する様に設定をお願いします。 | |
28 | + | |
29 | + - FLV配信に対応 | |
30 | + | |
31 | + | |
32 | += 諸注意 | |
33 | + - 1. 動作について | |
34 | + 不具合などによる責任は負いかねます。At your own risk。 | |
35 | + また動作確認はXP SP3/Win7のみで実施しており、その他の環境における動作 | |
36 | + については一切保証しません。 | |
37 | + | |
38 | + - 2. 同梱のDLLについて | |
39 | + + 1。dbghelp.dll (6.9.3.113) | |
40 | + このDLLはDebugging Tools for Windows(6.9.3.113)に含まれる再頒布可能 | |
41 | + コンポーネントであり、その権利はMicrosoftに帰属します。 | |
42 | + また再頒布はこのプログラムと共に行う場合のみ許可されます。 | |
43 | + | |
44 | + | |
45 | += 既知のバグ | |
46 | + - 視聴中のチャンネルを切断した場合、強制終了する場合があります。 | |
47 | + チャンネルの切断はリレーが停止した後に行うようにしてください。 | |
48 | + | |
49 | + | |
50 | += 改訂履歴 | |
51 | + - IM0051 (170115) | |
52 | + + FLVの配信に対応。 | |
53 | + RTMPの受け入れ機能は無いのでFlazrDumper等、HTTPで流せるツールが必要です。 | |
54 | + (Thanks to github:niwakazoider/peercast@21998fe) | |
55 | + | |
56 | + - IM0050 (160111) | |
57 | + + FLV配信の視聴・リレーに対応。(チケット#29363) | |
58 | + | |
59 | + - IM0045 (120506) | |
60 | + + DoS攻撃への耐性を向上。 | |
61 | + | |
62 | + - IM0044 (110309) | |
63 | + + GUIの右クリックメニューからリレーしていないチャンネル情報を | |
64 | + 一括削除できるようになりました。 | |
65 | + | |
66 | + - IM0043 (110129) | |
67 | + + WebGUIのレスポンスが低下していた不具合を修正。 | |
68 | + + 今回からx86版コアをSSE2オプション付きのみに変更。 | |
69 | + SSE2非対応CPUで動作しない場合はソースからコンパイルしてください。 | |
70 | + | |
71 | + - IM0042 (101120) | |
72 | + + チャンネル切断直後に同じチャンネルを開くと強制終了する場合が | |
73 | + あったのを修正。 | |
74 | + | |
75 | + - IM0041 (101023) | |
76 | + + Android OSからの再生に対応。 | |
77 | + チャンネルURL(http://host:ip/pls/ハッシュ値?tip=hoge)を | |
78 | + http://host:ip/stream/ハッシュ値.wmv?tip=hoge | |
79 | + と書き換え、Android OS上のブラウザから開くことで再生できます。 | |
80 | + ただし、WMV9 AP等による配信はAndroid OS側のデコーダが | |
81 | + 対応していないため再生できません。 | |
82 | + + VP版のGUIを追加。 | |
83 | + + x86版コアをSSE2のオプションを指定してコンパイルするように変更。 | |
84 | + SSE2非対応のCPUを使っている場合はx86_SSE_disabledフォルダの | |
85 | + バイナリを使用してください。 | |
86 | + | |
87 | + - IM0040 (090930) | |
88 | + + 再接続中のチャンネルをGUIから切断不能にした。 | |
89 | + + 出力するXMLが一部ライブラリ・ソフトウェアに受理されなかったのを修正。 | |
90 | + + バージョン情報の改竄に対応。 | |
91 | + | |
92 | + - IM0039 (090928) | |
93 | + + GUIからCOUTを切断できるようにした。 | |
94 | + + パッチをマージ。 | |
95 | + | |
96 | + - IM0038 (090705) | |
97 | + + 強制終了するバグを修正。 | |
98 | + | |
99 | + - IM0037 (090531) | |
100 | + + なんかよく分かんない修正。 | |
101 | + | |
102 | + - IM0036 (090528) | |
103 | + + バージョンアップ通知機能を追加。 | |
104 | + | |
105 | + - IM0035 (090523) | |
106 | + + デバッグ用のコードを抜き忘れてた。 | |
107 | + | |
108 | + - IM0034 (090523) | |
109 | + + index_xp.txtが原因で他のリレーが詰まる現象に対して非常に適当な対策。 | |
110 | + 効果不明な上,これがさらなる問題を生む可能性有り。 | |
111 | + | |
112 | + - IM0033 (090310) | |
113 | + + Vista環境でWindows Defenderがlocalhostのエイリアスを消去するバグに対応。 | |
114 | + | |
115 | + - IM0032 (090129) | |
116 | + + x64に暫定対応。 | |
117 | + | |
118 | + - IM0031 (080914) | |
119 | + + 例外処理機構を修正。 | |
120 | + | |
121 | + - IM0030 (080914) | |
122 | + + エラー落ちする可能性があったのを1カ所修正。 | |
123 | + | |
124 | + - IM0029 (080909) | |
125 | + + 例外処理機構が不完全だったのを修正。 | |
126 | + | |
127 | + - IM0028-3 (080907) | |
128 | + + GUIでリモートホストが表示されない事があるのを修正。 | |
129 | + | |
130 | + - IM0028-2 (080904) | |
131 | + + ソースアドレスがClass Dの通信を遮断。 | |
132 | + | |
133 | + - IM0028 (080818) | |
134 | + + ログダンプ機能を追加。 | |
135 | + + マイナービルド番号を増やすのもいい加減面倒くさくなってきたのでメジャーアップ。 | |
136 | + | |
137 | + - IM0027-5-2 (080628) | |
138 | + + トラフィックモニタが1^32で0に戻っていたのを修正。 | |
139 | + | |
140 | + - IM0027-5 (080628) | |
141 | + + トラフィックモニタを追加。 | |
142 | + | |
143 | + - IM0027-4-2 (080512) | |
144 | + + チャンネルを開いた際のメインウインドウ表示を抑止。 | |
145 | + | |
146 | + - IM0027-4 (080508) | |
147 | + + CVE-2008-2040を修正。 | |
148 | + | |
149 | + - IM0027-3 (080122) | |
150 | + + バグ修正用のパッチ(VPdiff20080120)をマージ。 | |
151 | + | |
152 | + - IM0027-2 (080106) | |
153 | + (注) PP版のGUIは搭載していないのでPP版の機能は使えません。 | |
154 | + + VP0027-1をマージ。 | |
155 | + | |
156 | + - IM0027 (071230) | |
157 | + (注) 未公開版 | |
158 | + + チャンネル毎にリレー数上限を設定できる機能を追加。 | |
159 | + | |
160 | + - IM0026-2 (071226) | |
161 | + (注) 動作そのものに修正は加わっていません。あくまで表面的な修正のみです。 | |
162 | + + 再接続時、GUIの表示が一時的にエラーとなるのを修正。 | |
163 | + + たまにGUIの表示(下流リレー)がバグるのを(多分)修正。 | |
164 | + | |
165 | + - IM0026 (071223) | |
166 | + + バージョン表記の変更。 | |
167 | + + 内部データのロックに問題があったのを修正。 | |
168 | + + VPdiff20071223(生命キャスト対策コード/ツールスレ24-517)をマージ。 | |
169 | + + マージによる変更点。 | |
170 | + ・下流情報の送信に簡単な帯域制限を付加。 | |
171 | + ・下流情報内のuphostで示されるホストが下流に存在しない場合、その下流情報は捨てる。 | |
172 | + ・下流情報を送信するとき、直下のホスト情報が必ず送信されるように修正。 | |
173 | + ・大きすぎるリスナー数、リレー数を制限。 | |
174 | + ・チャンネル要求時に自ホストのリスンポートを通知。 | |
175 | + ・紫ホストの自動切断を行うコードを修正。 | |
176 | + ・index.txtがオートBumpされるまでの時間を延長。 | |
177 | + | |
178 | + - IM7650 | |
179 | + + 初版。幾つかバージョン違いがあるけど肝心のバージョン表記は一緒なので区別できない。 | |
180 | + + VP26までの変更内容(GUI除く)をマージ。 |
@@ -39,6 +39,7 @@ | ||
39 | 39 | #include "ogg.h" |
40 | 40 | #include "mms.h" |
41 | 41 | #include "nsv.h" |
42 | +#include "flv.h" | |
42 | 43 | |
43 | 44 | #include "icy.h" |
44 | 45 | #include "url.h" |
@@ -1374,6 +1375,10 @@ ChannelStream *Channel::createSource() | ||
1374 | 1375 | LOG_CHANNEL("Channel is OGG"); |
1375 | 1376 | source = new OGGStream(); |
1376 | 1377 | break; |
1378 | + case ChanInfo::T_FLV: | |
1379 | + LOG_CHANNEL("Channel is FLV"); | |
1380 | + source = new FLVStream(); | |
1381 | + break; | |
1377 | 1382 | default: |
1378 | 1383 | LOG_CHANNEL("Channel is Raw"); |
1379 | 1384 | source = new RawStream(); |
@@ -2363,7 +2368,6 @@ Channel *ChanMgr::findAndRelay(ChanInfo &info) | ||
2363 | 2368 | return NULL; |
2364 | 2369 | } |
2365 | 2370 | |
2366 | - | |
2367 | 2371 | if (c->isPlaying() && (c->info.contentType!=ChanInfo::T_UNKNOWN)) |
2368 | 2372 | break; |
2369 | 2373 |
@@ -3997,6 +4001,7 @@ const char *ChanInfo::getTypeStr(TYPE t) | ||
3997 | 4001 | case T_MPG: return "MPG"; |
3998 | 4002 | case T_NSV: return "NSV"; |
3999 | 4003 | case T_WMV: return "WMV"; |
4004 | + case T_FLV: return "FLV"; | |
4000 | 4005 | |
4001 | 4006 | case T_PLS: return "PLS"; |
4002 | 4007 | case T_ASX: return "ASX"; |
@@ -4052,6 +4057,8 @@ const char *ChanInfo::getTypeExt(TYPE t) | ||
4052 | 4057 | return ".wmv"; |
4053 | 4058 | case ChanInfo::T_WMA: |
4054 | 4059 | return ".wma"; |
4060 | + case ChanInfo::T_FLV: | |
4061 | + return ".flv"; | |
4055 | 4062 | default: |
4056 | 4063 | return ""; |
4057 | 4064 | } |
@@ -4100,6 +4107,8 @@ ChanInfo::TYPE ChanInfo::getTypeFromStr(const char *str) | ||
4100 | 4107 | return T_WMA; |
4101 | 4108 | else if (stricmp(str,"WMV")==0) |
4102 | 4109 | return T_WMV; |
4110 | + else if (stricmp(str,"FLV")==0) | |
4111 | + return T_FLV; | |
4103 | 4112 | else if (stricmp(str,"PLS")==0) |
4104 | 4113 | return T_PLS; |
4105 | 4114 | else if (stricmp(str,"M3U")==0) |
@@ -95,6 +95,8 @@ public: | ||
95 | 95 | T_WMA, |
96 | 96 | T_WMV, |
97 | 97 | |
98 | + T_FLV, | |
99 | + | |
98 | 100 | T_PLS, |
99 | 101 | T_ASX |
100 | 102 | }; |
@@ -0,0 +1,136 @@ | ||
1 | +// ------------------------------------------------ | |
2 | +// File : flv.cpp | |
3 | +// Date: 14-jan-2017 | |
4 | +// Author: niwakazoider | |
5 | +// | |
6 | +// Modified by Eru @2017.1.15 for compilation error at VS2008 | |
7 | +// | |
8 | +// (c) 2002-3 peercast.org | |
9 | +// ------------------------------------------------ | |
10 | +// This program is free software; you can redistribute it and/or modify | |
11 | +// it under the terms of the GNU General Public License as published by | |
12 | +// the Free Software Foundation; either version 2 of the License, or | |
13 | +// (at your option) any later version. | |
14 | + | |
15 | +// This program is distributed in the hope that it will be useful, | |
16 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | +// GNU General Public License for more details. | |
19 | +// ------------------------------------------------ | |
20 | + | |
21 | +#include "channel.h" | |
22 | +#include "flv.h" | |
23 | +#include "string.h" | |
24 | +#include "stdio.h" | |
25 | +#ifdef _DEBUG | |
26 | +#include "chkMemoryLeak.h" | |
27 | +#define DEBUG_NEW new(__FILE__, __LINE__) | |
28 | +#define new DEBUG_NEW | |
29 | +#endif | |
30 | + | |
31 | + | |
32 | +// ------------------------------------------ | |
33 | +void FLVStream::readEnd(Stream &, Channel *) | |
34 | +{ | |
35 | +} | |
36 | + | |
37 | +// ------------------------------------------ | |
38 | +void FLVStream::readHeader(Stream &, Channel *) | |
39 | +{ | |
40 | +} | |
41 | + | |
42 | +// ------------------------------------------ | |
43 | +int FLVStream::readPacket(Stream &in, Channel *ch) | |
44 | +{ | |
45 | + bool headerUpdate = false; | |
46 | + | |
47 | + if (ch->streamPos == 0) { | |
48 | + bitrate = 0; | |
49 | + FLVFileHeader header = FLVFileHeader(); | |
50 | + header.read(in); | |
51 | + fileHeader = header; | |
52 | + headerUpdate = true; | |
53 | + } | |
54 | + | |
55 | + FLVTag flvTag; | |
56 | + flvTag.read(in); | |
57 | + | |
58 | + switch (flvTag.type) | |
59 | + { | |
60 | + case TAG_SCRIPTDATA: | |
61 | + { | |
62 | + AMFObject amf; | |
63 | + MemoryStream flvmem = MemoryStream(flvTag.data, flvTag.size); | |
64 | + if (amf.readMetaData(flvmem)) { | |
65 | + flvmem.close(); | |
66 | + bitrate = amf.bitrate; | |
67 | + metaData = flvTag; | |
68 | + headerUpdate = true; | |
69 | + } | |
70 | + } | |
71 | + case TAG_VIDEO: | |
72 | + { | |
73 | + //AVC Header | |
74 | + if (flvTag.data[0] == 0x17 && flvTag.data[1] == 0x00 && | |
75 | + flvTag.data[2] == 0x00 && flvTag.data[3] == 0x00) { | |
76 | + avcHeader = flvTag; | |
77 | + headerUpdate = true; | |
78 | + } | |
79 | + } | |
80 | + case TAG_AUDIO: | |
81 | + { | |
82 | + //AAC Header | |
83 | + if (flvTag.data[0] == 0xaf && flvTag.data[1] == 0x00) { | |
84 | + aacHeader = flvTag; | |
85 | + headerUpdate = true; | |
86 | + } | |
87 | + } | |
88 | + } | |
89 | + | |
90 | + if (headerUpdate && fileHeader.size>0) { | |
91 | + int len = fileHeader.size; | |
92 | + if (metaData.type==TAG_SCRIPTDATA) len += metaData.packetSize; | |
93 | + if (avcHeader.type == TAG_VIDEO) len += avcHeader.packetSize; | |
94 | + if (aacHeader.type == TAG_AUDIO) len += aacHeader.packetSize; | |
95 | + MemoryStream mem = MemoryStream(ch->headPack.data, len); | |
96 | + mem.write(fileHeader.data, fileHeader.size); | |
97 | + if (metaData.type == TAG_SCRIPTDATA) mem.write(metaData.packet, metaData.packetSize); | |
98 | + if (avcHeader.type == TAG_VIDEO) mem.write(avcHeader.packet, avcHeader.packetSize); | |
99 | + if (aacHeader.type == TAG_AUDIO) mem.write(aacHeader.packet, aacHeader.packetSize); | |
100 | + | |
101 | + ch->info.bitrate = bitrate; | |
102 | + | |
103 | + ch->headPack.type = ChanPacket::T_HEAD; | |
104 | + ch->headPack.len = mem.pos; | |
105 | + ch->headPack.pos = ch->streamPos; | |
106 | + ch->newPacket(ch->headPack); | |
107 | + | |
108 | + ch->streamPos += ch->headPack.len; | |
109 | + } | |
110 | + else { | |
111 | + ChanPacket pack; | |
112 | + | |
113 | + MemoryStream mem = MemoryStream(flvTag.packet, flvTag.packetSize); | |
114 | + | |
115 | + int rlen = flvTag.packetSize; | |
116 | + while (rlen) | |
117 | + { | |
118 | + int rl = rlen; | |
119 | + if (rl > ChanMgr::MAX_METAINT) | |
120 | + rl = ChanMgr::MAX_METAINT; | |
121 | + | |
122 | + pack.init(ChanPacket::T_DATA, pack.data, rl, ch->streamPos); | |
123 | + mem.read(pack.data, pack.len); | |
124 | + ch->newPacket(pack); | |
125 | + ch->checkReadDelay(pack.len); | |
126 | + ch->streamPos += pack.len; | |
127 | + | |
128 | + rlen -= rl; | |
129 | + } | |
130 | + | |
131 | + mem.close(); | |
132 | + | |
133 | + } | |
134 | + | |
135 | + return 0; | |
136 | +} |
@@ -0,0 +1,277 @@ | ||
1 | +// ------------------------------------------------ | |
2 | +// File : flv.h | |
3 | +// Date: 14-jan-2017 | |
4 | +// Author: niwakazoider | |
5 | +// | |
6 | +// Modified by Eru @2017.1.15 for compilation error at VS2008 | |
7 | +// | |
8 | +// (c) 2002-3 peercast.org | |
9 | +// ------------------------------------------------ | |
10 | +// This program is free software; you can redistribute it and/or modify | |
11 | +// it under the terms of the GNU General Public License as published by | |
12 | +// the Free Software Foundation; either version 2 of the License, or | |
13 | +// (at your option) any later version. | |
14 | + | |
15 | +// This program is distributed in the hope that it will be useful, | |
16 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | +// GNU General Public License for more details. | |
19 | +// ------------------------------------------------ | |
20 | + | |
21 | +#ifndef _FLV_H | |
22 | +#define _FLV_H | |
23 | + | |
24 | +#include "channel.h" | |
25 | +#include "stdio.h" | |
26 | + | |
27 | + | |
28 | +const int TAG_SCRIPTDATA = 18; | |
29 | +const int TAG_AUDIO = 8; | |
30 | +const int TAG_VIDEO = 9; | |
31 | + | |
32 | +// ----------------------------------- | |
33 | +class FLVFileHeader | |
34 | +{ | |
35 | +public: | |
36 | + FLVFileHeader() : size(0), data(NULL) | |
37 | + { | |
38 | + } | |
39 | + | |
40 | + void read(Stream &in) | |
41 | + { | |
42 | + size = 13; | |
43 | + data = (char *)malloc(size); | |
44 | + in.read(data, size); | |
45 | + | |
46 | + if (data[0] == 0x46 && //F | |
47 | + data[1] == 0x4c && //L | |
48 | + data[2] == 0x56) { //V | |
49 | + version = data[3]; | |
50 | + } | |
51 | + } | |
52 | + int version; | |
53 | + int size; | |
54 | + char *data; | |
55 | +}; | |
56 | + | |
57 | + | |
58 | +// ----------------------------------- | |
59 | +class FLVTag | |
60 | +{ | |
61 | +public: | |
62 | + enum TYPE | |
63 | + { | |
64 | + T_UNKNOWN, | |
65 | + T_SCRIPT, | |
66 | + T_AUDIO, | |
67 | + T_VIDEO | |
68 | + }; | |
69 | + | |
70 | + FLVTag() | |
71 | + { | |
72 | + size = 0; | |
73 | + type = T_UNKNOWN; | |
74 | + data = NULL; | |
75 | + packet = NULL; | |
76 | + } | |
77 | + | |
78 | + void read(Stream &in) | |
79 | + { | |
80 | + if (data != NULL) free(data); | |
81 | + if (packet != NULL) free(packet); | |
82 | + | |
83 | + unsigned char binary[11]; | |
84 | + in.read(binary, 11); | |
85 | + | |
86 | + type = binary[0]; | |
87 | + size = (binary[1] << 16) | (binary[2] << 8) | (binary[3]); | |
88 | + //int timestamp = (binary[7] << 24) | (binary[4] << 16) | (binary[5] << 8) | (binary[6]); | |
89 | + //int streamID = (binary[8] << 16) | (binary[9] << 8) | (binary[10]); | |
90 | + data = (char *)malloc(size); | |
91 | + in.read(data, size); | |
92 | + | |
93 | + unsigned char prevsize[4]; | |
94 | + in.read(prevsize, 4); | |
95 | + | |
96 | + packet = (char *)malloc(11+size+4); | |
97 | + memcpy(packet, binary, 11); | |
98 | + memcpy(packet+11, data, size); | |
99 | + memcpy(packet+11+size, prevsize, 4); | |
100 | + packetSize = 11 + size + 4; | |
101 | + } | |
102 | + | |
103 | + const char *getTagType() | |
104 | + { | |
105 | + switch (type) | |
106 | + { | |
107 | + case TAG_SCRIPTDATA: | |
108 | + return "Script"; | |
109 | + case TAG_VIDEO: | |
110 | + return "Video"; | |
111 | + case TAG_AUDIO: | |
112 | + return "Audio"; | |
113 | + } | |
114 | + return "Unknown"; | |
115 | + } | |
116 | + | |
117 | + int size; | |
118 | + int packetSize; | |
119 | + char type; | |
120 | + char *data; | |
121 | + char *packet; | |
122 | +}; | |
123 | + | |
124 | + | |
125 | + | |
126 | +// ---------------------------------------------- | |
127 | +class FLVStream : public ChannelStream | |
128 | +{ | |
129 | +public: | |
130 | + int bitrate; | |
131 | + FLVFileHeader fileHeader; | |
132 | + FLVTag metaData; | |
133 | + FLVTag aacHeader; | |
134 | + FLVTag avcHeader; | |
135 | + FLVStream() | |
136 | + { | |
137 | + fileHeader = FLVFileHeader(); | |
138 | + metaData = FLVTag(); | |
139 | + aacHeader = FLVTag(); | |
140 | + avcHeader = FLVTag(); | |
141 | + bitrate = 0; | |
142 | + } | |
143 | + virtual void readHeader(Stream &, Channel *); | |
144 | + virtual int readPacket(Stream &, Channel *); | |
145 | + virtual void readEnd(Stream &, Channel *); | |
146 | +}; | |
147 | + | |
148 | +class AMFObject | |
149 | +{ | |
150 | +public: | |
151 | + AMFObject() : bitrate(0) | |
152 | + { | |
153 | + // nothing to do | |
154 | + } | |
155 | + | |
156 | + static const int AMF_NUMBER = 0x00; | |
157 | + static const int AMF_BOOL = 0x01; | |
158 | + static const int AMF_STRING = 0x02; | |
159 | + static const int AMF_OBJECT = 0x03; | |
160 | + static const int AMF_MOVIECLIP = 0x04; | |
161 | + static const int AMF_NULL = 0x05; | |
162 | + static const int AMF_UNDEFINED = 0x06; | |
163 | + static const int AMF_REFERENCE = 0x07; | |
164 | + static const int AMF_ARRAY = 0x08; | |
165 | + static const int AMF_OBJECT_END = 0x09; | |
166 | + static const int AMF_STRICTARRAY = 0x0a; | |
167 | + static const int AMF_DATE = 0x0b; | |
168 | + static const int AMF_LONG_STRING = 0x0c; | |
169 | + | |
170 | + bool readBool(Stream &in) | |
171 | + { | |
172 | + return in.readChar() != 0; | |
173 | + } | |
174 | + | |
175 | + int readInt(Stream &in) | |
176 | + { | |
177 | + return (in.readChar() << 24) | (in.readChar() << 16) | (in.readChar() << 8) | (in.readChar()); | |
178 | + } | |
179 | + | |
180 | + char* readString(Stream &in) | |
181 | + { | |
182 | + int len = (in.readChar() << 8) | (in.readChar()); | |
183 | + if (len == 0) { | |
184 | + return NULL; | |
185 | + } | |
186 | + else { | |
187 | + char* data = (char *)malloc(len+1); | |
188 | + *(data+len) = '\0'; | |
189 | + in.read(data, len); | |
190 | + return data; | |
191 | + } | |
192 | + }; | |
193 | + | |
194 | + double readDouble(Stream &in) | |
195 | + { | |
196 | + char* data = (char *)malloc(sizeof(double)); | |
197 | + for (int i = 8; i > 0; i--) { | |
198 | + char c = in.readChar(); | |
199 | + *(data + i - 1) = c; | |
200 | + } | |
201 | + double number = *reinterpret_cast<double*>(data); | |
202 | + return number; | |
203 | + }; | |
204 | + | |
205 | + void readObject(Stream &in) | |
206 | + { | |
207 | + while (true) { | |
208 | + char* key = readString(in); | |
209 | + if (key == NULL) { | |
210 | + break; | |
211 | + } | |
212 | + else { | |
213 | + if (strcmp(key, "audiodatarate") == 0) { | |
214 | + in.readChar(); | |
215 | + bitrate += static_cast<int>(readDouble(in)); | |
216 | + } | |
217 | + else if (strcmp(key, "videodatarate") == 0) { | |
218 | + in.readChar(); | |
219 | + bitrate += static_cast<int>(readDouble(in)); | |
220 | + } | |
221 | + else { | |
222 | + read(in); | |
223 | + } | |
224 | + } | |
225 | + } | |
226 | + in.readChar(); | |
227 | + } | |
228 | + | |
229 | + bool readMetaData(Stream &in) | |
230 | + { | |
231 | + char type = in.readChar(); | |
232 | + if (type == AMF_STRING) { | |
233 | + char* name = readString(in); | |
234 | + if (strcmp(name, "onMetaData") == 0) { | |
235 | + bitrate = 0; | |
236 | + read(in); | |
237 | + } | |
238 | + } | |
239 | + return bitrate > 0; | |
240 | + } | |
241 | + | |
242 | + void read(Stream &in) | |
243 | + { | |
244 | + char type = in.readChar(); | |
245 | + if (type == AMF_NUMBER) { | |
246 | + readDouble(in); | |
247 | + } | |
248 | + else if (type == AMF_BOOL) { | |
249 | + readBool(in); | |
250 | + } | |
251 | + else if (type == AMF_STRING) { | |
252 | + readString(in); | |
253 | + } | |
254 | + else if (type == AMF_OBJECT) { | |
255 | + readObject(in); | |
256 | + } | |
257 | + else if (type == AMF_OBJECT_END) { | |
258 | + } | |
259 | + else if (type == AMF_ARRAY) { | |
260 | + int len = readInt(in); | |
261 | + readObject(in); | |
262 | + } | |
263 | + else if (type == AMF_STRICTARRAY) { | |
264 | + int len = readInt(in); | |
265 | + for (int i = 0; i < len; i++) { | |
266 | + read(in); | |
267 | + } | |
268 | + } | |
269 | + else if (type == AMF_DATE) { | |
270 | + in.skip(10); | |
271 | + } | |
272 | + } | |
273 | + int bitrate; | |
274 | +}; | |
275 | + | |
276 | + | |
277 | +#endif |
@@ -74,6 +74,8 @@ static const char *MIME_RAM = "audio/x-pn-realaudio"; | ||
74 | 74 | static const char *MIME_WMA = "audio/x-ms-wma"; |
75 | 75 | static const char *MIME_WMV = "video/x-ms-wmv"; |
76 | 76 | |
77 | +static const char *MIME_FLV = "video/flv"; | |
78 | + | |
77 | 79 | static const char *MIME_HTML = "text/html"; |
78 | 80 | static const char *MIME_XML = "text/xml"; |
79 | 81 | static const char *MIME_CSS = "text/css"; |
@@ -44,9 +44,9 @@ extern int version_ex; // VERSION_EX | ||
44 | 44 | #if 1 /* for VP extend version */ |
45 | 45 | //#define VERSION_EX 1 |
46 | 46 | static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only |
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)"; | |
47 | +static const int PCP_CLIENT_VERSION_EX_NUMBER = 51; | |
48 | +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0051)"; | |
49 | +static const char *PCX_VERSTRING_EX = "v0.1218(IM0051)"; | |
50 | 50 | |
51 | 51 | static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; |
52 | 52 | static const char *PCP_CLIENT_VERSION_URL = "version.pecaim.net"; |
@@ -1249,6 +1249,31 @@ | ||
1249 | 1249 | </Configuration> |
1250 | 1250 | </Configurations> |
1251 | 1251 | <References> |
1252 | + <AssemblyReference | |
1253 | + RelativePath="System.dll" | |
1254 | + AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" | |
1255 | + MinFrameworkVersion="131072" | |
1256 | + /> | |
1257 | + <AssemblyReference | |
1258 | + RelativePath="System.Data.dll" | |
1259 | + AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86" | |
1260 | + MinFrameworkVersion="131072" | |
1261 | + /> | |
1262 | + <AssemblyReference | |
1263 | + RelativePath="System.Drawing.dll" | |
1264 | + AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" | |
1265 | + MinFrameworkVersion="131072" | |
1266 | + /> | |
1267 | + <AssemblyReference | |
1268 | + RelativePath="System.Windows.Forms.dll" | |
1269 | + AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" | |
1270 | + MinFrameworkVersion="131072" | |
1271 | + /> | |
1272 | + <AssemblyReference | |
1273 | + RelativePath="System.XML.dll" | |
1274 | + AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" | |
1275 | + MinFrameworkVersion="131072" | |
1276 | + /> | |
1252 | 1277 | </References> |
1253 | 1278 | <Files> |
1254 | 1279 | <Filter |
@@ -1394,6 +1419,36 @@ | ||
1394 | 1419 | </FileConfiguration> |
1395 | 1420 | </File> |
1396 | 1421 | <File |
1422 | + RelativePath="..\..\common\flv.cpp" | |
1423 | + > | |
1424 | + <FileConfiguration | |
1425 | + Name="Debug|Win32" | |
1426 | + > | |
1427 | + <Tool | |
1428 | + Name="VCCLCompilerTool" | |
1429 | + MinimalRebuild="false" | |
1430 | + ExceptionHandling="2" | |
1431 | + BasicRuntimeChecks="0" | |
1432 | + UsePrecompiledHeader="0" | |
1433 | + DebugInformationFormat="3" | |
1434 | + CompileAsManaged="1" | |
1435 | + /> | |
1436 | + </FileConfiguration> | |
1437 | + <FileConfiguration | |
1438 | + Name="Release|Win32" | |
1439 | + > | |
1440 | + <Tool | |
1441 | + Name="VCCLCompilerTool" | |
1442 | + MinimalRebuild="false" | |
1443 | + ExceptionHandling="2" | |
1444 | + BasicRuntimeChecks="0" | |
1445 | + UsePrecompiledHeader="0" | |
1446 | + DebugInformationFormat="3" | |
1447 | + CompileAsManaged="1" | |
1448 | + /> | |
1449 | + </FileConfiguration> | |
1450 | + </File> | |
1451 | + <File | |
1397 | 1452 | RelativePath="..\..\common\gnutella.cpp" |
1398 | 1453 | > |
1399 | 1454 | <FileConfiguration |
@@ -4480,6 +4535,10 @@ | ||
4480 | 4535 | > |
4481 | 4536 | </File> |
4482 | 4537 | <File |
4538 | + RelativePath="..\..\common\flv.h" | |
4539 | + > | |
4540 | + </File> | |
4541 | + <File | |
4483 | 4542 | RelativePath="..\..\common\gnutella.h" |
4484 | 4543 | > |
4485 | 4544 | </File> |
@@ -1045,7 +1045,6 @@ | ||
1045 | 1045 | /> |
1046 | 1046 | <Tool |
1047 | 1047 | Name="VCPostBuildEventTool" |
1048 | - Description="" | |
1049 | 1048 | CommandLine="" |
1050 | 1049 | /> |
1051 | 1050 | </Configuration> |