本文整理汇总了C++中RTMP_LogPrintf函数的典型用法代码示例。如果您正苦于以下问题:C++ RTMP_LogPrintf函数的具体用法?C++ RTMP_LogPrintf怎么用?C++ RTMP_LogPrintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTMP_LogPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sigIntHandler
void
sigIntHandler(int sig)
{
RTMP_ctrlC = TRUE;
RTMP_LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
if (rtmpServer)
stopStreaming(rtmpServer);
signal(SIGINT, SIG_DFL);
}
示例2: rtmp_rvod_stop_notify
static void rtmp_rvod_stop_notify(void* ctx)
{
if (!ctx)
{
return;
}
RTMP_LogPrintf("rtmp stopeed\n");
t_rtmp_vod_ctx *c = ctx;
c->stopeed = 1;
}
示例3: sigIntHandler
void sigIntHandler(int sig)
{
RTMP_ctrlC = TRUE;
RTMP_LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
// ignore all these signals now and let the connection close
signal(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
}
示例4: controlServerThread
TFTYPE
controlServerThread(void *unused)
{
char ich;
while (1)
{
ich = getchar();
switch (ich)
{
case 'q':
RTMP_LogPrintf("Exiting\n");
stopStreaming(rtmpServer);
exit(0);
break;
default:
RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich);
}
}
TFRET();
}
示例5: sigIntHandler
void
sigIntHandler(int sig)
{
//xjzhang, 屏蔽这些signal,设置RTMP_ctrlC为TRUE从而进入正常退出流程;
RTMP_ctrlC = TRUE;
RTMP_LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
// ignore all these signals now and let the connection close
signal(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
#ifndef WIN32
signal(SIGHUP, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
#endif
}
示例6: rtmp_rvod_pause_notify
static void rtmp_rvod_pause_notify(void* ctx, int paused, double ts)
{
RTMP_LogPrintf("rtmp pause %d ts %lf\n", paused, ts);
if (!ctx)
{
return;
}
t_rtmp_vod_ctx *c = ctx;
c->paused = paused;
if (paused)
{
c->start_timestamp = ts;
}
else
{
c->start_timestamp = ts;
c->epoch = RTMP_GetTime();
}
}
示例7: main
int
main(int argc, char **argv)
{
int nStatus = RD_SUCCESS;
// http streaming server
char DEFAULT_HTTP_STREAMING_DEVICE[] = "0.0.0.0"; // 0.0.0.0 is any device
char *rtmpStreamingDevice = DEFAULT_HTTP_STREAMING_DEVICE; // streaming device, default 0.0.0.0
int nRtmpStreamingPort = 1935; // port
RTMP_LogPrintf("RTMP Server %s\n", RTMPDUMP_VERSION);
RTMP_LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
RTMP_debuglevel = RTMP_LOGINFO;
if (argc > 1 && !strcmp(argv[1], "-z"))
RTMP_debuglevel = RTMP_LOGALL;
// init request
memset(&defaultRTMPRequest, 0, sizeof(RTMP_REQUEST));
defaultRTMPRequest.rtmpport = -1;
defaultRTMPRequest.protocol = RTMP_PROTOCOL_UNDEFINED;
defaultRTMPRequest.bLiveStream = FALSE; // is it a live stream? then we can't seek/resume
defaultRTMPRequest.timeout = 300; // timeout connection afte 300 seconds
defaultRTMPRequest.bufferTime = 20 * 1000;
signal(SIGINT, sigIntHandler);
#ifndef WIN32
signal(SIGPIPE, SIG_IGN);
#endif
#ifdef _DEBUG
netstackdump = fopen("netstackdump", "wb");
netstackdump_read = fopen("netstackdump_read", "wb");
#endif
InitSockets();
// start text UI
ThreadCreate(controlServerThread, 0);
// start http streaming
if ((rtmpServer =
startStreaming(rtmpStreamingDevice, nRtmpStreamingPort)) == 0)
{
RTMP_Log(RTMP_LOGERROR, "Failed to start RTMP server, exiting!");
return RD_FAILED;
}
RTMP_LogPrintf("Streaming on rtmp://%s:%d\n", rtmpStreamingDevice,
nRtmpStreamingPort);
while (rtmpServer->state != STREAMING_STOPPED)
{
sleep(1);
}
RTMP_Log(RTMP_LOGDEBUG, "Done, exiting...");
CleanupSockets();
#ifdef _DEBUG
if (netstackdump != 0)
fclose(netstackdump);
if (netstackdump_read != 0)
fclose(netstackdump_read);
#endif
return nStatus;
}
示例8: main
int
main(int argc, char **argv)
{
int nStatus = RD_SUCCESS;
// http streaming server
char DEFAULT_HTTP_STREAMING_DEVICE[] = "0.0.0.0"; // 0.0.0.0 is any device
char *httpStreamingDevice = DEFAULT_HTTP_STREAMING_DEVICE; // streaming device, default 0.0.0.0
int nHttpStreamingPort = 80; // port
int opt;
struct option longopts[] = {
{"help", 0, NULL, 'h'},
{"host", 1, NULL, 'n'},
{"port", 1, NULL, 'c'},
{"socks", 1, NULL, 'S'},
{"protocol", 1, NULL, 'l'},
{"playpath", 1, NULL, 'y'},
{"rtmp", 1, NULL, 'r'},
{"swfUrl", 1, NULL, 's'},
{"tcUrl", 1, NULL, 't'},
{"pageUrl", 1, NULL, 'p'},
{"app", 1, NULL, 'a'},
#ifdef CRYPTO
{"swfhash", 1, NULL, 'w'},
{"swfsize", 1, NULL, 'x'},
{"swfVfy", 1, NULL, 'W'},
{"swfAge", 1, NULL, 'X'},
#endif
{"auth", 1, NULL, 'u'},
{"conn", 1, NULL, 'C'},
{"flashVer", 1, NULL, 'f'},
{"live", 0, NULL, 'v'},
//{"flv", 1, NULL, 'o'},
//{"resume", 0, NULL, 'e'},
{"timeout", 1, NULL, 'm'},
{"buffer", 1, NULL, 'b'},
//{"skip", 1, NULL, 'k'},
{"device", 1, NULL, 'D'},
{"sport", 1, NULL, 'g'},
{"subscribe", 1, NULL, 'd'},
{"start", 1, NULL, 'A'},
{"stop", 1, NULL, 'B'},
{"token", 1, NULL, 'T'},
{"debug", 0, NULL, 'z'},
{"quiet", 0, NULL, 'q'},
{"verbose", 0, NULL, 'V'},
{0, 0, 0, 0}
};
RTMP_LogPrintf("HTTP-RTMP Stream Gateway %s\n", RTMPDUMP_VERSION);
RTMP_LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
// init request
memset(&defaultRTMPRequest, 0, sizeof(RTMP_REQUEST));
defaultRTMPRequest.rtmpport = -1;
defaultRTMPRequest.protocol = RTMP_PROTOCOL_UNDEFINED;
defaultRTMPRequest.bLiveStream = FALSE; // is it a live stream? then we can't seek/resume
defaultRTMPRequest.timeout = 120; // timeout connection after 120 seconds
defaultRTMPRequest.bufferTime = 20 * 1000;
defaultRTMPRequest.swfAge = 30;
signal(SIGINT, sigIntHandler);
#ifndef WIN32
signal(SIGPIPE, SIG_IGN);
#endif
InitSockets();
while ((opt =
getopt_long(argc, argv,
"hvqVzr:s:t:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:", longopts,
NULL)) != -1)
{
switch (opt)
{
case 'h':
RTMP_LogPrintf
("\nThis program serves media content streamed from RTMP onto HTTP.\n\n");
RTMP_LogPrintf("--help|-h Prints this help screen.\n");
RTMP_LogPrintf
("--rtmp|-r url URL (e.g. rtmp://host[:port]/path)\n");
RTMP_LogPrintf
("--host|-n hostname Overrides the hostname in the rtmp url\n");
RTMP_LogPrintf
("--port|-c port Overrides the port in the rtmp url\n");
RTMP_LogPrintf
("--socks|-S host:port Use the specified SOCKS proxy\n");
RTMP_LogPrintf
("--protocol|-l Overrides the protocol in the rtmp url (0 - RTMP, 2 - RTMPE)\n");
RTMP_LogPrintf
("--playpath|-y Overrides the playpath parsed from rtmp url\n");
RTMP_LogPrintf("--swfUrl|-s url URL to player swf file\n");
RTMP_LogPrintf
("--tcUrl|-t url URL to played stream (default: \"rtmp://host[:port]/app\")\n");
RTMP_LogPrintf("--pageUrl|-p url Web URL of played programme\n");
//.........这里部分代码省略.........
示例9: usage
void usage(char *prog)
{
RTMP_LogPrintf
("\n%s: This program dumps the media content streamed over RTMP.\n\n", prog);
RTMP_LogPrintf("--help|-h Prints this help screen.\n");
RTMP_LogPrintf
("--url|-i url URL with options included (e.g. rtmp://host[:port]/path swfUrl=url tcUrl=url)\n");
RTMP_LogPrintf
("--rtmp|-r url URL (e.g. rtmp://host[:port]/path)\n");
RTMP_LogPrintf
("--live|-v Save a live stream, no --resume (seeking) of live streams possible\n");
RTMP_LogPrintf
("--flv|-o string FLV output file name, if the file name is - print stream to stdout\n");
RTMP_LogPrintf
("--timeout|-m num Timeout connection num seconds (default: %u)\n", DEF_TIMEOUT);
RTMP_LogPrintf
("--quiet|-q Suppresses all command output.\n");
RTMP_LogPrintf("--verbose|-V Verbose command output.\n");
RTMP_LogPrintf
("If you don't pass parameters for swfUrl, pageUrl, or auth these properties will not be included in the connect ");
RTMP_LogPrintf("packet.\n\n");
}
示例10: main
int main(int argc, char* argv[])
{
InitSockets();
double duration = -1;
int nRead;
//is live stream ?
bool bLiveStream = TRUE;
int bufsize = 1024 * 1024 * 10;
char *buf = (char*)malloc(bufsize);
memset(buf, 0, bufsize);
long countbufsize = 0;
FILE *fp = fopen("receive.flv", "wb");
if (!fp)
{
RTMP_LogPrintf("Open File Error.\n");
CleanupSockets();
return -1;
}
/* set log level */
RTMP_LogLevel loglvl = RTMP_LOGDEBUG;
RTMP_LogSetLevel(loglvl);
RTMP *rtmp = RTMP_Alloc();
RTMP_Init(rtmp);
//set connection timeout,default 30s
rtmp->Link.timeout = 10;
char* rtmpFilePath = "d:\\rtmp.raw";
rtmp->m_pRTMPFile = fopen(rtmpFilePath,"rb");
if (!rtmp->m_pRTMPFile)
{
RTMP_LogPrintf("Failed to open File :%s\n", rtmpFilePath);
return FALSE;
}
// HKS's live URL
if(!RTMP_SetupURL(rtmp, "rtmp://live.hkstv.hk.lxdns.com/live/hks"))
{
RTMP_Log(RTMP_LOGERROR, "SetupURL Err\n");
RTMP_Free(rtmp);
CleanupSockets();
return -1;
}
if (bLiveStream)
{
rtmp->Link.lFlags |= RTMP_LF_LIVE;
}
//1hour
RTMP_SetBufferMS(rtmp, 3600 * 1000);
if(!RTMP_Connect(rtmp, NULL))
{
RTMP_Log(RTMP_LOGERROR, "Connect Err\n");
RTMP_Free(rtmp);
CleanupSockets();
return -1;
}
if(!RTMP_ConnectStream(rtmp, 0))
{
RTMP_Log(RTMP_LOGERROR, "ConnectStream Err\n");
RTMP_Close(rtmp);
RTMP_Free(rtmp);
CleanupSockets();
return -1;
}
while(nRead = RTMP_Read(rtmp, buf, bufsize))
{
fwrite(buf, 1, nRead, fp);
countbufsize += nRead;
RTMP_LogPrintf("Receive: %5dByte, Total: %5.2fkB\n", nRead, countbufsize * 1.0 / 1024);
}
if(fp)
fclose(fp);
if(fpPcap)
fclose(fpPcap);
if (rtmp->m_pRTMPFile)
{
fclose(rtmp->m_pRTMPFile);
}
if(buf)
{
free(buf);
}
if(rtmp)
{
RTMP_Close(rtmp);
RTMP_Free(rtmp);
//.........这里部分代码省略.........
示例11: ParseOption
//.........这里部分代码省略.........
{
int protocol = atoi(arg);
if (protocol < RTMP_PROTOCOL_RTMP || protocol > RTMP_PROTOCOL_RTMPTS)
{
RTMP_Log(RTMP_LOGERROR, "Unknown protocol specified: %d, using default",
protocol);
return FALSE;
}
else
{
req->protocol = protocol;
}
break;
}
case 'y':
STR2AVAL(req->playpath, arg);
break;
case 'r':
{
req->rtmpurl = arg;
if (!RTMP_ParseURL
(req->rtmpurl, &parsedProtocol, &parsedHost, &parsedPort,
&parsedPlaypath, &parsedApp))
{
RTMP_Log(RTMP_LOGWARNING, "Couldn't parse the specified url (%s)!", arg);
}
else
{
if (!req->hostname.av_len)
req->hostname = parsedHost;
if (req->rtmpport == -1)
req->rtmpport = parsedPort;
if (req->playpath.av_len == 0 && parsedPlaypath.av_len)
{
req->playpath = parsedPlaypath;
}
if (req->protocol == RTMP_PROTOCOL_UNDEFINED)
req->protocol = parsedProtocol;
if (req->app.av_len == 0 && parsedApp.av_len)
{
req->app = parsedApp;
}
}
break;
}
case 's':
STR2AVAL(req->swfUrl, arg);
break;
case 't':
STR2AVAL(req->tcUrl, arg);
break;
case 'p':
STR2AVAL(req->pageUrl, arg);
break;
case 'a':
STR2AVAL(req->app, arg);
break;
case 'f':
STR2AVAL(req->flashVer, arg);
break;
case 'u':
STR2AVAL(req->auth, arg);
break;
case 'C':
parseAMF(&req->extras, optarg, &req->edepth);
break;
case 'm':
req->timeout = atoi(arg);
break;
case 'A':
req->dStartOffset = (int)(atof(arg) * 1000.0);
//printf("dStartOffset = %d\n", dStartOffset);
break;
case 'B':
req->dStopOffset = (int)(atof(arg) * 1000.0);
//printf("dStartOffset = %d\n", dStartOffset);
break;
case 'T':
STR2AVAL(req->token, arg);
break;
case 'S':
STR2AVAL(req->sockshost, arg);
case 'q':
RTMP_debuglevel = RTMP_LOGCRIT;
break;
case 'V':
RTMP_debuglevel = RTMP_LOGDEBUG;
break;
case 'z':
RTMP_debuglevel = RTMP_LOGALL;
break;
default:
RTMP_LogPrintf("unknown option: %c, arg: %s\n", opt, arg);
return FALSE;
}
return TRUE;
}
示例12: usage
void usage(char *prog)
{
RTMP_LogPrintf
("\n%s: This program dumps the media content streamed over RTMP.\n\n", prog);
RTMP_LogPrintf("--help|-h Prints this help screen.\n");
RTMP_LogPrintf
("--url|-i url URL with options included (e.g. rtmp://host[:port]/path swfUrl=url tcUrl=url)\n");
RTMP_LogPrintf
("--rtmp|-r url URL (e.g. rtmp://host[:port]/path)\n");
RTMP_LogPrintf
("--host|-n hostname Overrides the hostname in the rtmp url\n");
RTMP_LogPrintf
("--port|-c port Overrides the port in the rtmp url\n");
RTMP_LogPrintf
("--socks|-S host:port Use the specified SOCKS proxy\n");
RTMP_LogPrintf
("--protocol|-l num Overrides the protocol in the rtmp url (0 - RTMP, 2 - RTMPE)\n");
RTMP_LogPrintf
("--playpath|-y path Overrides the playpath parsed from rtmp url\n");
RTMP_LogPrintf
("--playlist|-Y Set playlist before playing\n");
RTMP_LogPrintf("--swfUrl|-s url URL to player swf file\n");
RTMP_LogPrintf
("--tcUrl|-t url URL to played stream (default: \"rtmp://host[:port]/app\")\n");
RTMP_LogPrintf("--pageUrl|-p url Web URL of played programme\n");
RTMP_LogPrintf("--app|-a app Name of target app on server\n");
#ifdef CRYPTO
RTMP_LogPrintf
("--swfhash|-w hexstring SHA256 hash of the decompressed SWF file (32 bytes)\n");
RTMP_LogPrintf
("--swfsize|-x num Size of the decompressed SWF file, required for SWFVerification\n");
RTMP_LogPrintf
("--swfVfy|-W url URL to player swf file, compute hash/size automatically\n");
RTMP_LogPrintf
("--swfAge|-X days Number of days to use cached SWF hash before refreshing\n");
#endif
RTMP_LogPrintf
("--auth|-u string Authentication string to be appended to the connect string\n");
RTMP_LogPrintf
("--conn|-C type:data Arbitrary AMF data to be appended to the connect string\n");
RTMP_LogPrintf
(" B:boolean(0|1), S:string, N:number, O:object-flag(0|1),\n");
RTMP_LogPrintf
(" Z:(null), NB:name:boolean, NS:name:string, NN:name:number\n");
RTMP_LogPrintf
("--flashVer|-f string Flash version string (default: \"%s\")\n",
RTMP_DefaultFlashVer.av_val);
RTMP_LogPrintf
("--live|-v Save a live stream, no --resume (seeking) of live streams possible\n");
RTMP_LogPrintf
("--subscribe|-d string Stream name to subscribe to (otherwise defaults to playpath if live is specifed)\n");
RTMP_LogPrintf
("--realtime|-R Don't attempt to speed up download via the Pause/Unpause BUFX hack\n");
RTMP_LogPrintf
("--flv|-o string FLV output file name, if the file name is - print stream to stdout\n");
RTMP_LogPrintf
("--resume|-e Resume a partial RTMP download\n");
RTMP_LogPrintf
("--timeout|-m num Timeout connection num seconds (default: %u)\n",
DEF_TIMEOUT);
RTMP_LogPrintf
("--start|-A num Start at num seconds into stream (not valid when using --live)\n");
RTMP_LogPrintf
("--stop|-B num Stop at num seconds into stream\n");
RTMP_LogPrintf
("--token|-T key Key for SecureToken response\n");
RTMP_LogPrintf
("--jtv|-j JSON Authentication token for Justin.tv legacy servers\n");
RTMP_LogPrintf
("--hashes|-# Display progress with hashes, not with the byte counter\n");
RTMP_LogPrintf
("--buffer|-b Buffer time in milliseconds (default: %u)\n",
DEF_BUFTIME);
RTMP_LogPrintf
("--skip|-k num Skip num keyframes when looking for last keyframe to resume from. Useful if resume fails (default: %d)\n\n",
DEF_SKIPFRM);
RTMP_LogPrintf
("--quiet|-q Suppresses all command output.\n");
RTMP_LogPrintf("--verbose|-V Verbose command output.\n");
RTMP_LogPrintf("--debug|-z Debug level command output.\n");
RTMP_LogPrintf
("If you don't pass parameters for swfUrl, pageUrl, or auth these properties will not be included in the connect ");
RTMP_LogPrintf("packet.\n\n");
}
示例13: setError
void QRtmp::run()
{
bool first = true;
int retries = 0;
if(!m_destFile.fileName().isEmpty())
if(!m_destFile.open(QIODevice::WriteOnly))
{
setError(QString("Can't open %1 for writing").arg(m_destFile.fileName()));
return;
}
while(!m_stop)
{
RTMP_Log(RTMP_LOGDEBUG, "Setting buffer time to: %dms", m_bufferTime);
RTMP_SetBufferMS(m_rtmp, m_bufferTime);
if(first)
{
first = false;
RTMP_LogPrintf("Connecting ...\n");
if(!RTMP_Connect(m_rtmp, NULL))
{
setError("RTMP_Connect failed");
break;
}
RTMP_Log(RTMP_LOGINFO, "Connected...");
// User defined seek offset
if(dStartOffset > 0)
{
// Don't need the start offset if resuming an existing file
if(m_bResume)
{
RTMP_Log(RTMP_LOGWARNING, "Can't seek a resumed stream, ignoring --start option");
dStartOffset = 0;
}
else
dSeek = dStartOffset;
}
// Calculate the length of the stream to still play
if(dStopOffset > 0)
{
// Quit if start seek is past required stop offset
if(dStopOffset <= dSeek)
{
RTMP_LogPrintf("Already Completed\n");
break;
}
}
if(!RTMP_ConnectStream(m_rtmp, dSeek))
{
setError("RTMP_ConnectStream failed");
break;
}
}
else
{
if(retries)
{
RTMP_Log(RTMP_LOGERROR, "Failed to resume the stream\n\n");
if(!RTMP_IsTimedout(m_rtmp))
setError("RTMP_IsTimedout failed");
else
setError("RTMP_IsTimedout RD_INCOMPLETE");
break;
}
RTMP_Log(RTMP_LOGINFO, "Connection timed out, trying to resume.\n\n");
/* Did we already try pausing, and it still didn't work? */
if(m_rtmp->m_pausing == 3)
{
/* Only one try at reconnecting... */
retries = 1;
dSeek = m_rtmp->m_pauseStamp;
if(dStopOffset > 0)
{
if(dStopOffset <= dSeek)
{
RTMP_LogPrintf("Already Completed\n");
break;
}
}
if(!RTMP_ReconnectStream(m_rtmp, dSeek))
{
RTMP_Log(RTMP_LOGERROR, "Failed to resume the stream\n\n");
if(!RTMP_IsTimedout(m_rtmp))
setError("RTMP_IsTimedout failed");
else
setError("RTMP_IsTimedout RD_INCOMPLETE");
break;
}
}
else if(!RTMP_ToggleStream(m_rtmp))
{
//.........这里部分代码省略.........
示例14: doServe
void doServe(STREAMING_SERVER * server, // server socket and state (our listening socket)
int sockfd // client connection socket
)
{
server->state = STREAMING_IN_PROGRESS;
RTMP rtmp = { 0 }; /* our session with the real client */
RTMPPacket packet = { 0 };
// timeout for http requests
fd_set fds;
struct timeval tv;
memset(&tv, 0, sizeof(struct timeval));
tv.tv_sec = 5;
FD_ZERO(&fds);
FD_SET(sockfd, &fds);
if (select(sockfd + 1, &fds, NULL, NULL, &tv) <= 0)
{
RTMP_Log(RTMP_LOGERROR, "Request timeout/select failed, ignoring request");
goto quit;
}
else
{
RTMP_Init(&rtmp);
rtmp.m_sb.sb_socket = sockfd;
if (!RTMP_Serve(&rtmp))
{
RTMP_Log(RTMP_LOGERROR, "Handshake failed");
goto cleanup;
}
}
server->arglen = 0;
while (RTMP_IsConnected(&rtmp) && RTMP_ReadPacket(&rtmp, &packet))
{
if (!RTMPPacket_IsReady(&packet))
continue;
ServePacket(server, &rtmp, &packet);
RTMPPacket_Free(&packet);
}
cleanup:
RTMP_LogPrintf("Closing connection... ");
RTMP_Close(&rtmp);
/* Should probably be done by RTMP_Close() ... */
rtmp.Link.playpath.av_val = NULL;
rtmp.Link.tcUrl.av_val = NULL;
rtmp.Link.swfUrl.av_val = NULL;
rtmp.Link.pageUrl.av_val = NULL;
rtmp.Link.app.av_val = NULL;
rtmp.Link.flashVer.av_val = NULL;
RTMP_LogPrintf("done!\n\n");
quit:
if (server->state == STREAMING_IN_PROGRESS)
server->state = STREAMING_ACCEPTING;
return;
}
示例15: main
int main(int argc, char **argv)
{
extern char *optarg;
int nStatus = RD_SUCCESS;
int bStdoutMode = TRUE; // if true print the stream directly to stdout, messages go to stderr
int bLiveStream = TRUE; // is it a live stream? then we can't seek/resume
long int timeout = DEF_TIMEOUT; // timeout connection after 120 seconds
RTMP rtmp = { 0 };
AVal fullUrl = { 0, 0 };
RTMP_debuglevel = RTMP_LOGINFO;
char *flvFile = 0;
signal(SIGINT, sigIntHandler);
signal(SIGTERM, sigIntHandler);
signal(SIGHUP, sigIntHandler);
signal(SIGPIPE, sigIntHandler);
signal(SIGQUIT, sigIntHandler);
RTMP_LogPrintf("RTMPDump %s\n", RTMPDUMP_VERSION);
RTMP_LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL\n");
int opt;
struct option longopts[] = {
{"help", 0, NULL, 'h'},
{"url", 1, NULL, 'i'},
{"rtmp", 1, NULL, 'r'},
{"live", 0, NULL, 'v'},
{"timeout", 1, NULL, 'm'},
{"hashes", 0, NULL, '#'},
{"quiet", 0, NULL, 'q'},
{"verbose", 0, NULL, 'V'},
{0, 0, 0, 0}
};
while ((opt = getopt_long(argc, argv, "hVvqzRr:s:t:i:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:", longopts, NULL)) != -1)
{
switch (opt)
{
case 'h':
usage(argv[0]);
return RD_SUCCESS;
case 'v':
bLiveStream = TRUE; // no seeking or resuming possible!
break;
case 'i':
STR2AVAL(fullUrl, optarg);
break;
case 'o':
flvFile = optarg;
if (strcmp(flvFile, "-"))
bStdoutMode = FALSE;
break;
case 'm':
timeout = atoi(optarg);
break;
case 'q':
RTMP_debuglevel = RTMP_LOGCRIT;
break;
case 'V':
RTMP_debuglevel = RTMP_LOGDEBUG;
break;
case 'z':
RTMP_debuglevel = RTMP_LOGALL;
break;
default:
RTMP_LogPrintf("unknown option: %c\n", opt);
usage(argv[0]);
return RD_FAILED;
break;
}
}
if (flvFile == 0) {
RTMP_Log(RTMP_LOGWARNING, "You haven't specified an output file (-o filename), using stdout");
bStdoutMode = TRUE;
}
if (!file) {
if (bStdoutMode) {
file = stdout;
SET_BINMODE(file);
}
else {
file = fopen(flvFile, "w+b");
if (file == 0) {
RTMP_LogPrintf("Failed to open file! %s\n", flvFile);
return RD_FAILED;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
RTMP_Init(&rtmp);//初始化RTMP参数
//指定了-i 参数,直接设置URL
if (RTMP_SetupURL(&rtmp, fullUrl.av_val) == FALSE) {
//.........这里部分代码省略.........