Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
d2b3b804
Commit
d2b3b804
authored
Dec 19, 2011
by
Hugo Beauzée-Luyssen
Committed by
Jean-Baptiste Kempf
Dec 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dash: BasicCMParser: Check for attributes at parsing time.
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
68024ffe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
1 deletion
+79
-1
modules/stream_filter/dash/mpd/BasicCMParser.cpp
modules/stream_filter/dash/mpd/BasicCMParser.cpp
+78
-1
modules/stream_filter/dash/mpd/BasicCMParser.h
modules/stream_filter/dash/mpd/BasicCMParser.h
+1
-0
No files found.
modules/stream_filter/dash/mpd/BasicCMParser.cpp
View file @
d2b3b804
...
...
@@ -27,6 +27,9 @@
#include "BasicCMParser.h"
#include <cstdlib>
#include <sstream>
using
namespace
dash
::
mpd
;
using
namespace
dash
::
xml
;
...
...
@@ -87,7 +90,14 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
for
(
size_t
i
=
0
;
i
<
representations
.
size
();
i
++
)
{
Representation
*
rep
=
new
Representation
(
representations
.
at
(
i
)
->
getAttributes
());
const
std
::
map
<
std
::
string
,
std
::
string
>
attributes
=
representations
.
at
(
i
)
->
getAttributes
();
Representation
*
rep
=
new
Representation
(
attributes
);
if
(
this
->
parseCommonAttributesElements
(
representations
.
at
(
i
),
rep
)
==
false
)
{
delete
rep
;
continue
;
}
this
->
setSegmentInfo
(
representations
.
at
(
i
),
rep
);
if
(
rep
->
getSegmentInfo
()
&&
rep
->
getSegmentInfo
()
->
getSegments
().
size
()
>
0
)
group
->
addRepresentation
(
rep
);
...
...
@@ -131,3 +141,70 @@ MPD* BasicCMParser::getMPD ()
{
return
this
->
mpd
;
}
bool
BasicCMParser
::
parseCommonAttributesElements
(
Node
*
node
,
CommonAttributesElements
*
common
)
const
{
const
std
::
map
<
std
::
string
,
std
::
string
>
&
attr
=
node
->
getAttributes
();
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
it
;
//Parse mandatory elements first.
it
=
attr
.
find
(
"mimeType"
);
if
(
it
==
attr
.
end
()
)
{
std
::
cerr
<<
"Missing mandatory attribute: @mimeType"
<<
std
::
endl
;
return
false
;
}
common
->
setMimeType
(
it
->
second
);
//Everything else is optionnal.
it
=
attr
.
find
(
"width"
);
if
(
it
!=
attr
.
end
()
)
common
->
setWidth
(
atoi
(
it
->
second
.
c_str
()
)
);
it
=
attr
.
find
(
"height"
);
if
(
it
!=
attr
.
end
()
)
common
->
setHeight
(
atoi
(
it
->
second
.
c_str
()
)
);
it
=
attr
.
find
(
"parx"
);
if
(
it
!=
attr
.
end
()
)
common
->
setParX
(
atoi
(
it
->
second
.
c_str
()
)
);
it
=
attr
.
find
(
"pary"
);
if
(
it
!=
attr
.
end
()
)
common
->
setParY
(
atoi
(
it
->
second
.
c_str
()
)
);
it
=
attr
.
find
(
"frameRate"
);
if
(
it
!=
attr
.
end
()
)
common
->
setFrameRate
(
atoi
(
it
->
second
.
c_str
()
)
);
it
=
attr
.
find
(
"lang"
);
if
(
it
!=
attr
.
end
()
&&
it
->
second
.
empty
()
==
false
)
{
std
::
istringstream
s
(
it
->
second
);
while
(
s
)
{
std
::
string
lang
;
s
>>
lang
;
common
->
addLang
(
lang
);
}
}
it
=
attr
.
find
(
"numberOfChannels"
);
if
(
it
!=
attr
.
end
()
)
{
std
::
istringstream
s
(
it
->
second
);
while
(
s
)
{
std
::
string
channel
;
s
>>
channel
;
common
->
addChannel
(
channel
);
}
}
it
=
attr
.
find
(
"samplingRate"
);
if
(
it
!=
attr
.
end
()
)
{
std
::
istringstream
s
(
it
->
second
);
while
(
s
)
{
int
rate
;
s
>>
rate
;
common
->
addSampleRate
(
rate
);
}
}
//FIXME: Handle : group, maximumRAPPeriod startWithRAP attributes
//FIXME: Handle : ContentProtection Accessibility Rating Viewpoing MultipleViews elements
return
true
;
}
modules/stream_filter/dash/mpd/BasicCMParser.h
View file @
d2b3b804
...
...
@@ -62,6 +62,7 @@ namespace dash
void
setInitSegment
(
dash
::
xml
::
Node
*
root
,
SegmentInfo
*
info
);
void
setSegments
(
dash
::
xml
::
Node
*
root
,
SegmentInfo
*
info
);
void
setMPDBaseUrl
(
dash
::
xml
::
Node
*
root
);
bool
parseCommonAttributesElements
(
dash
::
xml
::
Node
*
node
,
CommonAttributesElements
*
common
)
const
;
};
}
}
...
...
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