Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
05ce529a
Commit
05ce529a
authored
Jan 03, 2014
by
Anssi Hannula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/hls: factor identical playlist allocations out of parse_playlist
Signed-off-by:
Anssi Hannula
<
anssi.hannula@iki.fi
>
parent
6b4b73e7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
hls.c
libavformat/hls.c
+22
-14
No files found.
libavformat/hls.c
View file @
05ce529a
...
...
@@ -465,6 +465,22 @@ static void handle_rendition_args(struct rendition_info *info, const char *key,
*/
}
/* used by parse_playlist to allocate a new variant+playlist when the
* playlist is detected to be a Media Playlist (not Master Playlist)
* and we have no parent Master Playlist (parsing of which would have
* allocated the variant and playlist already) */
static
int
ensure_playlist
(
HLSContext
*
c
,
struct
playlist
**
pls
,
const
char
*
url
)
{
if
(
*
pls
)
return
0
;
if
(
!
new_variant
(
c
,
NULL
,
url
,
NULL
))
return
AVERROR
(
ENOMEM
);
*
pls
=
c
->
playlists
[
c
->
n_playlists
-
1
];
return
0
;
}
/* pls = NULL => Master Playlist or parentless Media Playlist
* pls = !NULL => parented Media Playlist, playlist+variant allocated */
static
int
parse_playlist
(
HLSContext
*
c
,
const
char
*
url
,
struct
playlist
*
pls
,
AVIOContext
*
in
)
{
...
...
@@ -539,22 +555,14 @@ static int parse_playlist(HLSContext *c, const char *url,
&
info
);
new_rendition
(
c
,
&
info
,
url
);
}
else
if
(
av_strstart
(
line
,
"#EXT-X-TARGETDURATION:"
,
&
ptr
))
{
if
(
!
pls
)
{
if
(
!
new_variant
(
c
,
NULL
,
url
,
NULL
))
{
ret
=
AVERROR
(
ENOMEM
);
ret
=
ensure_playlist
(
c
,
&
pls
,
url
);
if
(
ret
<
0
)
goto
fail
;
}
pls
=
c
->
playlists
[
c
->
n_playlists
-
1
];
}
pls
->
target_duration
=
atoi
(
ptr
)
*
AV_TIME_BASE
;
}
else
if
(
av_strstart
(
line
,
"#EXT-X-MEDIA-SEQUENCE:"
,
&
ptr
))
{
if
(
!
pls
)
{
if
(
!
new_variant
(
c
,
NULL
,
url
,
NULL
))
{
ret
=
AVERROR
(
ENOMEM
);
ret
=
ensure_playlist
(
c
,
&
pls
,
url
);
if
(
ret
<
0
)
goto
fail
;
}
pls
=
c
->
playlists
[
c
->
n_playlists
-
1
];
}
pls
->
start_seq_no
=
atoi
(
ptr
);
}
else
if
(
av_strstart
(
line
,
"#EXT-X-ENDLIST"
,
&
ptr
))
{
if
(
pls
)
...
...
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