Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
3da7f14e
Commit
3da7f14e
authored
Nov 12, 2014
by
François Cartegnie
🤞
Browse files
stream_filter: dash: match case insensitively namespaces
and add a missing one
parent
fcef78e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/stream_filter/dash/Helper.cpp
View file @
3da7f14e
...
...
@@ -26,7 +26,7 @@
#endif
#include "Helper.h"
#include <algorithm>
using
namespace
dash
;
std
::
string
Helper
::
combinePaths
(
const
std
::
string
&
path1
,
const
std
::
string
&
path2
)
...
...
@@ -48,3 +48,10 @@ std::string Helper::getDirectoryPath (const std::string &path)
return
path
.
substr
(
0
,
pos
);
}
bool
Helper
::
ifind
(
std
::
string
haystack
,
std
::
string
needle
)
{
transform
(
haystack
.
begin
(),
haystack
.
end
(),
haystack
.
begin
(),
toupper
);
transform
(
needle
.
begin
(),
needle
.
end
(),
needle
.
begin
(),
toupper
);
return
haystack
.
find
(
needle
)
!=
std
::
string
::
npos
;
}
modules/stream_filter/dash/Helper.h
View file @
3da7f14e
...
...
@@ -34,6 +34,7 @@ namespace dash
public:
static
std
::
string
combinePaths
(
const
std
::
string
&
path1
,
const
std
::
string
&
path2
);
static
std
::
string
getDirectoryPath
(
const
std
::
string
&
path
);
static
bool
ifind
(
std
::
string
haystack
,
std
::
string
needle
);
};
}
...
...
modules/stream_filter/dash/xml/DOMParser.cpp
View file @
3da7f14e
...
...
@@ -26,6 +26,7 @@
#endif
#include "DOMParser.h"
#include "../Helper.h"
#include <vector>
...
...
@@ -141,16 +142,24 @@ void DOMParser::print ()
}
bool
DOMParser
::
isDash
(
stream_t
*
stream
)
{
const
char
*
psz_namespaceDIS
=
"urn:mpeg:mpegB:schema:DASH:MPD:DIS2011"
;
const
char
*
psz_namespaceIS
=
"urn:mpeg:DASH:schema:MPD:2011"
;
const
std
::
string
namespaces
[]
=
{
"xmlns=
\"
urn:mpeg:mpegB:schema:DASH:MPD:DIS2011
\"
"
,
"xmlns=
\"
urn:mpeg:schema:dash:mpd:2011
\"
"
,
"xmlns=
\"
urn:mpeg:DASH:schema:MPD:2011
\"
"
,
};
const
uint8_t
*
peek
;
int
peek_size
=
stream_Peek
(
stream
,
&
peek
,
1024
);
if
(
peek_size
<
(
int
)
strlen
(
psz_namespaceDIS
))
if
(
peek_size
<
(
int
)
namespaces
[
0
].
length
(
))
return
false
;
std
::
string
header
((
const
char
*
)
peek
,
peek_size
);
return
(
header
.
find
(
psz_namespaceDIS
)
!=
std
::
string
::
npos
)
||
(
header
.
find
(
psz_namespaceIS
)
!=
std
::
string
::
npos
);
for
(
size_t
i
=
0
;
i
<
ARRAY_SIZE
(
namespaces
);
i
++
)
{
if
(
Helper
::
ifind
(
header
,
namespaces
[
i
])
)
return
true
;
}
return
false
;
}
Profile
DOMParser
::
getProfile
()
{
...
...
Write
Preview
Supports
Markdown
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