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
c34c0e3a
Commit
c34c0e3a
authored
Sep 21, 2017
by
Steven Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/hlsenc: support http method for hls fmp4 init file
Signed-off-by:
Steven Liu
<
lq@onvideo.cn
>
parent
02bf023a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
hlsenc.c
libavformat/hlsenc.c
+18
-17
No files found.
libavformat/hlsenc.c
View file @
c34c0e3a
...
...
@@ -215,6 +215,22 @@ static int mkdir_p(const char *path) {
return
ret
;
}
static
void
set_http_options
(
AVFormatContext
*
s
,
AVDictionary
**
options
,
HLSContext
*
c
)
{
const
char
*
proto
=
avio_find_protocol_name
(
s
->
filename
);
int
http_base_proto
=
proto
?
(
!
av_strcasecmp
(
proto
,
"http"
)
||
!
av_strcasecmp
(
proto
,
"https"
))
:
0
;
if
(
c
->
method
)
{
av_dict_set
(
options
,
"method"
,
c
->
method
,
0
);
}
else
if
(
http_base_proto
)
{
av_log
(
c
,
AV_LOG_WARNING
,
"No HTTP method set, hls muxer defaulting to method PUT.
\n
"
);
av_dict_set
(
options
,
"method"
,
"PUT"
,
0
);
}
if
(
c
->
user_agent
)
av_dict_set
(
options
,
"user_agent"
,
c
->
user_agent
,
0
);
}
static
int
replace_int_data_in_filename
(
char
*
buf
,
int
buf_size
,
const
char
*
filename
,
char
placeholder
,
int64_t
number
)
{
const
char
*
p
;
...
...
@@ -592,7 +608,8 @@ static int hls_mux_init(AVFormatContext *s)
return
AVERROR_PATCHWELCOME
;
}
hls
->
fmp4_init_mode
=
!
byterange_mode
;
if
((
ret
=
s
->
io_open
(
s
,
&
oc
->
pb
,
hls
->
base_output_dirname
,
AVIO_FLAG_WRITE
,
NULL
))
<
0
)
{
set_http_options
(
s
,
&
options
,
hls
);
if
((
ret
=
s
->
io_open
(
s
,
&
oc
->
pb
,
hls
->
base_output_dirname
,
AVIO_FLAG_WRITE
,
&
options
))
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Failed to open segment '%s'
\n
"
,
hls
->
fmp4_init_filename
);
return
ret
;
}
...
...
@@ -964,22 +981,6 @@ static void hls_free_segments(HLSSegment *p)
}
}
static
void
set_http_options
(
AVFormatContext
*
s
,
AVDictionary
**
options
,
HLSContext
*
c
)
{
const
char
*
proto
=
avio_find_protocol_name
(
s
->
filename
);
int
http_base_proto
=
proto
?
(
!
av_strcasecmp
(
proto
,
"http"
)
||
!
av_strcasecmp
(
proto
,
"https"
))
:
0
;
if
(
c
->
method
)
{
av_dict_set
(
options
,
"method"
,
c
->
method
,
0
);
}
else
if
(
http_base_proto
)
{
av_log
(
c
,
AV_LOG_WARNING
,
"No HTTP method set, hls muxer defaulting to method PUT.
\n
"
);
av_dict_set
(
options
,
"method"
,
"PUT"
,
0
);
}
if
(
c
->
user_agent
)
av_dict_set
(
options
,
"user_agent"
,
c
->
user_agent
,
0
);
}
static
void
write_m3u8_head_block
(
HLSContext
*
hls
,
AVIOContext
*
out
,
int
version
,
int
target_duration
,
int64_t
sequence
)
{
...
...
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