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
e9a42b2d
Commit
e9a42b2d
authored
Nov 26, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: dash: use dedicated segment classes and improve debug
parent
32402847
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
26 deletions
+97
-26
modules/stream_filter/dash/mpd/BasicCMParser.cpp
modules/stream_filter/dash/mpd/BasicCMParser.cpp
+6
-1
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+7
-2
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.cpp
+57
-17
modules/stream_filter/dash/mpd/Segment.h
modules/stream_filter/dash/mpd/Segment.h
+27
-6
No files found.
modules/stream_filter/dash/mpd/BasicCMParser.cpp
View file @
e9a42b2d
...
...
@@ -369,7 +369,12 @@ Segment* BasicCMParser::parseSegment( Node* node, bool init )
seg
=
new
SegmentTemplate
(
runtimeToken
,
this
->
currentRepresentation
);
}
else
seg
=
new
Segment
(
this
->
currentRepresentation
,
init
);
{
if
(
init
)
seg
=
new
InitSegment
(
currentRepresentation
);
else
seg
=
new
Segment
(
currentRepresentation
);
}
if
(
url
.
find
(
this
->
p_stream
->
psz_access
)
!=
0
)
//Relative url
url
=
this
->
url
+
url
;
seg
->
setSourceUrl
(
url
);
...
...
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
View file @
e9a42b2d
...
...
@@ -123,17 +123,22 @@ void IsoffMainParser::setSegmentBase (dash::xml::Node *repNode, Represent
if
(
segmentBase
.
front
()
->
hasAttribute
(
"indexRange"
))
{
SegmentList
*
list
=
new
SegmentList
();
Segment
*
seg
=
new
Segment
(
rep
)
;
Segment
*
seg
;
size_t
start
=
0
,
end
=
0
;
if
(
std
::
sscanf
(
segmentBase
.
front
()
->
getAttributeValue
(
"indexRange"
).
c_str
(),
"%"
PRIu64
"-%"
PRIu64
,
&
start
,
&
end
)
==
2
)
{
seg
=
new
IndexSegment
(
rep
);
seg
->
setByteRange
(
start
,
end
);
list
->
addSegment
(
seg
);
/* index must be before data, so data starts at index end */
seg
=
new
Segment
(
rep
);
seg
->
setByteRange
(
end
+
1
,
0
);
}
else
{
seg
=
new
Segment
(
rep
);
}
list
->
addSegment
(
seg
);
rep
->
setSegmentList
(
list
);
...
...
@@ -174,7 +179,7 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
if
(
initSeg
.
size
()
>
0
)
{
Segment
*
seg
=
new
Segment
(
currentRepresentation
,
true
);
Segment
*
seg
=
new
InitSegment
(
currentRepresentation
);
seg
->
setSourceUrl
(
initSeg
.
at
(
0
)
->
getAttributeValue
(
"sourceURL"
));
if
(
initSeg
.
at
(
0
)
->
hasAttribute
(
"range"
))
...
...
modules/stream_filter/dash/mpd/Segment.cpp
View file @
e9a42b2d
...
...
@@ -38,12 +38,17 @@ ISegment::ISegment(const ICanonicalUrl *parent):
startByte
(
0
),
endByte
(
0
)
{
debugName
=
"Segment"
;
}
dash
::
http
::
Chunk
*
ISegment
::
getChunk
()
{
return
new
SegmentChunk
(
this
);
}
dash
::
http
::
Chunk
*
ISegment
::
toChunk
()
{
Chunk
*
chunk
=
new
SegmentChunk
(
this
);
Chunk
*
chunk
=
getChunk
(
);
if
(
!
chunk
)
return
NULL
;
...
...
@@ -75,11 +80,15 @@ void ISegment::setByteRange(size_t start, size_t end)
std
::
string
ISegment
::
toString
()
const
{
return
std
::
string
(
" Segment url="
).
append
(
getUrlSegment
());
std
::
stringstream
ss
(
" "
);
ss
<<
debugName
<<
" url="
<<
getUrlSegment
();
if
(
startByte
!=
endByte
)
ss
<<
" @"
<<
startByte
<<
".."
<<
endByte
;
return
ss
.
str
();
}
ISegment
::
SegmentChunk
::
SegmentChunk
(
ISegment
*
segment_
)
:
Chunk
()
dash
::
http
::
Chunk
()
{
segment
=
segment_
;
}
...
...
@@ -89,11 +98,9 @@ void ISegment::SegmentChunk::onDownload(void *, size_t)
}
Segment
::
Segment
(
Representation
*
parent
,
bool
isinit
,
bool
tosplit
)
:
Segment
::
Segment
(
Representation
*
parent
)
:
ISegment
(
parent
),
parentRepresentation
(
parent
),
init
(
isinit
),
needssplit
(
tosplit
)
parentRepresentation
(
parent
)
{
assert
(
parent
!=
NULL
);
if
(
parent
->
getSegmentInfo
()
!=
NULL
&&
parent
->
getSegmentInfo
()
->
getDuration
()
>=
0
)
...
...
@@ -115,14 +122,28 @@ void Segment::setSourceUrl ( const std::string &url )
this
->
sourceUrl
=
url
;
}
bool
Segment
::
needsSplit
()
const
Representation
*
Segment
::
getRepresentation
()
const
{
return
needssplit
;
return
parentRepresentation
;
}
Representation
*
Segment
::
getRepresentation
()
const
std
::
string
Segment
::
toString
()
const
{
return
parentRepresentation
;
if
(
subsegments
.
empty
())
{
return
ISegment
::
toString
();
}
else
{
std
::
string
ret
;
std
::
vector
<
SubSegment
*>::
const_iterator
l
;
for
(
l
=
subsegments
.
begin
();
l
!=
subsegments
.
end
();
l
++
)
{
ret
.
append
(
(
*
l
)
->
toString
()
);
}
return
ret
;
}
}
std
::
string
Segment
::
getUrlSegment
()
const
...
...
@@ -157,19 +178,38 @@ std::vector<ISegment*> Segment::subSegments()
return
list
;
}
std
::
string
Segment
::
toString
()
const
InitSegment
::
InitSegment
(
Representation
*
parent
)
:
Segment
(
parent
)
{
debugName
=
"InitSegment"
;
}
IndexSegment
::
IndexSegment
(
Representation
*
parent
)
:
Segment
(
parent
)
{
debugName
=
"IndexSegment"
;
}
dash
::
http
::
Chunk
*
IndexSegment
::
getChunk
()
{
return
new
IndexSegmentChunk
(
this
);
}
IndexSegment
::
IndexSegmentChunk
::
IndexSegmentChunk
(
ISegment
*
segment
)
:
SegmentChunk
(
segment
)
{
}
void
IndexSegment
::
IndexSegmentChunk
::
onDownload
(
void
*
buffer
,
size_t
size
)
{
if
(
init
)
return
std
::
string
(
" InitSeg url="
)
.
append
(
getUrlSegment
());
else
return
ISegment
::
toString
();
}
SubSegment
::
SubSegment
(
Segment
*
main
,
size_t
start
,
size_t
end
)
:
ISegment
(
main
),
parent
(
main
)
{
setByteRange
(
start
,
end
);
debugName
=
"SubSegment"
;
}
std
::
string
SubSegment
::
getUrlSegment
()
const
...
...
modules/stream_filter/dash/mpd/Segment.h
View file @
e9a42b2d
...
...
@@ -60,6 +60,7 @@ namespace dash
protected:
size_t
startByte
;
size_t
endByte
;
std
::
string
debugName
;
class
SegmentChunk
:
public
dash
::
http
::
Chunk
{
...
...
@@ -67,33 +68,53 @@ namespace dash
SegmentChunk
(
ISegment
*
segment
);
virtual
void
onDownload
(
void
*
,
size_t
);
pr
ivate
:
pr
otected
:
ISegment
*
segment
;
};
virtual
dash
::
http
::
Chunk
*
getChunk
();
};
class
Segment
:
public
ISegment
{
public:
Segment
(
Representation
*
parent
,
bool
isinit
=
false
,
bool
tosplit
=
false
);
Segment
(
Representation
*
parent
);
~
Segment
();
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
virtual
bool
needsSplit
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
dash
::
http
::
Chunk
*
toChunk
();
virtual
std
::
vector
<
ISegment
*>
subSegments
();
virtual
std
::
string
toString
()
const
;
virtual
Representation
*
getRepresentation
()
const
;
protected:
Representation
*
parentRepresentation
;
bool
init
;
bool
needssplit
;
std
::
vector
<
SubSegment
*>
subsegments
;
std
::
string
sourceUrl
;
int
size
;
};
class
InitSegment
:
public
Segment
{
public:
InitSegment
(
Representation
*
parent
);
};
class
IndexSegment
:
public
Segment
{
public:
IndexSegment
(
Representation
*
parent
);
protected:
class
IndexSegmentChunk
:
public
SegmentChunk
{
public:
IndexSegmentChunk
(
ISegment
*
segment
);
virtual
void
onDownload
(
void
*
,
size_t
);
};
virtual
dash
::
http
::
Chunk
*
getChunk
();
};
class
SubSegment
:
public
ISegment
{
public:
...
...
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