Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
50541d21
Commit
50541d21
authored
Jul 05, 2016
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptive: simplify streams with unique init method
parent
43c91076
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
62 deletions
+56
-62
modules/demux/adaptive/Streams.cpp
modules/demux/adaptive/Streams.cpp
+36
-36
modules/demux/adaptive/Streams.hpp
modules/demux/adaptive/Streams.hpp
+2
-2
modules/demux/dash/DASHStream.cpp
modules/demux/dash/DASHStream.cpp
+5
-7
modules/demux/dash/DASHStream.hpp
modules/demux/dash/DASHStream.hpp
+1
-1
modules/demux/hls/HLSStreams.cpp
modules/demux/hls/HLSStreams.cpp
+5
-7
modules/demux/hls/HLSStreams.hpp
modules/demux/hls/HLSStreams.hpp
+1
-1
modules/demux/smooth/SmoothStream.cpp
modules/demux/smooth/SmoothStream.cpp
+5
-7
modules/demux/smooth/SmoothStream.hpp
modules/demux/smooth/SmoothStream.hpp
+1
-1
No files found.
modules/demux/adaptive/Streams.cpp
View file @
50541d21
...
...
@@ -35,10 +35,10 @@
using
namespace
adaptive
;
using
namespace
adaptive
::
http
;
AbstractStream
::
AbstractStream
(
demux_t
*
demux_
,
const
StreamFormat
&
format_
)
AbstractStream
::
AbstractStream
(
demux_t
*
demux_
)
{
p_realdemux
=
demux_
;
format
=
format_
;
format
=
StreamFormat
::
UNSUPPORTED
;
currentChunk
=
NULL
;
eof
=
false
;
dead
=
false
;
...
...
@@ -47,42 +47,50 @@ AbstractStream::AbstractStream(demux_t * demux_, const StreamFormat &format_)
discontinuity
=
false
;
segmentTracker
=
NULL
;
pcr
=
VLC_TS_INVALID
;
demuxersource
=
NULL
;
commandsqueue
=
NULL
;
demuxer
=
NULL
;
fakeesout
=
NULL
;
}
/* Don't even try if not supported */
if
((
unsigned
)
format
==
StreamFormat
::
UNSUPPORTED
)
throw
VLC_EGENERIC
;
bool
AbstractStream
::
init
(
const
StreamFormat
&
format_
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
conn
)
{
/* Don't even try if not supported or already init */
if
((
unsigned
)
format_
==
StreamFormat
::
UNSUPPORTED
||
demuxersource
)
return
false
;
demuxersource
=
new
(
std
::
nothrow
)
ChunksSourceStream
(
VLC_OBJECT
(
p_realdemux
),
this
);
if
(
!
demuxersource
)
throw
VLC_EGENERIC
;
CommandsFactory
*
factory
=
new
(
std
::
nothrow
)
CommandsFactory
();
if
(
!
factory
)
if
(
demuxersource
)
{
CommandsFactory
*
factory
=
new
(
std
::
nothrow
)
CommandsFactory
();
if
(
factory
)
{
commandsqueue
=
new
(
std
::
nothrow
)
CommandsQueue
(
factory
);
if
(
commandsqueue
)
{
fakeesout
=
new
(
std
::
nothrow
)
FakeESOut
(
p_realdemux
->
out
,
commandsqueue
);
if
(
fakeesout
)
{
/* All successfull */
fakeesout
->
setExtraInfoProvider
(
this
);
format
=
format_
;
segmentTracker
=
tracker
;
segmentTracker
->
registerListener
(
this
);
connManager
=
conn
;
return
true
;
}
delete
commandsqueue
;
commandsqueue
=
NULL
;
}
else
{
delete
factory
;
}
}
delete
demuxersource
;
throw
VLC_EGENERIC
;
}
commandsqueue
=
new
CommandsQueue
(
factory
);
if
(
!
commandsqueue
)
{
delete
factory
;
delete
demuxersource
;
throw
VLC_EGENERIC
;
}
fakeesout
=
new
(
std
::
nothrow
)
FakeESOut
(
p_realdemux
->
out
,
commandsqueue
);
if
(
!
fakeesout
)
{
delete
commandsqueue
;
delete
demuxersource
;
throw
VLC_EGENERIC
;
}
fakeesout
->
setExtraInfoProvider
(
this
);
return
false
;
}
AbstractStream
::~
AbstractStream
()
...
...
@@ -96,14 +104,6 @@ AbstractStream::~AbstractStream()
delete
commandsqueue
;
}
void
AbstractStream
::
bind
(
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
conn
)
{
segmentTracker
=
tracker
;
segmentTracker
->
registerListener
(
this
);
connManager
=
conn
;
}
void
AbstractStream
::
prepareFormatChange
()
{
if
(
demuxer
)
...
...
modules/demux/adaptive/Streams.hpp
View file @
50541d21
...
...
@@ -54,9 +54,9 @@ namespace adaptive
public
SegmentTrackerListenerInterface
{
public:
AbstractStream
(
demux_t
*
,
const
StreamFormat
&
);
AbstractStream
(
demux_t
*
);
virtual
~
AbstractStream
();
void
bind
(
SegmentTracker
*
,
HTTPConnectionManager
*
);
bool
init
(
const
StreamFormat
&
,
SegmentTracker
*
,
HTTPConnectionManager
*
);
void
setLanguage
(
const
std
::
string
&
);
void
setDescription
(
const
std
::
string
&
);
...
...
modules/demux/dash/DASHStream.cpp
View file @
50541d21
...
...
@@ -25,8 +25,8 @@
using
namespace
dash
;
DASHStream
::
DASHStream
(
demux_t
*
demux
,
const
StreamFormat
&
format
)
:
AbstractStream
(
demux
,
format
)
DASHStream
::
DASHStream
(
demux_t
*
demux
)
:
AbstractStream
(
demux
)
{
}
...
...
@@ -74,13 +74,11 @@ AbstractDemuxer * DASHStream::createDemux(const StreamFormat &format)
AbstractStream
*
DASHStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
manager
)
const
{
AbstractStream
*
stream
;
try
AbstractStream
*
stream
=
new
(
std
::
nothrow
)
DASHStream
(
realdemux
)
;
if
(
stream
&&
!
stream
->
init
(
format
,
tracker
,
manager
))
{
stream
=
new
DASHStream
(
realdemux
,
format
);
}
catch
(
int
)
{
delete
stream
;
return
NULL
;
}
stream
->
bind
(
tracker
,
manager
);
return
stream
;
}
modules/demux/dash/DASHStream.hpp
View file @
50541d21
...
...
@@ -29,7 +29,7 @@ namespace dash
class
DASHStream
:
public
AbstractStream
{
public:
DASHStream
(
demux_t
*
,
const
StreamFormat
&
);
DASHStream
(
demux_t
*
);
protected:
virtual
block_t
*
checkBlock
(
block_t
*
,
bool
);
/* impl */
...
...
modules/demux/hls/HLSStreams.cpp
View file @
50541d21
...
...
@@ -26,8 +26,8 @@
using
namespace
hls
;
HLSStream
::
HLSStream
(
demux_t
*
demux
,
const
StreamFormat
&
format
)
:
AbstractStream
(
demux
,
format
)
HLSStream
::
HLSStream
(
demux_t
*
demux
)
:
AbstractStream
(
demux
)
{
b_timestamps_offset_set
=
false
;
i_aac_offset
=
0
;
...
...
@@ -158,13 +158,11 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
AbstractStream
*
HLSStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
manager
)
const
{
HLSStream
*
stream
;
try
HLSStream
*
stream
=
new
(
std
::
nothrow
)
HLSStream
(
realdemux
)
;
if
(
stream
&&
!
stream
->
init
(
StreamFormat
(
StreamFormat
::
UNKNOWN
),
tracker
,
manager
))
{
stream
=
new
HLSStream
(
realdemux
,
StreamFormat
(
StreamFormat
::
UNKNOWN
));
}
catch
(
int
)
{
delete
stream
;
return
NULL
;
}
stream
->
bind
(
tracker
,
manager
);
return
stream
;
}
modules/demux/hls/HLSStreams.hpp
View file @
50541d21
...
...
@@ -29,7 +29,7 @@ namespace hls
class
HLSStream
:
public
AbstractStream
{
public:
HLSStream
(
demux_t
*
,
const
StreamFormat
&
);
HLSStream
(
demux_t
*
);
virtual
bool
setPosition
(
mtime_t
,
bool
);
/* reimpl */
protected:
...
...
modules/demux/smooth/SmoothStream.cpp
View file @
50541d21
...
...
@@ -26,8 +26,8 @@
using
namespace
smooth
;
SmoothStream
::
SmoothStream
(
demux_t
*
demux
,
const
StreamFormat
&
format
)
:
AbstractStream
(
demux
,
format
)
SmoothStream
::
SmoothStream
(
demux_t
*
demux
)
:
AbstractStream
(
demux
)
{
}
...
...
@@ -63,13 +63,11 @@ block_t * SmoothStream::checkBlock(block_t *p_block, bool)
AbstractStream
*
SmoothStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
manager
)
const
{
SmoothStream
*
stream
;
try
SmoothStream
*
stream
=
new
(
std
::
nothrow
)
SmoothStream
(
realdemux
)
;
if
(
stream
&&
!
stream
->
init
(
format
,
tracker
,
manager
))
{
stream
=
new
SmoothStream
(
realdemux
,
format
);
}
catch
(
int
)
{
delete
stream
;
return
NULL
;
}
stream
->
bind
(
tracker
,
manager
);
return
stream
;
}
modules/demux/smooth/SmoothStream.hpp
View file @
50541d21
...
...
@@ -29,7 +29,7 @@ namespace smooth
class
SmoothStream
:
public
AbstractStream
{
public:
SmoothStream
(
demux_t
*
,
const
StreamFormat
&
);
SmoothStream
(
demux_t
*
);
protected:
virtual
AbstractDemuxer
*
createDemux
(
const
StreamFormat
&
);
/* impl */
...
...
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