33 #include <librtmp/rtmp.h>
34 #include <librtmp/log.h>
65 av_vlog(NULL, level, fmt, args);
108 RTMP_LogSetLevel(
level);
111 if (ctx->
app) len += strlen(ctx->
app) +
sizeof(
" app=");
112 if (ctx->
tcurl) len += strlen(ctx->
tcurl) +
sizeof(
" tcUrl=");
113 if (ctx->
pageurl) len += strlen(ctx->
pageurl) +
sizeof(
" pageUrl=");
117 char *sep, *p = ctx->
conn;
125 sep = strchr(p,
' ');
131 len += options *
sizeof(
" conn=");
132 len += strlen(ctx->
conn);
136 len += strlen(ctx->
playpath) +
sizeof(
" playpath=");
138 len +=
sizeof(
" live=1");
140 len += strlen(ctx->
subscribe) +
sizeof(
" subscribe=");
146 len +=
sizeof(
" swfUrl=");
149 len += strlen(ctx->
swfverify) +
sizeof(
" swfVfy=1");
151 len += strlen(ctx->
swfurl);
179 char *sep, *p = ctx->
conn;
185 sep = strchr(p,
' ');
220 if (!RTMP_SetupURL(r, filename)) {
228 if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
246 RTMP *
r = &ctx->
rtmp;
248 return RTMP_Write(r, buf, size);
254 RTMP *
r = &ctx->
rtmp;
256 return RTMP_Read(r, buf, size);
262 RTMP *
r = &ctx->
rtmp;
264 if (!RTMP_Pause(r, pause))
270 int64_t timestamp,
int flags)
273 RTMP *
r = &ctx->
rtmp;
279 if (stream_index < 0)
283 if (!RTMP_SendSeek(r, timestamp))
291 RTMP *
r = &ctx->
rtmp;
293 return RTMP_Socket(r);
296 #define OFFSET(x) offsetof(LibRTMPContext, x)
297 #define DEC AV_OPT_FLAG_DECODING_PARAM
298 #define ENC AV_OPT_FLAG_ENCODING_PARAM
301 {
"rtmp_buffer",
"Set buffer time in milliseconds. The default is 3000.",
OFFSET(client_buffer_time),
AV_OPT_TYPE_STRING, {.str =
"3000"}, 0, 0,
DEC|
ENC},
303 {
"rtmp_flashver",
"Version of the Flash plugin used to run the SWF player.",
OFFSET(flashver),
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0,
DEC|
ENC},
304 {
"rtmp_live",
"Specify that the media is a live stream.",
OFFSET(live),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
DEC,
"rtmp_live"},
308 {
"rtmp_pageurl",
"URL of the web page in which the media was embedded. By default no value will be sent.",
OFFSET(pageurl),
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0,
DEC},
310 {
"rtmp_subscribe",
"Name of live stream to subscribe to. Defaults to rtmp_playpath.",
OFFSET(subscribe),
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0,
DEC},
312 {
"rtmp_swfverify",
"URL to player swf file, compute hash/size automatically. (unimplemented)",
OFFSET(swfverify),
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0,
DEC},
313 {
"rtmp_tcurl",
"URL of the target stream. Defaults to proto://host[:port]/app.",
OFFSET(tcurl),
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0,
DEC|
ENC},
317 #define RTMP_CLASS(flavor)\
318 static const AVClass lib ## flavor ## _class = {\
319 .class_name = "lib" #flavor " protocol",\
320 .item_name = av_default_item_name,\
322 .version = LIBAVUTIL_VERSION_INT,\
336 .priv_data_class = &librtmp_class,
351 .priv_data_class = &librtmpt_class,
366 .priv_data_class = &librtmpe_class,
381 .priv_data_class = &librtmpte_class,
396 .priv_data_class = &librtmps_class,