FFmpeg
Loading...
Searching...
No Matches
icecast.c File Reference
#include "libavutil/bprint.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "network.h"

Go to the source code of this file.

Data Structures

struct  IcecastContext
 

Macros

#define DEFAULT_ICE_USER   "source"
 
#define NOT_EMPTY(s)
 
#define OFFSET(x)
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void cat_header (AVBPrint *bp, const char key[], const char value[])
 
static int icecast_close (URLContext *h)
 
static int icecast_open (URLContext *h, const char *uri, int flags)
 
static int icecast_write (URLContext *h, const uint8_t *buf, int size)
 

Variables

static const AVOption options []
 
static const AVClass icecast_context_class
 
const URLProtocol ff_icecast_protocol
 

Macro Definition Documentation

◆ DEFAULT_ICE_USER

#define DEFAULT_ICE_USER   "source"

Definition at line 49 of file icecast.c.

Referenced by icecast_open().

◆ NOT_EMPTY

#define NOT_EMPTY ( s)
Value:
(s && s[0])
#define s(width, name)
Definition cbs_vp9.c:198

Definition at line 51 of file icecast.c.

Referenced by cat_header(), and icecast_open().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 53 of file icecast.c.

◆ E

Definition at line 54 of file icecast.c.

Function Documentation

◆ cat_header()

static void cat_header ( AVBPrint * bp,
const char key[],
const char value[] )
static

Definition at line 71 of file icecast.c.

Referenced by icecast_open().

◆ icecast_close()

static int icecast_close ( URLContext * h)
static

Definition at line 83 of file icecast.c.

◆ icecast_open()

static int icecast_open ( URLContext * h,
const char * uri,
int flags )
static

Definition at line 90 of file icecast.c.

◆ icecast_write()

static int icecast_write ( URLContext * h,
const uint8_t * buf,
int size )
static

Definition at line 187 of file icecast.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "ice_genre", "set stream genre", OFFSET(genre), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "ice_name", "set stream description", OFFSET(name), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "ice_description", "set stream description", OFFSET(description), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "ice_url", "set stream website", OFFSET(url), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "ice_public", "set if stream is public", OFFSET(public), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
{ "user_agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "password", "set password", OFFSET(pass), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "content_type", "set content-type, MUST be set if not audio/mpeg", OFFSET(content_type), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "legacy_icecast", "use legacy SOURCE method, for Icecast < v2.4", OFFSET(legacy_icecast), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
{ "tls", "use a TLS connection", OFFSET(tls), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
{ NULL }
}
#define E
Definition avdct.c:34
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
const char * name
Definition qsvenc.c:142

Definition at line 56 of file icecast.c.

◆ icecast_context_class

const AVClass icecast_context_class
static
Initial value:
= {
.class_name = "icecast",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 214 of file icecast.c.

◆ ff_icecast_protocol

const URLProtocol ff_icecast_protocol
Initial value:
= {
.name = "icecast",
.url_open = icecast_open,
.url_write = icecast_write,
.url_close = icecast_close,
.priv_data_size = sizeof(IcecastContext),
.priv_data_class = &icecast_context_class,
}
#define flags(name, subs,...)
Definition cbs_h264.c:74
static int icecast_write(URLContext *h, const uint8_t *buf, int size)
Definition icecast.c:187
static int icecast_open(URLContext *h, const char *uri, int flags)
Definition icecast.c:90
static const AVClass icecast_context_class
Definition icecast.c:214
static int icecast_close(URLContext *h)
Definition icecast.c:83
#define URL_PROTOCOL_FLAG_NETWORK
Definition url.h:33

Definition at line 221 of file icecast.c.