Using librtmp library to publish a live stream to Wowza Media Server

Hi,

How to publish a stream using librtmp library? 
I read the librtmp man page and for publishing , RTMP_Write() is used.

I am using C/C++ for my application.

//Code
//Init RTMP code
RTMP *r;
char uri[]="rtmp://localhost:1935/live/desktop";
r= RTMP_Alloc();
RTMP_Init(r);
RTMP_SetupURL(r, (char*)uri);
RTMP_EnableWrite(r); // To publish a stream, enable write support before connect
RTMP_Connect(r, NULL);
RTMP_ConnectStream(r,0);

Then to respond to ping/other messages from server, I am using a thread to respond like following:

//Thread
While (ThreadIsRunning && RTMP_IsConnected(r) && RTMP_ReadPacket(r, &packet))
{
if (RTMPPacket_IsReady(&packet))
{
if (!packet.m_nBodySize)
continue;
RTMP_ClientPacket(r, &packet); //This takes care of handling ping/other messages
RTMPPacket_Free(&packet);
}
}I am stuck at how to use RTMP_Write() to send the stream.
Please help me.Thanks,
Dhruva

你可能感兴趣的:(Using librtmp library to publish a live stream to Wowza Media Server)