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
7081fb2b
Commit
7081fb2b
authored
Nov 19, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: dash: build URL hierarchically
parent
14f9d9d4
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
134 additions
and
110 deletions
+134
-110
modules/stream_filter/Makefile.am
modules/stream_filter/Makefile.am
+1
-0
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
...filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+1
-1
modules/stream_filter/dash/mpd/BasicCMParser.cpp
modules/stream_filter/dash/mpd/BasicCMParser.cpp
+3
-4
modules/stream_filter/dash/mpd/ICanonicalUrl.hpp
modules/stream_filter/dash/mpd/ICanonicalUrl.hpp
+47
-0
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+2
-10
modules/stream_filter/dash/mpd/MPD.cpp
modules/stream_filter/dash/mpd/MPD.cpp
+9
-6
modules/stream_filter/dash/mpd/MPD.h
modules/stream_filter/dash/mpd/MPD.h
+4
-2
modules/stream_filter/dash/mpd/Representation.cpp
modules/stream_filter/dash/mpd/Representation.cpp
+11
-7
modules/stream_filter/dash/mpd/Representation.h
modules/stream_filter/dash/mpd/Representation.h
+6
-3
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.cpp
+10
-27
modules/stream_filter/dash/mpd/Segment.h
modules/stream_filter/dash/mpd/Segment.h
+3
-4
modules/stream_filter/dash/mpd/SegmentInfo.cpp
modules/stream_filter/dash/mpd/SegmentInfo.cpp
+2
-1
modules/stream_filter/dash/mpd/SegmentInfo.h
modules/stream_filter/dash/mpd/SegmentInfo.h
+2
-1
modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
+10
-6
modules/stream_filter/dash/mpd/SegmentInfoCommon.h
modules/stream_filter/dash/mpd/SegmentInfoCommon.h
+4
-3
modules/stream_filter/dash/mpd/SegmentList.cpp
modules/stream_filter/dash/mpd/SegmentList.cpp
+2
-1
modules/stream_filter/dash/mpd/SegmentList.h
modules/stream_filter/dash/mpd/SegmentList.h
+2
-1
modules/stream_filter/dash/mpd/SegmentTemplate.cpp
modules/stream_filter/dash/mpd/SegmentTemplate.cpp
+14
-29
modules/stream_filter/dash/mpd/SegmentTemplate.h
modules/stream_filter/dash/mpd/SegmentTemplate.h
+1
-4
No files found.
modules/stream_filter/Makefile.am
View file @
7081fb2b
...
@@ -44,6 +44,7 @@ libdash_plugin_la_SOURCES = \
...
@@ -44,6 +44,7 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/mpd/ContentDescription.h
\
stream_filter/dash/mpd/ContentDescription.h
\
stream_filter/dash/mpd/MPDManager.hpp
\
stream_filter/dash/mpd/MPDManager.hpp
\
stream_filter/dash/mpd/MPDManager.cpp
\
stream_filter/dash/mpd/MPDManager.cpp
\
stream_filter/dash/mpd/ICanonicalUrl.hpp
\
stream_filter/dash/mpd/IMPDParser.cpp
\
stream_filter/dash/mpd/IMPDParser.cpp
\
stream_filter/dash/mpd/IMPDParser.h
\
stream_filter/dash/mpd/IMPDParser.h
\
stream_filter/dash/mpd/IsoffMainParser.cpp
\
stream_filter/dash/mpd/IsoffMainParser.cpp
\
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
View file @
7081fb2b
...
@@ -54,7 +54,7 @@ Chunk* AlwaysBestAdaptationLogic::getNextChunk()
...
@@ -54,7 +54,7 @@ Chunk* AlwaysBestAdaptationLogic::getNextChunk()
if
(
this
->
count
<
this
->
schedule
.
size
()
)
if
(
this
->
count
<
this
->
schedule
.
size
()
)
{
{
Chunk
*
chunk
=
new
Chunk
();
Chunk
*
chunk
=
new
Chunk
();
chunk
->
setUrl
(
this
->
schedule
.
at
(
this
->
count
)
->
get
SourceUrl
());
chunk
->
setUrl
(
this
->
schedule
.
at
(
this
->
count
)
->
get
UrlSegment
());
this
->
count
++
;
this
->
count
++
;
return
chunk
;
return
chunk
;
}
}
...
...
modules/stream_filter/dash/mpd/BasicCMParser.cpp
View file @
7081fb2b
...
@@ -263,7 +263,7 @@ void BasicCMParser::setRepresentations (Node *root, AdaptationSet *group)
...
@@ -263,7 +263,7 @@ void BasicCMParser::setRepresentations (Node *root, AdaptationSet *group)
{
{
const
std
::
map
<
std
::
string
,
std
::
string
>
attributes
=
representations
.
at
(
i
)
->
getAttributes
();
const
std
::
map
<
std
::
string
,
std
::
string
>
attributes
=
representations
.
at
(
i
)
->
getAttributes
();
Representation
*
rep
=
new
Representation
;
Representation
*
rep
=
new
Representation
(
getMPD
())
;
rep
->
setParentGroup
(
group
);
rep
->
setParentGroup
(
group
);
this
->
currentRepresentation
=
rep
;
this
->
currentRepresentation
=
rep
;
if
(
this
->
parseCommonAttributesElements
(
representations
.
at
(
i
),
rep
,
group
)
==
false
)
if
(
this
->
parseCommonAttributesElements
(
representations
.
at
(
i
),
rep
,
group
)
==
false
)
...
@@ -326,7 +326,7 @@ bool BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
...
@@ -326,7 +326,7 @@ bool BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
if
(
segmentInfo
)
if
(
segmentInfo
)
{
{
SegmentInfo
*
info
=
new
SegmentInfo
;
SegmentInfo
*
info
=
new
SegmentInfo
(
rep
)
;
this
->
parseSegmentInfoCommon
(
segmentInfo
,
info
);
this
->
parseSegmentInfoCommon
(
segmentInfo
,
info
);
//If we don't have any segment, there's no point keeping this SegmentInfo.
//If we don't have any segment, there's no point keeping this SegmentInfo.
if
(
this
->
setSegments
(
segmentInfo
,
info
)
==
false
)
if
(
this
->
setSegments
(
segmentInfo
,
info
)
==
false
)
...
@@ -427,8 +427,7 @@ bool BasicCMParser::setSegments (Node *root, SegmentInfo *info)
...
@@ -427,8 +427,7 @@ bool BasicCMParser::setSegments (Node *root, SegmentInfo *info)
Segment
*
seg
=
parseSegment
(
segments
.
at
(
i
)
);
Segment
*
seg
=
parseSegment
(
segments
.
at
(
i
)
);
if
(
seg
==
NULL
)
if
(
seg
==
NULL
)
continue
;
continue
;
if
(
seg
->
getSourceUrl
().
empty
()
==
false
)
info
->
addSegment
(
seg
);
info
->
addSegment
(
seg
);
}
}
return
true
;
return
true
;
}
}
...
...
modules/stream_filter/dash/mpd/ICanonicalUrl.hpp
0 → 100644
View file @
7081fb2b
/*
* ICanonicalUrl.hpp
*****************************************************************************
* Copyright (C) 2014 - VideoLAN Authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CANONICALURL_HPP
#define CANONICALURL_HPP
#include <string>
namespace
dash
{
namespace
mpd
{
class
ICanonicalUrl
{
public:
ICanonicalUrl
(
const
ICanonicalUrl
*
parent
=
NULL
)
{
parentUrlMember
=
parent
;
}
virtual
std
::
string
getUrlSegment
()
const
=
0
;
protected:
std
::
string
getParentUrlSegment
()
const
{
return
(
parentUrlMember
)
?
parentUrlMember
->
getUrlSegment
()
:
std
::
string
();
}
private:
const
ICanonicalUrl
*
parentUrlMember
;
};
}
}
#endif // CANONICALURL_HPP
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
View file @
7081fb2b
...
@@ -84,7 +84,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
...
@@ -84,7 +84,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
for
(
size_t
i
=
0
;
i
<
representations
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
representations
.
size
();
i
++
)
{
{
this
->
currentRepresentation
=
new
Representation
;
this
->
currentRepresentation
=
new
Representation
(
getMPD
())
;
Node
*
repNode
=
representations
.
at
(
i
);
Node
*
repNode
=
representations
.
at
(
i
);
std
::
vector
<
Node
*>
baseUrls
=
DOMHelper
::
getChildElementByTagName
(
repNode
,
"BaseURL"
);
std
::
vector
<
Node
*>
baseUrls
=
DOMHelper
::
getChildElementByTagName
(
repNode
,
"BaseURL"
);
...
@@ -147,9 +147,6 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
...
@@ -147,9 +147,6 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
seg
->
setByteRange
(
atoi
(
range
.
substr
(
0
,
pos
).
c_str
()),
atoi
(
range
.
substr
(
pos
+
1
,
range
.
size
()).
c_str
()));
seg
->
setByteRange
(
atoi
(
range
.
substr
(
0
,
pos
).
c_str
()),
atoi
(
range
.
substr
(
pos
+
1
,
range
.
size
()).
c_str
()));
}
}
for
(
size_t
i
=
0
;
i
<
this
->
mpd
->
getBaseUrls
().
size
();
i
++
)
seg
->
addBaseUrl
(
this
->
mpd
->
getBaseUrls
().
at
(
i
));
base
->
addInitSegment
(
seg
);
base
->
addInitSegment
(
seg
);
}
}
}
}
...
@@ -169,9 +166,6 @@ void IsoffMainParser::setSegments (dash::xml::Node *segListNode, Segme
...
@@ -169,9 +166,6 @@ void IsoffMainParser::setSegments (dash::xml::Node *segListNode, Segme
seg
->
setByteRange
(
atoi
(
range
.
substr
(
0
,
pos
).
c_str
()),
atoi
(
range
.
substr
(
pos
+
1
,
range
.
size
()).
c_str
()));
seg
->
setByteRange
(
atoi
(
range
.
substr
(
0
,
pos
).
c_str
()),
atoi
(
range
.
substr
(
pos
+
1
,
range
.
size
()).
c_str
()));
}
}
for
(
size_t
j
=
0
;
j
<
this
->
mpd
->
getBaseUrls
().
size
();
j
++
)
seg
->
addBaseUrl
(
this
->
mpd
->
getBaseUrls
().
at
(
j
));
list
->
addSegment
(
seg
);
list
->
addSegment
(
seg
);
}
}
}
}
...
@@ -183,9 +177,7 @@ void IsoffMainParser::print ()
...
@@ -183,9 +177,7 @@ void IsoffMainParser::print ()
static_cast
<
std
::
string
>
(
mpd
->
getProfile
()).
c_str
(),
static_cast
<
std
::
string
>
(
mpd
->
getProfile
()).
c_str
(),
mpd
->
getDuration
(),
mpd
->
getDuration
(),
mpd
->
getMinBufferTime
());
mpd
->
getMinBufferTime
());
std
::
vector
<
BaseUrl
*>::
const_iterator
h
;
msg_Dbg
(
p_stream
,
"BaseUrl=%s"
,
mpd
->
getUrlSegment
().
c_str
());
for
(
h
=
mpd
->
getBaseUrls
().
begin
();
h
!=
mpd
->
getBaseUrls
().
end
();
h
++
)
msg_Dbg
(
p_stream
,
"BaseUrl=%s"
,
(
*
h
)
->
getUrl
().
c_str
());
std
::
vector
<
Period
*>::
const_iterator
i
;
std
::
vector
<
Period
*>::
const_iterator
i
;
for
(
i
=
mpd
->
getPeriods
().
begin
();
i
!=
mpd
->
getPeriods
().
end
();
i
++
)
for
(
i
=
mpd
->
getPeriods
().
begin
();
i
!=
mpd
->
getPeriods
().
end
();
i
++
)
...
...
modules/stream_filter/dash/mpd/MPD.cpp
View file @
7081fb2b
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
MPD
::
MPD
()
:
MPD
::
MPD
()
:
ICanonicalUrl
(),
profile
(
dash
::
mpd
::
Profile
::
Unknown
),
profile
(
dash
::
mpd
::
Profile
::
Unknown
),
live
(
false
),
live
(
false
),
availabilityStartTime
(
-
1
),
availabilityStartTime
(
-
1
),
...
@@ -58,12 +59,6 @@ const std::vector<Period*>& MPD::getPeriods () const
...
@@ -58,12 +59,6 @@ const std::vector<Period*>& MPD::getPeriods () const
return
this
->
periods
;
return
this
->
periods
;
}
}
const
std
::
vector
<
BaseUrl
*>&
MPD
::
getBaseUrls
()
const
{
return
this
->
baseUrls
;
}
time_t
MPD
::
getDuration
()
const
time_t
MPD
::
getDuration
()
const
{
{
return
this
->
duration
;
return
this
->
duration
;
...
@@ -167,3 +162,11 @@ void MPD::setProfile(Profile profile)
...
@@ -167,3 +162,11 @@ void MPD::setProfile(Profile profile)
{
{
this
->
profile
=
profile
;
this
->
profile
=
profile
;
}
}
std
::
string
MPD
::
getUrlSegment
()
const
{
if
(
!
baseUrls
.
empty
())
return
baseUrls
.
front
()
->
getUrl
();
else
return
std
::
string
();
}
modules/stream_filter/dash/mpd/MPD.h
View file @
7081fb2b
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "mpd/Period.h"
#include "mpd/Period.h"
#include "mpd/BaseUrl.h"
#include "mpd/BaseUrl.h"
#include "mpd/ICanonicalUrl.hpp"
#include "mpd/ProgramInformation.h"
#include "mpd/ProgramInformation.h"
#include "mpd/Profile.hpp"
#include "mpd/Profile.hpp"
...
@@ -38,7 +39,7 @@ namespace dash
...
@@ -38,7 +39,7 @@ namespace dash
{
{
namespace
mpd
namespace
mpd
{
{
class
MPD
class
MPD
:
public
ICanonicalUrl
{
{
public:
public:
MPD
();
MPD
();
...
@@ -60,7 +61,6 @@ namespace dash
...
@@ -60,7 +61,6 @@ namespace dash
void
setMinBufferTime
(
time_t
time
);
void
setMinBufferTime
(
time_t
time
);
time_t
getTimeShiftBufferDepth
()
const
;
time_t
getTimeShiftBufferDepth
()
const
;
void
setTimeShiftBufferDepth
(
time_t
depth
);
void
setTimeShiftBufferDepth
(
time_t
depth
);
const
std
::
vector
<
BaseUrl
*>&
getBaseUrls
()
const
;
const
std
::
vector
<
Period
*>&
getPeriods
()
const
;
const
std
::
vector
<
Period
*>&
getPeriods
()
const
;
const
ProgramInformation
*
getProgramInformation
()
const
;
const
ProgramInformation
*
getProgramInformation
()
const
;
...
@@ -68,6 +68,8 @@ namespace dash
...
@@ -68,6 +68,8 @@ namespace dash
void
addBaseUrl
(
BaseUrl
*
url
);
void
addBaseUrl
(
BaseUrl
*
url
);
void
setProgramInformation
(
ProgramInformation
*
progInfo
);
void
setProgramInformation
(
ProgramInformation
*
progInfo
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
private:
private:
Profile
profile
;
Profile
profile
;
bool
live
;
bool
live
;
...
...
modules/stream_filter/dash/mpd/Representation.cpp
View file @
7081fb2b
...
@@ -28,10 +28,12 @@
...
@@ -28,10 +28,12 @@
#include <cstdlib>
#include <cstdlib>
#include "Representation.h"
#include "Representation.h"
#include "mpd/MPD.h"
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
Representation
::
Representation
()
:
Representation
::
Representation
(
MPD
*
mpd
)
:
ICanonicalUrl
(
mpd
),
bandwidth
(
0
),
bandwidth
(
0
),
qualityRanking
(
-
1
),
qualityRanking
(
-
1
),
segmentInfo
(
NULL
),
segmentInfo
(
NULL
),
...
@@ -42,7 +44,6 @@ Representation::Representation () :
...
@@ -42,7 +44,6 @@ Representation::Representation () :
baseUrl
(
NULL
),
baseUrl
(
NULL
),
width
(
0
),
width
(
0
),
height
(
0
)
height
(
0
)
{
{
}
}
...
@@ -165,11 +166,6 @@ void Representation::setSegmentBase (SegmentBase *base)
...
@@ -165,11 +166,6 @@ void Representation::setSegmentBase (SegmentBase *base)
this
->
segmentBase
=
base
;
this
->
segmentBase
=
base
;
}
}
BaseUrl
*
Representation
::
getBaseUrl
()
const
{
return
baseUrl
;
}
void
Representation
::
setBaseUrl
(
BaseUrl
*
base
)
void
Representation
::
setBaseUrl
(
BaseUrl
*
base
)
{
{
baseUrl
=
base
;
baseUrl
=
base
;
...
@@ -210,3 +206,11 @@ std::vector<std::string> Representation::toString() const
...
@@ -210,3 +206,11 @@ std::vector<std::string> Representation::toString() const
}
}
return
ret
;
return
ret
;
}
}
std
::
string
Representation
::
getUrlSegment
()
const
{
std
::
string
ret
=
getParentUrlSegment
();
if
(
baseUrl
)
ret
.
append
(
baseUrl
->
getUrl
());
return
ret
;
}
modules/stream_filter/dash/mpd/Representation.h
View file @
7081fb2b
...
@@ -33,17 +33,20 @@
...
@@ -33,17 +33,20 @@
#include "mpd/SegmentBase.h"
#include "mpd/SegmentBase.h"
#include "mpd/SegmentList.h"
#include "mpd/SegmentList.h"
#include "mpd/BaseUrl.h"
#include "mpd/BaseUrl.h"
#include "mpd/ICanonicalUrl.hpp"
namespace
dash
namespace
dash
{
{
namespace
mpd
namespace
mpd
{
{
class
AdaptationSet
;
class
AdaptationSet
;
class
MPD
;
class
Representation
:
public
CommonAttributesElements
class
Representation
:
public
CommonAttributesElements
,
public
ICanonicalUrl
{
{
public:
public:
Representation
();
Representation
(
MPD
*
mpd
);
virtual
~
Representation
();
virtual
~
Representation
();
const
std
::
string
&
getId
()
const
;
const
std
::
string
&
getId
()
const
;
...
@@ -80,10 +83,10 @@ namespace dash
...
@@ -80,10 +83,10 @@ namespace dash
int
getWidth
()
const
;
int
getWidth
()
const
;
void
setHeight
(
int
height
);
void
setHeight
(
int
height
);
int
getHeight
()
const
;
int
getHeight
()
const
;
BaseUrl
*
getBaseUrl
()
const
;
void
setBaseUrl
(
BaseUrl
*
baseUrl
);
void
setBaseUrl
(
BaseUrl
*
baseUrl
);
std
::
vector
<
std
::
string
>
toString
()
const
;
std
::
vector
<
std
::
string
>
toString
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
private:
private:
uint64_t
bandwidth
;
uint64_t
bandwidth
;
...
...
modules/stream_filter/dash/mpd/Segment.cpp
View file @
7081fb2b
...
@@ -34,6 +34,7 @@ using namespace dash::mpd;
...
@@ -34,6 +34,7 @@ using namespace dash::mpd;
using
namespace
dash
::
http
;
using
namespace
dash
::
http
;
Segment
::
Segment
(
const
Representation
*
parent
)
:
Segment
::
Segment
(
const
Representation
*
parent
)
:
ICanonicalUrl
(
parent
),
startByte
(
-
1
),
startByte
(
-
1
),
endByte
(
-
1
),
endByte
(
-
1
),
parentRepresentation
(
parent
)
parentRepresentation
(
parent
)
...
@@ -45,11 +46,6 @@ Segment::Segment(const Representation *parent) :
...
@@ -45,11 +46,6 @@ Segment::Segment(const Representation *parent) :
this
->
size
=
-
1
;
this
->
size
=
-
1
;
}
}
std
::
string
Segment
::
getSourceUrl
()
const
{
return
this
->
sourceUrl
;
}
void
Segment
::
setSourceUrl
(
const
std
::
string
&
url
)
void
Segment
::
setSourceUrl
(
const
std
::
string
&
url
)
{
{
if
(
url
.
empty
()
==
false
)
if
(
url
.
empty
()
==
false
)
...
@@ -63,10 +59,6 @@ void Segment::done ()
...
@@ -63,10 +59,6 @@ void Segment::done ()
{
{
//Only used for a SegmentTemplate.
//Only used for a SegmentTemplate.
}
}
void
Segment
::
addBaseUrl
(
BaseUrl
*
url
)
{
this
->
baseUrls
.
push_back
(
url
);
}
void
Segment
::
setByteRange
(
int
start
,
int
end
)
void
Segment
::
setByteRange
(
int
start
,
int
end
)
{
{
...
@@ -85,24 +77,7 @@ dash::http::Chunk* Segment::toChunk ()
...
@@ -85,24 +77,7 @@ dash::http::Chunk* Segment::toChunk ()
chunk
->
setEndByte
(
this
->
endByte
);
chunk
->
setEndByte
(
this
->
endByte
);
}
}
if
(
this
->
baseUrls
.
size
()
>
0
)
chunk
->
setUrl
(
getUrlSegment
()
);
{
std
::
stringstream
ss
;
ss
<<
this
->
baseUrls
.
at
(
0
)
->
getUrl
()
<<
this
->
sourceUrl
;
chunk
->
setUrl
(
ss
.
str
());
ss
.
clear
();
for
(
size_t
i
=
1
;
i
<
this
->
baseUrls
.
size
();
i
++
)
{
ss
<<
this
->
baseUrls
.
at
(
i
)
->
getUrl
()
<<
this
->
sourceUrl
;
chunk
->
addOptionalUrl
(
ss
.
str
());
ss
.
clear
();
}
}
else
{
chunk
->
setUrl
(
this
->
sourceUrl
);
}
chunk
->
setBitrate
(
this
->
parentRepresentation
->
getBandwidth
());
chunk
->
setBitrate
(
this
->
parentRepresentation
->
getBandwidth
());
...
@@ -113,3 +88,11 @@ const Representation *Segment::getParentRepresentation() const
...
@@ -113,3 +88,11 @@ const Representation *Segment::getParentRepresentation() const
{
{
return
this
->
parentRepresentation
;
return
this
->
parentRepresentation
;
}
}
std
::
string
Segment
::
getUrlSegment
()
const
{
std
::
string
ret
=
getParentUrlSegment
();
if
(
!
sourceUrl
.
empty
())
ret
.
append
(
sourceUrl
);
return
ret
;
}
modules/stream_filter/dash/mpd/Segment.h
View file @
7081fb2b
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <sstream>
#include <sstream>
#include <vector>
#include <vector>
#include "mpd/BaseUrl.h"
#include "mpd/BaseUrl.h"
#include "mpd/ICanonicalUrl.hpp"
#include "http/Chunk.h"
#include "http/Chunk.h"
namespace
dash
namespace
dash
...
@@ -36,12 +37,11 @@ namespace dash
...
@@ -36,12 +37,11 @@ namespace dash
namespace
mpd
namespace
mpd
{
{
class
Representation
;
class
Representation
;
class
Segment
class
Segment
:
public
ICanonicalUrl
{
{
public:
public:
Segment
(
const
Representation
*
parent
);
Segment
(
const
Representation
*
parent
);
virtual
~
Segment
(){}
virtual
~
Segment
(){}
virtual
std
::
string
getSourceUrl
()
const
;
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
/**
/**
* @return true if the segment should be dropped after being read.
* @return true if the segment should be dropped after being read.
...
@@ -50,14 +50,13 @@ namespace dash
...
@@ -50,14 +50,13 @@ namespace dash
*/
*/
virtual
bool
isSingleShot
()
const
;
virtual
bool
isSingleShot
()
const
;
virtual
void
done
();
virtual
void
done
();
virtual
void
addBaseUrl
(
BaseUrl
*
url
);
virtual
void
setByteRange
(
int
start
,
int
end
);
virtual
void
setByteRange
(
int
start
,
int
end
);
virtual
dash
::
http
::
Chunk
*
toChunk
();
virtual
dash
::
http
::
Chunk
*
toChunk
();
const
Representation
*
getParentRepresentation
()
const
;
const
Representation
*
getParentRepresentation
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
protected:
protected:
std
::
string
sourceUrl
;
std
::
string
sourceUrl
;
std
::
vector
<
BaseUrl
*>
baseUrls
;
int
startByte
;
int
startByte
;
int
endByte
;
int
endByte
;
const
Representation
*
parentRepresentation
;
const
Representation
*
parentRepresentation
;
...
...
modules/stream_filter/dash/mpd/SegmentInfo.cpp
View file @
7081fb2b
...
@@ -29,7 +29,8 @@
...
@@ -29,7 +29,8 @@
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
SegmentInfo
::
SegmentInfo
()
:
SegmentInfo
::
SegmentInfo
(
ICanonicalUrl
*
parent
)
:
SegmentInfoCommon
(
parent
),
initSeg
(
NULL
)
initSeg
(
NULL
)
{
{
}
}
...
...
modules/stream_filter/dash/mpd/SegmentInfo.h
View file @
7081fb2b
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "mpd/Segment.h"
#include "mpd/Segment.h"
#include "mpd/SegmentInfoCommon.h"
#include "mpd/SegmentInfoCommon.h"
#include "ICanonicalUrl.hpp"
namespace
dash
namespace
dash
{
{
...
@@ -39,7 +40,7 @@ namespace dash
...
@@ -39,7 +40,7 @@ namespace dash
class
SegmentInfo
:
public
SegmentInfoCommon
class
SegmentInfo
:
public
SegmentInfoCommon
{
{
public:
public:
SegmentInfo
();
SegmentInfo
(
ICanonicalUrl
*
=
NULL
);
virtual
~
SegmentInfo
();
virtual
~
SegmentInfo
();
const
std
::
vector
<
Segment
*>&
getSegments
()
const
;
const
std
::
vector
<
Segment
*>&
getSegments
()
const
;
...
...
modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
View file @
7081fb2b
...
@@ -33,7 +33,8 @@
...
@@ -33,7 +33,8 @@
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
SegmentInfoCommon
::
SegmentInfoCommon
()
:
SegmentInfoCommon
::
SegmentInfoCommon
(
ICanonicalUrl
*
parent
)
:
ICanonicalUrl
(
parent
),
duration
(
-
1
),
duration
(
-
1
),
initialisationSegment
(
NULL
),
initialisationSegment
(
NULL
),
segmentTimeline
(
NULL
)
segmentTimeline
(
NULL
)
...
@@ -79,11 +80,6 @@ void SegmentInfoCommon::setInitialisationSegment(Segment *seg)
...
@@ -79,11 +80,6 @@ void SegmentInfoCommon::setInitialisationSegment(Segment *seg)
this
->
initialisationSegment
=
seg
;
this
->
initialisationSegment
=
seg
;
}
}
const
std
::
list
<
std
::
string
>&
SegmentInfoCommon
::
getBaseURL
()
const
{
return
this
->
baseURLs
;
}
void
SegmentInfoCommon
::
appendBaseURL
(
const
std
::
string
&
url
)
void
SegmentInfoCommon
::
appendBaseURL
(
const
std
::
string
&
url
)
{
{
this
->
baseURLs
.
push_back
(
url
);
this
->
baseURLs
.
push_back
(
url
);
...
@@ -99,3 +95,11 @@ void SegmentInfoCommon::setSegmentTimeline( const SegmentTimeline *segTl )
...
@@ -99,3 +95,11 @@ void SegmentInfoCommon::setSegmentTimeline( const SegmentTimeline *segTl )
if
(
segTl
!=
NULL
)
if
(
segTl
!=
NULL
)
this
->
segmentTimeline
=
segTl
;
this
->
segmentTimeline
=
segTl
;
}
}
std
::
string
SegmentInfoCommon
::
getUrlSegment
()
const
{
std
::
string
ret
=
getParentUrlSegment
();
if
(
!
baseURLs
.
empty
())
ret
.
append
(
baseURLs
.
front
());
return
ret
;
}
modules/stream_filter/dash/mpd/SegmentInfoCommon.h
View file @
7081fb2b
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <string>
#include <string>
#include <list>
#include <list>
#include <ctime>
#include <ctime>
#include "ICanonicalUrl.hpp"
namespace
dash
namespace
dash
{
{
...
@@ -36,10 +37,10 @@ namespace dash
...
@@ -36,10 +37,10 @@ namespace dash
class
Segment
;
class
Segment
;
class
SegmentTimeline
;
class
SegmentTimeline
;
class
SegmentInfoCommon
class
SegmentInfoCommon
:
public
ICanonicalUrl
{
{
public:
public:
SegmentInfoCommon
();
SegmentInfoCommon
(
ICanonicalUrl
*
parent
=
NULL
);
virtual
~
SegmentInfoCommon
();
virtual
~
SegmentInfoCommon
();
time_t
getDuration
()
const
;
time_t
getDuration
()
const
;
void
setDuration
(
time_t
duration
);
void
setDuration
(
time_t
duration
);
...
@@ -47,10 +48,10 @@ namespace dash
...
@@ -47,10 +48,10 @@ namespace dash
void
setStartIndex
(
int
startIndex
);
void
setStartIndex
(
int
startIndex
);
Segment
*
getInitialisationSegment
()
const
;
Segment
*
getInitialisationSegment
()
const
;
void
setInitialisationSegment
(
Segment
*
seg
);
void
setInitialisationSegment
(
Segment
*
seg
);
const
std
::
list
<
std
::
string
>&
getBaseURL
()
const
;
void
appendBaseURL
(
const
std
::
string
&
url
);
void
appendBaseURL
(
const
std
::
string
&
url
);
const
SegmentTimeline
*
getSegmentTimeline
()
const
;
const
SegmentTimeline
*
getSegmentTimeline
()
const
;
void
setSegmentTimeline
(
const
SegmentTimeline
*
segTl
);
void
setSegmentTimeline
(
const
SegmentTimeline
*
segTl
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
private:
private:
time_t
duration
;
time_t
duration
;
...
...
modules/stream_filter/dash/mpd/SegmentList.cpp
View file @
7081fb2b
...
@@ -30,7 +30,8 @@
...
@@ -30,7 +30,8 @@
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
SegmentList
::
SegmentList
()
SegmentList
::
SegmentList
(
ICanonicalUrl
*
parent
)
:
SegmentInfo
(
parent
)
{
{
}
}
...
...
modules/stream_filter/dash/mpd/SegmentList.h
View file @
7081fb2b
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#define SEGMENTLIST_H_
#define SEGMENTLIST_H_
#include "mpd/SegmentInfo.h"
#include "mpd/SegmentInfo.h"
#include "mpd/ICanonicalUrl.hpp"
namespace
dash
namespace
dash
{
{
...
@@ -34,7 +35,7 @@ namespace dash
...
@@ -34,7 +35,7 @@ namespace dash
class
SegmentList
:
public
SegmentInfo
class
SegmentList
:
public
SegmentInfo
{
{
public:
public:
SegmentList
();
SegmentList
(
ICanonicalUrl
*
=
NULL
);
virtual
~
SegmentList
();
virtual
~
SegmentList
();
};
};
}
}
...
...
modules/stream_filter/dash/mpd/SegmentTemplate.cpp
View file @
7081fb2b
...
@@ -30,60 +30,45 @@
...
@@ -30,60 +30,45 @@
#include "AdaptationSet.h"
#include "AdaptationSet.h"
#include "SegmentInfoDefault.h"
#include "SegmentInfoDefault.h"
#include <cassert>
#include <cstring>
#include <iostream>
#include <sstream>
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
SegmentTemplate
::
SegmentTemplate
(
bool
containRuntimeIdentifier
,
SegmentTemplate
::
SegmentTemplate
(
bool
containRuntimeIdentifier
,
Representation
*
representation
)
:
Representation
*
representation
)
:
Segment
(
representation
),
Segment
(
representation
),
containRuntimeIdentifier
(
containRuntimeIdentifier
),
containRuntimeIdentifier
(
containRuntimeIdentifier
),
beginTime
(
std
::
string
::
npos
),
beginIndex
(
std
::
string
::
npos
),
currentSegmentIndex
(
0
)
currentSegmentIndex
(
0
)
{
{
}
}
std
::
string
SegmentTemplate
::
getSourceUrl
()
const
std
::
string
SegmentTemplate
::
getUrlSegment
()
const
{
{
std
::
string
res
=
this
->
sourceUrl
;
std
::
string
res
=
Segment
::
getUrlSegment
();
if
(
!
containRuntimeIdentifier
)
return
res
;
if
(
this
->
containRuntimeIdentifier
==
false
)
size_t
beginTime
=
res
.
find
(
"$Time$"
);
return
Segment
::
getSourceUrl
(
);
// size_t beginIndex = res.find( "$Index$"
);
// if ( this->beginIndex != std::string::npos )
if
(
beginTime
!=
std
::
string
::
npos
)
// std::cerr << "Unhandled identifier \"$Index$\"" << std::endl;
if
(
this
->
beginTime
!=
std
::
string
::
npos
)
{
{
//FIXME: This should use the current representation SegmentInfo
//FIXME: This should use the current representation SegmentInfo
//which "inherits" the SegmentInfoDefault values.
//which "inherits" the SegmentInfoDefault values.
if
(
this
->
parentRepresentation
->
getParentGroup
()
->
getSegmentInfoDefault
()
!=
NULL
&&
if
(
parentRepresentation
->
getParentGroup
()
->
getSegmentInfoDefault
()
!=
NULL
&&
this
->
parentRepresentation
->
getParentGroup
()
->
getSegmentInfoDefault
()
->
getSegmentTimeline
()
!=
NULL
)
parentRepresentation
->
getParentGroup
()
->
getSegmentInfoDefault
()
->
getSegmentTimeline
()
!=
NULL
)
{
{
const
SegmentTimeline
::
Element
*
el
=
this
->
parentRepresentation
->
getParentGroup
()
->
const
SegmentTimeline
::
Element
*
el
=
parentRepresentation
->
getParentGroup
()
->
getSegmentInfoDefault
()
->
getSegmentTimeline
()
->
getElement
(
this
->
currentSegmentIndex
);
getSegmentInfoDefault
()
->
getSegmentTimeline
()
->
getElement
(
currentSegmentIndex
);
if
(
el
!=
NULL
)
if
(
el
!=
NULL
)
{
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
el
->
t
;
oss
<<
el
->
t
;
res
.
replace
(
this
->
beginTime
,
strlen
(
"$Time$"
),
oss
.
str
()
);
res
.
replace
(
beginTime
,
strlen
(
"$Time$"
),
oss
.
str
()
);
}
}
}
}
}
}
return
res
;
}
void
SegmentTemplate
::
setSourceUrl
(
const
std
::
string
&
url
)
return
res
;
{
if
(
this
->
containRuntimeIdentifier
==
true
)
{
this
->
beginTime
=
url
.
find
(
"$Time$"
);
this
->
beginIndex
=
url
.
find
(
"$Index$"
);
}
Segment
::
setSourceUrl
(
url
);
}
}
bool
SegmentTemplate
::
isSingleShot
()
const
bool
SegmentTemplate
::
isSingleShot
()
const
...
...
modules/stream_filter/dash/mpd/SegmentTemplate.h
View file @
7081fb2b
...
@@ -36,14 +36,11 @@ namespace dash
...
@@ -36,14 +36,11 @@ namespace dash
{
{
public:
public:
SegmentTemplate
(
bool
containRuntimeIdentifier
,
Representation
*
rep
);
SegmentTemplate
(
bool
containRuntimeIdentifier
,
Representation
*
rep
);
virtual
std
::
string
getSourceUrl
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* reimpl */
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
virtual
bool
isSingleShot
()
const
;
virtual
bool
isSingleShot
()
const
;
virtual
void
done
();
virtual
void
done
();
private:
private:
bool
containRuntimeIdentifier
;
bool
containRuntimeIdentifier
;
size_t
beginTime
;
size_t
beginIndex
;
int
currentSegmentIndex
;
int
currentSegmentIndex
;
};
};
}
}
...
...
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