Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
7601f941
Commit
7601f941
authored
Jul 31, 2014
by
Andrew Stone
Committed by
Anton Khirnov
Aug 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: export icecast metadata as an option with name "metadata".
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
a8c104a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
http.c
libavformat/http.c
+31
-0
No files found.
libavformat/http.c
View file @
7601f941
...
@@ -80,6 +80,7 @@ typedef struct {
...
@@ -80,6 +80,7 @@ typedef struct {
int
icy_metaint
;
int
icy_metaint
;
char
*
icy_metadata_headers
;
char
*
icy_metadata_headers
;
char
*
icy_metadata_packet
;
char
*
icy_metadata_packet
;
AVDictionary
*
metadata
;
#if CONFIG_ZLIB
#if CONFIG_ZLIB
int
compressed
;
int
compressed
;
z_stream
inflate_stream
;
z_stream
inflate_stream
;
...
@@ -107,6 +108,7 @@ static const AVOption options[] = {
...
@@ -107,6 +108,7 @@ static const AVOption options[] = {
{
"icy"
,
"request ICY metadata"
,
OFFSET
(
icy
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
1
,
D
},
{
"icy"
,
"request ICY metadata"
,
OFFSET
(
icy
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
1
,
D
},
{
"icy_metadata_headers"
,
"return ICY metadata headers"
,
OFFSET
(
icy_metadata_headers
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
AV_OPT_FLAG_EXPORT
},
{
"icy_metadata_headers"
,
"return ICY metadata headers"
,
OFFSET
(
icy_metadata_headers
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
AV_OPT_FLAG_EXPORT
},
{
"icy_metadata_packet"
,
"return current ICY metadata packet"
,
OFFSET
(
icy_metadata_packet
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
AV_OPT_FLAG_EXPORT
},
{
"icy_metadata_packet"
,
"return current ICY metadata packet"
,
OFFSET
(
icy_metadata_packet
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
AV_OPT_FLAG_EXPORT
},
{
"metadata"
,
"metadata read from the bitstream"
,
OFFSET
(
metadata
),
AV_OPT_TYPE_DICT
,
{
0
},
0
,
0
,
AV_OPT_FLAG_EXPORT
},
{
"auth_type"
,
"HTTP authentication type"
,
OFFSET
(
auth_state
.
auth_type
),
AV_OPT_TYPE_INT
,
{
.
i64
=
HTTP_AUTH_NONE
},
HTTP_AUTH_NONE
,
HTTP_AUTH_BASIC
,
D
|
E
,
"auth_type"
},
{
"auth_type"
,
"HTTP authentication type"
,
OFFSET
(
auth_state
.
auth_type
),
AV_OPT_TYPE_INT
,
{
.
i64
=
HTTP_AUTH_NONE
},
HTTP_AUTH_NONE
,
HTTP_AUTH_BASIC
,
D
|
E
,
"auth_type"
},
{
"none"
,
"No auth method set, autodetect"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
HTTP_AUTH_NONE
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"none"
,
"No auth method set, autodetect"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
HTTP_AUTH_NONE
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"basic"
,
"HTTP basic authentication"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
HTTP_AUTH_BASIC
},
0
,
0
,
D
|
E
,
"auth_type"
},
{
"basic"
,
"HTTP basic authentication"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
HTTP_AUTH_BASIC
},
0
,
0
,
D
|
E
,
"auth_type"
},
...
@@ -421,6 +423,8 @@ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
...
@@ -421,6 +423,8 @@ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
int
is_first
=
!
s
->
icy_metadata_headers
;
int
is_first
=
!
s
->
icy_metadata_headers
;
int
ret
;
int
ret
;
av_dict_set
(
&
s
->
metadata
,
tag
,
p
,
0
);
if
(
s
->
icy_metadata_headers
)
if
(
s
->
icy_metadata_headers
)
len
+=
strlen
(
s
->
icy_metadata_headers
);
len
+=
strlen
(
s
->
icy_metadata_headers
);
...
@@ -800,6 +804,32 @@ static int http_read_stream_all(URLContext *h, uint8_t *buf, int size)
...
@@ -800,6 +804,32 @@ static int http_read_stream_all(URLContext *h, uint8_t *buf, int size)
return
pos
;
return
pos
;
}
}
static
void
update_metadata
(
HTTPContext
*
s
,
char
*
data
)
{
char
*
key
;
char
*
val
;
char
*
end
;
char
*
next
=
data
;
while
(
*
next
)
{
key
=
next
;
val
=
strstr
(
key
,
"='"
);
if
(
!
val
)
break
;
end
=
strstr
(
val
,
"';"
);
if
(
!
end
)
break
;
*
val
=
'\0'
;
*
end
=
'\0'
;
val
+=
2
;
av_dict_set
(
&
s
->
metadata
,
key
,
val
,
0
);
next
=
end
+
2
;
}
}
static
int
store_icy
(
URLContext
*
h
,
int
size
)
static
int
store_icy
(
URLContext
*
h
,
int
size
)
{
{
HTTPContext
*
s
=
h
->
priv_data
;
HTTPContext
*
s
=
h
->
priv_data
;
...
@@ -828,6 +858,7 @@ static int store_icy(URLContext *h, int size)
...
@@ -828,6 +858,7 @@ static int store_icy(URLContext *h, int size)
data
[
len
+
1
]
=
0
;
data
[
len
+
1
]
=
0
;
if
((
ret
=
av_opt_set
(
s
,
"icy_metadata_packet"
,
data
,
0
))
<
0
)
if
((
ret
=
av_opt_set
(
s
,
"icy_metadata_packet"
,
data
,
0
))
<
0
)
return
ret
;
return
ret
;
update_metadata
(
s
,
data
);
}
}
s
->
icy_data_read
=
0
;
s
->
icy_data_read
=
0
;
remaining
=
s
->
icy_metaint
;
remaining
=
s
->
icy_metaint
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment