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,
...
@@ -51,16 +51,16 @@ PlaylistManager::PlaylistManager( AbstractPlaylist *pl,
stream
(
stream
),
stream
(
stream
),
nextPlaylistupdate
(
0
)
nextPlaylistupdate
(
0
)
{
{
for
(
int
i
=
0
;
i
<
StreamTypeCount
;
i
++
)
streams
[
i
]
=
NULL
;
}
}
PlaylistManager
::~
PlaylistManager
()
PlaylistManager
::~
PlaylistManager
()
{
{
delete
conManager
;
delete
conManager
;
delete
streamOutputFactory
;
delete
streamOutputFactory
;
for
(
int
i
=
0
;
i
<
StreamTypeCount
;
i
++
)
std
::
vector
<
Stream
*>::
iterator
it
;
delete
streams
[
i
];
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
delete
*
it
;
streams
.
clear
();
}
}
bool
PlaylistManager
::
start
(
demux_t
*
demux
)
bool
PlaylistManager
::
start
(
demux_t
*
demux
)
...
@@ -75,14 +75,13 @@ bool PlaylistManager::start(demux_t *demux)
...
@@ -75,14 +75,13 @@ bool PlaylistManager::start(demux_t *demux)
const
BaseAdaptationSet
*
set
=
period
->
getAdaptationSet
(
type
);
const
BaseAdaptationSet
*
set
=
period
->
getAdaptationSet
(
type
);
if
(
set
)
if
(
set
)
{
{
streams
[
type
]
=
new
(
std
::
nothrow
)
Stream
(
demux
,
type
,
set
->
getStreamFormat
());
Stream
*
st
=
new
(
std
::
nothrow
)
Stream
(
demux
,
type
,
set
->
getStreamFormat
());
if
(
!
st
reams
[
type
]
)
if
(
!
st
)
continue
;
continue
;
AbstractAdaptationLogic
*
logic
=
createLogic
(
logicType
);
AbstractAdaptationLogic
*
logic
=
createLogic
(
logicType
);
if
(
!
logic
)
if
(
!
logic
)
{
{
delete
streams
[
type
];
delete
st
;
streams
[
type
]
=
NULL
;
continue
;
continue
;
}
}
...
@@ -90,13 +89,15 @@ bool PlaylistManager::start(demux_t *demux)
...
@@ -90,13 +89,15 @@ bool PlaylistManager::start(demux_t *demux)
try
try
{
{
if
(
!
tracker
||
!
streamOutputFactory
)
if
(
!
tracker
||
!
streamOutputFactory
)
{
delete
tracker
;
delete
logic
;
throw
VLC_ENOMEM
;
throw
VLC_ENOMEM
;
streams
[
type
]
->
create
(
logic
,
tracker
,
streamOutputFactory
);
}
st
->
create
(
logic
,
tracker
,
streamOutputFactory
);
streams
.
push_back
(
st
);
}
catch
(
int
)
{
}
catch
(
int
)
{
delete
streams
[
type
];
delete
st
;
delete
logic
;
delete
tracker
;
streams
[
type
]
=
NULL
;
}
}
}
}
}
}
...
@@ -115,13 +116,10 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
...
@@ -115,13 +116,10 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
{
{
Stream
::
status
i_return
=
Stream
::
status_eof
;
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
])
Stream
::
status
i_ret
=
(
*
it
)
->
demux
(
conManager
,
nzdeadline
,
send
);
continue
;
Stream
::
status
i_ret
=
streams
[
type
]
->
demux
(
conManager
,
nzdeadline
,
send
);
if
(
i_ret
==
Stream
::
status_buffering
)
if
(
i_ret
==
Stream
::
status_buffering
)
{
{
...
@@ -140,12 +138,11 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
...
@@ -140,12 +138,11 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
mtime_t
PlaylistManager
::
getPCR
()
const
mtime_t
PlaylistManager
::
getPCR
()
const
{
{
mtime_t
pcr
=
VLC_TS_INVALID
;
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
])
if
(
pcr
==
VLC_TS_INVALID
||
pcr
>
(
*
it
)
->
getPCR
())
continue
;
pcr
=
(
*
it
)
->
getPCR
();
if
(
pcr
==
VLC_TS_INVALID
||
pcr
>
streams
[
type
]
->
getPCR
())
pcr
=
streams
[
type
]
->
getPCR
();
}
}
return
pcr
;
return
pcr
;
}
}
...
@@ -153,23 +150,21 @@ mtime_t PlaylistManager::getPCR() const
...
@@ -153,23 +150,21 @@ mtime_t PlaylistManager::getPCR() const
mtime_t
PlaylistManager
::
getFirstDTS
()
const
mtime_t
PlaylistManager
::
getFirstDTS
()
const
{
{
mtime_t
dts
=
VLC_TS_INVALID
;
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
])
if
(
dts
==
VLC_TS_INVALID
||
dts
>
(
*
it
)
->
getFirstDTS
())
continue
;
dts
=
(
*
it
)
->
getFirstDTS
();
if
(
dts
==
VLC_TS_INVALID
||
dts
>
streams
[
type
]
->
getFirstDTS
())
dts
=
streams
[
type
]
->
getFirstDTS
();
}
}
return
dts
;
return
dts
;
}
}
int
PlaylistManager
::
getGroup
()
const
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
])
return
(
*
it
)
->
getGroup
();
continue
;
return
streams
[
type
]
->
getGroup
();
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -177,11 +172,10 @@ int PlaylistManager::getGroup() const
...
@@ -177,11 +172,10 @@ int PlaylistManager::getGroup() const
int
PlaylistManager
::
esCount
()
const
int
PlaylistManager
::
esCount
()
const
{
{
int
es
=
0
;
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
])
es
+=
(
*
it
)
->
esCount
();
continue
;
es
+=
streams
[
type
]
->
esCount
();
}
}
return
es
;
return
es
;
}
}
...
@@ -200,11 +194,10 @@ bool PlaylistManager::setPosition(mtime_t time)
...
@@ -200,11 +194,10 @@ bool PlaylistManager::setPosition(mtime_t time)
for
(
int
real
=
0
;
real
<
2
;
real
++
)
for
(
int
real
=
0
;
real
<
2
;
real
++
)
{
{
/* Always probe if we can seek first */
/* 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
])
ret
&=
(
*
it
)
->
setPosition
(
time
,
!
real
);
continue
;
ret
&=
streams
[
type
]
->
setPosition
(
time
,
!
real
);
}
}
if
(
!
ret
)
if
(
!
ret
)
break
;
break
;
...
@@ -217,11 +210,10 @@ bool PlaylistManager::seekAble() const
...
@@ -217,11 +210,10 @@ bool PlaylistManager::seekAble() const
if
(
playlist
->
isLive
())
if
(
playlist
->
isLive
())
return
false
;
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
])
if
(
!
(
*
it
)
->
seekAble
())
continue
;
if
(
!
streams
[
type
]
->
seekAble
())
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
...
modules/demux/adaptative/PlaylistManager.h
View file @
69361064
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "logic/AbstractAdaptationLogic.h"
#include "logic/AbstractAdaptationLogic.h"
#include "Streams.hpp"
#include "Streams.hpp"
#include <vector>
namespace
adaptative
namespace
adaptative
{
{
...
@@ -74,7 +75,7 @@ namespace adaptative
...
@@ -74,7 +75,7 @@ namespace adaptative
AbstractPlaylist
*
playlist
;
AbstractPlaylist
*
playlist
;
AbstractStreamOutputFactory
*
streamOutputFactory
;
AbstractStreamOutputFactory
*
streamOutputFactory
;
stream_t
*
stream
;
stream_t
*
stream
;
Stream
*
streams
[
StreamTypeCount
]
;
std
::
vector
<
Stream
*>
streams
;
mtime_t
nextPlaylistupdate
;
mtime_t
nextPlaylistupdate
;
};
};
...
...
modules/demux/dash/DASHManager.cpp
View file @
69361064
...
@@ -107,11 +107,10 @@ bool DASHManager::updatePlaylist()
...
@@ -107,11 +107,10 @@ bool DASHManager::updatePlaylist()
}
}
mtime_t
minsegmentTime
=
0
;
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
])
mtime_t
segmentTime
=
(
*
it
)
->
getPosition
();
continue
;
mtime_t
segmentTime
=
streams
[
type
]
->
getPosition
();
if
(
!
minsegmentTime
||
segmentTime
<
minsegmentTime
)
if
(
!
minsegmentTime
||
segmentTime
<
minsegmentTime
)
minsegmentTime
=
segmentTime
;
minsegmentTime
=
segmentTime
;
}
}
...
...
modules/demux/hls/HLSManager.cpp
View file @
69361064
...
@@ -121,11 +121,10 @@ bool HLSManager::updatePlaylist()
...
@@ -121,11 +121,10 @@ bool HLSManager::updatePlaylist()
delete
updatedplaylist
;
delete
updatedplaylist
;
/* pruning */
/* pruning */
for
(
int
type
=
0
;
type
<
StreamTypeCount
;
type
++
)
std
::
vector
<
Stream
*>::
iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
{
if
(
!
streams
[
type
])
(
*
it
)
->
prune
();
continue
;
streams
[
type
]
->
prune
();
}
}
}
}
else
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