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
0b80d620
Commit
0b80d620
authored
Nov 23, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: dash: add subsegments
We'll need to split single file, ranged chunks
parent
33097d5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
44 deletions
+150
-44
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
...filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+1
-1
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.cpp
+106
-30
modules/stream_filter/dash/mpd/Segment.h
modules/stream_filter/dash/mpd/Segment.h
+43
-13
No files found.
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
View file @
0b80d620
...
...
@@ -58,7 +58,7 @@ Chunk* AlwaysBestAdaptationLogic::getNextChunk()
const
Representation
*
AlwaysBestAdaptationLogic
::
getCurrentRepresentation
()
const
{
if
(
this
->
count
<
this
->
schedule
.
size
()
)
return
this
->
schedule
.
at
(
this
->
count
)
->
get
Parent
Representation
();
return
this
->
schedule
.
at
(
this
->
count
)
->
getRepresentation
();
return
NULL
;
}
...
...
modules/stream_filter/dash/mpd/Segment.cpp
View file @
0b80d620
...
...
@@ -33,12 +33,56 @@
using
namespace
dash
::
mpd
;
using
namespace
dash
::
http
;
Segment
::
Segment
(
const
Representation
*
parent
,
bool
isinit
)
:
ICanonicalUrl
(
parent
),
startByte
(
0
),
endByte
(
0
),
ISegment
::
ISegment
(
const
ICanonicalUrl
*
parent
)
:
ICanonicalUrl
(
parent
),
startByte
(
0
),
endByte
(
0
)
{
}
dash
::
http
::
Chunk
*
ISegment
::
toChunk
()
const
{
Chunk
*
chunk
=
new
Chunk
();
if
(
!
chunk
)
return
NULL
;
if
(
startByte
!=
endByte
)
{
chunk
->
setStartByte
(
startByte
);
chunk
->
setEndByte
(
endByte
);
}
chunk
->
setUrl
(
getUrlSegment
());
return
chunk
;
}
bool
ISegment
::
isSingleShot
()
const
{
return
true
;
}
void
ISegment
::
done
()
{
//Only used for a SegmentTemplate.
}
void
ISegment
::
setByteRange
(
size_t
start
,
size_t
end
)
{
startByte
=
start
;
endByte
=
end
;
}
std
::
string
ISegment
::
toString
()
const
{
return
std
::
string
(
" Segment url="
).
append
(
getUrlSegment
());
}
Segment
::
Segment
(
Representation
*
parent
,
bool
isinit
,
bool
tosplit
)
:
ISegment
(
parent
),
parentRepresentation
(
parent
),
init
(
isinit
)
init
(
isinit
),
needssplit
(
tosplit
)
{
assert
(
parent
!=
NULL
);
if
(
parent
->
getSegmentInfo
()
!=
NULL
&&
parent
->
getSegmentInfo
()
->
getDuration
()
>=
0
)
...
...
@@ -47,57 +91,89 @@ Segment::Segment(const Representation *parent, bool isinit) :
this
->
size
=
-
1
;
}
Segment
::~
Segment
()
{
std
::
vector
<
SubSegment
*>::
iterator
it
;
for
(
it
=
subsegments
.
begin
();
it
!=
subsegments
.
end
();
it
++
)
delete
*
it
;
}
void
Segment
::
setSourceUrl
(
const
std
::
string
&
url
)
{
if
(
url
.
empty
()
==
false
)
this
->
sourceUrl
=
url
;
}
bool
Segment
::
isSingleShot
()
const
bool
Segment
::
needsSplit
()
const
{
return
true
;
return
needssplit
;
}
void
Segment
::
done
()
Representation
*
Segment
::
getRepresentation
()
const
{
//Only used for a SegmentTemplate.
return
parentRepresentation
;
}
void
Segment
::
setByteRange
(
int
start
,
int
end
)
std
::
string
Segment
::
getUrlSegment
()
const
{
this
->
startByte
=
start
;
this
->
endByte
=
end
;
std
::
string
ret
=
getParentUrlSegment
();
if
(
!
sourceUrl
.
empty
())
ret
.
append
(
sourceUrl
);
return
ret
;
}
dash
::
http
::
Chunk
*
Segment
::
toChunk
()
dash
::
http
::
Chunk
*
Segment
::
toChunk
()
const
{
Chunk
*
chunk
=
new
Chunk
();
Chunk
*
chunk
=
ISegment
::
toChunk
();
if
(
chunk
)
chunk
->
setBitrate
(
parentRepresentation
->
getBandwidth
());
return
chunk
;
}
if
(
startByte
!=
endByte
)
std
::
vector
<
ISegment
*>
Segment
::
subSegments
()
{
std
::
vector
<
ISegment
*>
list
;
if
(
!
subsegments
.
empty
())
{
chunk
->
setStartByte
(
startByte
);
chunk
->
setEndByte
(
endByte
);
std
::
vector
<
SubSegment
*>::
iterator
it
;
for
(
it
=
subsegments
.
begin
();
it
!=
subsegments
.
end
();
it
++
)
list
.
push_back
(
*
it
);
}
else
{
list
.
push_back
(
this
);
}
return
list
;
}
chunk
->
setUrl
(
getUrlSegment
()
);
chunk
->
setBitrate
(
this
->
parentRepresentation
->
getBandwidth
());
std
::
string
Segment
::
toString
()
const
{
if
(
init
)
return
std
::
string
(
" InitSeg url="
)
.
append
(
getUrlSegment
());
else
return
ISegment
::
toString
();
}
return
chunk
;
SubSegment
::
SubSegment
(
Segment
*
main
,
size_t
start
,
size_t
end
)
:
ISegment
(
main
),
parent
(
main
)
{
setByteRange
(
start
,
end
);
}
const
Representation
*
Segment
::
getParentRepresentation
()
const
std
::
string
SubSegment
::
getUrlSegment
()
const
{
return
this
->
parentRepresentation
;
return
getParentUrlSegment
()
;
}
std
::
string
Segment
::
getUrlSegment
()
const
std
::
vector
<
ISegment
*>
SubSegment
::
subSegments
()
{
std
::
string
ret
=
getParentUrlSegment
();
if
(
!
sourceUrl
.
empty
())
ret
.
append
(
sourceUrl
);
return
ret
;
std
::
vector
<
ISegment
*>
list
;
list
.
push_back
(
this
);
return
list
;
}
bool
Segment
::
isInit
()
const
Representation
*
SubSegment
::
getRepresentation
()
const
{
return
init
;
return
parent
->
getRepresentation
()
;
}
modules/stream_filter/dash/mpd/Segment.h
View file @
0b80d620
...
...
@@ -37,32 +37,62 @@ namespace dash
namespace
mpd
{
class
Representation
;
class
Segment
:
public
ICanonicalUrl
class
SubSegment
;
class
ISegment
:
public
ICanonicalUrl
{
public:
Segment
(
const
Representation
*
parent
,
bool
isinit
=
false
);
virtual
~
Segment
(){}
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
ISegment
(
const
ICanonicalUrl
*
parent
);
virtual
~
ISegment
(){}
/**
* @return true if the segment should be dropped after being read.
* That is basically true when using an Url, and false
* when using an UrlTemplate
*/
virtual
bool
isSingleShot
()
const
;
virtual
bool
isInit
()
const
;
virtual
void
done
();
virtual
void
setByteRange
(
int
start
,
int
end
);
virtual
dash
::
http
::
Chunk
*
toChunk
();
const
Representation
*
getParentRepresentation
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
dash
::
http
::
Chunk
*
toChunk
()
const
;
virtual
void
setByteRange
(
size_t
start
,
size_t
end
);
virtual
std
::
vector
<
ISegment
*>
subSegments
()
=
0
;
virtual
std
::
string
toString
()
const
;
virtual
Representation
*
getRepresentation
()
const
=
0
;
protected:
std
::
string
sourceUrl
;
size_t
startByte
;
size_t
endByte
;
const
Representation
*
parentRepresentation
;
int
size
;
bool
init
;
};
class
Segment
:
public
ISegment
{
public:
Segment
(
Representation
*
parent
,
bool
isinit
=
false
,
bool
tosplit
=
false
);
~
Segment
();
virtual
void
setSourceUrl
(
const
std
::
string
&
url
);
virtual
bool
needsSplit
()
const
;
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
dash
::
http
::
Chunk
*
toChunk
()
const
;
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
SubSegment
:
public
ISegment
{
public:
SubSegment
(
Segment
*
,
size_t
start
,
size_t
end
);
virtual
std
::
string
getUrlSegment
()
const
;
/* impl */
virtual
std
::
vector
<
ISegment
*>
subSegments
();
virtual
Representation
*
getRepresentation
()
const
;
private:
Segment
*
parent
;
};
}
}
...
...
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