Permalink
Browse files

+ Adding wrapper for rtmpd

  • Loading branch information...
1 parent 8e81ef0 commit eb987b0c548ccfa9df999b57157b1c8ce39e65d0 ru committed Jun 8, 2012
View
1 Makefile
@@ -78,6 +78,7 @@ BUILDDIRS := $(BUILDDIRS) \
sqmod/sqmod_openssl \
sqmod/sqmod_poco \
sqmod/sqmod_portaudio \
+ sqmod/sqmod_rtmpd \
sqmod/sqmod_ssh2 \
sqmod/sqmod_tinyxml
View
70 etc/scripts/test_rtmpd_server.nut
@@ -0,0 +1,70 @@
+
+class CGlobal
+{
+ server = CSqSocket();
+};
+
+local _g = CGlobal();
+
+function _init() : ( _g )
+{
+ if ( _self.load_module( "rtmpd", "" ) )
+ { _self.echo( "\n!!! FAILED TO LOAD RTMP MODULE !!!\n" );
+ return -1;
+ } // end if
+
+ _self.echo( "\n... Starting RTMP server ...\n" );
+
+ local ts = CSqTime(); ts.GetLocalTime();
+ local rtmp = CRtmpdSession();
+ local ver = rtmp.getLibVersion();
+ _self.echo( "... LIB VERSION : " + ( ( ver & 0xffff0000 ) >> 16 ) + "." + ( ver & 0xffff ) + "\n" );
+ if ( !rtmp.StartDebugLog( _self.root( "rtmpd-" + ts.FormatTime( "%Y%c%d-%g%m%s" ) ) ) )
+ { _self.echo( "StartDebugLog() : " + rtmp.getLastErrorStr() );
+ return 0;
+ } // end if
+
+ if ( !_g.server.Bind( 1935 ) )
+ { _self.echo( "Bind() : " + _g.server.getLastError() );
+ return 0;
+ } // end if
+
+ if ( !_g.server.Listen( 16 ) )
+ { _self.echo( "Listen() : " + _g.server.getLastError() );
+ return 0;
+ } // end if
+
+ _self.echo( "server listening on : rtmp://localhost:1935" );
+
+ return 0;
+}
+
+function _idle() : ( _g )
+{
+ // Wait for connect request
+ while ( _g.server.WaitEvent( CSqSocket().EVT_ACCEPT, 100 ) )
+ {
+ // Create a new socket to handle this session
+ local session = CSqSocket();
+
+ // Accept the session
+ if ( !_g.server.Accept( session ) )
+ _self.echo( "Accept() : " + _g.server.getLastError() );
+
+ else
+ {
+ // Show connection info
+ local addr = CSqSockAddress();
+ _g.server.getPeerAddress( addr );
+ _self.echo( "Connection from : " + addr.getDotAddress() );
+
+ // Set the script that will handle the session
+ session.setScript( _self.queue(), "session", "test_rtmpd_session.nut", "SetSocket" );
+
+ } // end else
+
+ } // end while
+
+ return 0;
+}
+
View
107 etc/scripts/test_rtmpd_session.nut
@@ -0,0 +1,107 @@
+
+class CGlobal
+{
+ quit = 0;
+ session = 0;
+ fps = 0;
+ rtmp = 0;
+};
+
+local _g = CGlobal();
+
+function _idle() : ( _g )
+{
+ return _g.quit;
+}
+
+function _init() : ( _g )
+{
+ // Start the update timer
+ if ( 0 >= _g.fps ) _g.fps = 30;
+ _self.set_timer( ".", 1000 / _g.fps, "Run" );
+
+ _self.echo( "... Starting session ..." );
+
+ return 0;
+}
+
+function _exit() : ( _g )
+{
+ if ( _g.rtmp )
+ _g.rtmp.Destroy(), _g.rtmp = 0;
+
+ if ( _g.session )
+ _g.session.Destroy(), _g.session = 0;
+
+ return 0;
+}
+
+function SetSocket( socket ) : ( _g )
+{
+ // Load rtmpd module
+ if ( _self.load_module( "rtmpd", "" ) )
+ { _self.echo( "!!! Unable to load RTMPD module !!!" );
+ _g.quit = 1;
+ return 0;
+ } // end if
+
+ // Important! must do a share here
+ _g.session = CSqSocket();
+ _g.session.Share( socket );
+
+ // Show remote client address
+ local addr = CSqSockAddress();
+ if ( _g.session.getPeerAddress( addr ) )
+ _self.echo( "... Connecting to : " + addr.getDotAddress() );
+ else
+ _self.echo( "... FAILED TO CONNECT ..." );
+
+ _self.echo( "... Connected" );
+
+ return 1;
+}
+
+function Run() : ( _g )
+{
+ if ( _g.quit || !_g.session )
+ return 0;
+
+ if ( !_g.rtmp )
+ {
+ // Create rtmpd session object
+ _g.rtmp = CRtmpdSession();
+
+ // Initialize RTMP stuff
+ if ( !_g.rtmp.Init( _g.session ) )
+ { _self.echo( "!!! RTMP Session Init() Failed : " + _g.rtmp.getLastErrorStr() );
+ _g.quit = 1;
+ return 0;
+ } // end if
+
+ } // end if
+
+ local ret = _g.rtmp.ReadPacket();
+
+ _self.echo( "... ReadPacket() : " + ret );
+
+ if ( 0 > ret )
+ { _g.quit = 1;
+ return 0;
+ } // end if
+
+ else if ( !ret )
+ return 0;
+
+ _self.echo( "... Packet Type : " + ret + format( " : 0x%x", ret ) );
+ _self.echo( "... Packet Size : " + _g.rtmp.getPacketSize() );
+
+ local data = _g.rtmp.getPacketData( 0 );
+ _self.echo( data.AsciiHexStr( 16, 32 ) );
+
+ local pkt = _g.rtmp.getPacket( 0 );
+ _self.echo( "n = " + pkt.size() );
+ _self.echo( "\n --- PACKET ---\n" + pkt.print_r( 1 ) );
+
+ return 1;
+}
+
View
2 lib/oexlib/src/os/windows/ip_socket.cpp
@@ -654,7 +654,7 @@ void CIpSocket::CloseEventHandle()
{
WSAEventSelect( (SOCKET)m_hSocket, (WSAEVENT)m_hSocketEvent, 0 );
WSAEventSelect( (SOCKET)m_hSocket, (WSAEVENT)0, 0 );
- ioctlsocket( (SOCKET)m_hSocket, FIONBIO, 0 );
+ unsigned long l = 0; ioctlsocket( (SOCKET)m_hSocket, FIONBIO, &l );
// Restore socket timeout defaults
struct timeval tv;
View
5 lib/sqbind/import/sq_binary.h
@@ -140,6 +140,11 @@ namespace sqbind
m_bin.MemCpy( x_ptr, x_size );
}
+ /// Construct from raw buffer
+ CSqBinary( t_byte *x_ptr, t_size x_size, t_size x_offset, int x_bFree )
+ { m_bin.setBuffer( x_ptr, x_size, x_offset, x_bFree );
+ }
+
/// Registers the class
static void Register( sqbind::VM vm );
View
6 lib/sqbind/import/sq_socket.cpp
@@ -129,6 +129,7 @@ SQBIND_REGISTER_CLASS_BEGIN( sqbind::CSqSocket, CSqSocket )
SQBIND_MEMBER_FUNCTION( sqbind::CSqSocket, Destroy )
SQBIND_MEMBER_FUNCTION( sqbind::CSqSocket, Connect )
+ SQBIND_MEMBER_FUNCTION( sqbind::CSqSocket, Detach )
SQBIND_MEMBER_FUNCTION( sqbind::CSqSocket, CreateUDP )
SQBIND_MEMBER_FUNCTION( sqbind::CSqSocket, setBlockingMode )
SQBIND_MEMBER_FUNCTION( sqbind::CSqSocket, Bind )
@@ -208,6 +209,11 @@ int CSqSocket::Connect( const sqbind::stdString &sUrl, int nPort )
return m_socket->Connect( sUrl.c_str(), nPort ) ? 1 : 0;
}
+SQInteger CSqSocket::Detach()
+{_STT();
+ return (SQInteger)m_socket->Detach();
+}
+
int CSqSocket::Bind( int nPort )
{_STT();
return m_socket->Bind( nPort );
View
11 lib/sqbind/import/sq_socket.h
@@ -37,8 +37,8 @@
// namespace
namespace sqbind
{
- class CSqSockAddress
- {
+ class CSqSockAddress
+ {
public:
SQBIND_CLASS_CTOR_BEGIN( CSqSockAddress )
_SQBIND_CLASS_CTOR1( CSqSockAddress, OT_STRING ) ( sqbind::stdString( sa.GetString( 2 ), sq_getsize( x_v, 2 ) ) )
@@ -114,7 +114,7 @@ namespace sqbind
class CSqSocket
- {
+ {
public:
SQBIND_CLASS_CTOR_BEGIN( CSqSocket )
@@ -149,6 +149,9 @@ namespace sqbind
/// Connects to the specified address
int Connect( const sqbind::stdString &sUrl, int nPort );
+ /// Detaches from the socket and returns the os socket handle
+ SQInteger Detach();
+
/// Binds the socket to a port
int Bind( int nPort );
@@ -256,7 +259,7 @@ namespace sqbind
/// Socket class
oex::TMem< oex::os::CIpSocket > m_socket;
- };
+ };
}; // end namespace
View
3 lib/sqbind/sq_tools.h
@@ -36,6 +36,9 @@
// +++ Fix string conversions to be binary safe
+template < typename T >
+ stdString ToStr( T n ) { return oex2std( oex::CStr( n ) ); }
+
template < typename T_PB, typename T_STD >
void SQBIND_PropertyBagToStd( T_PB &pb, T_STD &m )
{ for( oex::CPropertyBag::iterator it; pb.List().Next( it ); )
View
2 sqmod/sqmod_live555/Makefile
@@ -10,7 +10,7 @@ default_target: all
PRJ_NAME := sqmod_live555
PRJ_DEPS := live555
PRJ_TYPE := dll
-PRJ_INCS := winglib/lib/oexlib winglib/lib/sqbind SqPlus/include SqPlus/sqplus ffmpeg \
+PRJ_INCS := winglib/lib/oexlib winglib/lib/sqbind SqPlus/include SqPlus/sqplus \
live555/liveMedia/include live555/UsageEnvironment/include \
live555/BasicUsageEnvironment/include live555/groupsock/include
PRJ_LIBS := sqbind oexlib sqplus sqstdlib squirrel cximage jpeg png tiff zlib live555
View
46 sqmod/sqmod_rtmpd/Makefile
@@ -0,0 +1,46 @@
+
+PRJ_RELROOT := ../..
+include $(PRJ_RELROOT)/buildpath.mk
+
+default_target: all
+
+#-------------------------------------------------------------------
+# Project
+#-------------------------------------------------------------------
+PRJ_NAME := sqmod_rtmpd
+PRJ_DEPS := rtmpd
+PRJ_TYPE := dll
+PRJ_INCS := winglib/lib/oexlib winglib/lib/sqbind SqPlus/include SqPlus/sqplus \
+ rtmpd/librtmp
+PRJ_LIBS := sqbind oexlib sqplus sqstdlib squirrel cximage jpeg png tiff \
+ rtmpd openssl_a openssl_b zlib
+PRJ_DEFS :=
+PRJ_LIBP :=
+PRJ_OSLB :=
+
+PRJ_SUBROOT := _sqmod
+
+PRJ_EXPORTS := SRV_GetModuleInfo SRV_Start SRV_Stop SQBIND_Export_Symbols
+
+#-------------------------------------------------------------------
+# Configure build
+#-------------------------------------------------------------------
+include $(PRJ_LIBROOT)/config.mk
+
+ifeq ($(PLATFORM),windows)
+ ifeq ($(BUILD),vs)
+ PRJ_INCS := $(PRJ_INCS) $(CFG_LIB2BLD)/dep/etc/vs/inc/c99
+ endif
+endif
+
+#-------------------------------------------------------------------
+# File locations
+#-------------------------------------------------------------------
+export LOC_TAG := def
+include $(PRJ_LIBROOT)/build.mk
+
+#-------------------------------------------------------------------
+# Execute the build
+#-------------------------------------------------------------------
+include $(PRJ_LIBROOT)/go.mk
+
View
307 sqmod/sqmod_rtmpd/rtmpd_session.cpp
@@ -0,0 +1,307 @@
+
+#include "stdafx.h"
+
+#include <winsock2.h>
+
+#if defined( _DEBUG )
+ extern "C"
+ { extern FILE *netstackdump;
+ extern FILE *netstackdump_read;
+ };
+#endif
+
+// CRtmpdServer
+SQBIND_REGISTER_CLASS_BEGIN( CRtmpdSession, CRtmpdSession )
+
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, Destroy )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, Init )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, getLastErrorStr )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, setLastErrorStr )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, getLibVersion )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, StartDebugLog )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, StopDebugLog )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, isSession )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, ReadPacket )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, getPacketType )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, getPacketData )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, getPacketSize )
+ SQBIND_MEMBER_FUNCTION( CRtmpdSession, getPacket )
+// SQBIND_MEMBER_FUNCTION( CRtmpdSession, )
+// SQBIND_MEMBER_FUNCTION( CRtmpdSession, )
+
+SQBIND_REGISTER_CLASS_END()
+DECLARE_INSTANCE_TYPE( CRtmpdSession );
+
+void CRtmpdSession::Register( sqbind::VM vm )
+{_STT();
+ SQBIND_EXPORT( vm, CRtmpdSession );
+}
+
+CRtmpdSession::CRtmpdSession()
+{_STT();
+
+ // Initialize structures
+ oexZero( m_session );
+ oexZero( m_packet );
+ m_nPacketReady = 0;
+}
+
+void CRtmpdSession::Destroy()
+{_STT();
+
+ // Release session if any
+ if ( m_session.m_sb.sb_socket )
+ RTMP_Close( &m_session );
+
+ oexZero( m_session );
+ oexZero( m_packet );
+ m_nPacketReady = 0;
+}
+
+SQInteger CRtmpdSession::getLibVersion()
+{
+ return RTMP_LibVersion();
+}
+
+int CRtmpdSession::StartDebugLog( const sqbind::stdString &sFile )
+{_STT();
+
+#if _DEBUG
+
+ StopDebugLog();
+
+ oex::CStr8 s = oexStrToMb( sqbind::std2oex( sFile ) << oexT( ".dump.dat" ) );
+ netstackdump = fopen( s.Ptr(), "wb" );
+ if ( !netstackdump )
+ { setLastErrorStr( sqbind::stdString( "Failed to open log file : " ) + sqbind::oex2std( s ) );
+ return 0;
+ } // end if
+
+ s = oexStrToMb( sqbind::std2oex( sFile ) << oexT( ".read.dat" ) );
+ netstackdump_read = fopen( s.Ptr(), "wb" );
+ if ( !netstackdump_read )
+ { setLastErrorStr( sqbind::stdString( "Failed to open log file : " ) + sqbind::oex2std( s ) );
+ return 0;
+ } // end if
+
+ return 1;
+
+#else
+ return 0;
+#endif
+
+}
+
+int CRtmpdSession::StopDebugLog()
+{_STT();
+
+#if _DEBUG
+ if ( netstackdump )
+ fclose( netstackdump );
+ if ( netstackdump_read )
+ fclose( netstackdump_read );
+ return 1;
+#else
+ return 0;
+#endif
+
+}
+
+int CRtmpdSession::Init( sqbind::CSqSocket *pSocket )
+{
+ // Out with the old
+ Destroy();
+
+#if _DEBUG
+
+ // Unfortunately, this is a must for the debug version
+ if ( !netstackdump || !netstackdump_read )
+ { setLastErrorStr( "You must call StartDebugLog() in debug versions" );
+ return 0;
+ } // end if
+
+#endif
+
+ // Sanity check
+ if ( !pSocket || !pSocket->Ptr() )
+ { setLastErrorStr( "Invalid socket" );
+ return 0;
+ } // end if
+
+ // Initialize the session object
+ RTMP_Init( &m_session );
+
+ // Give the rtmpd object control of the socket handle
+ m_session.m_sb.sb_socket = (int)pSocket->Ptr()->Detach();
+
+ // Attempt handshake
+ if ( !RTMP_Serve( &m_session ) )
+ { setLastErrorStr( "RTMP handshake failed" );
+ return 0;
+ } // end if
+
+ return 1;
+}
+
+
+int CRtmpdSession::ReadPacket()
+{_STT();
+
+ // Ensure we have a session
+ if ( !isSession() )
+ return -1;
+
+ // Ensure we still have a connection
+ if ( !RTMP_IsConnected( &m_session ) )
+ { Destroy();
+ return -2;
+ } // end if
+
+ // Free previous packet if needed
+ if ( m_nPacketReady )
+ RTMPPacket_Free( &m_packet ), m_nPacketReady = 0;
+
+ // See if we can get a packet
+ if ( !RTMP_ReadPacket( &m_session, &m_packet ) || !RTMPPacket_IsReady( &m_packet ) )
+ return 0;
+
+ // We have a packet
+ m_nPacketReady = 1;
+
+ return m_packet.m_packetType;
+}
+
+sqbind::CSqBinary CRtmpdSession::getPacketData( int nOffset )
+{_STT();
+
+ // Sanity checks
+ if ( !m_nPacketReady || !m_packet.m_body
+ || 0 > nOffset || nOffset >= m_packet.m_nBodySize )
+ return sqbind::CSqBinary();
+
+ // Return buffer pointer
+ return sqbind::CSqBinary( &m_packet.m_body[ nOffset ], m_packet.m_nBodySize - nOffset, nOffset, 0 );
+}
+
+sqbind::CSqMulti CRtmpdSession::getPacket( int nMode )
+{_STT();
+
+ int nOffset = 0;
+
+ // Sanity checks
+ if ( !m_nPacketReady || !m_packet.m_body
+ || 0 > nOffset || nOffset >= m_packet.m_nBodySize
+ || ( nMode & 0xffff0000 ) )
+ return sqbind::CSqMulti();
+
+ // Convert to array
+ sqbind::CSqMulti m;
+ ParsePacket( &m, &m_packet.m_body[ nOffset ], m_packet.m_nBodySize - nOffset, 0 );
+ return m;
+}
+
+#define _USER_ALLINFO 0x00000001
+#define _IN_OBJECT 0x00010000
+int CRtmpdSession::ParsePacket( sqbind::CSqMulti *m, const char *p, int nLength, int nMode )
+{_STT();
+
+ // Sanity checks
+ if ( !m || !p || 0 >= nLength )
+ return 0;
+
+ // Parse the packet data
+ unsigned long i = 0, l = 0;
+ const char *s = p, *e = p + nLength;
+
+ // Parse values
+ while ( ( p + 1 ) < e )
+ {
+ // Key
+ sqbind::stdString k;
+
+ if ( !( _IN_OBJECT & nMode ) )
+ k = sqbind::ToStr( i++ );
+ else
+ { l = oex::os::CIpSocket::ntoh_s( *(unsigned short*)p ); p += 2;
+ if ( ( p + l ) > e )
+ return p - s;
+ else
+ k.assign( p, l ), p += l;
+ } // end else
+
+ switch( *p++ )
+ {
+ case AMF_NUMBER :
+ if ( ( p + 4 ) > e )
+ return p - s;
+ else
+ {
+ oex::oexINT64 n = *(oex::oexINT64*)p; p += 8;
+ oex::cmn::RevBytes( &n, sizeof( oex::oexINT64 ) );
+ if ( _USER_ALLINFO & nMode )
+ (*m)[ k ][ "t" ].set( "double" ),
+ (*m)[ k ][ "v" ].set( sqbind::ToStr( *(double*)&n ) );
+ else
+ (*m)[ k ].set( sqbind::ToStr( *(double*)&n ) );
+ } // end else
+ break;
+
+ case AMF_BOOLEAN :
+ if ( _USER_ALLINFO & nMode )
+ (*m)[ k ][ "t" ].set( "bool" ),
+ (*m)[ k ][ "v" ].set( sqbind::ToStr( *p ? 1 : 0 ) );
+ else
+ (*m)[ k ].set( sqbind::ToStr( *p ? 1 : 0 ) );
+ p++;
+ break;
+
+ case AMF_STRING :
+ l = oex::os::CIpSocket::ntoh_s( *(unsigned short*)p ); p += 2;
+ if ( ( p + l ) > e )
+ return p - s;
+ else
+ {
+ if ( _USER_ALLINFO & nMode )
+ (*m)[ k ][ "t" ].set( "string" ),
+ (*m)[ k ][ "v" ].set( sqbind::stdString( p, l ) );
+ else
+ (*m)[ k ].set( sqbind::stdString( p, l ) );
+ p += l;
+ } // end else
+ break;
+
+ case AMF_OBJECT :
+ {
+ int n = 0;
+ if ( _USER_ALLINFO & nMode )
+ (*m)[ k ][ "t" ].set( "obj" ),
+ n = ParsePacket( &(*m)[ k ][ "v" ], p, e - p, nMode | _IN_OBJECT );
+ else
+ n = ParsePacket( &(*m)[ k ], p, e - p, nMode | _IN_OBJECT );
+
+ if ( 0 >= n )
+ return p - s;
+
+ p += n;
+
+ } break;
+
+ // Ignore
+ case AMF_NULL :
+ break;
+
+ // Pop
+ case AMF_OBJECT_END :
+ return p - s;
+
+ // Give up on unknown item
+ default :
+ return 0;
+
+ } // end switch
+
+ } // end while
+
+ return p - s;
+}
+
View
96 sqmod/sqmod_rtmpd/rtmpd_session.h
@@ -0,0 +1,96 @@
+
+#pragma once
+
+class CRtmpdSession
+{
+public:
+
+ // Declare constructors
+ _SQBIND_CLASS_CTOR_BEGIN( CRtmpdSession )
+ _SQBIND_CLASS_CTOR_END( CRtmpdSession )
+
+ /// Default constructor
+ CRtmpdSession();
+
+ /// Destructor
+ virtual ~CRtmpdSession() { Destroy(); }
+
+ /// Copy
+ CRtmpdSession( const CRtmpdSession &r ) { }
+ CRtmpdSession& operator = ( const CRtmpdSession &r ) { return *this; }
+
+ /// Registers the class
+ static void Register( sqbind::VM vm );
+
+ /** \addtogroup CRtmpdSession
+ @{
+ */
+
+ /// Destroy connection
+ void Destroy();
+
+ /// Initializes the RTMP session on the specified socket
+ int Init( sqbind::CSqSocket *pSocket );
+
+ /// Returns non-zero if there is a valid session
+ int isSession() { return m_session.m_sb.sb_socket ? 1 : 0; }
+
+ /// Returns the version number of the RTMPD library
+ SQInteger getLibVersion();
+
+ /// Returns the last error string
+ sqbind::stdString getLastErrorStr() { return m_sLastError; }
+
+ /// Sets the last error string
+ void setLastErrorStr( const sqbind::stdString &s ) { m_sLastError = s; }
+
+ /// Start debug output log
+ int StartDebugLog( const sqbind::stdString &sFile );
+
+ /// Start debug output log
+ int StopDebugLog();
+
+ /// Read a packet message from the server
+ /**
+
+ Returns
+ < 0 - Client session is closed
+ = 0 - No packet or incomplete packet, call again later
+ > 0 - Packet received
+
+ */
+ int ReadPacket();
+
+ /// Returns the packet type
+ int getPacketType() { return m_nPacketReady ? m_packet.m_packetType : 0; }
+
+ /// Returns the packet type
+ int getPacketSize() { return m_nPacketReady ? m_packet.m_nBodySize : 0; }
+
+ /// Returns the packet data
+ sqbind::CSqBinary getPacketData( int nOffset );
+
+ /// Returns the parsed packet data
+ sqbind::CSqMulti getPacket( int nMode );
+
+ /** @} */
+
+ /// Parses the packet data
+ int ParsePacket( sqbind::CSqMulti *m, const char *p, int nOffset, int nMode );
+
+private:
+
+ /// RTMP session context
+ RTMP m_session;
+
+ /// RTMP packet
+ RTMPPacket m_packet;
+
+ /// Non-zero if a packet is ready
+ int m_nPacketReady;
+
+ /// String describing the last error
+ sqbind::stdString m_sLastError;
+
+};
+
View
30 sqmod/sqmod_rtmpd/stdafx.cpp
@@ -0,0 +1,30 @@
+// stdafx.cpp
+
+#include "stdafx.h"
+
+#if defined( _DEBUG )
+ extern "C" FILE *netstackdump = 0;
+ extern "C" FILE *netstackdump_read = 0;
+#endif
+
+// Export classes
+static void SQBIND_Export_rtmpd( sqbind::VM x_vm )
+{_STT();
+ if ( !oexCHECK_PTR( x_vm ) )
+ return;
+
+ // Register class instances
+ CRtmpdSession::Register( x_vm );
+}
+
+#if defined( SQBIND_STATIC )
+ #include "rtmpd_session.cpp"
+#else
+
+ static void SQBIND_Export( sqbind::VM x_vm )
+ {_STT(); SQBIND_Export_rtmpd( x_vm ); }
+
+ // Include squirrel module exported symbols
+ #include <sqmod_extern.hpp>
+
+#endif
View
15 sqmod/sqmod_rtmpd/stdafx.h
@@ -0,0 +1,15 @@
+
+#pragma once
+
+#include <string>
+#include <list>
+#include <map>
+#include <vector>
+
+#include "oexlib.h"
+#include "sqbind.h"
+
+#include "rtmp.h"
+
+#include "rtmpd_session.h"
+

0 comments on commit eb987b0

Please sign in to comment.