librtmp.c File Reference

RTMP protocol based on http://rtmpdump.mplayerhq.hu/ librtmp. More...

#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "url.h"
#include <librtmp/rtmp.h>
#include <librtmp/log.h>
Include dependency graph for librtmp.c:

Go to the source code of this file.

Data Structures

struct  LibRTMPContext
 

Macros

#define OFFSET(x)   offsetof(LibRTMPContext, x)
 
#define DEC   AV_OPT_FLAG_DECODING_PARAM
 
#define ENC   AV_OPT_FLAG_ENCODING_PARAM
 
#define RTMP_CLASS(flavor)
 

Typedefs

typedef struct LibRTMPContext LibRTMPContext
 

Functions

static void rtmp_log (int level, const char *fmt, va_list args)
 
static int rtmp_close (URLContext *s)
 
static int rtmp_open (URLContext *s, const char *uri, int flags)
 Open RTMP connection and verify that the stream can be played. More...
 
static int rtmp_write (URLContext *s, const uint8_t *buf, int size)
 
static int rtmp_read (URLContext *s, uint8_t *buf, int size)
 
static int rtmp_read_pause (URLContext *s, int pause)
 
static int64_t rtmp_read_seek (URLContext *s, int stream_index, int64_t timestamp, int flags)
 
static int rtmp_get_file_handle (URLContext *s)
 

Variables

static const AVOption options []
 
URLProtocol ff_librtmp_protocol
 
URLProtocol ff_librtmpt_protocol
 
URLProtocol ff_librtmpe_protocol
 
URLProtocol ff_librtmpte_protocol
 
URLProtocol ff_librtmps_protocol
 

Detailed Description

RTMP protocol based on http://rtmpdump.mplayerhq.hu/ librtmp.

Definition in file librtmp.c.

Macro Definition Documentation

#define DEC   AV_OPT_FLAG_DECODING_PARAM

Definition at line 194 of file librtmp.c.

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 195 of file librtmp.c.

#define OFFSET (   x)    offsetof(LibRTMPContext, x)

Definition at line 193 of file librtmp.c.

#define RTMP_CLASS (   flavor)
Value:
static const AVClass lib ## flavor ## _class = {\
.class_name = "lib" #flavor " protocol",\
.item_name = av_default_item_name,\
.option = options,\
.version = LIBAVUTIL_VERSION_INT,\
};
av_default_item_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:55
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
static const AVOption options[]
Definition: librtmp.c:196
Describe the class of an AVClass context structure.
Definition: log.h:50

Definition at line 202 of file librtmp.c.

Typedef Documentation

Function Documentation

static int rtmp_close ( URLContext s)
static

Definition at line 59 of file librtmp.c.

static int rtmp_get_file_handle ( URLContext s)
static

Definition at line 185 of file librtmp.c.

static void rtmp_log ( int  level,
const char *  fmt,
va_list  args 
)
static

Definition at line 43 of file librtmp.c.

Referenced by rtmp_open().

static int rtmp_open ( URLContext s,
const char *  uri,
int  flags 
)
static

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.

Definition at line 80 of file librtmp.c.

static int rtmp_read ( URLContext s,
uint8_t buf,
int  size 
)
static

Definition at line 148 of file librtmp.c.

static int rtmp_read_pause ( URLContext s,
int  pause 
)
static

Definition at line 156 of file librtmp.c.

