[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11991: Fix namespace collisions by
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11991: Fix namespace collisions by avoiding 'using namespace ...' in global scope. |
Date: |
Mon, 08 Mar 2010 03:13:37 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 11991
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Mon 2010-03-08 03:13:37 +0100
message:
Fix namespace collisions by avoiding 'using namespace ...' in global scope.
modified:
libnet/rtmp.cpp
libnet/rtmp_client.cpp
=== modified file 'libnet/rtmp.cpp'
--- a/libnet/rtmp.cpp 2010-01-25 18:52:20 +0000
+++ b/libnet/rtmp.cpp 2010-03-08 02:13:37 +0000
@@ -46,8 +46,6 @@
#include "GnashSleep.h"
using std::cerr;
-using std::endl;
-using namespace amf;
namespace gnash
{
@@ -378,7 +376,7 @@
RTMP::encodeHeader(int amf_index, rtmp_headersize_e head_size)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf(new Buffer(1));
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(1));
buf->clear();
boost::uint8_t *ptr = buf->reference();
@@ -400,16 +398,16 @@
boost::shared_ptr<amf::Buffer> buf;
switch(head_size) {
case HEADER_1:
- buf.reset(new Buffer(1));
+ buf.reset(new amf::Buffer(1));
break;
case HEADER_4:
- buf.reset(new Buffer(4));
+ buf.reset(new amf::Buffer(4));
break;
case HEADER_8:
- buf.reset(new Buffer(8));
+ buf.reset(new amf::Buffer(8));
break;
case HEADER_12:
- buf.reset(new Buffer(12));
+ buf.reset(new amf::Buffer(12));
break;
}
boost::uint8_t *ptr = buf->reference();
@@ -551,7 +549,8 @@
void
RTMP::dump()
{
- cerr << "RTMP packet contains " << _properties.size() << " variables." <<
endl;
+ cerr << "RTMP packet contains " << _properties.size() << " variables."
+ << std::endl;
AMFProperties::iterator it;
for (it = _properties.begin(); it != _properties.end(); it++) {
// const char *name = it->first;
@@ -688,9 +687,9 @@
boost::uint32_t swapped = 0;
boost::shared_ptr<amf::Buffer> buf;
if (eventid == STREAM_BUFFER) {
- buf.reset(new Buffer(sizeof(boost::uint16_t) * 5));
+ buf.reset(new amf::Buffer(sizeof(boost::uint16_t) * 5));
} else {
- buf.reset(new Buffer(sizeof(boost::uint16_t) * 3));
+ buf.reset(new amf::Buffer(sizeof(boost::uint16_t) * 3));
}
// Set the type of this ping message
@@ -706,17 +705,17 @@
case STREAM_EOF:
case STREAM_NODATA:
swapped = data;
- swapBytes(&swapped, sizeof(boost::uint32_t));
+ amf::swapBytes(&swapped, sizeof(boost::uint32_t));
*buf += swapped;
break;
case STREAM_BUFFER:
- buf.reset(new Buffer(sizeof(boost::uint16_t) * 5));
+ buf.reset(new amf::Buffer(sizeof(boost::uint16_t) * 5));
break;
case STREAM_LIVE:
case STREAM_PING:
case STREAM_PONG:
swapped = data;
- swapBytes(&swapped, sizeof(boost::uint32_t));
+ amf::swapBytes(&swapped, sizeof(boost::uint32_t));
*buf += swapped;
break;
default:
@@ -730,7 +729,7 @@
RTMP::decodeMsgBody(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
- AMF amf_obj;
+ amf::AMF amf_obj;
boost::uint8_t *ptr = data;
boost::uint8_t* tooFar = data + size;
bool status = false;
@@ -739,7 +738,7 @@
// The first data object is the method name of this object.
boost::shared_ptr<amf::Element> name = amf_obj.extractAMF(ptr, tooFar);
if (name) {
- ptr += name->getDataSize() + AMF_HEADER_SIZE; // skip the length bytes
too
+ ptr += name->getDataSize() + amf::AMF_HEADER_SIZE; // skip the length
bytes too
} else {
log_error("Name field of RTMP Message corrupted!");
msg.reset();
@@ -753,8 +752,8 @@
// Most onStatus messages have the stream ID, but the Data
// Start onStatus message is basically just a marker that an
// FLV file is coming next.
- if (streamid->getType() == Element::NUMBER_AMF0) {
- ptr += AMF0_NUMBER_SIZE + 1;
+ if (streamid->getType() == amf::Element::NUMBER_AMF0) {
+ ptr += amf::AMF0_NUMBER_SIZE + 1;
}
} else {
log_error("Stream ID field of RTMP Message corrupted!");
@@ -1266,7 +1265,7 @@
//bool nopacket = true;
// Read really big packets, they get split into the smaller ones when
'split'
- boost::shared_ptr<amf::Buffer> buf(new Buffer(3074));
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(3074));
do {
ret = readNet(fd, buf->reference()+ret, buf->size()-ret, _timeout);
// We got data. Resize the buffer if necessary.
@@ -1358,13 +1357,13 @@
// range, we can't really continue.
if (rthead->head_size <= RTMP_MAX_HEADER_SIZE) {
// Any packet with a header size greater than 1 is a
- // always a new RTMP message, so create a new Buffer to
+ // always a new RTMP message, so create a new amf::Buffer to
// hold all the data.
if ((rthead->head_size >= 1) || (ptr == data)) {
// cerr << "New packet for channel #" << rthead->channel << "
of size "
// << (rthead->head_size + rthead->bodysize) << endl;
// give it some memory to store data in. We store
- chunk.reset(new Buffer(rthead->bodysize + rthead->head_size +
1));
+ chunk.reset(new amf::Buffer(rthead->bodysize +
rthead->head_size + 1));
// Each RTMP connection has 64 channels, so we store
// the header with the data so that info is accessible
// via the Buffer for processing later. All the data
@@ -1381,8 +1380,9 @@
// Red5 version 5 sends out PING messages with a 1 byte header. I
think this
// may be a bug in Red5, but we should handle it anyway.
if (chunk == 0) {
- cerr << "Chunk wasn't allocated! " << (rthead->bodysize +
rthead->head_size) << endl;
- chunk.reset(new Buffer(rthead->bodysize + rthead->head_size));
+ cerr << "Chunk wasn't allocated! " << (rthead->bodysize +
rthead->head_size)
+ << std::endl;
+ chunk.reset(new amf::Buffer(rthead->bodysize +
rthead->head_size));
chunk->clear(); // FIXME: temporary debug only, should be
unnecessary
_queues[rthead->channel].push(chunk);
}
=== modified file 'libnet/rtmp_client.cpp'
--- a/libnet/rtmp_client.cpp 2010-01-11 06:41:38 +0000
+++ b/libnet/rtmp_client.cpp 2010-03-08 02:13:37 +0000
@@ -46,10 +46,6 @@
#include "GnashSleep.h"
#include "URL.h"
-using namespace gnash;
-using namespace std;
-using namespace amf;
-
typedef boost::shared_ptr<amf::Element> ElementSharedPtr;
namespace gnash
@@ -83,7 +79,7 @@
// Make the NetConnection object that is used to connect to the
// server.
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeConnect()
{
// GNASH_REPORT_FUNCTION;
@@ -91,7 +87,7 @@
return encodeConnect(_path.c_str());
}
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeConnect(const char *uri)
{
// GNASH_REPORT_FUNCTION;
@@ -101,12 +97,13 @@
RTMPClient::SEEK);
}
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeConnect(const char *uri,
double audioCodecs, double videoCodecs,
double videoFunction)
{
GNASH_REPORT_FUNCTION;
+ using std::string;
URL url(uri);
string portstr;
@@ -169,14 +166,14 @@
pageUrl.c_str());
}
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeConnect(const char *app, const char *swfUrl, const char
*tcUrl,
double audioCodecs, double videoCodecs, double
videoFunction,
const char *pageUrl)
{
GNASH_REPORT_FUNCTION;
- AMF amf_obj;
+ amf::AMF amf_obj;
ElementSharedPtr connect(new amf::Element);
connect->makeString("connect");
@@ -220,22 +217,22 @@
fpad->makeBoolean("fpad", false);
obj->addProperty(fpad);
- ElementSharedPtr audioCodecsnode(new Element);
+ ElementSharedPtr audioCodecsnode(new amf::Element);
// audioCodecsnode->makeNumber("audioCodecs", 615);
audioCodecsnode->makeNumber("audioCodecs", audioCodecs);
obj->addProperty(audioCodecsnode);
- ElementSharedPtr videoCodecsnode(new Element);
+ ElementSharedPtr videoCodecsnode(new amf::Element);
// videoCodecsnode->makeNumber("videoCodecs", 124);
videoCodecsnode->makeNumber("videoCodecs", videoCodecs);
obj->addProperty(videoCodecsnode);
- ElementSharedPtr videoFunctionnode(new Element);
+ ElementSharedPtr videoFunctionnode(new amf::Element);
// videoFunctionnode->makeNumber("videoFunction", 0x1);
videoFunctionnode->makeNumber("videoFunction", videoFunction);
obj->addProperty(videoFunctionnode);
- ElementSharedPtr pageUrlnode(new Element);
+ ElementSharedPtr pageUrlnode(new amf::Element);
// pageUrlnode->makeString("pageUrl",
"http://x86-ubuntu/software/gnash/tests/");
pageUrlnode->makeString("pageUrl", pageUrl);
obj->addProperty(pageUrlnode);
@@ -250,11 +247,11 @@
// RTMP::INVOKE, RTMP::FROM_CLIENT);
// const char *rtmpStr = "03 00 00 04 00 01 1f 14 00 00 00 00";
// Buffer *rtmpBuf = hex2mem(rtmpStr);
- boost::shared_ptr<Buffer> conobj = connect->encode();
- boost::shared_ptr<Buffer> numobj = connum->encode();
- boost::shared_ptr<Buffer> encobj = obj->encode();
+ boost::shared_ptr<amf::Buffer> conobj = connect->encode();
+ boost::shared_ptr<amf::Buffer> numobj = connum->encode();
+ boost::shared_ptr<amf::Buffer> encobj = obj->encode();
- boost::shared_ptr<Buffer> buf(new Buffer(conobj->size() + numobj->size() +
encobj->size()));
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(conobj->size() +
numobj->size() + encobj->size()));
*buf += conobj;
*buf += numobj;
*buf += encobj;
@@ -367,23 +364,23 @@
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<amf::Element> str(new amf::Element);
str->makeString(method);
- boost::shared_ptr<Buffer> strobj = str->encode();
+ boost::shared_ptr<amf::Buffer> strobj = str->encode();
// Encod ethe stream ID
boost::shared_ptr<amf::Element> num(new amf::Element);
num->makeNumber(id);
- boost::shared_ptr<Buffer> numobj = num->encode();
+ boost::shared_ptr<amf::Buffer> numobj = num->encode();
// Set the NULL object element that follows the stream ID
boost::shared_ptr<amf::Element> null(new amf::Element);
null->makeNull();
- boost::shared_ptr<Buffer> nullobj = null->encode();
+ boost::shared_ptr<amf::Buffer> nullobj = null->encode();
- boost::shared_ptr<Buffer> elobj = el.encode();
+ boost::shared_ptr<amf::Buffer> elobj = el.encode();
size_t totalsize = strobj->size() + numobj->size() + nullobj->size() +
elobj->size();
- boost::shared_ptr<Buffer> buf(new Buffer(totalsize));
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(totalsize));
*buf += strobj;
*buf += numobj;
@@ -396,7 +393,7 @@
// 43 00 1a 21 00 00 19 14 02 00 0c 63 72 65 61 74 C..!.......creat
// 65 53 74 72 65 61 6d 00 40 08 00 00 00 00 00 00 address@hidden
// 05 .
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeStream(double id)
{
// GNASH_REPORT_FUNCTION;
@@ -406,20 +403,20 @@
boost::shared_ptr<amf::Element> str(new amf::Element);
str->makeString("createStream");
- boost::shared_ptr<Buffer> strobj = str->encode();
+ boost::shared_ptr<amf::Buffer> strobj = str->encode();
boost::shared_ptr<amf::Element> num(new amf::Element);
num->makeNumber(id);
- boost::shared_ptr<Buffer> numobj = num->encode();
+ boost::shared_ptr<amf::Buffer> numobj = num->encode();
// Set the NULL object element that follows the stream ID
boost::shared_ptr<amf::Element> null(new amf::Element);
null->makeNull();
- boost::shared_ptr<Buffer> nullobj = null->encode();
+ boost::shared_ptr<amf::Buffer> nullobj = null->encode();
size_t totalsize = strobj->size() + numobj->size() + nullobj->size();
- boost::shared_ptr<Buffer> buf(new Buffer(totalsize));
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(totalsize));
*buf += strobj;
*buf += numobj;
@@ -434,21 +431,21 @@
// 6f 6e 32 5f 66 6c 61 73 68 38 5f 77 5f 61 75 64 on2_flash8_w_aud
// 69 6f 2e 66 6c 76 c2 00 03 00 00 00 01 00 00 27 io.flv.........'
// 10
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag)
{
// GNASH_REPORT_FUNCTION;
return encodeStreamOp(id, op, flag, "", 0);
}
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, double pos)
{
// GNASH_REPORT_FUNCTION;
return encodeStreamOp(id, op, flag, "", pos);
}
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name)
{
// GNASH_REPORT_FUNCTION;
@@ -461,13 +458,13 @@
// A pause packet is the operation name "pause", followed by the stream ID,
// then a NULL object, a boolean (always true from what I can tell), and then
// a location, which appears to always be 0.
-boost::shared_ptr<Buffer>
+boost::shared_ptr<amf::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name, double pos)
{
// GNASH_REPORT_FUNCTION;
// Set the operations command name
- Element str;
+ amf::Element str;
switch (op) {
case STREAM_PLAY: // play the existing stream
str.makeString("play");
@@ -485,35 +482,35 @@
str.makeString("seek");
break;
default:
- boost::shared_ptr<Buffer> foo;
+ boost::shared_ptr<amf::Buffer> foo;
return foo;
};
- boost::shared_ptr<Buffer> strobj = str.encode();
+ boost::shared_ptr<amf::Buffer> strobj = str.encode();
// Set the stream ID, which follows the command
- Element strid;
+ amf::Element strid;
strid.makeNumber(id);
- boost::shared_ptr<Buffer> stridobj = strid.encode();
+ boost::shared_ptr<amf::Buffer> stridobj = strid.encode();
// Set the NULL object element that follows the stream ID
- Element null;
+ amf::Element null;
null.makeNull();
- boost::shared_ptr<Buffer> nullobj = null.encode();
+ boost::shared_ptr<amf::Buffer> nullobj = null.encode();
// Set the BOOLEAN object element that is the last field in the packet
// (SEEK and PLAY don't use the boolean flag)
- boost::shared_ptr<Buffer> boolobj;
+ boost::shared_ptr<amf::Buffer> boolobj;
if ((op != STREAM_SEEK) && (op != STREAM_PLAY)) {
- Element boolean;
+ amf::Element boolean;
boolean.makeBoolean(flag);
boolobj = boolean.encode();
}
// The seek command also may have an optional location to seek to
- boost::shared_ptr<Buffer> posobj;
+ boost::shared_ptr<amf::Buffer> posobj;
if ((op == STREAM_PAUSE) || (op == STREAM_SEEK)) {
- Element seek;
+ amf::Element seek;
seek.makeNumber(pos);
posobj = seek.encode();
}
@@ -521,9 +518,9 @@
// The play command has an optional field, which is the name of the file
// used for the stream. A Play command without this name set play an
// existing stream that is already open.
- boost::shared_ptr<Buffer> fileobj;
+ boost::shared_ptr<amf::Buffer> fileobj;
if (!name.empty()) {
- Element filespec;
+ amf::Element filespec;
filespec.makeString(name);
fileobj = filespec.encode();
}
@@ -536,7 +533,7 @@
if ( fileobj ) pktsize += fileobj->size();
if ( posobj ) pktsize += posobj->size();
- boost::shared_ptr<Buffer> buf(new Buffer(pktsize));
+ boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(pktsize));
*buf += strobj;
*buf += stridobj;
*buf += nullobj;
@@ -556,7 +553,7 @@
boost::uint32_t zero = 0;
// Make a buffer to hold the handshake data.
- boost::shared_ptr<amf::Buffer> handshake(new
Buffer(RTMP_HANDSHAKE_SIZE+1));
+ boost::shared_ptr<amf::Buffer> handshake(new
amf::Buffer(RTMP_HANDSHAKE_SIZE+1));
if (!handshake) {
return handshake;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11991: Fix namespace collisions by avoiding 'using namespace ...' in global scope.,
Bastiaan Jacques <=