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
0e944452
Commit
0e944452
authored
May 21, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add stream factory
parent
9a3c24a6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
15 deletions
+44
-15
modules/demux/adaptative/PlaylistManager.cpp
modules/demux/adaptative/PlaylistManager.cpp
+4
-1
modules/demux/adaptative/PlaylistManager.h
modules/demux/adaptative/PlaylistManager.h
+4
-0
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+21
-13
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+15
-1
No files found.
modules/demux/adaptative/PlaylistManager.cpp
View file @
0e944452
...
...
@@ -52,6 +52,7 @@ PlaylistManager::PlaylistManager( AbstractPlaylist *pl,
conManager
(
NULL
),
logicType
(
type
),
playlist
(
pl
),
streamOutputFactory
(
NULL
),
stream
(
stream
),
nextPlaylistupdate
(
0
)
{
...
...
@@ -90,11 +91,13 @@ bool PlaylistManager::start(demux_t *demux)
}
SegmentTracker
*
tracker
=
new
(
std
::
nothrow
)
SegmentTracker
(
logic
,
playlist
);
DefaultStreamOutputFactory
defaultfactory
;
try
{
if
(
!
tracker
)
throw
VLC_ENOMEM
;
streams
[
type
]
->
create
(
demux
,
logic
,
tracker
);
streams
[
type
]
->
create
(
demux
,
logic
,
tracker
,
(
streamOutputFactory
)
?
*
streamOutputFactory
:
defaultfactory
);
}
catch
(
int
)
{
delete
streams
[
type
];
delete
logic
;
...
...
modules/demux/adaptative/PlaylistManager.h
View file @
0e944452
...
...
@@ -41,6 +41,8 @@ namespace adaptative
using
namespace
logic
;
using
namespace
http
;
class
AbstractStreamFactory
;
class
PlaylistManager
{
public:
...
...
@@ -60,11 +62,13 @@ namespace adaptative
virtual
bool
updatePlaylist
();
protected:
/* local factories */
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
HTTPConnectionManager
*
conManager
;
AbstractAdaptationLogic
::
LogicType
logicType
;
AbstractPlaylist
*
playlist
;
AbstractStreamOutputFactory
*
streamOutputFactory
;
stream_t
*
stream
;
Stream
*
streams
[
StreamTypeCount
];
mtime_t
nextPlaylistupdate
;
...
...
modules/demux/adaptative/Streams.cpp
View file @
0e944452
...
...
@@ -90,20 +90,10 @@ StreamFormat Stream::mimeToFormat(const std::string &mime)
return
format
;
}
void
Stream
::
create
(
demux_t
*
demux
,
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
)
void
Stream
::
create
(
demux_t
*
demux
,
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
,
AbstractStreamOutputFactory
&
factory
)
{
switch
(
format
)
{
case
StreamFormat
:
:
MP4
:
output
=
new
MP4StreamOutput
(
demux
);
break
;
case
StreamFormat
:
:
MPEG2TS
:
output
=
new
MPEG2TSStreamOutput
(
demux
);
break
;
default:
throw
VLC_EBADVAR
;
break
;
}
output
=
factory
.
create
(
demux
,
format
);
adaptationLogic
=
logic
;
segmentTracker
=
tracker
;
}
...
...
@@ -452,6 +442,24 @@ void AbstractStreamOutput::esOutDestroy(es_out_t *fakees)
}
/* !Static callbacks */
AbstractStreamOutput
*
DefaultStreamOutputFactory
::
create
(
demux_t
*
demux
,
int
format
)
const
{
switch
(
format
)
{
case
StreamFormat
:
:
MP4
:
return
new
MP4StreamOutput
(
demux
);
case
StreamFormat
:
:
MPEG2TS
:
return
new
MPEG2TSStreamOutput
(
demux
);
default:
throw
VLC_EBADVAR
;
break
;
}
return
NULL
;
}
MP4StreamOutput
::
MP4StreamOutput
(
demux_t
*
demux
)
:
AbstractStreamOutput
(
demux
)
{
...
...
modules/demux/adaptative/Streams.hpp
View file @
0e944452
...
...
@@ -46,6 +46,7 @@ namespace adaptative
class
AbstractStreamOutput
;
class
AbstractStreamOutputFactory
;
using
namespace
http
;
using
namespace
logic
;
...
...
@@ -59,7 +60,8 @@ namespace adaptative
bool
operator
==
(
const
Stream
&
)
const
;
static
StreamType
mimeToType
(
const
std
::
string
&
mime
);
static
StreamFormat
mimeToFormat
(
const
std
::
string
&
mime
);
void
create
(
demux_t
*
,
AbstractAdaptationLogic
*
,
SegmentTracker
*
);
void
create
(
demux_t
*
,
AbstractAdaptationLogic
*
,
SegmentTracker
*
,
AbstractStreamOutputFactory
&
);
bool
isEOF
()
const
;
mtime_t
getPCR
()
const
;
int
getGroup
()
const
;
...
...
@@ -127,6 +129,18 @@ namespace adaptative
void
sendToDecoderUnlocked
(
mtime_t
);
};
class
AbstractStreamOutputFactory
{
public:
virtual
AbstractStreamOutput
*
create
(
demux_t
*
,
int
streamType
)
const
=
0
;
};
class
DefaultStreamOutputFactory
:
public
AbstractStreamOutputFactory
{
public:
virtual
AbstractStreamOutput
*
create
(
demux_t
*
,
int
streamType
)
const
;
};
class
MP4StreamOutput
:
public
AbstractStreamOutput
{
public:
...
...
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