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
63 {
"content_type",
"set content-type, MUST be set if not audio/mpeg",
OFFSET(content_type),
AV_OPT_TYPE_STRING, { 0 }, 0, 0,
E },
64 {
"legacy_icecast",
"use legacy SOURCE method, for Icecast < v2.4",
OFFSET(legacy_icecast),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
E },
91 char h_url[1024], host[1024], auth[1024], path[1024];
92 char *headers = NULL, *user = NULL;
123 av_url_split(NULL, 0, auth,
sizeof(auth), host,
sizeof(host),
124 &port, path,
sizeof(path), uri);
128 char *sep = strchr(auth,
':');
154 if (!path[0] || strcmp(path,
"/") == 0) {
161 ff_url_join(h_url,
sizeof(h_url),
"http", auth, host, port,
"%s", path);
179 static const uint8_t oggs[4] = { 0x4F, 0x67, 0x67, 0x53 };
180 static const uint8_t webm[4] = { 0x1A, 0x45, 0xDF, 0xA3 };
181 static const uint8_t opus[8] = { 0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64 };
182 if (memcmp(buf, oggs,
sizeof(oggs)) == 0) {
185 }
else if (memcmp(buf, opus,
sizeof(opus)) == 0) {
188 }
else if (memcmp(buf, webm,
sizeof(webm)) == 0) {
213 .priv_data_class = &icecast_context_class,