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
8c6bf181
Commit
8c6bf181
authored
Jan 12, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: dash: factorize timescales inheritance
parent
2f04d039
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
52 deletions
+70
-52
modules/demux/dash/mpd/SegmentInfoCommon.cpp
modules/demux/dash/mpd/SegmentInfoCommon.cpp
+20
-0
modules/demux/dash/mpd/SegmentInfoCommon.h
modules/demux/dash/mpd/SegmentInfoCommon.h
+12
-0
modules/demux/dash/mpd/SegmentInformation.cpp
modules/demux/dash/mpd/SegmentInformation.cpp
+18
-31
modules/demux/dash/mpd/SegmentInformation.hpp
modules/demux/dash/mpd/SegmentInformation.hpp
+6
-5
modules/demux/dash/mpd/SegmentList.cpp
modules/demux/dash/mpd/SegmentList.cpp
+3
-3
modules/demux/dash/mpd/SegmentList.h
modules/demux/dash/mpd/SegmentList.h
+5
-4
modules/demux/dash/mpd/SegmentTemplate.cpp
modules/demux/dash/mpd/SegmentTemplate.cpp
+2
-3
modules/demux/dash/mpd/SegmentTemplate.h
modules/demux/dash/mpd/SegmentTemplate.h
+3
-3
modules/demux/dash/mpd/Url.cpp
modules/demux/dash/mpd/Url.cpp
+1
-3
No files found.
modules/demux/dash/mpd/SegmentInfoCommon.cpp
View file @
8c6bf181
...
@@ -43,6 +43,26 @@ Timelineable::~Timelineable()
...
@@ -43,6 +43,26 @@ Timelineable::~Timelineable()
delete
segmentTimeline
.
Get
();
delete
segmentTimeline
.
Get
();
}
}
TimescaleAble
::
TimescaleAble
(
TimescaleAble
*
parent
)
{
timescale
.
Set
(
0
);
parentTimescale
=
parent
;
}
TimescaleAble
::~
TimescaleAble
()
{
}
uint64_t
TimescaleAble
::
inheritTimescale
()
const
{
if
(
timescale
.
Get
())
return
timescale
.
Get
();
else
if
(
parentTimescale
)
return
parentTimescale
->
inheritTimescale
();
else
return
1
;
}
SegmentInfoCommon
::
SegmentInfoCommon
(
ICanonicalUrl
*
parent
)
:
SegmentInfoCommon
::
SegmentInfoCommon
(
ICanonicalUrl
*
parent
)
:
ICanonicalUrl
(
parent
),
Initializable
(),
ICanonicalUrl
(
parent
),
Initializable
(),
duration
(
0
),
duration
(
0
),
...
...
modules/demux/dash/mpd/SegmentInfoCommon.h
View file @
8c6bf181
...
@@ -60,6 +60,18 @@ namespace dash
...
@@ -60,6 +60,18 @@ namespace dash
Property
<
SegmentTimeline
*>
segmentTimeline
;
Property
<
SegmentTimeline
*>
segmentTimeline
;
};
};
class
TimescaleAble
{
public:
TimescaleAble
(
TimescaleAble
*
=
NULL
);
~
TimescaleAble
();
uint64_t
inheritTimescale
()
const
;
Property
<
uint64_t
>
timescale
;
private:
TimescaleAble
*
parentTimescale
;
};
template
<
class
T
>
class
UniqueNess
template
<
class
T
>
class
UniqueNess
{
{
public:
public:
...
...
modules/demux/dash/mpd/SegmentInformation.cpp
View file @
8c6bf181
...
@@ -24,30 +24,33 @@
...
@@ -24,30 +24,33 @@
#include "SegmentList.h"
#include "SegmentList.h"
#include "SegmentTemplate.h"
#include "SegmentTemplate.h"
#include "SegmentTimeline.h"
#include "SegmentTimeline.h"
#include "MPD.h"
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
using
namespace
std
;
using
namespace
std
;
SegmentInformation
::
SegmentInformation
(
SegmentInformation
*
parent_
)
:
SegmentInformation
::
SegmentInformation
(
SegmentInformation
*
parent_
)
:
ICanonicalUrl
(
parent_
)
ICanonicalUrl
(
parent_
),
TimescaleAble
(
parent_
)
{
{
parent
=
parent_
;
parent
=
parent_
;
segmentBase
=
NULL
;
init
();
segmentList
=
NULL
;
mediaSegmentTemplate
=
NULL
;
bitswitch_policy
=
BITSWITCH_INHERIT
;
timescale
.
Set
(
0
);
}
}
SegmentInformation
::
SegmentInformation
(
ICanonicalUrl
*
parent_
)
:
SegmentInformation
::
SegmentInformation
(
MPD
*
parent_
)
:
ICanonicalUrl
(
parent_
)
ICanonicalUrl
(
parent_
),
TimescaleAble
()
{
{
parent
=
NULL
;
parent
=
NULL
;
init
();
}
void
SegmentInformation
::
init
()
{
segmentBase
=
NULL
;
segmentBase
=
NULL
;
segmentList
=
NULL
;
segmentList
=
NULL
;
mediaSegmentTemplate
=
NULL
;
mediaSegmentTemplate
=
NULL
;
bitswitch_policy
=
BITSWITCH_INHERIT
;
bitswitch_policy
=
BITSWITCH_INHERIT
;
timescale
.
Set
(
0
);
}
}
SegmentInformation
::~
SegmentInformation
()
SegmentInformation
::~
SegmentInformation
()
...
@@ -159,24 +162,22 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
...
@@ -159,24 +162,22 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
{
{
SegmentList
*
segList
;
SegmentList
*
segList
;
MediaSegmentTemplate
*
mediaTemplate
;
MediaSegmentTemplate
*
mediaTemplate
;
uint64_t
timescale
=
0
;
uint64_t
timescale
=
1
;
mtime_t
duration
=
0
;
mtime_t
duration
=
0
;
if
(
(
mediaTemplate
=
inheritSegmentTemplate
())
)
if
(
(
mediaTemplate
=
inheritSegmentTemplate
())
)
{
{
timescale
=
mediaTemplate
->
timescale
.
Get
();
timescale
=
mediaTemplate
->
inheritTimescale
();
duration
=
mediaTemplate
->
duration
.
Get
();
duration
=
mediaTemplate
->
duration
.
Get
();
}
}
else
if
(
(
segList
=
inheritSegmentList
())
)
else
if
(
(
segList
=
inheritSegmentList
())
)
{
{
timescale
=
segList
->
timescale
.
Get
();
timescale
=
segList
->
inheritTimescale
();
duration
=
segList
->
getDuration
();
duration
=
segList
->
getDuration
();
}
}
if
(
duration
)
if
(
duration
)
{
{
if
(
!
timescale
)
timescale
=
getTimescale
();
/* inherit */
*
ret
=
time
/
(
CLOCK_FREQ
*
duration
/
timescale
);
*
ret
=
time
/
(
CLOCK_FREQ
*
duration
/
timescale
);
return
true
;
return
true
;
}
}
...
@@ -188,11 +189,11 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
...
@@ -188,11 +189,11 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
{
{
SegmentList
*
segList
;
SegmentList
*
segList
;
MediaSegmentTemplate
*
mediaTemplate
;
MediaSegmentTemplate
*
mediaTemplate
;
uint64_t
timescale
=
0
;
uint64_t
timescale
=
1
;
mtime_t
time
=
0
;
mtime_t
time
=
0
;
if
(
(
mediaTemplate
=
inheritSegmentTemplate
())
)
if
(
(
mediaTemplate
=
inheritSegmentTemplate
())
)
{
{
timescale
=
mediaTemplate
->
timescale
.
Get
();
timescale
=
mediaTemplate
->
inheritTimescale
();
if
(
mediaTemplate
->
segmentTimeline
.
Get
())
if
(
mediaTemplate
->
segmentTimeline
.
Get
())
{
{
time
=
mediaTemplate
->
segmentTimeline
.
Get
()
->
time
=
mediaTemplate
->
segmentTimeline
.
Get
()
->
...
@@ -205,16 +206,12 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
...
@@ -205,16 +206,12 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
}
}
else
if
(
(
segList
=
inheritSegmentList
())
)
else
if
(
(
segList
=
inheritSegmentList
())
)
{
{
timescale
=
segList
->
timescale
.
Get
();
timescale
=
segList
->
inheritTimescale
();
time
=
number
*
segList
->
getDuration
();
time
=
number
*
segList
->
getDuration
();
}
}
if
(
time
)
if
(
time
)
{
if
(
!
timescale
)
timescale
=
getTimescale
();
/* inherit */
time
=
CLOCK_FREQ
*
time
/
timescale
;
time
=
CLOCK_FREQ
*
time
/
timescale
;
}
return
time
;
return
time
;
}
}
...
@@ -237,16 +234,6 @@ bool SegmentInformation::canBitswitch() const
...
@@ -237,16 +234,6 @@ bool SegmentInformation::canBitswitch() const
return
(
bitswitch_policy
==
BITSWITCH_YES
);
return
(
bitswitch_policy
==
BITSWITCH_YES
);
}
}
uint64_t
SegmentInformation
::
getTimescale
()
const
{
if
(
timescale
.
Get
())
return
timescale
.
Get
();
else
if
(
parent
)
return
parent
->
getTimescale
();
else
return
1
;
}
mtime_t
SegmentInformation
::
getPeriodStart
()
const
mtime_t
SegmentInformation
::
getPeriodStart
()
const
{
{
if
(
parent
)
if
(
parent
)
...
...
modules/demux/dash/mpd/SegmentInformation.hpp
View file @
8c6bf181
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "ICanonicalUrl.hpp"
#include "ICanonicalUrl.hpp"
#include "Properties.hpp"
#include "Properties.hpp"
#include "SegmentInfoCommon.h"
#include <vlc_common.h>
#include <vlc_common.h>
#include <vector>
#include <vector>
...
@@ -40,19 +41,20 @@ namespace dash
...
@@ -40,19 +41,20 @@ namespace dash
class
SegmentList
;
class
SegmentList
;
class
SegmentTemplate
;
class
SegmentTemplate
;
class
SegmentTimeline
;
class
SegmentTimeline
;
class
MPD
;
/* common segment elements for period/adaptset/rep 5.3.9.1,
/* common segment elements for period/adaptset/rep 5.3.9.1,
* with properties inheritance */
* with properties inheritance */
class
SegmentInformation
:
public
ICanonicalUrl
class
SegmentInformation
:
public
ICanonicalUrl
,
public
TimescaleAble
{
{
friend
class
IsoffMainParser
;
friend
class
IsoffMainParser
;
public:
public:
SegmentInformation
(
SegmentInformation
*
=
0
);
SegmentInformation
(
SegmentInformation
*
=
0
);
explicit
SegmentInformation
(
ICanonicalUrl
*
);
explicit
SegmentInformation
(
MPD
*
);
virtual
~
SegmentInformation
();
virtual
~
SegmentInformation
();
bool
canBitswitch
()
const
;
bool
canBitswitch
()
const
;
uint64_t
getTimescale
()
const
;
virtual
mtime_t
getPeriodStart
()
const
;
virtual
mtime_t
getPeriodStart
()
const
;
class
SplitPoint
class
SplitPoint
...
@@ -82,6 +84,7 @@ namespace dash
...
@@ -82,6 +84,7 @@ namespace dash
std
::
vector
<
SegmentInformation
*>
childs
;
std
::
vector
<
SegmentInformation
*>
childs
;
private:
private:
void
init
();
void
setSegmentList
(
SegmentList
*
);
void
setSegmentList
(
SegmentList
*
);
void
setSegmentBase
(
SegmentBase
*
);
void
setSegmentBase
(
SegmentBase
*
);
void
setSegmentTemplate
(
MediaSegmentTemplate
*
);
void
setSegmentTemplate
(
MediaSegmentTemplate
*
);
...
@@ -102,8 +105,6 @@ namespace dash
...
@@ -102,8 +105,6 @@ namespace dash
BITSWITCH_YES
,
BITSWITCH_YES
,
BITSWITCH_NO
BITSWITCH_NO
}
bitswitch_policy
;
}
bitswitch_policy
;
Property
<
uint64_t
>
timescale
;
};
};
}
}
}
}
...
...
modules/demux/dash/mpd/SegmentList.cpp
View file @
8c6bf181
...
@@ -28,13 +28,13 @@
...
@@ -28,13 +28,13 @@
#include "SegmentList.h"
#include "SegmentList.h"
#include "Segment.h"
#include "Segment.h"
#include "SegmentInformation.hpp"
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
SegmentList
::
SegmentList
(
ICanonicalUrl
*
parent
)
:
SegmentList
::
SegmentList
(
SegmentInformation
*
parent
)
:
SegmentInfoCommon
(
parent
)
SegmentInfoCommon
(
parent
)
,
TimescaleAble
(
parent
)
{
{
timescale
.
Set
(
0
);
}
}
SegmentList
::~
SegmentList
()
SegmentList
::~
SegmentList
()
{
{
...
...
modules/demux/dash/mpd/SegmentList.h
View file @
8c6bf181
...
@@ -39,17 +39,18 @@ namespace dash
...
@@ -39,17 +39,18 @@ namespace dash
{
{
namespace
mpd
namespace
mpd
{
{
class
SegmentList
:
public
SegmentInfoCommon
class
SegmentInformation
;
class
SegmentList
:
public
SegmentInfoCommon
,
public
TimescaleAble
{
{
public:
public:
SegmentList
(
ICanonicalUrl
*
=
NULL
);
SegmentList
(
SegmentInformation
*
=
NULL
);
virtual
~
SegmentList
();
virtual
~
SegmentList
();
const
std
::
vector
<
Segment
*>&
getSegments
()
const
;
const
std
::
vector
<
Segment
*>&
getSegments
()
const
;
void
addSegment
(
Segment
*
seg
);
void
addSegment
(
Segment
*
seg
);
Property
<
uint64_t
>
timescale
;
private:
private:
std
::
vector
<
Segment
*>
segments
;
std
::
vector
<
Segment
*>
segments
;
};
};
...
...
modules/demux/dash/mpd/SegmentTemplate.cpp
View file @
8c6bf181
...
@@ -49,12 +49,11 @@ Url BaseSegmentTemplate::getUrlSegment() const
...
@@ -49,12 +49,11 @@ Url BaseSegmentTemplate::getUrlSegment() const
return
ret
;
return
ret
;
}
}
MediaSegmentTemplate
::
MediaSegmentTemplate
(
ICanonicalUrl
*
parent
)
:
MediaSegmentTemplate
::
MediaSegmentTemplate
(
SegmentInformation
*
parent
)
:
BaseSegmentTemplate
(
parent
),
Timelineable
()
BaseSegmentTemplate
(
parent
),
Timelineable
()
,
TimescaleAble
(
parent
)
{
{
debugName
=
"SegmentTemplate"
;
debugName
=
"SegmentTemplate"
;
classId
=
Segment
::
CLASSID_SEGMENT
;
classId
=
Segment
::
CLASSID_SEGMENT
;
timescale
.
Set
(
0
);
startNumber
.
Set
(
0
);
startNumber
.
Set
(
0
);
initialisationSegment
.
Set
(
NULL
);
initialisationSegment
.
Set
(
NULL
);
}
}
...
...
modules/demux/dash/mpd/SegmentTemplate.h
View file @
8c6bf181
...
@@ -44,12 +44,12 @@ namespace dash
...
@@ -44,12 +44,12 @@ namespace dash
class
MediaSegmentTemplate
:
public
BaseSegmentTemplate
,
class
MediaSegmentTemplate
:
public
BaseSegmentTemplate
,
public
Initializable
<
InitSegmentTemplate
>
,
public
Initializable
<
InitSegmentTemplate
>
,
public
Timelineable
public
Timelineable
,
public
TimescaleAble
{
{
public:
public:
MediaSegmentTemplate
(
ICanonicalUrl
*
=
NULL
);
MediaSegmentTemplate
(
SegmentInformation
*
=
NULL
);
Property
<
size_t
>
startNumber
;
Property
<
size_t
>
startNumber
;
Property
<
uint64_t
>
timescale
;
};
};
class
InitSegmentTemplate
:
public
BaseSegmentTemplate
class
InitSegmentTemplate
:
public
BaseSegmentTemplate
...
...
modules/demux/dash/mpd/Url.cpp
View file @
8c6bf181
...
@@ -116,9 +116,7 @@ size_t Url::Component::getSegmentNumber(size_t index, const Representation *rep)
...
@@ -116,9 +116,7 @@ size_t Url::Component::getSegmentNumber(size_t index, const Representation *rep)
mtime_t
streamstart
=
rep
->
getMPD
()
->
availabilityStartTime
.
Get
();
mtime_t
streamstart
=
rep
->
getMPD
()
->
availabilityStartTime
.
Get
();
streamstart
+=
rep
->
getPeriodStart
();
streamstart
+=
rep
->
getPeriodStart
();
mtime_t
duration
=
templ
->
duration
.
Get
();
mtime_t
duration
=
templ
->
duration
.
Get
();
uint64_t
timescale
=
templ
->
timescale
.
Get
()
?
uint64_t
timescale
=
templ
->
inheritTimescale
();
templ
->
timescale
.
Get
()
:
rep
->
getTimescale
();
if
(
duration
&&
timescale
)
if
(
duration
&&
timescale
)
index
+=
(
playbackstart
-
streamstart
)
*
timescale
/
duration
;
index
+=
(
playbackstart
-
streamstart
)
*
timescale
/
duration
;
}
}
...
...
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