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
69361064
Commit
69361064
authored
Jul 19, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: use streams vector instead of static array
parent
3258f429
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
54 deletions
+45
-54
modules/demux/adaptative/PlaylistManager.cpp
modules/demux/adaptative/PlaylistManager.cpp
+37
-45
modules/demux/adaptative/PlaylistManager.h
modules/demux/adaptative/PlaylistManager.h
+2
-1
modules/demux/dash/DASHManager.cpp
modules/demux/dash/DASHManager.cpp
+3
-4
modules/demux/hls/HLSManager.cpp
modules/demux/hls/HLSManager.cpp
+3
-4
No files found.
modules/demux/adaptative/PlaylistManager.cpp
View file @
69361064
...
...
@@ -51,16 +51,16 @@ PlaylistManager::PlaylistManager( AbstractPlaylist *pl,
stream
(
stream
),
nextPlaylistupdate
(
0
)
{
for
(
int
i
=
0
;
i
<
StreamTypeCount
;
i
++
)
streams
[
i
]
=
NULL
;
}
PlaylistManager
::~
PlaylistManager
()
{
delete
conManager
;
delete
streamOutputFactory
;
for
(
int
i
=
0
;
i
<
StreamTypeCount
;
i
++
)
delete
streams
[
i
];
std
::
vector
<
Stream
*>::
iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
delete
*
it
;
streams
.
clear
();
}
bool
PlaylistManager
::
start
(
demux_t
*
demux
)
...
...
@@ -75,14 +75,13 @@ bool PlaylistManager::start(demux_t *demux)
const
BaseAdaptationSet
*
set
=
period
->
getAdaptationSet
(
type
);
if
(
set
)
{
streams
[
type
]
=
new
(
std
::
nothrow
)
Stream
(
demux
,
type
,
set
->
getStreamFormat
());
if
(
!
st
reams
[
type
]
)
Stream
*
st
=
new
(
std
::
nothrow
)
Stream
(
demux
,
type
,
set
->
getStreamFormat
());
if
(
!
st
)
continue
;
AbstractAdaptationLogic
*
logic
=
createLogic
(
logicType
);
if
(
!
logic
)
{
delete
streams
[
type
];
streams
[
type
]
=
NULL
;
delete
st
;
continue
;
}
...
...
@@ -90,13 +89,15 @@ bool PlaylistManager::start(demux_t *demux)
try
{
if
(
!
tracker
||
!
streamOutputFactory
)
{
delete
tracker
;
delete
logic
;
throw
VLC_ENOMEM
;
streams
[
type
]
->
create
(
logic
,
tracker
,
streamOutputFactory
);
}
st
->
create
(
logic
,
tracker
,
streamOutputFactory
);
streams
.
push_back
(
st
);
}
catch
(
int
)
{
delete
streams
[
type
];
delete
logic
;
delete
tracker
;
streams
[
type
]
=
NULL
;
delete
st
;
}
}
}
...
...
@@ -115,13 +116,10 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
{
Stream
::
status
i_return
=
Stream
::
status_eof
;
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
Stream
::
status
i_ret
=
streams
[
type
]
->
demux
(
conManager
,
nzdeadline
,
send
);
Stream
::
status
i_ret
=
(
*
it
)
->
demux
(
conManager
,
nzdeadline
,
send
);
if
(
i_ret
==
Stream
::
status_buffering
)
{
...
...
@@ -140,12 +138,11 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
mtime_t
PlaylistManager
::
getPCR
()
const
{
mtime_t
pcr
=
VLC_TS_INVALID
;
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
if
(
pcr
==
VLC_TS_INVALID
||
pcr
>
streams
[
type
]
->
getPCR
())
pcr
=
streams
[
type
]
->
getPCR
();
if
(
pcr
==
VLC_TS_INVALID
||
pcr
>
(
*
it
)
->
getPCR
())
pcr
=
(
*
it
)
->
getPCR
();
}
return
pcr
;
}
...
...
@@ -153,23 +150,21 @@ mtime_t PlaylistManager::getPCR() const
mtime_t
PlaylistManager
::
getFirstDTS
()
const
{
mtime_t
dts
=
VLC_TS_INVALID
;
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
if
(
dts
==
VLC_TS_INVALID
||
dts
>
streams
[
type
]
->
getFirstDTS
())
dts
=
streams
[
type
]
->
getFirstDTS
();
if
(
dts
==
VLC_TS_INVALID
||
dts
>
(
*
it
)
->
getFirstDTS
())
dts
=
(
*
it
)
->
getFirstDTS
();
}
return
dts
;
}
int
PlaylistManager
::
getGroup
()
const
{
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
return
streams
[
type
]
->
getGroup
();
return
(
*
it
)
->
getGroup
();
}
return
-
1
;
}
...
...
@@ -177,11 +172,10 @@ int PlaylistManager::getGroup() const
int
PlaylistManager
::
esCount
()
const
{
int
es
=
0
;
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
es
+=
streams
[
type
]
->
esCount
();
es
+=
(
*
it
)
->
esCount
();
}
return
es
;
}
...
...
@@ -200,11 +194,10 @@ bool PlaylistManager::setPosition(mtime_t time)
for
(
int
real
=
0
;
real
<
2
;
real
++
)
{
/* Always probe if we can seek first */
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
ret
&=
streams
[
type
]
->
setPosition
(
time
,
!
real
);
ret
&=
(
*
it
)
->
setPosition
(
time
,
!
real
);
}
if
(
!
ret
)
break
;
...
...
@@ -217,11 +210,10 @@ bool PlaylistManager::seekAble() const
if
(
playlist
->
isLive
())
return
false
;
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
if
(
!
streams
[
type
]
->
seekAble
())
if
(
!
(
*
it
)
->
seekAble
())
return
false
;
}
return
true
;
...
...
modules/demux/adaptative/PlaylistManager.h
View file @
69361064
...
...
@@ -24,6 +24,7 @@
#include "logic/AbstractAdaptationLogic.h"
#include "Streams.hpp"
#include <vector>
namespace
adaptative
{
...
...
@@ -74,7 +75,7 @@ namespace adaptative
AbstractPlaylist
*
playlist
;
AbstractStreamOutputFactory
*
streamOutputFactory
;
stream_t
*
stream
;
Stream
*
streams
[
StreamTypeCount
]
;
std
::
vector
<
Stream
*>
streams
;
mtime_t
nextPlaylistupdate
;
};
...
...
modules/demux/dash/DASHManager.cpp
View file @
69361064
...
...
@@ -107,11 +107,10 @@ bool DASHManager::updatePlaylist()
}
mtime_t
minsegmentTime
=
0
;
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
it
++
)
{
if
(
!
streams
[
type
])
continue
;
mtime_t
segmentTime
=
streams
[
type
]
->
getPosition
();
mtime_t
segmentTime
=
(
*
it
)
->
getPosition
();
if
(
!
minsegmentTime
||
segmentTime
<
minsegmentTime
)
minsegmentTime
=
segmentTime
;
}
...
...
modules/demux/hls/HLSManager.cpp
View file @
69361064
...
...
@@ -121,11 +121,10 @@ bool HLSManager::updatePlaylist()
delete
updatedplaylist
;
/* pruning */
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
(
!
streams
[
type
])
continue
;
streams
[
type
]
->
prune
();
(
*
it
)
->
prune
();
}
}
else
...
...
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