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
6502b3a0
Commit
6502b3a0
authored
Dec 30, 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: Parsing SegmentInfoDefault & SegmentTimeline elements.
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
6347005a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
10 deletions
+109
-10
modules/stream_filter/dash/mpd/BasicCMParser.cpp
modules/stream_filter/dash/mpd/BasicCMParser.cpp
+89
-9
modules/stream_filter/dash/mpd/BasicCMParser.h
modules/stream_filter/dash/mpd/BasicCMParser.h
+4
-1
modules/stream_filter/dash/mpd/Group.cpp
modules/stream_filter/dash/mpd/Group.cpp
+11
-0
modules/stream_filter/dash/mpd/Group.h
modules/stream_filter/dash/mpd/Group.h
+5
-0
No files found.
modules/stream_filter/dash/mpd/BasicCMParser.cpp
View file @
6502b3a0
...
...
@@ -27,6 +27,8 @@
#include "BasicCMParser.h"
#include "mpd/ContentDescription.h"
#include "mpd/SegmentInfoDefault.h"
#include "mpd/SegmentTimeline.h"
#include <cstdlib>
#include <sstream>
...
...
@@ -149,6 +151,90 @@ void BasicCMParser::setPeriods (Node *root)
}
}
void
BasicCMParser
::
parseSegmentTimeline
(
Node
*
node
,
SegmentInfoCommon
*
segmentInfo
)
{
Node
*
segmentTimelineNode
=
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentTimeline"
);
if
(
segmentTimelineNode
)
{
SegmentTimeline
*
segmentTimeline
=
new
SegmentTimeline
;
std
::
vector
<
Node
*>
sNodes
=
DOMHelper
::
getChildElementByTagName
(
segmentTimelineNode
,
"S"
);
std
::
vector
<
Node
*>::
const_iterator
it
=
sNodes
.
begin
();
std
::
vector
<
Node
*>::
const_iterator
end
=
sNodes
.
end
();
while
(
it
!=
end
)
{
SegmentTimeline
::
Element
*
s
=
new
SegmentTimeline
::
Element
;
const
std
::
map
<
std
::
string
,
std
::
string
>
sAttr
=
(
*
it
)
->
getAttributes
();
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
sIt
;
sIt
=
sAttr
.
find
(
"t"
);
if
(
sIt
==
sAttr
.
end
()
)
{
std
::
cerr
<<
"'t' attribute is mandatory for every SegmentTimeline/S element"
<<
std
::
endl
;
delete
s
;
++
it
;
continue
;
}
s
->
t
=
atoll
(
sIt
->
second
.
c_str
()
);
sIt
=
sAttr
.
find
(
"d"
);
if
(
sIt
==
sAttr
.
end
()
)
{
std
::
cerr
<<
"'d' attribute is mandatory for every SegmentTimeline/S element"
<<
std
::
endl
;
delete
s
;
++
it
;
continue
;
}
s
->
d
=
atoll
(
sIt
->
second
.
c_str
()
);
sIt
=
sAttr
.
find
(
"r"
);
if
(
sIt
!=
sAttr
.
end
()
)
s
->
r
=
atoi
(
sIt
->
second
.
c_str
()
);
segmentTimeline
->
addElement
(
s
);
++
it
;
}
segmentInfo
->
setSegmentTimeline
(
segmentTimeline
);
}
}
void
BasicCMParser
::
parseSegmentInfoCommon
(
Node
*
node
,
SegmentInfoCommon
*
segmentInfo
)
{
const
std
::
map
<
std
::
string
,
std
::
string
>
attr
=
node
->
getAttributes
();
const
std
::
vector
<
Node
*>
baseUrls
=
DOMHelper
::
getChildElementByTagName
(
node
,
"BaseURL"
);
if
(
baseUrls
.
size
()
>
0
)
{
std
::
vector
<
Node
*>::
const_iterator
it
=
baseUrls
.
begin
();
std
::
vector
<
Node
*>::
const_iterator
end
=
baseUrls
.
end
();
while
(
it
!=
end
)
{
segmentInfo
->
appendBaseURL
(
(
*
it
)
->
getText
()
);
++
it
;
}
}
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
it
=
attr
.
begin
();
this
->
setInitSegment
(
node
,
segmentInfo
);
it
=
attr
.
find
(
"duration"
);
if
(
it
!=
attr
.
end
()
)
segmentInfo
->
setDuration
(
str_duration
(
it
->
second
.
c_str
()
)
);
it
=
attr
.
find
(
"startIndex"
);
if
(
it
!=
attr
.
end
()
)
segmentInfo
->
setStartIndex
(
atoi
(
it
->
second
.
c_str
()
)
);
this
->
parseSegmentTimeline
(
node
,
segmentInfo
);
}
void
BasicCMParser
::
parseSegmentInfoDefault
(
Node
*
node
,
Group
*
group
)
{
Node
*
segmentInfoDefaultNode
=
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentInfoDefault"
);
if
(
segmentInfoDefaultNode
!=
NULL
)
{
SegmentInfoDefault
*
segInfoDef
=
new
SegmentInfoDefault
;
this
->
parseSegmentInfoCommon
(
segmentInfoDefaultNode
,
segInfoDef
);
group
->
setSegmentInfoDefault
(
segInfoDef
);
}
}
void
BasicCMParser
::
setGroups
(
Node
*
root
,
Period
*
period
)
{
std
::
vector
<
Node
*>
groups
=
DOMHelper
::
getElementByTagName
(
root
,
"Group"
,
false
);
...
...
@@ -261,19 +347,13 @@ bool BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
const
std
::
map
<
std
::
string
,
std
::
string
>
attr
=
segmentInfo
->
getAttributes
();
SegmentInfo
*
info
=
new
SegmentInfo
();
//Init segment is not mandatory.
this
->
setInitSegment
(
segmentInfo
,
info
);
this
->
parseSegmentInfoCommon
(
segmentInfo
,
info
);
//If we don't have any segment, there's no point keeping this SegmentInfo.
if
(
this
->
setSegments
(
segmentInfo
,
info
)
==
false
)
{
delete
info
;
return
false
;
}
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
it
;
it
=
attr
.
find
(
"duration"
);
if
(
it
!=
attr
.
end
()
)
info
->
setDuration
(
str_duration
(
it
->
second
.
c_str
()
)
);
rep
->
setSegmentInfo
(
info
);
return
true
;
}
...
...
@@ -316,7 +396,7 @@ ProgramInformation* BasicCMParser::parseProgramInformation()
return
pInfo
;
}
void
BasicCMParser
::
setInitSegment
(
Node
*
root
,
SegmentInfo
*
info
)
void
BasicCMParser
::
setInitSegment
(
Node
*
root
,
SegmentInfo
Common
*
info
)
{
const
std
::
vector
<
Node
*>
initSeg
=
DOMHelper
::
getChildElementByTagName
(
root
,
"InitialisationSegmentURL"
);
...
...
@@ -327,7 +407,7 @@ void BasicCMParser::setInitSegment (Node *root, SegmentInfo *info)
{
Segment
*
seg
=
new
Segment
();
parseSegment
(
seg
,
initSeg
.
at
(
0
)
->
getAttributes
()
);
info
->
setInitSegment
(
seg
);
info
->
setInit
ialisation
Segment
(
seg
);
}
}
...
...
modules/stream_filter/dash/mpd/BasicCMParser.h
View file @
6502b3a0
...
...
@@ -57,11 +57,14 @@ namespace dash
private:
bool
setMPD
();
void
setPeriods
(
dash
::
xml
::
Node
*
root
);
void
parseSegmentTimeline
(
xml
::
Node
*
node
,
SegmentInfoCommon
*
segmentInfo
);
void
parseSegmentInfoCommon
(
xml
::
Node
*
node
,
SegmentInfoCommon
*
segmentInfo
);
void
parseSegmentInfoDefault
(
xml
::
Node
*
node
,
Group
*
group
);
void
setGroups
(
dash
::
xml
::
Node
*
root
,
Period
*
period
);
void
parseTrickMode
(
dash
::
xml
::
Node
*
node
,
Representation
*
repr
);
void
setRepresentations
(
dash
::
xml
::
Node
*
root
,
Group
*
group
);
bool
setSegmentInfo
(
dash
::
xml
::
Node
*
root
,
Representation
*
rep
);
void
setInitSegment
(
dash
::
xml
::
Node
*
root
,
SegmentInfo
*
info
);
void
setInitSegment
(
dash
::
xml
::
Node
*
root
,
SegmentInfo
Common
*
info
);
bool
setSegments
(
dash
::
xml
::
Node
*
root
,
SegmentInfo
*
info
);
void
setMPDBaseUrl
(
dash
::
xml
::
Node
*
root
);
void
parseContentDescriptor
(
xml
::
Node
*
node
,
const
std
::
string
&
name
,
...
...
modules/stream_filter/dash/mpd/Group.cpp
View file @
6502b3a0
...
...
@@ -68,6 +68,17 @@ const Representation *Group::getRepresentationById(const std::string &id) const
return
NULL
;
}
const
SegmentInfoDefault
*
Group
::
getSegmentInfoDefault
()
const
{
return
this
->
segmentInfoDefault
;
}
void
Group
::
setSegmentInfoDefault
(
const
SegmentInfoDefault
*
seg
)
{
if
(
seg
!=
NULL
)
this
->
segmentInfoDefault
=
seg
;
}
void
Group
::
addRepresentation
(
Representation
*
rep
)
{
this
->
representations
.
push_back
(
rep
);
...
...
modules/stream_filter/dash/mpd/Group.h
View file @
6502b3a0
...
...
@@ -36,6 +36,8 @@ namespace dash
{
namespace
mpd
{
class
SegmentInfoDefault
;
class
Group
:
public
CommonAttributesElements
{
public:
...
...
@@ -46,12 +48,15 @@ namespace dash
void
setSubsegmentAlignmentFlag
(
bool
alignment
);
std
::
vector
<
Representation
*>
getRepresentations
();
const
Representation
*
getRepresentationById
(
const
std
::
string
&
id
)
const
;
const
SegmentInfoDefault
*
getSegmentInfoDefault
()
const
;
void
setSegmentInfoDefault
(
const
SegmentInfoDefault
*
seg
);
void
addRepresentation
(
Representation
*
rep
);
private:
bool
subsegmentAlignmentFlag
;
std
::
vector
<
Representation
*>
representations
;
const
SegmentInfoDefault
*
segmentInfoDefault
;
};
}
}
...
...
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