static int64_t rtmp_read_seek ( URLContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 166 of file librtmp.c.

static int rtmp_write ( URLContext s,
const uint8_t buf,
int  size 
)
static

Definition at line 140 of file librtmp.c.

Variable Documentation

URLProtocol ff_librtmp_protocol
Initial value:
= {
.name = "rtmp",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
.priv_data_size = sizeof(LibRTMPContext),
.priv_data_class = &librtmp_class,
}
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
static int64_t rtmp_read_seek(URLContext *s, int stream_index, int64_t timestamp, int flags)
Definition: librtmp.c:166
static int rtmp_read_pause(URLContext *s, int pause)
Definition: librtmp.c:156
static int rtmp_close(URLContext *s)
Definition: librtmp.c:59
static int rtmp_open(URLContext *s, const char *uri, int flags)
Open RTMP connection and verify that the stream can be played.
Definition: librtmp.c:80
static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
Definition: librtmp.c:140
static int flags
Definition: cpu.c:23
struct LibRTMPContext LibRTMPContext
static int rtmp_get_file_handle(URLContext *s)
Definition: librtmp.c:185
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
Definition: librtmp.c:148

Definition at line 211 of file librtmp.c.

URLProtocol ff_librtmpe_protocol
Initial value:
= {
.name = "rtmpe",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
.priv_data_size = sizeof(LibRTMPContext),
.priv_data_class = &librtmpe_class,
}
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
static int64_t rtmp_read_seek(URLContext *s, int stream_index, int64_t timestamp, int flags)
Definition: librtmp.c:166
static int rtmp_read_pause(URLContext *s, int pause)
Definition: librtmp.c:156
static int rtmp_close(URLContext *s)
Definition: librtmp.c:59
static int rtmp_open(URLContext *s, const char *uri, int flags)
Open RTMP connection and verify that the stream can be played.
Definition: librtmp.c:80
static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
Definition: librtmp.c:140
static int flags
Definition: cpu.c:23
struct LibRTMPContext LibRTMPContext
static int rtmp_get_file_handle(URLContext *s)
Definition: librtmp.c:185
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
Definition: librtmp.c:148

Definition at line 241 of file librtmp.c.

URLProtocol ff_librtmps_protocol
Initial value:
= {
.name = "rtmps",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
.priv_data_size = sizeof(LibRTMPContext),
.priv_data_class = &librtmps_class,
}
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
static int64_t rtmp_read_seek(URLContext *s, int stream_index, int64_t timestamp, int flags)
Definition: librtmp.c:166
static int rtmp_read_pause(URLContext *s, int pause)
Definition: librtmp.c:156
static int rtmp_close(URLContext *s)
Definition: librtmp.c:59
static int rtmp_open(URLContext *s, const char *uri, int flags)
Open RTMP connection and verify that the stream can be played.
Definition: librtmp.c:80
static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
Definition: librtmp.c:140
static int flags
Definition: cpu.c:23
struct LibRTMPContext LibRTMPContext
static int rtmp_get_file_handle(URLContext *s)
Definition: librtmp.c:185
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
Definition: librtmp.c:148

Definition at line 271 of file librtmp.c.

URLProtocol ff_librtmpt_protocol
Initial value:
= {
.name = "rtmpt",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
.priv_data_size = sizeof(LibRTMPContext),
.priv_data_class = &librtmpt_class,
}
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
static int64_t rtmp_read_seek(URLContext *s, int stream_index, int64_t timestamp, int flags)
Definition: librtmp.c:166
static int rtmp_read_pause(URLContext *s, int pause)
Definition: librtmp.c:156
static int rtmp_close(URLContext *s)
Definition: librtmp.c:59
static int rtmp_open(URLContext *s, const char *uri, int flags)
Open RTMP connection and verify that the stream can be played.
Definition: librtmp.c:80
static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
Definition: librtmp.c:140
static int flags
Definition: cpu.c:23
struct LibRTMPContext LibRTMPContext
static int rtmp_get_file_handle(URLContext *s)
Definition: librtmp.c:185
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
Definition: librtmp.c:148

Definition at line 226 of file librtmp.c.

URLProtocol ff_librtmpte_protocol
Initial value:
= {
.name = "rtmpte",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
.priv_data_size = sizeof(LibRTMPContext),
.priv_data_class = &librtmpte_class,
}
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
static int64_t rtmp_read_seek(URLContext *s, int stream_index, int64_t timestamp, int flags)
Definition: librtmp.c:166
static int rtmp_read_pause(URLContext *s, int pause)
Definition: librtmp.c:156
static int rtmp_close(URLContext *s)
Definition: librtmp.c:59
static int rtmp_open(URLContext *s, const char *uri, int flags)
Open RTMP connection and verify that the stream can be played.
Definition: librtmp.c:80
static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
Definition: librtmp.c:140
static int flags
Definition: cpu.c:23
struct LibRTMPContext LibRTMPContext
static int rtmp_get_file_handle(URLContext *s)
Definition: librtmp.c:185
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
Definition: librtmp.c:148

Definition at line 256 of file librtmp.c.

const AVOption options[]
static
Initial value:
= {
{"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
{"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
{ NULL },
}
#define ENC
Definition: librtmp.c:195
#define DEC
Definition: librtmp.c:194
NULL
Definition: eval.c:55
#define OFFSET(x)
Definition: librtmp.c:193

Definition at line 196 of file librtmp.c.