Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
6c8bc5c2
Commit
6c8bc5c2
authored
Dec 11, 2014
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: dash: build urls using class
We'll need this for templates
parent
26beaad6
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
228 additions
and
24 deletions
+228
-24
modules/stream_filter/Makefile.am
modules/stream_filter/Makefile.am
+2
-0
modules/stream_filter/dash/mpd/AdaptationSet.cpp
modules/stream_filter/dash/mpd/AdaptationSet.cpp
+1
-1
modules/stream_filter/dash/mpd/AdaptationSet.h
modules/stream_filter/dash/mpd/AdaptationSet.h
+1
-1
modules/stream_filter/dash/mpd/ICanonicalUrl.hpp
modules/stream_filter/dash/mpd/ICanonicalUrl.hpp
+4
-4
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+4
-1
modules/stream_filter/dash/mpd/MPD.cpp
modules/stream_filter/dash/mpd/MPD.cpp
+3
-4
modules/stream_filter/dash/mpd/MPD.h
modules/stream_filter/dash/mpd/MPD.h
+1
-1
modules/stream_filter/dash/mpd/Period.cpp
modules/stream_filter/dash/mpd/Period.cpp
+1
-1
modules/stream_filter/dash/mpd/Period.h
modules/stream_filter/dash/mpd/Period.h
+1
-1
modules/stream_filter/dash/mpd/Representation.cpp
modules/stream_filter/dash/mpd/Representation.cpp
+2
-2
modules/stream_filter/dash/mpd/Representation.h
modules/stream_filter/dash/mpd/Representation.h
+1
-1
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.cpp
+2
-2
modules/stream_filter/dash/mpd/Segment.h
modules/stream_filter/dash/mpd/Segment.h
+3
-2
modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
+2
-2
modules/stream_filter/dash/mpd/SegmentInfoCommon.h
modules/stream_filter/dash/mpd/SegmentInfoCommon.h
+1
-1
modules/stream_filter/dash/mpd/Url.cpp
modules/stream_filter/dash/mpd/Url.cpp
+135
-0
modules/stream_filter/dash/mpd/Url.hpp
modules/stream_filter/dash/mpd/Url.hpp
+64
-0
No files found.
modules/stream_filter/Makefile.am
View file @
6c8bc5c2
...
...
@@ -80,6 +80,8 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/mpd/SegmentTimeline.h
\
stream_filter/dash/mpd/TrickModeType.cpp
\
stream_filter/dash/mpd/TrickModeType.h
\
stream_filter/dash/mpd/Url.cpp
\
stream_filter/dash/mpd/Url.hpp
\
stream_filter/dash/mp4/AtomsReader.cpp
\
stream_filter/dash/mp4/AtomsReader.hpp
\
stream_filter/dash/xml/DOMHelper.cpp
\
...
...
modules/stream_filter/dash/mpd/AdaptationSet.cpp
View file @
6c8bc5c2
...
...
@@ -113,7 +113,7 @@ bool AdaptationSet::getBitstreamSwitching () const
return
this
->
isBitstreamSwitching
;
}
std
::
string
AdaptationSet
::
getUrlSegment
()
const
Url
AdaptationSet
::
getUrlSegment
()
const
{
return
getParentUrlSegment
();
}
modules/stream_filter/dash/mpd/AdaptationSet.h
View file @
6c8bc5c2
...
...
@@ -56,7 +56,7 @@ namespace dash
void
setBitstreamSwitching
(
bool
value
);
bool
getBitstreamSwitching
()
const
;
void
addRepresentation
(
Representation
*
rep
);
virtual
std
::
string
getUrlSegment
()
const
;
/* reimpl */
virtual
Url
getUrlSegment
()
const
;
/* reimpl */
private:
bool
subsegmentAlignmentFlag
;
...
...
modules/stream_filter/dash/mpd/ICanonicalUrl.hpp
View file @
6c8bc5c2
...
...
@@ -20,7 +20,7 @@
#ifndef CANONICALURL_HPP
#define CANONICALURL_HPP
#include
<string>
#include
"Url.hpp"
namespace
dash
{
...
...
@@ -30,12 +30,12 @@ namespace dash
{
public:
ICanonicalUrl
(
const
ICanonicalUrl
*
parent
=
NULL
)
{
parentUrlMember
=
parent
;
}
virtual
std
::
string
getUrlSegment
()
const
=
0
;
virtual
Url
getUrlSegment
()
const
=
0
;
protected:
std
::
string
getParentUrlSegment
()
const
{
Url
getParentUrlSegment
()
const
{
return
(
parentUrlMember
)
?
parentUrlMember
->
getUrlSegment
()
:
std
::
string
();
:
Url
();
}
private:
...
...
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
View file @
6c8bc5c2
...
...
@@ -101,6 +101,9 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
if
(
!
baseUrls
.
empty
())
currentRepresentation
->
setBaseUrl
(
new
BaseUrl
(
baseUrls
.
front
()
->
getText
()
)
);
if
(
repNode
->
hasAttribute
(
"id"
))
currentRepresentation
->
setId
(
repNode
->
getAttributeValue
(
"id"
));
if
(
repNode
->
hasAttribute
(
"width"
))
this
->
currentRepresentation
->
setWidth
(
atoi
(
repNode
->
getAttributeValue
(
"width"
).
c_str
()));
...
...
@@ -242,7 +245,7 @@ void IsoffMainParser::print ()
static_cast
<
std
::
string
>
(
mpd
->
getProfile
()).
c_str
(),
mpd
->
getDuration
(),
mpd
->
getMinBufferTime
());
msg_Dbg
(
p_stream
,
"BaseUrl=%s"
,
mpd
->
getUrlSegment
().
c_str
());
msg_Dbg
(
p_stream
,
"BaseUrl=%s"
,
mpd
->
getUrlSegment
().
toString
().
c_str
());
std
::
vector
<
Period
*>::
const_iterator
i
;
for
(
i
=
mpd
->
getPeriods
().
begin
();
i
!=
mpd
->
getPeriods
().
end
();
i
++
)
...
...
modules/stream_filter/dash/mpd/MPD.cpp
View file @
6c8bc5c2
...
...
@@ -165,16 +165,15 @@ Profile MPD::getProfile() const
{
return
profile
;
}
std
::
string
MPD
::
getUrlSegment
()
const
Url
MPD
::
getUrlSegment
()
const
{
if
(
!
baseUrls
.
empty
())
return
baseUrls
.
front
()
->
getUrl
();
return
Url
(
baseUrls
.
front
()
->
getUrl
()
)
;
else
{
std
::
stringstream
ss
;
ss
<<
stream
->
psz_access
<<
"://"
<<
Helper
::
getDirectoryPath
(
stream
->
psz_path
)
<<
"/"
;
return
ss
.
str
();
return
Url
(
ss
.
str
()
)
;
}
}
...
...
modules/stream_filter/dash/mpd/MPD.h
View file @
6c8bc5c2
...
...
@@ -66,7 +66,7 @@ namespace dash
void
addBaseUrl
(
BaseUrl
*
url
);
void
setProgramInformation
(
ProgramInformation
*
progInfo
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
Url
getUrlSegment
()
const
;
/* impl */
vlc_object_t
*
getVLCObject
()
const
;
virtual
const
std
::
vector
<
Period
*>&
getPeriods
()
const
;
...
...
modules/stream_filter/dash/mpd/Period.cpp
View file @
6c8bc5c2
...
...
@@ -78,7 +78,7 @@ AdaptationSet * Period::getAdaptationSet(Streams::Type type) const
return
NULL
;
}
std
::
string
Period
::
getUrlSegment
()
const
Url
Period
::
getUrlSegment
()
const
{
return
getParentUrlSegment
();
}
modules/stream_filter/dash/mpd/Period.h
View file @
6c8bc5c2
...
...
@@ -47,7 +47,7 @@ namespace dash
AdaptationSet
*
getAdaptationSet
(
Streams
::
Type
)
const
;
void
addAdaptationSet
(
AdaptationSet
*
AdaptationSet
);
virtual
std
::
string
getUrlSegment
()
const
;
/* reimpl */
virtual
Url
getUrlSegment
()
const
;
/* reimpl */
private:
std
::
vector
<
AdaptationSet
*>
adaptationSets
;
...
...
modules/stream_filter/dash/mpd/Representation.cpp
View file @
6c8bc5c2
...
...
@@ -218,9 +218,9 @@ std::vector<std::string> Representation::toString() const
return
ret
;
}
std
::
string
Representation
::
getUrlSegment
()
const
Url
Representation
::
getUrlSegment
()
const
{
std
::
string
ret
=
getParentUrlSegment
();
Url
ret
=
getParentUrlSegment
();
if
(
baseUrl
)
ret
.
append
(
baseUrl
->
getUrl
());
return
ret
;
...
...
modules/stream_filter/dash/mpd/Representation.h
View file @
6c8bc5c2
...
...
@@ -87,7 +87,7 @@ namespace dash
MPD
*
getMPD
()
const
;
std
::
vector
<
std
::
string
>
toString
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
Url
getUrlSegment
()
const
;
/* impl */
class
SplitPoint
{
...
...
modules/stream_filter/dash/mpd/Segment.cpp
View file @
6c8bc5c2
...
...
@@ -108,7 +108,7 @@ size_t ISegment::getOffset() const
std
::
string
ISegment
::
toString
()
const
{
std
::
stringstream
ss
(
" "
);
ss
<<
debugName
<<
" url="
<<
getUrlSegment
();
ss
<<
debugName
<<
" url="
<<
getUrlSegment
()
.
toString
()
;
if
(
startByte
!=
endByte
)
ss
<<
" @"
<<
startByte
<<
".."
<<
endByte
;
return
ss
.
str
();
...
...
@@ -263,7 +263,7 @@ SubSegment::SubSegment(Segment *main, size_t start, size_t end) :
classId
=
CLASSID_SUBSEGMENT
;
}
std
::
string
SubSegment
::
getUrlSegment
()
const
Url
SubSegment
::
getUrlSegment
()
const
{
return
getParentUrlSegment
();
}
...
...
modules/stream_filter/dash/mpd/Segment.h
View file @
6c8bc5c2
...
...
@@ -88,9 +88,10 @@ namespace dash
{
public:
Segment
(
Representation
*
parent
);
explicit
Segment
(
ICanonicalUrl
*
parent
);
~
Segment
();
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
Url
getUrlSegment
()
const
;
/* impl */
virtual
dash
::
http
::
Chunk
*
toChunk
();
virtual
std
::
vector
<
ISegment
*>
subSegments
();
virtual
Representation
*
getRepresentation
()
const
;
...
...
@@ -133,7 +134,7 @@ namespace dash
{
public:
SubSegment
(
Segment
*
,
size_t
start
,
size_t
end
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
Url
getUrlSegment
()
const
;
/* impl */
virtual
std
::
vector
<
ISegment
*>
subSegments
();
virtual
Representation
*
getRepresentation
()
const
;
static
const
int
CLASSID_SUBSEGMENT
=
4
;
...
...
modules/stream_filter/dash/mpd/SegmentInfoCommon.cpp
View file @
6c8bc5c2
...
...
@@ -96,9 +96,9 @@ void SegmentInfoCommon::setSegmentTimeline( const SegmentTimeline *segTl )
this
->
segmentTimeline
=
segTl
;
}
std
::
string
SegmentInfoCommon
::
getUrlSegment
()
const
Url
SegmentInfoCommon
::
getUrlSegment
()
const
{
std
::
string
ret
=
getParentUrlSegment
();
Url
ret
=
getParentUrlSegment
();
if
(
!
baseURLs
.
empty
())
ret
.
append
(
baseURLs
.
front
());
return
ret
;
...
...
modules/stream_filter/dash/mpd/SegmentInfoCommon.h
View file @
6c8bc5c2
...
...
@@ -51,7 +51,7 @@ namespace dash
void
appendBaseURL
(
const
std
::
string
&
url
);
const
SegmentTimeline
*
getSegmentTimeline
()
const
;
void
setSegmentTimeline
(
const
SegmentTimeline
*
segTl
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
Url
getUrlSegment
()
const
;
/* impl */
private:
time_t
duration
;
...
...
modules/stream_filter/dash/mpd/Url.cpp
0 → 100644
View file @
6c8bc5c2
/*
* Url.cpp
*****************************************************************************
* 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.
*****************************************************************************/
#include "Url.hpp"
#include "Representation.h"
#include "SegmentTemplate.h"
#include <sstream>
using
namespace
dash
::
mpd
;
Url
::
Url
()
{
}
Url
::
Url
(
const
Component
&
comp
)
{
prepend
(
comp
);
}
Url
::
Url
(
const
std
::
string
&
str
)
{
prepend
(
Component
(
str
));
}
Url
&
Url
::
prepend
(
const
Component
&
comp
)
{
components
.
insert
(
components
.
begin
(),
comp
);
return
*
this
;
}
Url
&
Url
::
append
(
const
Component
&
comp
)
{
components
.
push_back
(
comp
);
return
*
this
;
}
Url
&
Url
::
prepend
(
const
Url
&
url
)
{
components
.
insert
(
components
.
begin
(),
url
.
components
.
begin
(),
url
.
components
.
end
());
return
*
this
;
}
Url
&
Url
::
append
(
const
Url
&
url
)
{
components
.
insert
(
components
.
end
(),
url
.
components
.
begin
(),
url
.
components
.
end
());
return
*
this
;
}
std
::
string
Url
::
toString
()
const
{
return
toString
(
0
,
NULL
);
}
std
::
string
Url
::
toString
(
size_t
index
,
const
Representation
*
rep
)
const
{
std
::
string
ret
;
std
::
vector
<
Component
>::
const_iterator
it
;
for
(
it
=
components
.
begin
();
it
!=
components
.
end
();
it
++
)
{
ret
.
append
((
*
it
).
contextualize
(
index
,
rep
));
}
return
ret
;
}
Url
::
Component
::
Component
(
const
std
::
string
&
str
,
const
SegmentTemplate
*
templ_
)
{
component
=
str
;
templ
=
templ_
;
}
std
::
string
Url
::
Component
::
contextualize
(
size_t
index
,
const
Representation
*
rep
)
const
{
std
::
string
ret
(
component
);
if
(
!
rep
||
!
templ
)
return
ret
;
size_t
pos
=
ret
.
find
(
"$Time$"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
stringstream
ss
;
ss
<<
(
templ
->
getDuration
()
*
index
);
ret
.
replace
(
pos
,
std
::
string
(
"$Time$"
).
length
(),
ss
.
str
());
}
pos
=
ret
.
find
(
"$Index$"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
stringstream
ss
;
ss
<<
index
;
ret
.
replace
(
pos
,
std
::
string
(
"$Index$"
).
length
(),
ss
.
str
());
}
pos
=
ret
.
find
(
"$Number$"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
stringstream
ss
;
ss
<<
index
;
ret
.
replace
(
pos
,
std
::
string
(
"$Number$"
).
length
(),
ss
.
str
());
}
pos
=
ret
.
find
(
"$Bandwidth$"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
stringstream
ss
;
ss
<<
rep
->
getBandwidth
();
ret
.
replace
(
pos
,
std
::
string
(
"$Bandwidth$"
).
length
(),
ss
.
str
());
}
pos
=
ret
.
find
(
"$RepresentationID$"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
stringstream
ss
;
ss
<<
rep
->
getId
();
ret
.
replace
(
pos
,
std
::
string
(
"$RepresentationID$"
).
length
(),
ss
.
str
());
}
return
ret
;
}
modules/stream_filter/dash/mpd/Url.hpp
0 → 100644
View file @
6c8bc5c2
/*
* Url.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 URL_HPP
#define URL_HPP
#include <string>
#include <vector>
namespace
dash
{
namespace
mpd
{
class
Representation
;
class
SegmentTemplate
;
class
Url
{
public:
class
Component
{
friend
class
Url
;
public:
Component
(
const
std
::
string
&
,
const
SegmentTemplate
*
=
NULL
);
protected:
std
::
string
contextualize
(
size_t
,
const
Representation
*
)
const
;
std
::
string
component
;
const
SegmentTemplate
*
templ
;
};
Url
();
Url
(
const
Component
&
);
explicit
Url
(
const
std
::
string
&
);
Url
&
prepend
(
const
Component
&
);
Url
&
append
(
const
Component
&
);
Url
&
append
(
const
Url
&
);
Url
&
prepend
(
const
Url
&
);
std
::
string
toString
(
size_t
,
const
Representation
*
)
const
;
std
::
string
toString
()
const
;
private:
std
::
vector
<
Component
>
components
;
};
}
}
#endif // URL_HPP
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