48 #define DEFAULT_ICE_USER "source"
50 #define NOT_EMPTY(s) (s && s[0])
52 #define OFFSET(x) offsetof(IcecastContext, x)
53 #define E AV_OPT_FLAG_ENCODING_PARAM
64 {
"legacy_icecast",
"use legacy SOURCE method, for Icecast < v2.4",
OFFSET(legacy_icecast),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
E },
91 char h_url[1024], host[1024], auth[1024], path[1024];
122 av_dict_set(&opt_dict,
"content_type",
"audio/mpeg", 0);
128 &port, path,
sizeof(path), uri);
132 char *sep = strchr(auth,
':');
158 if (!path[0] || strcmp(path,
"/") == 0) {
165 ff_url_join(h_url,
sizeof(h_url),
"http", auth, host, port,
"%s", path);
184 static const uint8_t oggs[4] = { 0x4F, 0x67, 0x67, 0x53 };
185 static const uint8_t webm[4] = { 0x1A, 0x45, 0xDF, 0xA3 };
186 static const uint8_t opus[8] = { 0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64 };
187 if (memcmp(buf, oggs,
sizeof(oggs)) == 0) {
190 }
else if (memcmp(buf, opus,
sizeof(opus)) == 0) {
193 }
else if (memcmp(buf, webm,
sizeof(webm)) == 0) {
218 .priv_data_class = &icecast_context_class,
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
static int icecast_open(URLContext *h, const char *uri, int flags)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
#define URL_PROTOCOL_FLAG_NETWORK
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
#define AVIO_FLAG_READ
read-only
static const AVOption options[]
static int icecast_write(URLContext *h, const uint8_t *buf, int size)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const URLProtocol ff_icecast_protocol
static int icecast_close(URLContext *h)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * protocol_whitelist
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
GLsizei GLboolean const GLfloat * value
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
char * av_strdup(const char *s)
Duplicate a string.
const char * protocol_blacklist
#define AVIO_FLAG_READ_WRITE
read-write pseudo flag
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static const AVClass icecast_context_class
Describe the class of an AVClass context structure.
static void cat_header(AVBPrint *bp, const char key[], const char value[])
int ffurl_close(URLContext *h)
static av_cold void cleanup(FlashSV2Context *s)