本文整理汇总了C++中RTMP_Connect函数的典型用法代码示例。如果您正苦于以下问题:C++ RTMP_Connect函数的具体用法?C++ RTMP_Connect怎么用?C++ RTMP_Connect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTMP_Connect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: try_connect
static int try_connect(struct rtmp_stream *stream)
{
#ifndef FILE_TEST
blog(LOG_INFO, "Connecting to RTMP URL %s...", stream->path.array);
if (!RTMP_SetupURL2(&stream->rtmp, stream->path.array,
stream->key.array))
return OBS_OUTPUT_BAD_PATH;
RTMP_EnableWrite(&stream->rtmp);
set_rtmp_dstr(&stream->rtmp.Link.pubUser, &stream->username);
set_rtmp_dstr(&stream->rtmp.Link.pubPasswd, &stream->password);
stream->rtmp.Link.swfUrl = stream->rtmp.Link.tcUrl;
set_rtmp_str(&stream->rtmp.Link.flashVer,
"FMLE/3.0 (compatible; FMSc/1.0)");
stream->rtmp.m_outChunkSize = 4096;
stream->rtmp.m_bSendChunkSizeInfo = true;
stream->rtmp.m_bUseNagle = true;
if (!RTMP_Connect(&stream->rtmp, NULL))
return OBS_OUTPUT_CONNECT_FAILED;
if (!RTMP_ConnectStream(&stream->rtmp, 0))
return OBS_OUTPUT_INVALID_STREAM;
blog(LOG_INFO, "Connection to %s successful", stream->path.array);
#endif
return init_send(stream);
}
示例2: rtmp_probe
static int
rtmp_probe(const char *url0, char *errbuf, size_t errlen, int timeout_ms)
{
RTMP *r;
char *url = mystrdupa(url0);
r = RTMP_Alloc();
RTMP_Init(r, NULL);
if(!RTMP_SetupURL(r, url)) {
snprintf(errbuf, errlen, "Unable to setup RTMP-session");
RTMP_Free(r);
return BACKEND_PROBE_FAIL;
}
if(!RTMP_Connect(r, NULL, errbuf, errlen, timeout_ms)) {
RTMP_Close(r);
RTMP_Free(r);
return BACKEND_PROBE_FAIL;
}
RTMP_SetReadTimeout(r, timeout_ms);
if(!RTMP_ConnectStream(r, 0)) {
snprintf(errbuf, errlen, "Unable to connect RTMP-stream");
RTMP_Close(r);
RTMP_Free(r);
return BACKEND_PROBE_FAIL;
}
RTMP_Close(r);
RTMP_Free(r);
return BACKEND_PROBE_OK;
}
示例3: RTMP_Alloc
/*
* Class: net_butterflytv_rtmp_client_RtmpClient
* Method: open
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_net_ossrs_sea_RtmpClient_open
(JNIEnv * env, jobject thiz, jstring url_, jboolean isPublishMode) {
const char *url = (*env)->GetStringUTFChars(env, url_, 0);
rtmp = RTMP_Alloc();
if (rtmp == NULL) {
return -1;
}
RTMP_Init(rtmp);
int ret = RTMP_SetupURL(rtmp, url);
if (!ret) {
RTMP_Free(rtmp);
return -2;
}
if (isPublishMode) {
RTMP_EnableWrite(rtmp);
}
ret = RTMP_Connect(rtmp, NULL);
if (!ret) {
RTMP_Free(rtmp);
return -3;
}
ret = RTMP_ConnectStream(rtmp, 0);
if (!ret) {
return -4;
}
(*env)->ReleaseStringUTFChars(env, url_, url);
return 1;
}
示例4: rtmp_open
/**
* Open RTMP connection and verify that the stream can be played.
*
* URL syntax: rtmp://server[:port][/app][/playpath][ keyword=value]...
* where 'app' is first one or two directories in the path
* (e.g. /ondemand/, /flash/live/, etc.)
* and 'playpath' is a file name (the rest of the path,
* may be prefixed with "mp4:")
*
* Additional RTMP library options may be appended as
* space-separated key-value pairs.
*/
static int rtmp_open(URLContext *s, const char *uri, int flags)
{
LibRTMPContext *ctx = s->priv_data;
RTMP *r = &ctx->rtmp;
int rc = 0, level;
char *filename = s->filename;
switch (av_log_get_level()) {
default:
case AV_LOG_FATAL: level = RTMP_LOGCRIT; break;
case AV_LOG_ERROR: level = RTMP_LOGERROR; break;
case AV_LOG_WARNING: level = RTMP_LOGWARNING; break;
case AV_LOG_INFO: level = RTMP_LOGINFO; break;
case AV_LOG_VERBOSE: level = RTMP_LOGDEBUG; break;
case AV_LOG_DEBUG: level = RTMP_LOGDEBUG2; break;
}
RTMP_LogSetLevel(level);
RTMP_LogSetCallback(rtmp_log);
if (ctx->app || ctx->playpath) {
int len = strlen(s->filename) + 1;
if (ctx->app) len += strlen(ctx->app) + sizeof(" app=");
if (ctx->playpath) len += strlen(ctx->playpath) + sizeof(" playpath=");
if (!(filename = av_malloc(len)))
return AVERROR(ENOMEM);
av_strlcpy(filename, s->filename, len);
if (ctx->app) {
av_strlcat(filename, " app=", len);
av_strlcat(filename, ctx->app, len);
}
if (ctx->playpath) {
av_strlcat(filename, " playpath=", len);
av_strlcat(filename, ctx->playpath, len);
}
}
RTMP_Init(r);
if (!RTMP_SetupURL(r, filename)) {
rc = AVERROR_UNKNOWN;
goto fail;
}
if (flags & AVIO_FLAG_WRITE)
RTMP_EnableWrite(r);
if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
rc = AVERROR_UNKNOWN;
goto fail;
}
s->is_streamed = 1;
rc = 0;
fail:
if (filename != s->filename)
av_freep(&filename);
return rc;
}
示例5: rtmp_open
/**
* Open RTMP connection and verify that the stream can be played.
*
* URL syntax: rtmp://server[:port][/app][/playpath][ keyword=value]...
* where 'app' is first one or two directories in the path
* (e.g. /ondemand/, /flash/live/, etc.)
* and 'playpath' is a file name (the rest of the path,
* may be prefixed with "mp4:")
*
* Additional RTMP library options may be appended as
* space-separated key-value pairs.
*/
static int rtmp_open(URLContext *s, const char *uri, int flags)
{
RTMP *r;
int rc;
r = av_mallocz(sizeof(RTMP));
if (!r)
return AVERROR(ENOMEM);
switch (av_log_get_level())
{
default:
case AV_LOG_FATAL:
rc = RTMP_LOGCRIT;
break;
case AV_LOG_ERROR:
rc = RTMP_LOGERROR;
break;
case AV_LOG_WARNING:
rc = RTMP_LOGWARNING;
break;
case AV_LOG_INFO:
rc = RTMP_LOGINFO;
break;
case AV_LOG_VERBOSE:
rc = RTMP_LOGDEBUG;
break;
case AV_LOG_DEBUG:
rc = RTMP_LOGDEBUG2;
break;
}
RTMP_LogSetLevel(rc);
RTMP_LogSetCallback(rtmp_log);
RTMP_Init(r);
if (!RTMP_SetupURL(r, s->filename))
{
rc = -1;
goto fail;
}
if (flags & AVIO_WRONLY)
RTMP_EnableWrite(r);
if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0))
{
rc = -1;
goto fail;
}
s->priv_data = r;
s->is_streamed = 1;
return 0;
fail:
av_free(r);
return rc;
}
示例6: gst_rtmp_sink_render
static GstFlowReturn
gst_rtmp_sink_render (GstBaseSink * bsink, GstBuffer * buf)
{
GstRTMPSink *sink = GST_RTMP_SINK (bsink);
GstBuffer *reffed_buf = NULL;
if (sink->first) {
/* open the connection */
if (!RTMP_IsConnected (sink->rtmp)) {
if (!RTMP_Connect (sink->rtmp, NULL)
|| !RTMP_ConnectStream (sink->rtmp, 0)) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
("Could not connect to RTMP stream \"%s\" for writing", sink->uri));
RTMP_Free (sink->rtmp);
sink->rtmp = NULL;
g_free (sink->rtmp_uri);
sink->rtmp_uri = NULL;
return GST_FLOW_ERROR;
}
GST_DEBUG_OBJECT (sink, "Opened connection to %s", sink->rtmp_uri);
}
/* FIXME: Parse the first buffer and see if it contains a header plus a packet instead
* of just assuming it's only the header */
GST_LOG_OBJECT (sink, "Caching first buffer of size %d for concatenation",
GST_BUFFER_SIZE (buf));
gst_buffer_replace (&sink->cache, buf);
sink->first = FALSE;
return GST_FLOW_OK;
}
if (sink->cache) {
GST_LOG_OBJECT (sink, "Joining 2nd buffer of size %d to cached buf",
GST_BUFFER_SIZE (buf));
gst_buffer_ref (buf);
reffed_buf = buf = gst_buffer_join (sink->cache, buf);
sink->cache = NULL;
}
GST_LOG_OBJECT (sink, "Sending %d bytes to RTMP server",
GST_BUFFER_SIZE (buf));
if (!RTMP_Write (sink->rtmp,
(char *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf))) {
GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL), ("Failed to write data"));
if (reffed_buf)
gst_buffer_unref (reffed_buf);
return GST_FLOW_ERROR;
}
if (reffed_buf)
gst_buffer_unref (reffed_buf);
return GST_FLOW_OK;
}
示例7: rtmp_playvideo
static event_t *
rtmp_playvideo(const char *url0, media_pipe_t *mp,
int flags, int priority,
char *errbuf, size_t errlen,
const char *mimetype)
{
rtmp_t r = {0};
event_t *e;
char *url = mystrdupa(url0);
prop_set_string(mp->mp_prop_type, "video");
RTMP_LogSetLevel(RTMP_LOGINFO);
r.r = RTMP_Alloc();
RTMP_Init(r.r);
if(!RTMP_SetupURL(r.r, url)) {
snprintf(errbuf, errlen, "Unable to setup RTMP-session");
rtmp_free(&r);
return NULL;
}
if(!RTMP_Connect(r.r, NULL)) {
snprintf(errbuf, errlen, "Unable to connect RTMP-session");
rtmp_free(&r);
return NULL;
}
if(!RTMP_ConnectStream(r.r, 0)) {
snprintf(errbuf, errlen, "Unable to connect RTMP-stream");
rtmp_free(&r);
return NULL;
}
mp->mp_audio.mq_stream = 0;
mp->mp_video.mq_stream = 0;
mp_configure(mp, MP_PLAY_CAPS_PAUSE, MP_BUFFER_DEEP);
mp->mp_max_realtime_delay = (r.r->Link.timeout - 1) * 1000000;
mp_become_primary(mp);
e = rtmp_loop(&r, mp, url, errbuf, errlen);
mp_flush(mp, 0);
mp_shutdown(mp);
TRACE(TRACE_DEBUG, "RTMP", "End of stream");
rtmp_free(&r);
return e;
}
示例8: gst_rtmp_src_start
/* open the file, do stuff necessary to go to PAUSED state */
static gboolean
gst_rtmp_src_start (GstBaseSrc * basesrc)
{
GstRTMPSrc *src;
src = GST_RTMP_SRC (basesrc);
if (!src->uri) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("No filename given"));
return FALSE;
}
src->cur_offset = 0;
src->last_timestamp = 0;
src->discont = TRUE;
src->rtmp = RTMP_Alloc ();
if (!src->rtmp) {
GST_ERROR_OBJECT (src, "Could not allocate librtmp's RTMP context");
goto error;
}
RTMP_Init (src->rtmp);
if (!RTMP_SetupURL (src->rtmp, src->uri)) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
("Failed to setup URL '%s'", src->uri));
goto error;
}
src->seekable = !(src->rtmp->Link.lFlags & RTMP_LF_LIVE);
GST_INFO_OBJECT (src, "seekable %d", src->seekable);
/* open if required */
if (!RTMP_IsConnected (src->rtmp)) {
if (!RTMP_Connect (src->rtmp, NULL)) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
("Could not connect to RTMP stream \"%s\" for reading", src->uri));
goto error;
}
}
return TRUE;
error:
if (src->rtmp) {
RTMP_Free (src->rtmp);
src->rtmp = NULL;
}
return FALSE;
}
示例9: try_connect
static int try_connect(struct rtmp_stream *stream)
{
if (dstr_is_empty(&stream->path)) {
warn("URL is empty");
return OBS_OUTPUT_BAD_PATH;
}
info("Connecting to RTMP URL %s...", stream->path.array);
memset(&stream->rtmp.Link, 0, sizeof(stream->rtmp.Link));
if (!RTMP_SetupURL(&stream->rtmp, stream->path.array))
return OBS_OUTPUT_BAD_PATH;
RTMP_EnableWrite(&stream->rtmp);
set_rtmp_dstr(&stream->rtmp.Link.pubUser, &stream->username);
set_rtmp_dstr(&stream->rtmp.Link.pubPasswd, &stream->password);
stream->rtmp.Link.swfUrl = stream->rtmp.Link.tcUrl;
set_rtmp_str(&stream->rtmp.Link.flashVer,
"FMLE/3.0 (compatible; OBS Studio; FMSc/1.0)");
RTMP_AddStream(&stream->rtmp, stream->key.array);
for (size_t idx = 1;; idx++) {
obs_encoder_t *encoder = obs_output_get_audio_encoder(
stream->output, idx);
const char *encoder_name;
if (!encoder)
break;
encoder_name = obs_encoder_get_name(encoder);
RTMP_AddStream(&stream->rtmp, encoder_name);
}
stream->rtmp.m_outChunkSize = 4096;
stream->rtmp.m_bSendChunkSizeInfo = true;
stream->rtmp.m_bUseNagle = true;
if (!RTMP_Connect(&stream->rtmp, NULL))
return OBS_OUTPUT_CONNECT_FAILED;
if (!RTMP_ConnectStream(&stream->rtmp, 0))
return OBS_OUTPUT_INVALID_STREAM;
info("Connection to %s successful", stream->path.array);
return init_send(stream);
}
示例10: gst_rtmp_sink_start
static gboolean
gst_rtmp_sink_start (GstBaseSink * basesink)
{
GstRTMPSink *sink = GST_RTMP_SINK (basesink);
if (!sink->uri) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
("Please set URI for RTMP output"), ("No URI set before starting"));
return FALSE;
}
sink->rtmp_uri = g_strdup (sink->uri);
sink->rtmp = RTMP_Alloc ();
RTMP_Init (sink->rtmp);
if (!RTMP_SetupURL (sink->rtmp, sink->rtmp_uri)) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
("Failed to setup URL '%s'", sink->uri));
RTMP_Free (sink->rtmp);
sink->rtmp = NULL;
g_free (sink->rtmp_uri);
sink->rtmp_uri = NULL;
return FALSE;
}
GST_DEBUG_OBJECT (sink, "Created RTMP object");
/* Mark this as an output connection */
RTMP_EnableWrite (sink->rtmp);
/* open the connection */
if (!RTMP_IsConnected (sink->rtmp)) {
if (!RTMP_Connect (sink->rtmp, NULL) || !RTMP_ConnectStream (sink->rtmp, 0)) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
("Could not connect to RTMP stream \"%s\" for writing", sink->uri));
RTMP_Free (sink->rtmp);
sink->rtmp = NULL;
g_free (sink->rtmp_uri);
sink->rtmp_uri = NULL;
return FALSE;
}
GST_DEBUG_OBJECT (sink, "Opened connection to %s", sink->rtmp_uri);
}
sink->first = TRUE;
return TRUE;
}
示例11: QObject
Rtmp::Rtmp(QUrl url, QObject *parent)
: QObject(parent)
{
m_rtmp = RTMP_Alloc();
RTMP_Init(m_rtmp);
qDebug() << "Connecting to" << url;
RTMP_SetupURL(m_rtmp, MY_URL );
RTMP_EnableWrite(m_rtmp);
RTMP_Connect(m_rtmp, NULL);
RTMP_ConnectStream(m_rtmp, 0);
memset(&m_rtmpPacket, 0, sizeof(RTMPPacket));
qDebug() << RTMP_IsConnected(m_rtmp);
}
示例12: gst_rtmp_src_start
/* open the file, do stuff necessary to go to PAUSED state */
static gboolean
gst_rtmp_src_start (GstBaseSrc * basesrc)
{
GstRTMPSrc *src;
gchar *uri_copy;
src = GST_RTMP_SRC (basesrc);
if (!src->uri) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("No filename given"));
return FALSE;
}
src->cur_offset = 0;
src->last_timestamp = 0;
src->seekable = TRUE;
src->discont = TRUE;
uri_copy = g_strdup (src->uri);
src->rtmp = RTMP_Alloc ();
RTMP_Init (src->rtmp);
if (!RTMP_SetupURL (src->rtmp, uri_copy)) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
("Failed to setup URL '%s'", src->uri));
g_free (uri_copy);
RTMP_Free (src->rtmp);
src->rtmp = NULL;
return FALSE;
}
/* open if required */
if (!RTMP_IsConnected (src->rtmp)) {
if (!RTMP_Connect (src->rtmp, NULL)) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
("Could not connect to RTMP stream \"%s\" for reading", src->uri));
RTMP_Free (src->rtmp);
src->rtmp = NULL;
return FALSE;
}
}
return TRUE;
}
示例13: sizeof
bool LibRtmp::Open(const char* url)
{
streming_url_ = (char*)calloc(strlen(url)+1, sizeof(char));
strcpy(streming_url_, url);
std::string tmp(url);
stream_name_ = tmp.substr(tmp.rfind("/")+1);
//AVal flashver = AVC("flashver");
//AVal flashver_arg = AVC("WIN 9,0,115,0");
AVal swfUrl = AVC("swfUrl");
AVal swfUrl_arg = AVC("http://localhost/librtmp.swf");
AVal pageUrl = AVC("pageUrl");
AVal pageUrl_arg = AVC("http://localhost/librtmp.html");
//RTMP_SetOpt(rtmp_, &flashver, &flashver_arg);
RTMP_SetOpt(rtmp_, &swfUrl, &swfUrl_arg);
RTMP_SetOpt(rtmp_, &pageUrl, &pageUrl_arg);
if (is_need_record_)
{
AVal record = AVC("record");
AVal record_arg = AVC("on");
RTMP_SetOpt(rtmp_, &record, &record_arg);
}
int err = RTMP_SetupURL(rtmp_, streming_url_);
if (err <= 0) return false;
RTMP_EnableWrite(rtmp_);
err = RTMP_Connect(rtmp_, NULL);
if (err <= 0) return false;
err = RTMP_ConnectStream(rtmp_, 0);
if (err <= 0) return false;
rtmp_->m_outChunkSize = 2*1024*1024;
SendSetChunkSize(rtmp_->m_outChunkSize);
return true;
}
示例14: download
static int download(char *osis, int chapter)
{
struct stat sb;
int size, pipe;
char pageurl[256];
char playpath[256];
char path[256];
double duration = 0;
RTMP_Init(rtmp);
rtmp->Link.protocol = RTMP_PROTOCOL_RTMP;
rtmp->Link.hostname = (AVal)AVC(HOSTNAME);
rtmp->Link.port = 1935;
rtmp->Link.app = (AVal)AVC(APP);
rtmp->Link.flashVer = (AVal)AVC(FLASHVER);
rtmp->Link.swfUrl = (AVal)AVC(SWFURL);
rtmp->Link.tcUrl = (AVal)AVC(TCURL);
sprintf(pageurl, PAGEURL "%s/%s/%s.%d", author, version, osis, chapter);
rtmp->Link.pageUrl = (AVal){pageurl, strlen(pageurl)};
sprintf(playpath, "%s-%s/%s.%d", version, author, osis, chapter);
rtmp->Link.playpath = (AVal){playpath, strlen(playpath)};
printf("downloading %s .....", playpath);
fflush(stdout);
sprintf(path, "%s.mp3", playpath);
if (stat(path, &sb) == 0 && sb.st_size == 0) {
unlink(path);
}
pipe = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
if (pipe < 0) {
perror("open");
return errno;
}
size = RTMP_Connect(rtmp, NULL);
if (size == FALSE) {
perror("rtmp_conect");
return EINVAL;
}
do {
size = RTMP_Read(rtmp, buffer, BUFSIZ);
if (duration <= 0) {
duration = RTMP_GetDuration(rtmp);
}
if (rtmp->m_read.status == RTMP_READ_COMPLETE) {
size = 0;
break;
}
if (!RTMP_IsConnected(rtmp)) {
size = -1;
break;
}
if (size > 0) {
write(pipe, buffer, size);
if (duration > 0) {
printf("\b\b\b\b\b%04.1f%%",
((double)rtmp->m_read.timestamp) / (duration * 10.0));
fflush(stdout);
}
}
} while (size >= 0);
close(pipe);
RTMP_Close(rtmp);
if (size != 0 && stat(path, &sb) == 0) {
if (sb.st_size == 0) {
unlink(path);
} else {
sprintf(buffer, "%s.failed", path);
rename(path, buffer);
}
}
printf("\b\b\b\b\b%s\n", size == 0 ? "completed" : "incomplete");
return size;
}
示例15: rtmp_open
//.........这里部分代码省略.........
len += strlen(ctx->swfurl);
}
if (!(ctx->temp_filename = filename = av_malloc(len)))
return AVERROR(ENOMEM);
av_strlcpy(filename, s->filename, len);
if (ctx->app) {
av_strlcat(filename, " app=", len);
av_strlcat(filename, ctx->app, len);
}
if (ctx->tcurl) {
av_strlcat(filename, " tcUrl=", len);
av_strlcat(filename, ctx->tcurl, len);
}
if (ctx->pageurl) {
av_strlcat(filename, " pageUrl=", len);
av_strlcat(filename, ctx->pageurl, len);
}
if (ctx->swfurl) {
av_strlcat(filename, " swfUrl=", len);
av_strlcat(filename, ctx->swfurl, len);
}
if (ctx->flashver) {
av_strlcat(filename, " flashVer=", len);
av_strlcat(filename, ctx->flashver, len);
}
if (ctx->conn) {
char *sep, *p = ctx->conn;
while (p) {
av_strlcat(filename, " conn=", len);
p += strspn(p, " ");
if (!*p)
break;
sep = strchr(p, ' ');
if (sep)
*sep = '\0';
av_strlcat(filename, p, len);
if (sep)
p = sep + 1;
else
break;
}
}
if (ctx->playpath) {
av_strlcat(filename, " playpath=", len);
av_strlcat(filename, ctx->playpath, len);
}
if (ctx->live)
av_strlcat(filename, " live=1", len);
if (ctx->subscribe) {
av_strlcat(filename, " subscribe=", len);
av_strlcat(filename, ctx->subscribe, len);
}
if (ctx->client_buffer_time) {
av_strlcat(filename, " buffer=", len);
av_strlcat(filename, ctx->client_buffer_time, len);
}
if (ctx->swfurl || ctx->swfverify) {
av_strlcat(filename, " swfUrl=", len);
if (ctx->swfverify) {
av_strlcat(filename, ctx->swfverify, len);
av_strlcat(filename, " swfVfy=1", len);
} else {
av_strlcat(filename, ctx->swfurl, len);
}
}
RTMP_Init(r);
if (!RTMP_SetupURL(r, filename)) {
rc = AVERROR_UNKNOWN;
goto fail;
}
if (flags & AVIO_FLAG_WRITE)
RTMP_EnableWrite(r);
if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
rc = AVERROR_UNKNOWN;
goto fail;
}
#if CONFIG_NETWORK
if (ctx->buffer_size >= 0 && (flags & AVIO_FLAG_WRITE)) {
int tmp = ctx->buffer_size;
setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp));
}
#endif
s->is_streamed = 1;
return 0;
fail:
av_freep(&ctx->temp_filename);
if (rc)
RTMP_Close(r);
return rc;
}