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
a5a93926
Commit
a5a93926
authored
Sep 30, 2012
by
Sergey Radionov
Committed by
Rémi Denis-Courmont
Sep 30, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mjpeg: move content-type checks to probe phase
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
89b1b06c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
27 deletions
+20
-27
modules/demux/mjpeg.c
modules/demux/mjpeg.c
+20
-27
No files found.
modules/demux/mjpeg.c
View file @
a5a93926
...
@@ -189,33 +189,8 @@ static bool CheckMimeHeader( demux_t *p_demux, int *p_header_size )
...
@@ -189,33 +189,8 @@ static bool CheckMimeHeader( demux_t *p_demux, int *p_header_size )
if
(
strncmp
(
(
char
*
)
p_sys
->
p_peek
,
"--"
,
2
)
!=
0
if
(
strncmp
(
(
char
*
)
p_sys
->
p_peek
,
"--"
,
2
)
!=
0
&&
strncmp
(
(
char
*
)
p_sys
->
p_peek
,
"
\r\n
--"
,
4
)
!=
0
)
&&
strncmp
(
(
char
*
)
p_sys
->
p_peek
,
"
\r\n
--"
,
4
)
!=
0
)
{
{
/* Some broken stream may lack the first boundary */
*
p_header_size
=
0
;
if
(
p_sys
->
psz_separator
==
NULL
)
return
false
;
{
msg_Warn
(
p_demux
,
"Malformed stream. Trying to work around"
);
char
*
content_type
=
stream_ContentType
(
p_demux
->
s
);
if
(
content_type
==
NULL
)
return
false
;
const
char
*
boundary
=
strstr
(
content_type
,
"boundary=--"
);
if
(
boundary
!=
NULL
)
{
p_sys
->
psz_separator
=
strdup
(
boundary
+
strlen
(
"boundary=--"
)
);
msg_Dbg
(
p_demux
,
"Video boundary extracted from Content-Type: %s"
,
p_sys
->
psz_separator
);
free
(
content_type
);
/* Skip to HTTP header parsing as there's no boundary to extract
* from the stream */
}
else
{
free
(
content_type
);
return
false
;
}
}
else
{
*
p_header_size
=
0
;
return
false
;
}
}
}
else
else
{
{
...
@@ -340,6 +315,23 @@ static int Open( vlc_object_t * p_this )
...
@@ -340,6 +315,23 @@ static int Open( vlc_object_t * p_this )
p_sys
->
psz_separator
=
NULL
;
p_sys
->
psz_separator
=
NULL
;
p_sys
->
i_frame_size_estimate
=
15
*
1024
;
p_sys
->
i_frame_size_estimate
=
15
*
1024
;
char
*
content_type
=
stream_ContentType
(
p_demux
->
s
);
if
(
content_type
)
{
//FIXME: this is not fully match to RFC
char
*
boundary
=
strstr
(
content_type
,
"boundary="
);
if
(
boundary
)
{
p_sys
->
psz_separator
=
strdup
(
boundary
+
strlen
(
"boundary="
)
);
if
(
!
p_sys
->
psz_separator
)
{
free
(
content_type
);
goto
error
;
}
}
free
(
content_type
);
}
b_matched
=
CheckMimeHeader
(
p_demux
,
&
i_size
);
b_matched
=
CheckMimeHeader
(
p_demux
,
&
i_size
);
if
(
b_matched
)
if
(
b_matched
)
{
{
...
@@ -389,6 +381,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -389,6 +381,7 @@ static int Open( vlc_object_t * p_this )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
free
(
p_sys
->
psz_separator
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
...
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