Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
fa540df2
Commit
fa540df2
authored
Dec 31, 2010
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter/httplive.c: cleanup error path
Make error path simpler.
parent
7507a0f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
45 deletions
+43
-45
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+43
-45
No files found.
modules/stream_filter/httplive.c
View file @
fa540df2
...
@@ -447,10 +447,8 @@ static void parse_SegmentInformation(stream_t *s, hls_stream_t *hls, char *p_rea
...
@@ -447,10 +447,8 @@ static void parse_SegmentInformation(stream_t *s, hls_stream_t *hls, char *p_rea
free
(
psz_uri
);
free
(
psz_uri
);
}
}
static
void
parse_TargetDuration
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_TargetDuration
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
assert
(
hls
);
assert
(
hls
);
int
duration
=
-
1
;
int
duration
=
-
1
;
...
@@ -458,11 +456,11 @@ static void parse_TargetDuration(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -458,11 +456,11 @@ static void parse_TargetDuration(stream_t *s, hls_stream_t *hls, char *p_read)
if
(
ret
!=
1
)
if
(
ret
!=
1
)
{
{
msg_Err
(
s
,
"expected #EXT-X-TARGETDURATION:<s>"
);
msg_Err
(
s
,
"expected #EXT-X-TARGETDURATION:<s>"
);
p_sys
->
b_error
=
true
;
return
VLC_EGENERIC
;
return
;
}
}
hls
->
duration
=
duration
;
/* seconds */
hls
->
duration
=
duration
;
/* seconds */
return
VLC_SUCCESS
;
}
}
static
void
parse_StreamInformation
(
stream_t
*
s
,
vlc_array_t
**
hls_stream
,
static
void
parse_StreamInformation
(
stream_t
*
s
,
vlc_array_t
**
hls_stream
,
...
@@ -512,10 +510,8 @@ static void parse_StreamInformation(stream_t *s, vlc_array_t **hls_stream,
...
@@ -512,10 +510,8 @@ static void parse_StreamInformation(stream_t *s, vlc_array_t **hls_stream,
free
(
psz_uri
);
free
(
psz_uri
);
}
}
static
void
parse_MediaSequence
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_MediaSequence
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
assert
(
hls
);
assert
(
hls
);
int
sequence
;
int
sequence
;
...
@@ -523,8 +519,7 @@ static void parse_MediaSequence(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -523,8 +519,7 @@ static void parse_MediaSequence(stream_t *s, hls_stream_t *hls, char *p_read)
if
(
ret
!=
1
)
if
(
ret
!=
1
)
{
{
msg_Err
(
s
,
"expected #EXT-X-MEDIA-SEQUENCE:<s>"
);
msg_Err
(
s
,
"expected #EXT-X-MEDIA-SEQUENCE:<s>"
);
p_sys
->
b_error
=
true
;
return
VLC_EGENERIC
;
return
;
}
}
if
(
hls
->
sequence
>
0
)
if
(
hls
->
sequence
>
0
)
...
@@ -532,29 +527,30 @@ static void parse_MediaSequence(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -532,29 +527,30 @@ static void parse_MediaSequence(stream_t *s, hls_stream_t *hls, char *p_read)
msg_Info
(
s
,
"#EXT-X-MEDIA-SEQUENCE:%d"
,
sequence
);
msg_Info
(
s
,
"#EXT-X-MEDIA-SEQUENCE:%d"
,
sequence
);
hls
->
sequence
=
sequence
;
hls
->
sequence
=
sequence
;
return
VLC_SUCCESS
;
}
}
static
void
parse_Key
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_Key
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
assert
(
hls
);
assert
(
hls
);
/* #EXT-X-KEY:METHOD=<method>[,URI="<URI>"][,IV=<IV>] */
/* #EXT-X-KEY:METHOD=<method>[,URI="<URI>"][,IV=<IV>] */
char
*
attr
;
int
err
=
VLC_SUCCESS
;
attr
=
parse_Attributes
(
p_read
,
"METHOD"
);
char
*
attr
=
parse_Attributes
(
p_read
,
"METHOD"
);
if
(
attr
==
NULL
)
if
(
attr
==
NULL
)
{
{
msg_Err
(
s
,
"#EXT-X-KEY: expected METHOD=<value>"
);
msg_Err
(
s
,
"#EXT-X-KEY: expected METHOD=<value>"
);
p_sys
->
b_error
=
true
;
return
err
;
}
}
else
if
(
strncasecmp
(
attr
,
"NONE"
,
4
)
==
0
)
if
(
strncasecmp
(
attr
,
"NONE"
,
4
)
==
0
)
{
{
char
*
uri
=
parse_Attributes
(
p_read
,
"URI"
);
char
*
uri
=
parse_Attributes
(
p_read
,
"URI"
);
if
(
uri
!=
NULL
)
if
(
uri
!=
NULL
)
{
{
msg_Err
(
s
,
"#EXT-X-KEY: URI not expected"
);
msg_Err
(
s
,
"#EXT-X-KEY: URI not expected"
);
p_sys
->
b_error
=
true
;
err
=
VLC_EGENERIC
;
}
}
free
(
uri
);
free
(
uri
);
/* IV is only supported in version 2 and above */
/* IV is only supported in version 2 and above */
...
@@ -564,7 +560,7 @@ static void parse_Key(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -564,7 +560,7 @@ static void parse_Key(stream_t *s, hls_stream_t *hls, char *p_read)
if
(
iv
!=
NULL
)
if
(
iv
!=
NULL
)
{
{
msg_Err
(
s
,
"#EXT-X-KEY: IV not expected"
);
msg_Err
(
s
,
"#EXT-X-KEY: IV not expected"
);
p_sys
->
b_error
=
true
;
err
=
VLC_EGENERIC
;
}
}
free
(
iv
);
free
(
iv
);
}
}
...
@@ -572,21 +568,21 @@ static void parse_Key(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -572,21 +568,21 @@ static void parse_Key(stream_t *s, hls_stream_t *hls, char *p_read)
else
else
{
{
msg_Warn
(
s
,
"playback of encrypted HTTP Live media is not supported."
);
msg_Warn
(
s
,
"playback of encrypted HTTP Live media is not supported."
);
p_sys
->
b_error
=
true
;
err
=
VLC_EGENERIC
;
}
}
free
(
attr
);
free
(
attr
);
return
err
;
}
}
static
void
parse_ProgramDateTime
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_ProgramDateTime
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
VLC_UNUSED
(
hls
);
VLC_UNUSED
(
hls
);
msg_Dbg
(
s
,
"tag not supported: #EXT-X-PROGRAM-DATE-TIME %s"
,
p_read
);
msg_Dbg
(
s
,
"tag not supported: #EXT-X-PROGRAM-DATE-TIME %s"
,
p_read
);
return
VLC_SUCCESS
;
}
}
static
void
parse_AllowCache
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_AllowCache
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
assert
(
hls
);
assert
(
hls
);
char
answer
[
4
]
=
"
\0
"
;
char
answer
[
4
]
=
"
\0
"
;
...
@@ -594,17 +590,15 @@ static void parse_AllowCache(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -594,17 +590,15 @@ static void parse_AllowCache(stream_t *s, hls_stream_t *hls, char *p_read)
if
(
ret
!=
1
)
if
(
ret
!=
1
)
{
{
msg_Err
(
s
,
"#EXT-X-ALLOW-CACHE, ignoring ..."
);
msg_Err
(
s
,
"#EXT-X-ALLOW-CACHE, ignoring ..."
);
p_sys
->
b_error
=
true
;
return
VLC_EGENERIC
;
return
;
}
}
hls
->
b_cache
=
(
strncmp
(
answer
,
"NO"
,
2
)
!=
0
);
hls
->
b_cache
=
(
strncmp
(
answer
,
"NO"
,
2
)
!=
0
);
return
VLC_SUCCESS
;
}
}
static
void
parse_Version
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_Version
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
assert
(
hls
);
assert
(
hls
);
int
version
;
int
version
;
...
@@ -612,8 +606,7 @@ static void parse_Version(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -612,8 +606,7 @@ static void parse_Version(stream_t *s, hls_stream_t *hls, char *p_read)
if
(
ret
!=
1
)
if
(
ret
!=
1
)
{
{
msg_Err
(
s
,
"#EXT-X-VERSION: no protocol version found, should be version 1."
);
msg_Err
(
s
,
"#EXT-X-VERSION: no protocol version found, should be version 1."
);
p_sys
->
b_error
=
true
;
return
VLC_EGENERIC
;
return
;
}
}
/* Check version */
/* Check version */
...
@@ -621,48 +614,53 @@ static void parse_Version(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -621,48 +614,53 @@ static void parse_Version(stream_t *s, hls_stream_t *hls, char *p_read)
if
(
hls
->
version
!=
1
)
if
(
hls
->
version
!=
1
)
{
{
msg_Err
(
s
,
"#EXT-X-VERSION should be version 1 iso %d"
,
version
);
msg_Err
(
s
,
"#EXT-X-VERSION should be version 1 iso %d"
,
version
);
p_sys
->
b_error
=
true
;
return
VLC_EGENERIC
;
}
}
return
VLC_SUCCESS
;
}
}
static
void
parse_EndList
(
stream_t
*
s
,
hls_stream_t
*
hls
)
static
int
parse_EndList
(
stream_t
*
s
,
hls_stream_t
*
hls
)
{
{
stream_sys_t
*
p_sys
=
s
->
p_sys
;
assert
(
hls
);
assert
(
hls
);
p_sys
->
b_live
=
false
;
s
->
p_sys
->
b_live
=
false
;
msg_Info
(
s
,
"video on demand (vod) mode"
);
msg_Info
(
s
,
"video on demand (vod) mode"
);
return
VLC_SUCCESS
;
}
}
static
void
parse_Discontinuity
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
static
int
parse_Discontinuity
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
p_read
)
{
{
assert
(
hls
);
assert
(
hls
);
/* FIXME: Do we need to act on discontinuity ?? */
/* FIXME: Do we need to act on discontinuity ?? */
msg_Dbg
(
s
,
"#EXT-X-DISCONTINUITY %s"
,
p_read
);
msg_Dbg
(
s
,
"#EXT-X-DISCONTINUITY %s"
,
p_read
);
return
VLC_SUCCESS
;
}
}
static
void
parse_M3U8ExtLine
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
line
)
static
void
parse_M3U8ExtLine
(
stream_t
*
s
,
hls_stream_t
*
hls
,
char
*
line
)
{
{
if
(
*
line
==
'#'
)
if
(
*
line
==
'#'
)
{
{
int
err
=
VLC_SUCCESS
;
if
(
strncmp
(
line
,
"#EXT-X-TARGETDURATION"
,
21
)
==
0
)
if
(
strncmp
(
line
,
"#EXT-X-TARGETDURATION"
,
21
)
==
0
)
parse_TargetDuration
(
s
,
hls
,
line
);
err
=
parse_TargetDuration
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-MEDIA-SEQUENCE"
,
21
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-MEDIA-SEQUENCE"
,
21
)
==
0
)
parse_MediaSequence
(
s
,
hls
,
line
);
err
=
parse_MediaSequence
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-KEY"
,
10
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-KEY"
,
10
)
==
0
)
parse_Key
(
s
,
hls
,
line
);
err
=
parse_Key
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-PROGRAM-DATE-TIME"
,
24
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-PROGRAM-DATE-TIME"
,
24
)
==
0
)
parse_ProgramDateTime
(
s
,
hls
,
line
);
err
=
parse_ProgramDateTime
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-ALLOW-CACHE"
,
18
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-ALLOW-CACHE"
,
18
)
==
0
)
parse_AllowCache
(
s
,
hls
,
line
);
err
=
parse_AllowCache
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-DISCONTINUITY"
,
20
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-DISCONTINUITY"
,
20
)
==
0
)
parse_Discontinuity
(
s
,
hls
,
line
);
err
=
parse_Discontinuity
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-VERSION"
,
14
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-VERSION"
,
14
)
==
0
)
parse_Version
(
s
,
hls
,
line
);
err
=
parse_Version
(
s
,
hls
,
line
);
else
if
(
strncmp
(
line
,
"#EXT-X-ENDLIST"
,
14
)
==
0
)
else
if
(
strncmp
(
line
,
"#EXT-X-ENDLIST"
,
14
)
==
0
)
parse_EndList
(
s
,
hls
);
err
=
parse_EndList
(
s
,
hls
);
if
(
err
!=
VLC_SUCCESS
)
s
->
p_sys
->
b_error
=
true
;
}
}
}
}
...
...
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