FFmpeg
Data Structures | Macros | Functions | Variables
icecast.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/bprint.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)   (s && s[0])
 
#define OFFSET(x)   offsetof(IcecastContext, 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.

◆ NOT_EMPTY

#define NOT_EMPTY (   s)    (s && s[0])

Definition at line 51 of file icecast.c.

◆ OFFSET

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

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 77 of file icecast.c.

◆ icecast_open()

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

Definition at line 84 of file icecast.c.

◆ icecast_write()

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

Definition at line 181 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 }
}

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,
}

Definition at line 208 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,
}

Definition at line 215 of file icecast.c.

options
static const AVOption options[]
Definition: icecast.c:56
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:34
icecast_write
static int icecast_write(URLContext *h, const uint8_t *buf, int size)
Definition: icecast.c:181
icecast_close
static int icecast_close(URLContext *h)
Definition: icecast.c:77
description
Tag description
Definition: snow.txt:206
IcecastContext
Definition: icecast.c:31
OFFSET
#define OFFSET(x)
Definition: icecast.c:53
pass
#define pass
Definition: fft_template.c:601
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
icecast_context_class
static const AVClass icecast_context_class
Definition: icecast.c:208
icecast_open
static int icecast_open(URLContext *h, const char *uri, int flags)
Definition: icecast.c:84
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
E
#define E
Definition: icecast.c:54
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228