winlin

refine amf0, rename internal classes

@@ -116,28 +116,28 @@ bool SrsAmf0Any::is_complex_object() @@ -116,28 +116,28 @@ bool SrsAmf0Any::is_complex_object()
116 116
117 string SrsAmf0Any::to_str() 117 string SrsAmf0Any::to_str()
118 { 118 {
119 - __SrsAmf0String* p = dynamic_cast<__SrsAmf0String*>(this); 119 + SrsAmf0String* p = dynamic_cast<SrsAmf0String*>(this);
120 srs_assert(p != NULL); 120 srs_assert(p != NULL);
121 return p->value; 121 return p->value;
122 } 122 }
123 123
124 const char* SrsAmf0Any::to_str_raw() 124 const char* SrsAmf0Any::to_str_raw()
125 { 125 {
126 - __SrsAmf0String* p = dynamic_cast<__SrsAmf0String*>(this); 126 + SrsAmf0String* p = dynamic_cast<SrsAmf0String*>(this);
127 srs_assert(p != NULL); 127 srs_assert(p != NULL);
128 return p->value.data(); 128 return p->value.data();
129 } 129 }
130 130
131 bool SrsAmf0Any::to_boolean() 131 bool SrsAmf0Any::to_boolean()
132 { 132 {
133 - __SrsAmf0Boolean* p = dynamic_cast<__SrsAmf0Boolean*>(this); 133 + SrsAmf0Boolean* p = dynamic_cast<SrsAmf0Boolean*>(this);
134 srs_assert(p != NULL); 134 srs_assert(p != NULL);
135 return p->value; 135 return p->value;
136 } 136 }
137 137
138 double SrsAmf0Any::to_number() 138 double SrsAmf0Any::to_number()
139 { 139 {
140 - __SrsAmf0Number* p = dynamic_cast<__SrsAmf0Number*>(this); 140 + SrsAmf0Number* p = dynamic_cast<SrsAmf0Number*>(this);
141 srs_assert(p != NULL); 141 srs_assert(p != NULL);
142 return p->value; 142 return p->value;
143 } 143 }
@@ -165,7 +165,7 @@ SrsAmf0StrictArray* SrsAmf0Any::to_strict_array() @@ -165,7 +165,7 @@ SrsAmf0StrictArray* SrsAmf0Any::to_strict_array()
165 165
166 void SrsAmf0Any::set_number(double value) 166 void SrsAmf0Any::set_number(double value)
167 { 167 {
168 - __SrsAmf0Number* p = dynamic_cast<__SrsAmf0Number*>(this); 168 + SrsAmf0Number* p = dynamic_cast<SrsAmf0Number*>(this);
169 srs_assert(p != NULL); 169 srs_assert(p != NULL);
170 p->value = value; 170 p->value = value;
171 } 171 }
@@ -261,27 +261,27 @@ char* SrsAmf0Any::human_print(char** pdata, int* psize) @@ -261,27 +261,27 @@ char* SrsAmf0Any::human_print(char** pdata, int* psize)
261 261
262 SrsAmf0Any* SrsAmf0Any::str(const char* value) 262 SrsAmf0Any* SrsAmf0Any::str(const char* value)
263 { 263 {
264 - return new __SrsAmf0String(value); 264 + return new SrsAmf0String(value);
265 } 265 }
266 266
267 SrsAmf0Any* SrsAmf0Any::boolean(bool value) 267 SrsAmf0Any* SrsAmf0Any::boolean(bool value)
268 { 268 {
269 - return new __SrsAmf0Boolean(value); 269 + return new SrsAmf0Boolean(value);
270 } 270 }
271 271
272 SrsAmf0Any* SrsAmf0Any::number(double value) 272 SrsAmf0Any* SrsAmf0Any::number(double value)
273 { 273 {
274 - return new __SrsAmf0Number(value); 274 + return new SrsAmf0Number(value);
275 } 275 }
276 276
277 SrsAmf0Any* SrsAmf0Any::null() 277 SrsAmf0Any* SrsAmf0Any::null()
278 { 278 {
279 - return new __SrsAmf0Null(); 279 + return new SrsAmf0Null();
280 } 280 }
281 281
282 SrsAmf0Any* SrsAmf0Any::undefined() 282 SrsAmf0Any* SrsAmf0Any::undefined()
283 { 283 {
284 - return new __SrsAmf0Undefined(); 284 + return new SrsAmf0Undefined();
285 } 285 }
286 286
287 SrsAmf0Object* SrsAmf0Any::object() 287 SrsAmf0Object* SrsAmf0Any::object()
@@ -291,7 +291,7 @@ SrsAmf0Object* SrsAmf0Any::object() @@ -291,7 +291,7 @@ SrsAmf0Object* SrsAmf0Any::object()
291 291
292 SrsAmf0Any* SrsAmf0Any::object_eof() 292 SrsAmf0Any* SrsAmf0Any::object_eof()
293 { 293 {
294 - return new __SrsAmf0ObjectEOF(); 294 + return new SrsAmf0ObjectEOF();
295 } 295 }
296 296
297 SrsAmf0EcmaArray* SrsAmf0Any::ecma_array() 297 SrsAmf0EcmaArray* SrsAmf0Any::ecma_array()
@@ -310,7 +310,7 @@ int SrsAmf0Any::discovery(SrsStream* stream, SrsAmf0Any** ppvalue) @@ -310,7 +310,7 @@ int SrsAmf0Any::discovery(SrsStream* stream, SrsAmf0Any** ppvalue)
310 310
311 // detect the object-eof specially 311 // detect the object-eof specially
312 if (srs_amf0_is_object_eof(stream)) { 312 if (srs_amf0_is_object_eof(stream)) {
313 - *ppvalue = new __SrsAmf0ObjectEOF(); 313 + *ppvalue = new SrsAmf0ObjectEOF();
314 return ret; 314 return ret;
315 } 315 }
316 316
@@ -371,21 +371,21 @@ int SrsAmf0Any::discovery(SrsStream* stream, SrsAmf0Any** ppvalue) @@ -371,21 +371,21 @@ int SrsAmf0Any::discovery(SrsStream* stream, SrsAmf0Any** ppvalue)
371 return ret; 371 return ret;
372 } 372 }
373 373
374 -__SrsUnSortedHashtable::__SrsUnSortedHashtable() 374 +SrsUnSortedHashtable::SrsUnSortedHashtable()
375 { 375 {
376 } 376 }
377 377
378 -__SrsUnSortedHashtable::~__SrsUnSortedHashtable() 378 +SrsUnSortedHashtable::~SrsUnSortedHashtable()
379 { 379 {
380 clear(); 380 clear();
381 } 381 }
382 382
383 -int __SrsUnSortedHashtable::count() 383 +int SrsUnSortedHashtable::count()
384 { 384 {
385 return (int)properties.size(); 385 return (int)properties.size();
386 } 386 }
387 387
388 -void __SrsUnSortedHashtable::clear() 388 +void SrsUnSortedHashtable::clear()
389 { 389 {
390 std::vector<SrsAmf0ObjectPropertyType>::iterator it; 390 std::vector<SrsAmf0ObjectPropertyType>::iterator it;
391 for (it = properties.begin(); it != properties.end(); ++it) { 391 for (it = properties.begin(); it != properties.end(); ++it) {
@@ -396,28 +396,28 @@ void __SrsUnSortedHashtable::clear() @@ -396,28 +396,28 @@ void __SrsUnSortedHashtable::clear()
396 properties.clear(); 396 properties.clear();
397 } 397 }
398 398
399 -string __SrsUnSortedHashtable::key_at(int index) 399 +string SrsUnSortedHashtable::key_at(int index)
400 { 400 {
401 srs_assert(index < count()); 401 srs_assert(index < count());
402 SrsAmf0ObjectPropertyType& elem = properties[index]; 402 SrsAmf0ObjectPropertyType& elem = properties[index];
403 return elem.first; 403 return elem.first;
404 } 404 }
405 405
406 -const char* __SrsUnSortedHashtable::key_raw_at(int index) 406 +const char* SrsUnSortedHashtable::key_raw_at(int index)
407 { 407 {
408 srs_assert(index < count()); 408 srs_assert(index < count());
409 SrsAmf0ObjectPropertyType& elem = properties[index]; 409 SrsAmf0ObjectPropertyType& elem = properties[index];
410 return elem.first.data(); 410 return elem.first.data();
411 } 411 }
412 412
413 -SrsAmf0Any* __SrsUnSortedHashtable::value_at(int index) 413 +SrsAmf0Any* SrsUnSortedHashtable::value_at(int index)
414 { 414 {
415 srs_assert(index < count()); 415 srs_assert(index < count());
416 SrsAmf0ObjectPropertyType& elem = properties[index]; 416 SrsAmf0ObjectPropertyType& elem = properties[index];
417 return elem.second; 417 return elem.second;
418 } 418 }
419 419
420 -void __SrsUnSortedHashtable::set(string key, SrsAmf0Any* value) 420 +void SrsUnSortedHashtable::set(string key, SrsAmf0Any* value)
421 { 421 {
422 if (!value) { 422 if (!value) {
423 srs_warn("add a NULL propertity %s", key.c_str()); 423 srs_warn("add a NULL propertity %s", key.c_str());
@@ -441,7 +441,7 @@ void __SrsUnSortedHashtable::set(string key, SrsAmf0Any* value) @@ -441,7 +441,7 @@ void __SrsUnSortedHashtable::set(string key, SrsAmf0Any* value)
441 properties.push_back(std::make_pair(key, value)); 441 properties.push_back(std::make_pair(key, value));
442 } 442 }
443 443
444 -SrsAmf0Any* __SrsUnSortedHashtable::get_property(string name) 444 +SrsAmf0Any* SrsUnSortedHashtable::get_property(string name)
445 { 445 {
446 std::vector<SrsAmf0ObjectPropertyType>::iterator it; 446 std::vector<SrsAmf0ObjectPropertyType>::iterator it;
447 447
@@ -457,7 +457,7 @@ SrsAmf0Any* __SrsUnSortedHashtable::get_property(string name) @@ -457,7 +457,7 @@ SrsAmf0Any* __SrsUnSortedHashtable::get_property(string name)
457 return NULL; 457 return NULL;
458 } 458 }
459 459
460 -SrsAmf0Any* __SrsUnSortedHashtable::ensure_property_string(string name) 460 +SrsAmf0Any* SrsUnSortedHashtable::ensure_property_string(string name)
461 { 461 {
462 SrsAmf0Any* prop = get_property(name); 462 SrsAmf0Any* prop = get_property(name);
463 463
@@ -472,7 +472,7 @@ SrsAmf0Any* __SrsUnSortedHashtable::ensure_property_string(string name) @@ -472,7 +472,7 @@ SrsAmf0Any* __SrsUnSortedHashtable::ensure_property_string(string name)
472 return prop; 472 return prop;
473 } 473 }
474 474
475 -SrsAmf0Any* __SrsUnSortedHashtable::ensure_property_number(string name) 475 +SrsAmf0Any* SrsUnSortedHashtable::ensure_property_number(string name)
476 { 476 {
477 SrsAmf0Any* prop = get_property(name); 477 SrsAmf0Any* prop = get_property(name);
478 478
@@ -487,7 +487,7 @@ SrsAmf0Any* __SrsUnSortedHashtable::ensure_property_number(string name) @@ -487,7 +487,7 @@ SrsAmf0Any* __SrsUnSortedHashtable::ensure_property_number(string name)
487 return prop; 487 return prop;
488 } 488 }
489 489
490 -void __SrsUnSortedHashtable::copy(__SrsUnSortedHashtable* src) 490 +void SrsUnSortedHashtable::copy(SrsUnSortedHashtable* src)
491 { 491 {
492 std::vector<SrsAmf0ObjectPropertyType>::iterator it; 492 std::vector<SrsAmf0ObjectPropertyType>::iterator it;
493 for (it = src->properties.begin(); it != src->properties.end(); ++it) { 493 for (it = src->properties.begin(); it != src->properties.end(); ++it) {
@@ -498,22 +498,22 @@ void __SrsUnSortedHashtable::copy(__SrsUnSortedHashtable* src) @@ -498,22 +498,22 @@ void __SrsUnSortedHashtable::copy(__SrsUnSortedHashtable* src)
498 } 498 }
499 } 499 }
500 500
501 -__SrsAmf0ObjectEOF::__SrsAmf0ObjectEOF() 501 +SrsAmf0ObjectEOF::SrsAmf0ObjectEOF()
502 { 502 {
503 marker = RTMP_AMF0_ObjectEnd; 503 marker = RTMP_AMF0_ObjectEnd;
504 utf8_empty = 0x00; 504 utf8_empty = 0x00;
505 } 505 }
506 506
507 -__SrsAmf0ObjectEOF::~__SrsAmf0ObjectEOF() 507 +SrsAmf0ObjectEOF::~SrsAmf0ObjectEOF()
508 { 508 {
509 } 509 }
510 510
511 -int __SrsAmf0ObjectEOF::total_size() 511 +int SrsAmf0ObjectEOF::total_size()
512 { 512 {
513 return SrsAmf0Size::object_eof(); 513 return SrsAmf0Size::object_eof();
514 } 514 }
515 515
516 -int __SrsAmf0ObjectEOF::read(SrsStream* stream) 516 +int SrsAmf0ObjectEOF::read(SrsStream* stream)
517 { 517 {
518 int ret = ERROR_SUCCESS; 518 int ret = ERROR_SUCCESS;
519 519
@@ -551,7 +551,7 @@ int __SrsAmf0ObjectEOF::read(SrsStream* stream) @@ -551,7 +551,7 @@ int __SrsAmf0ObjectEOF::read(SrsStream* stream)
551 551
552 return ret; 552 return ret;
553 } 553 }
554 -int __SrsAmf0ObjectEOF::write(SrsStream* stream) 554 +int SrsAmf0ObjectEOF::write(SrsStream* stream)
555 { 555 {
556 int ret = ERROR_SUCCESS; 556 int ret = ERROR_SUCCESS;
557 557
@@ -578,15 +578,15 @@ int __SrsAmf0ObjectEOF::write(SrsStream* stream) @@ -578,15 +578,15 @@ int __SrsAmf0ObjectEOF::write(SrsStream* stream)
578 return ret; 578 return ret;
579 } 579 }
580 580
581 -SrsAmf0Any* __SrsAmf0ObjectEOF::copy() 581 +SrsAmf0Any* SrsAmf0ObjectEOF::copy()
582 { 582 {
583 - return new __SrsAmf0ObjectEOF(); 583 + return new SrsAmf0ObjectEOF();
584 } 584 }
585 585
586 SrsAmf0Object::SrsAmf0Object() 586 SrsAmf0Object::SrsAmf0Object()
587 { 587 {
588 - properties = new __SrsUnSortedHashtable();  
589 - eof = new __SrsAmf0ObjectEOF(); 588 + properties = new SrsUnSortedHashtable();
  589 + eof = new SrsAmf0ObjectEOF();
590 marker = RTMP_AMF0_Object; 590 marker = RTMP_AMF0_Object;
591 } 591 }
592 592
@@ -637,7 +637,7 @@ int SrsAmf0Object::read(SrsStream* stream) @@ -637,7 +637,7 @@ int SrsAmf0Object::read(SrsStream* stream)
637 while (!stream->empty()) { 637 while (!stream->empty()) {
638 // detect whether is eof. 638 // detect whether is eof.
639 if (srs_amf0_is_object_eof(stream)) { 639 if (srs_amf0_is_object_eof(stream)) {
640 - __SrsAmf0ObjectEOF pbj_eof; 640 + SrsAmf0ObjectEOF pbj_eof;
641 if ((ret = pbj_eof.read(stream)) != ERROR_SUCCESS) { 641 if ((ret = pbj_eof.read(stream)) != ERROR_SUCCESS) {
642 srs_error("amf0 object read eof failed. ret=%d", ret); 642 srs_error("amf0 object read eof failed. ret=%d", ret);
643 return ret; 643 return ret;
@@ -765,8 +765,8 @@ SrsAmf0Any* SrsAmf0Object::ensure_property_number(string name) @@ -765,8 +765,8 @@ SrsAmf0Any* SrsAmf0Object::ensure_property_number(string name)
765 SrsAmf0EcmaArray::SrsAmf0EcmaArray() 765 SrsAmf0EcmaArray::SrsAmf0EcmaArray()
766 { 766 {
767 _count = 0; 767 _count = 0;
768 - properties = new __SrsUnSortedHashtable();  
769 - eof = new __SrsAmf0ObjectEOF(); 768 + properties = new SrsUnSortedHashtable();
  769 + eof = new SrsAmf0ObjectEOF();
770 marker = RTMP_AMF0_EcmaArray; 770 marker = RTMP_AMF0_EcmaArray;
771 } 771 }
772 772
@@ -829,7 +829,7 @@ int SrsAmf0EcmaArray::read(SrsStream* stream) @@ -829,7 +829,7 @@ int SrsAmf0EcmaArray::read(SrsStream* stream)
829 while (!stream->empty()) { 829 while (!stream->empty()) {
830 // detect whether is eof. 830 // detect whether is eof.
831 if (srs_amf0_is_object_eof(stream)) { 831 if (srs_amf0_is_object_eof(stream)) {
832 - __SrsAmf0ObjectEOF pbj_eof; 832 + SrsAmf0ObjectEOF pbj_eof;
833 if ((ret = pbj_eof.read(stream)) != ERROR_SUCCESS) { 833 if ((ret = pbj_eof.read(stream)) != ERROR_SUCCESS) {
834 srs_error("amf0 ecma_array read eof failed. ret=%d", ret); 834 srs_error("amf0 ecma_array read eof failed. ret=%d", ret);
835 return ret; 835 return ret;
@@ -1186,7 +1186,7 @@ int SrsAmf0Size::any(SrsAmf0Any* o) @@ -1186,7 +1186,7 @@ int SrsAmf0Size::any(SrsAmf0Any* o)
1186 return o->total_size(); 1186 return o->total_size();
1187 } 1187 }
1188 1188
1189 -__SrsAmf0String::__SrsAmf0String(const char* _value) 1189 +SrsAmf0String::SrsAmf0String(const char* _value)
1190 { 1190 {
1191 marker = RTMP_AMF0_String; 1191 marker = RTMP_AMF0_String;
1192 if (_value) { 1192 if (_value) {
@@ -1194,150 +1194,150 @@ __SrsAmf0String::__SrsAmf0String(const char* _value) @@ -1194,150 +1194,150 @@ __SrsAmf0String::__SrsAmf0String(const char* _value)
1194 } 1194 }
1195 } 1195 }
1196 1196
1197 -__SrsAmf0String::~__SrsAmf0String() 1197 +SrsAmf0String::~SrsAmf0String()
1198 { 1198 {
1199 } 1199 }
1200 1200
1201 -int __SrsAmf0String::total_size() 1201 +int SrsAmf0String::total_size()
1202 { 1202 {
1203 return SrsAmf0Size::str(value); 1203 return SrsAmf0Size::str(value);
1204 } 1204 }
1205 1205
1206 -int __SrsAmf0String::read(SrsStream* stream) 1206 +int SrsAmf0String::read(SrsStream* stream)
1207 { 1207 {
1208 return srs_amf0_read_string(stream, value); 1208 return srs_amf0_read_string(stream, value);
1209 } 1209 }
1210 1210
1211 -int __SrsAmf0String::write(SrsStream* stream) 1211 +int SrsAmf0String::write(SrsStream* stream)
1212 { 1212 {
1213 return srs_amf0_write_string(stream, value); 1213 return srs_amf0_write_string(stream, value);
1214 } 1214 }
1215 1215
1216 -SrsAmf0Any* __SrsAmf0String::copy() 1216 +SrsAmf0Any* SrsAmf0String::copy()
1217 { 1217 {
1218 - __SrsAmf0String* copy = new __SrsAmf0String(value.c_str()); 1218 + SrsAmf0String* copy = new SrsAmf0String(value.c_str());
1219 return copy; 1219 return copy;
1220 } 1220 }
1221 1221
1222 -__SrsAmf0Boolean::__SrsAmf0Boolean(bool _value) 1222 +SrsAmf0Boolean::SrsAmf0Boolean(bool _value)
1223 { 1223 {
1224 marker = RTMP_AMF0_Boolean; 1224 marker = RTMP_AMF0_Boolean;
1225 value = _value; 1225 value = _value;
1226 } 1226 }
1227 1227
1228 -__SrsAmf0Boolean::~__SrsAmf0Boolean() 1228 +SrsAmf0Boolean::~SrsAmf0Boolean()
1229 { 1229 {
1230 } 1230 }
1231 1231
1232 -int __SrsAmf0Boolean::total_size() 1232 +int SrsAmf0Boolean::total_size()
1233 { 1233 {
1234 return SrsAmf0Size::boolean(); 1234 return SrsAmf0Size::boolean();
1235 } 1235 }
1236 1236
1237 -int __SrsAmf0Boolean::read(SrsStream* stream) 1237 +int SrsAmf0Boolean::read(SrsStream* stream)
1238 { 1238 {
1239 return srs_amf0_read_boolean(stream, value); 1239 return srs_amf0_read_boolean(stream, value);
1240 } 1240 }
1241 1241
1242 -int __SrsAmf0Boolean::write(SrsStream* stream) 1242 +int SrsAmf0Boolean::write(SrsStream* stream)
1243 { 1243 {
1244 return srs_amf0_write_boolean(stream, value); 1244 return srs_amf0_write_boolean(stream, value);
1245 } 1245 }
1246 1246
1247 -SrsAmf0Any* __SrsAmf0Boolean::copy() 1247 +SrsAmf0Any* SrsAmf0Boolean::copy()
1248 { 1248 {
1249 - __SrsAmf0Boolean* copy = new __SrsAmf0Boolean(value); 1249 + SrsAmf0Boolean* copy = new SrsAmf0Boolean(value);
1250 return copy; 1250 return copy;
1251 } 1251 }
1252 1252
1253 -__SrsAmf0Number::__SrsAmf0Number(double _value) 1253 +SrsAmf0Number::SrsAmf0Number(double _value)
1254 { 1254 {
1255 marker = RTMP_AMF0_Number; 1255 marker = RTMP_AMF0_Number;
1256 value = _value; 1256 value = _value;
1257 } 1257 }
1258 1258
1259 -__SrsAmf0Number::~__SrsAmf0Number() 1259 +SrsAmf0Number::~SrsAmf0Number()
1260 { 1260 {
1261 } 1261 }
1262 1262
1263 -int __SrsAmf0Number::total_size() 1263 +int SrsAmf0Number::total_size()
1264 { 1264 {
1265 return SrsAmf0Size::number(); 1265 return SrsAmf0Size::number();
1266 } 1266 }
1267 1267
1268 -int __SrsAmf0Number::read(SrsStream* stream) 1268 +int SrsAmf0Number::read(SrsStream* stream)
1269 { 1269 {
1270 return srs_amf0_read_number(stream, value); 1270 return srs_amf0_read_number(stream, value);
1271 } 1271 }
1272 1272
1273 -int __SrsAmf0Number::write(SrsStream* stream) 1273 +int SrsAmf0Number::write(SrsStream* stream)
1274 { 1274 {
1275 return srs_amf0_write_number(stream, value); 1275 return srs_amf0_write_number(stream, value);
1276 } 1276 }
1277 1277
1278 -SrsAmf0Any* __SrsAmf0Number::copy() 1278 +SrsAmf0Any* SrsAmf0Number::copy()
1279 { 1279 {
1280 - __SrsAmf0Number* copy = new __SrsAmf0Number(value); 1280 + SrsAmf0Number* copy = new SrsAmf0Number(value);
1281 return copy; 1281 return copy;
1282 } 1282 }
1283 1283
1284 -__SrsAmf0Null::__SrsAmf0Null() 1284 +SrsAmf0Null::SrsAmf0Null()
1285 { 1285 {
1286 marker = RTMP_AMF0_Null; 1286 marker = RTMP_AMF0_Null;
1287 } 1287 }
1288 1288
1289 -__SrsAmf0Null::~__SrsAmf0Null() 1289 +SrsAmf0Null::~SrsAmf0Null()
1290 { 1290 {
1291 } 1291 }
1292 1292
1293 -int __SrsAmf0Null::total_size() 1293 +int SrsAmf0Null::total_size()
1294 { 1294 {
1295 return SrsAmf0Size::null(); 1295 return SrsAmf0Size::null();
1296 } 1296 }
1297 1297
1298 -int __SrsAmf0Null::read(SrsStream* stream) 1298 +int SrsAmf0Null::read(SrsStream* stream)
1299 { 1299 {
1300 return srs_amf0_read_null(stream); 1300 return srs_amf0_read_null(stream);
1301 } 1301 }
1302 1302
1303 -int __SrsAmf0Null::write(SrsStream* stream) 1303 +int SrsAmf0Null::write(SrsStream* stream)
1304 { 1304 {
1305 return srs_amf0_write_null(stream); 1305 return srs_amf0_write_null(stream);
1306 } 1306 }
1307 1307
1308 -SrsAmf0Any* __SrsAmf0Null::copy() 1308 +SrsAmf0Any* SrsAmf0Null::copy()
1309 { 1309 {
1310 - __SrsAmf0Null* copy = new __SrsAmf0Null(); 1310 + SrsAmf0Null* copy = new SrsAmf0Null();
1311 return copy; 1311 return copy;
1312 } 1312 }
1313 1313
1314 -__SrsAmf0Undefined::__SrsAmf0Undefined() 1314 +SrsAmf0Undefined::SrsAmf0Undefined()
1315 { 1315 {
1316 marker = RTMP_AMF0_Undefined; 1316 marker = RTMP_AMF0_Undefined;
1317 } 1317 }
1318 1318
1319 -__SrsAmf0Undefined::~__SrsAmf0Undefined() 1319 +SrsAmf0Undefined::~SrsAmf0Undefined()
1320 { 1320 {
1321 } 1321 }
1322 1322
1323 -int __SrsAmf0Undefined::total_size() 1323 +int SrsAmf0Undefined::total_size()
1324 { 1324 {
1325 return SrsAmf0Size::undefined(); 1325 return SrsAmf0Size::undefined();
1326 } 1326 }
1327 1327
1328 -int __SrsAmf0Undefined::read(SrsStream* stream) 1328 +int SrsAmf0Undefined::read(SrsStream* stream)
1329 { 1329 {
1330 return srs_amf0_read_undefined(stream); 1330 return srs_amf0_read_undefined(stream);
1331 } 1331 }
1332 1332
1333 -int __SrsAmf0Undefined::write(SrsStream* stream) 1333 +int SrsAmf0Undefined::write(SrsStream* stream)
1334 { 1334 {
1335 return srs_amf0_write_undefined(stream); 1335 return srs_amf0_write_undefined(stream);
1336 } 1336 }
1337 1337
1338 -SrsAmf0Any* __SrsAmf0Undefined::copy() 1338 +SrsAmf0Any* SrsAmf0Undefined::copy()
1339 { 1339 {
1340 - __SrsAmf0Undefined* copy = new __SrsAmf0Undefined(); 1340 + SrsAmf0Undefined* copy = new SrsAmf0Undefined();
1341 return copy; 1341 return copy;
1342 } 1342 }
1343 1343
@@ -1703,7 +1703,7 @@ namespace _srs_internal @@ -1703,7 +1703,7 @@ namespace _srs_internal
1703 return false; 1703 return false;
1704 } 1704 }
1705 1705
1706 - int srs_amf0_write_object_eof(SrsStream* stream, __SrsAmf0ObjectEOF* value) 1706 + int srs_amf0_write_object_eof(SrsStream* stream, SrsAmf0ObjectEOF* value)
1707 { 1707 {
1708 int ret = ERROR_SUCCESS; 1708 int ret = ERROR_SUCCESS;
1709 1709
@@ -41,8 +41,8 @@ class SrsAmf0StrictArray; @@ -41,8 +41,8 @@ class SrsAmf0StrictArray;
41 // internal objects, user should never use it. 41 // internal objects, user should never use it.
42 namespace _srs_internal 42 namespace _srs_internal
43 { 43 {
44 - class __SrsUnSortedHashtable;  
45 - class __SrsAmf0ObjectEOF; 44 + class SrsUnSortedHashtable;
  45 + class SrsAmf0ObjectEOF;
46 } 46 }
47 47
48 /* 48 /*
@@ -317,8 +317,8 @@ public: @@ -317,8 +317,8 @@ public:
317 class SrsAmf0Object : public SrsAmf0Any 317 class SrsAmf0Object : public SrsAmf0Any
318 { 318 {
319 private: 319 private:
320 - _srs_internal::__SrsUnSortedHashtable* properties;  
321 - _srs_internal::__SrsAmf0ObjectEOF* eof; 320 + _srs_internal::SrsUnSortedHashtable* properties;
  321 + _srs_internal::SrsAmf0ObjectEOF* eof;
322 private: 322 private:
323 friend class SrsAmf0Any; 323 friend class SrsAmf0Any;
324 /** 324 /**
@@ -399,8 +399,8 @@ public: @@ -399,8 +399,8 @@ public:
399 class SrsAmf0EcmaArray : public SrsAmf0Any 399 class SrsAmf0EcmaArray : public SrsAmf0Any
400 { 400 {
401 private: 401 private:
402 - _srs_internal::__SrsUnSortedHashtable* properties;  
403 - _srs_internal::__SrsAmf0ObjectEOF* eof; 402 + _srs_internal::SrsUnSortedHashtable* properties;
  403 + _srs_internal::SrsAmf0ObjectEOF* eof;
404 int32_t _count; 404 int32_t _count;
405 private: 405 private:
406 friend class SrsAmf0Any; 406 friend class SrsAmf0Any;
@@ -600,13 +600,19 @@ namespace _srs_internal @@ -600,13 +600,19 @@ namespace _srs_internal
600 * @return default value is empty string. 600 * @return default value is empty string.
601 * @remark: use SrsAmf0Any::str() to create it. 601 * @remark: use SrsAmf0Any::str() to create it.
602 */ 602 */
603 - class __SrsAmf0String : public SrsAmf0Any 603 + class SrsAmf0String : public SrsAmf0Any
604 { 604 {
605 public: 605 public:
606 std::string value; 606 std::string value;
  607 + private:
  608 + friend class SrsAmf0Any;
  609 + /**
  610 + * make amf0 string to private,
  611 + * use should never declare it, use SrsAmf0Any::str() to create it.
  612 + */
  613 + SrsAmf0String(const char* _value);
607 public: 614 public:
608 - __SrsAmf0String(const char* _value);  
609 - virtual ~__SrsAmf0String(); 615 + virtual ~SrsAmf0String();
610 public: 616 public:
611 virtual int total_size(); 617 virtual int total_size();
612 virtual int read(SrsStream* stream); 618 virtual int read(SrsStream* stream);
@@ -621,13 +627,19 @@ namespace _srs_internal @@ -621,13 +627,19 @@ namespace _srs_internal
621 * 0 is false, <> 0 is true 627 * 0 is false, <> 0 is true
622 * @return default value is false. 628 * @return default value is false.
623 */ 629 */
624 - class __SrsAmf0Boolean : public SrsAmf0Any 630 + class SrsAmf0Boolean : public SrsAmf0Any
625 { 631 {
626 public: 632 public:
627 bool value; 633 bool value;
  634 + private:
  635 + friend class SrsAmf0Any;
  636 + /**
  637 + * make amf0 boolean to private,
  638 + * use should never declare it, use SrsAmf0Any::boolean() to create it.
  639 + */
  640 + SrsAmf0Boolean(bool _value);
628 public: 641 public:
629 - __SrsAmf0Boolean(bool _value);  
630 - virtual ~__SrsAmf0Boolean(); 642 + virtual ~SrsAmf0Boolean();
631 public: 643 public:
632 virtual int total_size(); 644 virtual int total_size();
633 virtual int read(SrsStream* stream); 645 virtual int read(SrsStream* stream);
@@ -641,13 +653,19 @@ namespace _srs_internal @@ -641,13 +653,19 @@ namespace _srs_internal
641 * number-type = number-marker DOUBLE 653 * number-type = number-marker DOUBLE
642 * @return default value is 0. 654 * @return default value is 0.
643 */ 655 */
644 - class __SrsAmf0Number : public SrsAmf0Any 656 + class SrsAmf0Number : public SrsAmf0Any
645 { 657 {
646 public: 658 public:
647 double value; 659 double value;
  660 + private:
  661 + friend class SrsAmf0Any;
  662 + /**
  663 + * make amf0 number to private,
  664 + * use should never declare it, use SrsAmf0Any::number() to create it.
  665 + */
  666 + SrsAmf0Number(double _value);
648 public: 667 public:
649 - __SrsAmf0Number(double _value);  
650 - virtual ~__SrsAmf0Number(); 668 + virtual ~SrsAmf0Number();
651 public: 669 public:
652 virtual int total_size(); 670 virtual int total_size();
653 virtual int read(SrsStream* stream); 671 virtual int read(SrsStream* stream);
@@ -660,11 +678,17 @@ namespace _srs_internal @@ -660,11 +678,17 @@ namespace _srs_internal
660 * 2.7 null Type 678 * 2.7 null Type
661 * null-type = null-marker 679 * null-type = null-marker
662 */ 680 */
663 - class __SrsAmf0Null : public SrsAmf0Any 681 + class SrsAmf0Null : public SrsAmf0Any
664 { 682 {
  683 + private:
  684 + friend class SrsAmf0Any;
  685 + /**
  686 + * make amf0 null to private,
  687 + * use should never declare it, use SrsAmf0Any::null() to create it.
  688 + */
  689 + SrsAmf0Null();
665 public: 690 public:
666 - __SrsAmf0Null();  
667 - virtual ~__SrsAmf0Null(); 691 + virtual ~SrsAmf0Null();
668 public: 692 public:
669 virtual int total_size(); 693 virtual int total_size();
670 virtual int read(SrsStream* stream); 694 virtual int read(SrsStream* stream);
@@ -677,11 +701,17 @@ namespace _srs_internal @@ -677,11 +701,17 @@ namespace _srs_internal
677 * 2.8 undefined Type 701 * 2.8 undefined Type
678 * undefined-type = undefined-marker 702 * undefined-type = undefined-marker
679 */ 703 */
680 - class __SrsAmf0Undefined : public SrsAmf0Any 704 + class SrsAmf0Undefined : public SrsAmf0Any
681 { 705 {
  706 + private:
  707 + friend class SrsAmf0Any;
  708 + /**
  709 + * make amf0 undefined to private,
  710 + * use should never declare it, use SrsAmf0Any::undefined() to create it.
  711 + */
  712 + SrsAmf0Undefined();
682 public: 713 public:
683 - __SrsAmf0Undefined();  
684 - virtual ~__SrsAmf0Undefined(); 714 + virtual ~SrsAmf0Undefined();
685 public: 715 public:
686 virtual int total_size(); 716 virtual int total_size();
687 virtual int read(SrsStream* stream); 717 virtual int read(SrsStream* stream);
@@ -695,14 +725,14 @@ namespace _srs_internal @@ -695,14 +725,14 @@ namespace _srs_internal
695 * if ordered in map, the string compare order, the FMLE will creash when 725 * if ordered in map, the string compare order, the FMLE will creash when
696 * get the response of connect app. 726 * get the response of connect app.
697 */ 727 */
698 - class __SrsUnSortedHashtable 728 + class SrsUnSortedHashtable
699 { 729 {
700 private: 730 private:
701 typedef std::pair<std::string, SrsAmf0Any*> SrsAmf0ObjectPropertyType; 731 typedef std::pair<std::string, SrsAmf0Any*> SrsAmf0ObjectPropertyType;
702 std::vector<SrsAmf0ObjectPropertyType> properties; 732 std::vector<SrsAmf0ObjectPropertyType> properties;
703 public: 733 public:
704 - __SrsUnSortedHashtable();  
705 - virtual ~__SrsUnSortedHashtable(); 734 + SrsUnSortedHashtable();
  735 + virtual ~SrsUnSortedHashtable();
706 public: 736 public:
707 virtual int count(); 737 virtual int count();
708 virtual void clear(); 738 virtual void clear();
@@ -715,7 +745,7 @@ namespace _srs_internal @@ -715,7 +745,7 @@ namespace _srs_internal
715 virtual SrsAmf0Any* ensure_property_string(std::string name); 745 virtual SrsAmf0Any* ensure_property_string(std::string name);
716 virtual SrsAmf0Any* ensure_property_number(std::string name); 746 virtual SrsAmf0Any* ensure_property_number(std::string name);
717 public: 747 public:
718 - virtual void copy(__SrsUnSortedHashtable* src); 748 + virtual void copy(SrsUnSortedHashtable* src);
719 }; 749 };
720 750
721 /** 751 /**
@@ -723,14 +753,14 @@ namespace _srs_internal @@ -723,14 +753,14 @@ namespace _srs_internal
723 * object-end-type = UTF-8-empty object-end-marker 753 * object-end-type = UTF-8-empty object-end-marker
724 * 0x00 0x00 0x09 754 * 0x00 0x00 0x09
725 */ 755 */
726 - class __SrsAmf0ObjectEOF : public SrsAmf0Any 756 + class SrsAmf0ObjectEOF : public SrsAmf0Any
727 { 757 {
728 public: 758 public:
729 int16_t utf8_empty; 759 int16_t utf8_empty;
730 -  
731 - __SrsAmf0ObjectEOF();  
732 - virtual ~__SrsAmf0ObjectEOF();  
733 - 760 + public:
  761 + SrsAmf0ObjectEOF();
  762 + virtual ~SrsAmf0ObjectEOF();
  763 + public:
734 virtual int total_size(); 764 virtual int total_size();
735 virtual int read(SrsStream* stream); 765 virtual int read(SrsStream* stream);
736 virtual int write(SrsStream* stream); 766 virtual int write(SrsStream* stream);
@@ -749,7 +779,7 @@ namespace _srs_internal @@ -749,7 +779,7 @@ namespace _srs_internal
749 extern int srs_amf0_write_utf8(SrsStream* stream, std::string value); 779 extern int srs_amf0_write_utf8(SrsStream* stream, std::string value);
750 780
751 extern bool srs_amf0_is_object_eof(SrsStream* stream); 781 extern bool srs_amf0_is_object_eof(SrsStream* stream);
752 - extern int srs_amf0_write_object_eof(SrsStream* stream, __SrsAmf0ObjectEOF* value); 782 + extern int srs_amf0_write_object_eof(SrsStream* stream, SrsAmf0ObjectEOF* value);
753 783
754 extern int srs_amf0_write_any(SrsStream* stream, SrsAmf0Any* value); 784 extern int srs_amf0_write_any(SrsStream* stream, SrsAmf0Any* value);
755 }; 785 };