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
7000945e
Commit
7000945e
authored
Dec 31, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: dash: handle format string min width in segment number
parent
d1282d53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
15 deletions
+46
-15
modules/demux/dash/mpd/Url.cpp
modules/demux/dash/mpd/Url.cpp
+45
-15
modules/demux/dash/mpd/Url.hpp
modules/demux/dash/mpd/Url.hpp
+1
-0
No files found.
modules/demux/dash/mpd/Url.cpp
View file @
7000945e
...
@@ -85,6 +85,25 @@ Url::Component::Component(const std::string & str, const SegmentTemplate *templ_
...
@@ -85,6 +85,25 @@ Url::Component::Component(const std::string & str, const SegmentTemplate *templ_
templ
=
templ_
;
templ
=
templ_
;
}
}
size_t
Url
::
Component
::
getSegmentNumber
(
size_t
index
,
const
Representation
*
rep
)
const
{
index
+=
templ
->
getStartIndex
();
/* live streams / templated */
if
(
rep
->
getMPD
()
->
isLive
()
&&
templ
->
duration
.
Get
())
{
mtime_t
playbackstart
=
rep
->
getMPD
()
->
playbackStart
.
Get
();
mtime_t
streamstart
=
rep
->
getMPD
()
->
getAvailabilityStartTime
();
streamstart
+=
rep
->
getPeriodStart
();
mtime_t
duration
=
templ
->
duration
.
Get
();
uint64_t
timescale
=
templ
->
timescale
.
Get
()
?
templ
->
timescale
.
Get
()
:
rep
->
getTimescale
();
if
(
duration
&&
timescale
)
index
+=
(
playbackstart
-
streamstart
)
*
timescale
/
duration
;
}
return
index
;
}
std
::
string
Url
::
Component
::
contextualize
(
size_t
index
,
const
Representation
*
rep
)
const
std
::
string
Url
::
Component
::
contextualize
(
size_t
index
,
const
Representation
*
rep
)
const
{
{
std
::
string
ret
(
component
);
std
::
string
ret
(
component
);
...
@@ -100,27 +119,38 @@ std::string Url::Component::contextualize(size_t index, const Representation *re
...
@@ -100,27 +119,38 @@ std::string Url::Component::contextualize(size_t index, const Representation *re
ret
.
replace
(
pos
,
std
::
string
(
"$Time$"
).
length
(),
ss
.
str
());
ret
.
replace
(
pos
,
std
::
string
(
"$Time$"
).
length
(),
ss
.
str
());
}
}
pos
=
ret
.
find
(
"$Number$"
);
pos
=
ret
.
find
(
"$Number$"
);
if
(
pos
!=
std
::
string
::
npos
)
if
(
pos
!=
std
::
string
::
npos
)
{
{
index
+=
templ
->
getStartIndex
();
std
::
stringstream
ss
;
std
::
stringstream
ss
;
/* live streams / templated */
ss
<<
getSegmentNumber
(
index
,
rep
);
if
(
rep
->
getMPD
()
->
isLive
()
&&
templ
->
duration
.
Get
())
ret
.
replace
(
pos
,
std
::
string
(
"$Number$"
).
length
(),
ss
.
str
());
}
else
{
pos
=
ret
.
find
(
"$Number%"
);
size_t
tokenlength
=
std
::
string
(
"$Number%"
).
length
();
size_t
fmtstart
=
pos
+
tokenlength
;
if
(
pos
!=
std
::
string
::
npos
&&
fmtstart
<
ret
.
length
())
{
{
mtime_t
playbackstart
=
rep
->
getMPD
()
->
playbackStart
.
Get
();
size_t
fmtend
=
ret
.
find
(
'$'
,
fmtstart
);
mtime_t
streamstart
=
rep
->
getMPD
()
->
getAvailabilityStartTime
();
if
(
fmtend
!=
std
::
string
::
npos
)
streamstart
+=
rep
->
getPeriodStart
();
{
mtime_t
duration
=
templ
->
duration
.
Get
();
std
::
istringstream
iss
(
ret
.
substr
(
fmtstart
,
fmtend
-
fmtstart
+
1
));
uint64_t
timescale
=
templ
->
timescale
.
Get
()
?
try
templ
->
timescale
.
Get
()
:
{
rep
->
getTimescale
();
size_t
width
;
if
(
duration
&&
timescale
)
iss
>>
width
;
index
+=
(
playbackstart
-
streamstart
)
*
timescale
/
duration
;
if
(
iss
.
peek
()
!=
'$'
)
throw
VLC_EGENERIC
;
std
::
stringstream
oss
;
oss
.
width
(
width
);
/* set format string length */
oss
.
fill
(
'0'
);
oss
<<
getSegmentNumber
(
index
,
rep
);
ret
.
replace
(
pos
,
fmtend
-
pos
+
1
,
oss
.
str
());
}
catch
(
int
)
{}
}
}
}
ss
<<
index
;
ret
.
replace
(
pos
,
std
::
string
(
"$Number$"
).
length
(),
ss
.
str
());
}
}
pos
=
ret
.
find
(
"$Bandwidth$"
);
pos
=
ret
.
find
(
"$Bandwidth$"
);
...
...
modules/demux/dash/mpd/Url.hpp
View file @
7000945e
...
@@ -41,6 +41,7 @@ namespace dash
...
@@ -41,6 +41,7 @@ namespace dash
protected:
protected:
std
::
string
contextualize
(
size_t
,
const
Representation
*
)
const
;
std
::
string
contextualize
(
size_t
,
const
Representation
*
)
const
;
size_t
getSegmentNumber
(
size_t
,
const
Representation
*
)
const
;
std
::
string
component
;
std
::
string
component
;
const
SegmentTemplate
*
templ
;
const
SegmentTemplate
*
templ
;
};
};
...
...
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