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
75dda0a5
Commit
75dda0a5
authored
Sep 15, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: unify and make default id local to parent node
parent
d1ee36b8
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
51 additions
and
80 deletions
+51
-80
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
+1
-1
modules/demux/adaptative/playlist/CommonAttributesElements.cpp
...es/demux/adaptative/playlist/CommonAttributesElements.cpp
+0
-5
modules/demux/adaptative/playlist/CommonAttributesElements.h
modules/demux/adaptative/playlist/CommonAttributesElements.h
+0
-3
modules/demux/adaptative/playlist/ID.cpp
modules/demux/adaptative/playlist/ID.cpp
+8
-19
modules/demux/adaptative/playlist/ID.hpp
modules/demux/adaptative/playlist/ID.hpp
+6
-9
modules/demux/adaptative/playlist/Inheritables.cpp
modules/demux/adaptative/playlist/Inheritables.cpp
+9
-0
modules/demux/adaptative/playlist/Inheritables.hpp
modules/demux/adaptative/playlist/Inheritables.hpp
+7
-11
modules/demux/adaptative/playlist/SegmentInformation.hpp
modules/demux/adaptative/playlist/SegmentInformation.hpp
+2
-1
modules/demux/dash/mpd/AdaptationSet.cpp
modules/demux/dash/mpd/AdaptationSet.cpp
+0
-13
modules/demux/dash/mpd/AdaptationSet.h
modules/demux/dash/mpd/AdaptationSet.h
+0
-1
modules/demux/dash/mpd/IsoffMainParser.cpp
modules/demux/dash/mpd/IsoffMainParser.cpp
+14
-7
modules/demux/dash/mpd/IsoffMainParser.h
modules/demux/dash/mpd/IsoffMainParser.h
+1
-1
modules/demux/dash/mpd/Period.h
modules/demux/dash/mpd/Period.h
+1
-2
modules/demux/dash/mpd/Representation.cpp
modules/demux/dash/mpd/Representation.cpp
+1
-5
modules/demux/dash/mpd/Representation.h
modules/demux/dash/mpd/Representation.h
+1
-2
No files found.
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
View file @
75dda0a5
...
...
@@ -34,7 +34,7 @@
#include "SegmentTemplate.h"
#include "BasePeriod.h"
#include "I
D
.hpp"
#include "I
nheritables
.hpp"
using
namespace
adaptative
;
using
namespace
adaptative
::
playlist
;
...
...
modules/demux/adaptative/playlist/CommonAttributesElements.cpp
View file @
75dda0a5
...
...
@@ -84,8 +84,3 @@ void CommonAttributesElements::addLang( const std::string &lang )
if
(
lang
.
empty
()
==
false
)
this
->
lang
.
push_back
(
lang
);
}
const
ID
&
CommonAttributesElements
::
getID
()
const
{
return
id
;
}
modules/demux/adaptative/playlist/CommonAttributesElements.h
View file @
75dda0a5
...
...
@@ -26,7 +26,6 @@
#include <list>
#include <string>
#include "ID.hpp"
namespace
adaptative
{
...
...
@@ -45,14 +44,12 @@ namespace adaptative
void
setHeight
(
int
height
);
const
std
::
list
<
std
::
string
>&
getLang
()
const
;
void
addLang
(
const
std
::
string
&
lang
);
const
ID
&
getID
()
const
;
protected:
std
::
string
mimeType
;
int
width
;
int
height
;
std
::
list
<
std
::
string
>
lang
;
ID
id
;
};
}
}
...
...
modules/demux/adaptative/playlist/ID.cpp
View file @
75dda0a5
...
...
@@ -22,36 +22,25 @@
using
namespace
adaptative
::
playlist
;
int64_t
ID
::
nextid
=
0
;
ID
::
ID
()
{
id
=
nextid
++
;
}
ID
::
ID
(
int64_t
i_id
)
ID
::
ID
(
const
std
::
string
&
id_
)
{
id
=
i
_id
;
id
=
i
d_
;
}
ID
::
~
ID
(
)
ID
::
ID
(
uint64_t
id_
)
{
std
::
stringstream
ss
;
ss
<<
"default_id#"
<<
id_
;
id
=
ss
.
str
();
}
bool
ID
::
operator
==
(
const
ID
&
other
)
const
{
return
id
==
other
.
id
;
return
(
!
id
.
empty
()
&&
id
==
other
.
id
)
;
}
std
::
string
ID
::
str
()
const
{
std
::
stringstream
ss
;
ss
<<
id
;
return
ss
.
str
();
}
int64_t
ID
::
toInt
()
const
{
return
id
;
}
modules/demux/adaptative/playlist/ID.hpp
View file @
75dda0a5
...
...
@@ -31,16 +31,13 @@ namespace adaptative
class
ID
{
public:
ID
();
ID
(
int64_t
);
virtual
~
ID
();
virtual
bool
operator
==
(
const
ID
&
)
const
;
virtual
std
::
string
str
()
const
;
virtual
int64_t
toInt
()
const
;
ID
(
const
std
::
string
&
);
ID
(
uint64_t
=
0
);
bool
operator
==
(
const
ID
&
)
const
;
std
::
string
str
()
const
;
protected:
int64_t
id
;
static
int64_t
nextid
;
private:
std
::
string
id
;
};
}
...
...
modules/demux/adaptative/playlist/Inheritables.cpp
View file @
75dda0a5
...
...
@@ -57,3 +57,12 @@ uint64_t TimescaleAble::inheritTimescale() const
return
1
;
}
const
ID
&
Unique
::
getID
()
const
{
return
id
;
}
void
Unique
::
setID
(
const
ID
&
id_
)
{
id
=
id_
;
}
modules/demux/adaptative/playlist/Inheritables.hpp
View file @
75dda0a5
...
...
@@ -23,6 +23,7 @@
#include "../tools/Properties.hpp"
#include <string>
#include <stdint.h>
#include "ID.hpp"
namespace
adaptative
{
...
...
@@ -50,19 +51,14 @@ namespace adaptative
TimescaleAble
*
parentTimescale
;
};
template
<
class
T
>
class
UniqueNess
class
Unique
{
public:
UniqueNess
(){}
~
UniqueNess
()
{}
void
setId
(
const
std
::
string
&
id_
)
{
id
=
id_
;}
const
std
::
string
&
getId
()
const
{
return
id
;}
bool
sameAs
(
const
T
&
other
)
const
{
return
(
!
id
.
empty
()
&&
id
==
other
.
id
);
}
private:
std
::
string
id
;
const
ID
&
getID
()
const
;
void
setID
(
const
ID
&
);
protected:
ID
id
;
};
}
}
...
...
modules/demux/adaptative/playlist/SegmentInformation.hpp
View file @
75dda0a5
...
...
@@ -44,7 +44,8 @@ namespace adaptative
/* common segment elements for period/adaptset/rep 5.3.9.1,
* with properties inheritance */
class
SegmentInformation
:
public
ICanonicalUrl
,
public
TimescaleAble
public
TimescaleAble
,
public
Unique
{
public:
SegmentInformation
(
SegmentInformation
*
=
0
);
...
...
modules/demux/dash/mpd/AdaptationSet.cpp
View file @
75dda0a5
...
...
@@ -66,17 +66,4 @@ void AdaptationSet::setSubsegmentAlignmentFlag(bool alignment)
subsegmentAlignmentFlag
=
alignment
;
}
const
Representation
*
AdaptationSet
::
getRepresentationById
(
const
std
::
string
&
id
)
const
{
std
::
vector
<
BaseRepresentation
*>::
const_iterator
it
=
representations
.
begin
();
std
::
vector
<
BaseRepresentation
*>::
const_iterator
end
=
representations
.
end
();
while
(
it
!=
end
)
{
Representation
*
rep
=
dynamic_cast
<
Representation
*>
(
*
it
);
if
(
rep
->
getId
()
==
id
)
return
rep
;
++
it
;
}
return
NULL
;
}
modules/demux/dash/mpd/AdaptationSet.h
View file @
75dda0a5
...
...
@@ -51,7 +51,6 @@ namespace dash
virtual
StreamFormat
getStreamFormat
()
const
;
/* reimpl */
bool
getSubsegmentAlignmentFlag
()
const
;
void
setSubsegmentAlignmentFlag
(
bool
alignment
);
const
Representation
*
getRepresentationById
(
const
std
::
string
&
id
)
const
;
private:
bool
subsegmentAlignmentFlag
;
...
...
modules/demux/dash/mpd/IsoffMainParser.cpp
View file @
75dda0a5
...
...
@@ -132,19 +132,18 @@ void IsoffMainParser::parsePeriods(Node *root)
{
std
::
vector
<
Node
*>
periods
=
DOMHelper
::
getElementByTagName
(
root
,
"Period"
,
false
);
std
::
vector
<
Node
*>::
const_iterator
it
;
uint64_t
nextid
=
0
;
for
(
it
=
periods
.
begin
();
it
!=
periods
.
end
();
++
it
)
{
Period
*
period
=
new
(
std
::
nothrow
)
Period
(
mpd
);
if
(
!
period
)
continue
;
parseSegmentInformation
(
*
it
,
period
);
parseSegmentInformation
(
*
it
,
period
,
&
nextid
);
if
((
*
it
)
->
hasAttribute
(
"start"
))
period
->
startTime
.
Set
(
IsoTime
((
*
it
)
->
getAttributeValue
(
"start"
))
*
CLOCK_FREQ
);
if
((
*
it
)
->
hasAttribute
(
"duration"
))
period
->
duration
.
Set
(
IsoTime
((
*
it
)
->
getAttributeValue
(
"duration"
))
*
CLOCK_FREQ
);
if
((
*
it
)
->
hasAttribute
(
"id"
))
period
->
setId
((
*
it
)
->
getAttributeValue
(
"id"
));
std
::
vector
<
Node
*>
baseUrls
=
DOMHelper
::
getChildElementByTagName
(
*
it
,
"BaseURL"
);
if
(
!
baseUrls
.
empty
())
period
->
baseUrl
.
Set
(
new
Url
(
baseUrls
.
front
()
->
getText
()
)
);
...
...
@@ -194,7 +193,7 @@ size_t IsoffMainParser::parseSegmentTemplate(Node *templateNode, SegmentInformat
return
total
;
}
size_t
IsoffMainParser
::
parseSegmentInformation
(
Node
*
node
,
SegmentInformation
*
info
)
size_t
IsoffMainParser
::
parseSegmentInformation
(
Node
*
node
,
SegmentInformation
*
info
,
uint64_t
*
nextid
)
{
size_t
total
=
0
;
total
+=
parseSegmentBase
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentBase"
),
info
);
...
...
@@ -213,6 +212,12 @@ size_t IsoffMainParser::parseSegmentInformation(Node *node, SegmentInformation *
}
if
(
node
->
hasAttribute
(
"timescale"
))
info
->
timescale
.
Set
(
Integer
<
uint64_t
>
(
node
->
getAttributeValue
(
"timescale"
)));
if
(
node
->
hasAttribute
(
"id"
))
info
->
setID
(
node
->
getAttributeValue
(
"id"
));
else
info
->
setID
(
ID
((
*
nextid
)
++
));
return
total
;
}
...
...
@@ -220,6 +225,7 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period)
{
std
::
vector
<
Node
*>
adaptationSets
=
DOMHelper
::
getElementByTagName
(
periodNode
,
"AdaptationSet"
,
false
);
std
::
vector
<
Node
*>::
const_iterator
it
;
uint64_t
nextid
=
0
;
for
(
it
=
adaptationSets
.
begin
();
it
!=
adaptationSets
.
end
();
++
it
)
{
...
...
@@ -251,7 +257,7 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period)
adaptationSet
->
description
.
Set
(
role
->
getAttributeValue
(
"value"
));
}
parseSegmentInformation
(
*
it
,
adaptationSet
);
parseSegmentInformation
(
*
it
,
adaptationSet
,
&
nextid
);
setRepresentations
((
*
it
),
adaptationSet
);
period
->
addAdaptationSet
(
adaptationSet
);
...
...
@@ -260,6 +266,7 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period)
void
IsoffMainParser
::
setRepresentations
(
Node
*
adaptationSetNode
,
AdaptationSet
*
adaptationSet
)
{
std
::
vector
<
Node
*>
representations
=
DOMHelper
::
getElementByTagName
(
adaptationSetNode
,
"Representation"
,
false
);
uint64_t
nextid
=
0
;
for
(
size_t
i
=
0
;
i
<
representations
.
size
();
i
++
)
{
...
...
@@ -271,7 +278,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
currentRepresentation
->
baseUrl
.
Set
(
new
Url
(
baseUrls
.
front
()
->
getText
()));
if
(
repNode
->
hasAttribute
(
"id"
))
currentRepresentation
->
setI
d
(
repNode
->
getAttributeValue
(
"id"
));
currentRepresentation
->
setI
D
(
ID
(
repNode
->
getAttributeValue
(
"id"
)
));
if
(
repNode
->
hasAttribute
(
"width"
))
currentRepresentation
->
setWidth
(
atoi
(
repNode
->
getAttributeValue
(
"width"
).
c_str
()));
...
...
@@ -299,7 +306,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
}
}
size_t
i_total
=
parseSegmentInformation
(
repNode
,
currentRepresentation
);
size_t
i_total
=
parseSegmentInformation
(
repNode
,
currentRepresentation
,
&
nextid
);
/* Empty Representation with just baseurl (ex: subtitles) */
if
(
i_total
==
0
&&
(
currentRepresentation
->
baseUrl
.
Get
()
&&
!
currentRepresentation
->
baseUrl
.
Get
()
->
empty
())
&&
...
...
modules/demux/dash/mpd/IsoffMainParser.h
View file @
75dda0a5
...
...
@@ -78,7 +78,7 @@ namespace dash
void
parseInitSegment
(
xml
::
Node
*
,
Initializable
<
Segment
>
*
,
SegmentInformation
*
);
void
parseTimeline
(
xml
::
Node
*
,
MediaSegmentTemplate
*
);
void
parsePeriods
(
xml
::
Node
*
);
size_t
parseSegmentInformation
(
xml
::
Node
*
,
SegmentInformation
*
);
size_t
parseSegmentInformation
(
xml
::
Node
*
,
SegmentInformation
*
,
uint64_t
*
);
size_t
parseSegmentBase
(
xml
::
Node
*
,
SegmentInformation
*
);
size_t
parseSegmentList
(
xml
::
Node
*
,
SegmentInformation
*
);
size_t
parseSegmentTemplate
(
xml
::
Node
*
,
SegmentInformation
*
);
...
...
modules/demux/dash/mpd/Period.h
View file @
75dda0a5
...
...
@@ -35,8 +35,7 @@ namespace dash
using
namespace
adaptative
;
using
namespace
adaptative
::
playlist
;
class
Period
:
public
BasePeriod
,
public
UniqueNess
<
Period
>
class
Period
:
public
BasePeriod
{
public:
Period
(
MPD
*
);
...
...
modules/demux/dash/mpd/Representation.cpp
View file @
75dda0a5
...
...
@@ -152,11 +152,7 @@ std::string Representation::contextualize(size_t index, const std::string &compo
pos
=
ret
.
find
(
"$RepresentationID$"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
stringstream
ss
;
ss
<<
getId
();
ret
.
replace
(
pos
,
std
::
string
(
"$RepresentationID$"
).
length
(),
ss
.
str
());
}
ret
.
replace
(
pos
,
std
::
string
(
"$RepresentationID$"
).
length
(),
id
.
str
());
return
ret
;
}
...
...
modules/demux/dash/mpd/Representation.h
View file @
75dda0a5
...
...
@@ -41,8 +41,7 @@ namespace dash
using
namespace
adaptative
::
playlist
;
class
Representation
:
public
BaseRepresentation
,
public
DASHCommonAttributesElements
,
public
UniqueNess
<
Representation
>
public
DASHCommonAttributesElements
{
public:
Representation
(
AdaptationSet
*
);
...
...
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