winlin

add comments. refine naming

... ... @@ -28,7 +28,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
*/
// user must include the srs_core.hpp before any header.
/**
* the core provides the common defined macros, utilities,
* user must include the srs_core.hpp before any header, or maybe
* build failed.
*/
// for int64_t print using PRId64 format.
#ifndef __STDC_FORMAT_MACROS
... ... @@ -36,6 +40,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include <assert.h>
#define SrsAssert(expression) assert(expression)
#define srs_assert(expression) assert(expression)
#endif
\ No newline at end of file
... ...
... ... @@ -36,10 +36,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* auto free the instance in the current scope.
*/
#define SrsAutoFree(className, instance, is_array) \
c__SrsAutoFree<className> _auto_free_##instance(&instance, is_array)
__SrsAutoFree<className> _auto_free_##instance(&instance, is_array)
template<class T>
class c__SrsAutoFree
class __SrsAutoFree
{
private:
T** ptr;
... ... @@ -49,12 +49,12 @@ public:
* auto delete the ptr.
* @is_array a bool value indicates whether the ptr is a array.
*/
c__SrsAutoFree(T** _ptr, bool _is_array){
__SrsAutoFree(T** _ptr, bool _is_array){
ptr = _ptr;
is_array = _is_array;
}
virtual ~c__SrsAutoFree(){
virtual ~__SrsAutoFree(){
if (ptr == NULL || *ptr == NULL) {
return;
}
... ...
... ... @@ -22,3 +22,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core_buffer.hpp>
SrsBuffer::SrsBuffer()
{
}
SrsBuffer::~SrsBuffer()
{
}
... ...
... ... @@ -30,4 +30,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
/**
* the buffer provices bytes cache for protocol. generally,
* protocol recv data from socket, put into buffer, decode to RTMP message.
* protocol encode RTMP message to bytes, put into buffer, send to socket.
*/
class SrsBuffer
{
public:
SrsBuffer();
virtual ~SrsBuffer();
};
#endif
\ No newline at end of file
... ...
... ... @@ -33,6 +33,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_conn.hpp>
class SrsRtmp;
/**
* the client provides the main logic control for RTMP clients.
*/
class SrsClient : public SrsConnection
{
private:
... ...
... ... @@ -83,7 +83,7 @@ void SrsConnection::cycle()
void* SrsConnection::cycle_thread(void* arg)
{
SrsConnection* conn = (SrsConnection*)arg;
SrsAssert(conn != NULL);
srs_assert(conn != NULL);
conn->cycle();
... ...
... ... @@ -32,6 +32,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <st.h>
/**
* the protocol provides the rtmp-message-protocol services,
* to recv RTMP message from RTMP chunk stream,
* and to send out RTMP message over RTMP chunk stream.
*/
class SrsProtocol
{
private:
... ...
... ... @@ -34,13 +34,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <st.h>
class SrsProtocol;
struct SrsApp
{
std::string vhost;
std::string app;
};
class SrsProtocol;
/**
* the rtmp provices rtmp-command-protocol services,
* a high level protocol, media stream oriented services,
* such as connect to vhost/app, play stream, get audio/video data.
*/
class SrsRtmp
{
private:
... ...
... ... @@ -203,7 +203,7 @@ void SrsServer::listen_cycle()
void* SrsServer::listen_thread(void* arg)
{
SrsServer* server = (SrsServer*)arg;
SrsAssert(server != NULL);
srs_assert(server != NULL);
server->listen_cycle();
... ...
... ... @@ -32,7 +32,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <st.h>
// the socket base on st.
/**
* the socket provides TCP socket over st,
* that is, the sync socket mechanism.
*/
class Socket
{
private:
... ...