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
bfdc2b60
Commit
bfdc2b60
authored
Jul 05, 2015
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: rework stream format setup
parent
98332157
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
336 additions
and
81 deletions
+336
-81
modules/demux/Makefile.am
modules/demux/Makefile.am
+5
-1
modules/demux/adaptative/PlaylistManager.cpp
modules/demux/adaptative/PlaylistManager.cpp
+6
-6
modules/demux/adaptative/PlaylistManager.h
modules/demux/adaptative/PlaylistManager.h
+4
-1
modules/demux/adaptative/StreamFormat.cpp
modules/demux/adaptative/StreamFormat.cpp
+42
-0
modules/demux/adaptative/StreamFormat.hpp
modules/demux/adaptative/StreamFormat.hpp
+42
-0
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+35
-44
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+7
-12
modules/demux/adaptative/StreamsType.hpp
modules/demux/adaptative/StreamsType.hpp
+0
-7
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
+3
-5
modules/demux/adaptative/playlist/BaseAdaptationSet.h
modules/demux/adaptative/playlist/BaseAdaptationSet.h
+2
-1
modules/demux/adaptative/playlist/BaseRepresentation.cpp
modules/demux/adaptative/playlist/BaseRepresentation.cpp
+6
-0
modules/demux/adaptative/playlist/BaseRepresentation.h
modules/demux/adaptative/playlist/BaseRepresentation.h
+2
-0
modules/demux/dash/DASHManager.cpp
modules/demux/dash/DASHManager.cpp
+18
-1
modules/demux/dash/DASHManager.h
modules/demux/dash/DASHManager.h
+7
-0
modules/demux/dash/DASHStreamFormat.hpp
modules/demux/dash/DASHStreamFormat.hpp
+54
-0
modules/demux/dash/dash.cpp
modules/demux/dash/dash.cpp
+1
-0
modules/demux/dash/mpd/AdaptationSet.cpp
modules/demux/dash/mpd/AdaptationSet.cpp
+17
-0
modules/demux/dash/mpd/AdaptationSet.h
modules/demux/dash/mpd/AdaptationSet.h
+3
-0
modules/demux/dash/mpd/Representation.cpp
modules/demux/dash/mpd/Representation.cpp
+9
-0
modules/demux/dash/mpd/Representation.h
modules/demux/dash/mpd/Representation.h
+2
-0
modules/demux/hls/HLSManager.cpp
modules/demux/hls/HLSManager.cpp
+15
-1
modules/demux/hls/HLSManager.hpp
modules/demux/hls/HLSManager.hpp
+7
-0
modules/demux/hls/HLSStreamFormat.hpp
modules/demux/hls/HLSStreamFormat.hpp
+38
-0
modules/demux/hls/hls.cpp
modules/demux/hls/hls.cpp
+1
-0
modules/demux/hls/playlist/Parser.cpp
modules/demux/hls/playlist/Parser.cpp
+0
-2
modules/demux/hls/playlist/Representation.cpp
modules/demux/hls/playlist/Representation.cpp
+7
-0
modules/demux/hls/playlist/Representation.hpp
modules/demux/hls/playlist/Representation.hpp
+3
-0
No files found.
modules/demux/Makefile.am
View file @
bfdc2b60
...
...
@@ -298,6 +298,8 @@ adaptative_SOURCES = \
demux/adaptative/PlaylistManager.h
\
demux/adaptative/SegmentTracker.cpp
\
demux/adaptative/SegmentTracker.hpp
\
demux/adaptative/StreamFormat.cpp
\
demux/adaptative/StreamFormat.hpp
\
demux/adaptative/Streams.cpp
\
demux/adaptative/Streams.hpp
\
demux/adaptative/StreamsType.hpp
\
...
...
@@ -343,7 +345,8 @@ libdash_plugin_la_SOURCES = \
demux/dash/dash.cpp
\
demux/dash/dash.hpp
\
demux/dash/DASHManager.cpp
\
demux/dash/DASHManager.h
demux/dash/DASHManager.h
\
demux/dash/DASHStreamFormat.hpp
libdash_plugin_la_SOURCES
+=
$(adaptative_SOURCES)
libdash_plugin_la_SOURCES
+=
demux/mp4/libmp4.c demux/mp4/libmp4.h
...
...
@@ -368,6 +371,7 @@ libhls_plugin_la_SOURCES = \
demux/hls/playlist/Tags.cpp
\
demux/hls/HLSManager.hpp
\
demux/hls/HLSManager.cpp
\
demux/hls/HLSStreamFormat.hpp
\
demux/hls/hls.cpp
\
demux/hls/hls.hpp
...
...
modules/demux/adaptative/PlaylistManager.cpp
View file @
bfdc2b60
...
...
@@ -41,12 +41,13 @@ using namespace adaptative::logic;
using
namespace
adaptative
;
PlaylistManager
::
PlaylistManager
(
AbstractPlaylist
*
pl
,
AbstractStreamOutputFactory
*
factory
,
AbstractAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
)
:
conManager
(
NULL
),
logicType
(
type
),
playlist
(
pl
),
streamOutputFactory
(
NULL
),
streamOutputFactory
(
factory
),
stream
(
stream
),
nextPlaylistupdate
(
0
)
{
...
...
@@ -57,6 +58,7 @@ PlaylistManager::PlaylistManager( AbstractPlaylist *pl,
PlaylistManager
::~
PlaylistManager
()
{
delete
conManager
;
delete
streamOutputFactory
;
for
(
int
i
=
0
;
i
<
StreamTypeCount
;
i
++
)
delete
streams
[
i
];
}
...
...
@@ -73,7 +75,7 @@ bool PlaylistManager::start(demux_t *demux)
const
BaseAdaptationSet
*
set
=
period
->
getAdaptationSet
(
type
);
if
(
set
)
{
streams
[
type
]
=
new
(
std
::
nothrow
)
Stream
(
set
->
get
MimeType
());
streams
[
type
]
=
new
(
std
::
nothrow
)
Stream
(
type
,
set
->
get
StreamFormat
());
if
(
!
streams
[
type
])
continue
;
AbstractAdaptationLogic
*
logic
=
createLogic
(
logicType
);
...
...
@@ -85,13 +87,11 @@ bool PlaylistManager::start(demux_t *demux)
}
SegmentTracker
*
tracker
=
new
(
std
::
nothrow
)
SegmentTracker
(
logic
,
playlist
);
DefaultStreamOutputFactory
defaultfactory
;
try
{
if
(
!
tracker
)
if
(
!
tracker
||
!
streamOutputFactory
)
throw
VLC_ENOMEM
;
streams
[
type
]
->
create
(
demux
,
logic
,
tracker
,
(
streamOutputFactory
)
?
*
streamOutputFactory
:
defaultfactory
);
streams
[
type
]
->
create
(
demux
,
logic
,
tracker
,
streamOutputFactory
);
}
catch
(
int
)
{
delete
streams
[
type
];
delete
logic
;
...
...
modules/demux/adaptative/PlaylistManager.h
View file @
bfdc2b60
...
...
@@ -42,12 +42,15 @@ namespace adaptative
using
namespace
http
;
class
AbstractStreamFactory
;
class
AbstractStreamOutputFactory
;
class
PlaylistManager
{
public:
PlaylistManager
(
AbstractPlaylist
*
,
AbstractAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
);
AbstractStreamOutputFactory
*
,
AbstractAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
);
virtual
~
PlaylistManager
();
bool
start
(
demux_t
*
);
...
...
modules/demux/adaptative/StreamFormat.cpp
0 → 100644
View file @
bfdc2b60
/*
* StreamFormat.cpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "StreamFormat.hpp"
using
namespace
adaptative
;
StreamFormat
::
operator
unsigned
()
const
{
return
formatid
;
}
StreamFormat
::
StreamFormat
(
int
formatid_
)
{
formatid
=
formatid_
;
}
StreamFormat
::~
StreamFormat
()
{
}
bool
StreamFormat
::
operator
==
(
const
StreamFormat
&
other
)
const
{
return
formatid
==
other
.
formatid
;
}
modules/demux/adaptative/StreamFormat.hpp
0 → 100644
View file @
bfdc2b60
/*
* StreamFormat.hpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef STREAMFORMAT_HPP
#define STREAMFORMAT_HPP
namespace
adaptative
{
class
StreamFormat
{
public:
static
const
unsigned
UNSUPPORTED
=
0
;
StreamFormat
(
int
=
UNSUPPORTED
);
~
StreamFormat
();
operator
unsigned
()
const
;
bool
operator
==
(
const
StreamFormat
&
)
const
;
private:
unsigned
formatid
;
};
}
#endif // STREAMFORMAT_HPP
modules/demux/adaptative/Streams.cpp
View file @
bfdc2b60
...
...
@@ -31,17 +31,12 @@ using namespace adaptative;
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
logic
;
Stream
::
Stream
(
const
std
::
string
&
mime
)
{
init
(
mimeToType
(
mime
),
mimeToFormat
(
mime
));
}
Stream
::
Stream
(
const
StreamType
type
,
const
StreamFormat
format
)
Stream
::
Stream
(
const
StreamType
type
,
const
StreamFormat
&
format
)
{
init
(
type
,
format
);
}
void
Stream
::
init
(
const
StreamType
type_
,
const
StreamFormat
format_
)
void
Stream
::
init
(
const
StreamType
type_
,
const
StreamFormat
&
format_
)
{
type
=
type_
;
format
=
format_
;
...
...
@@ -74,29 +69,26 @@ StreamType Stream::mimeToType(const std::string &mime)
return
mimetype
;
}
StreamFormat
Stream
::
mimeToFormat
(
const
std
::
string
&
mime
)
{
StreamFormat
format
=
StreamFormat
::
UNSUPPORTED
;
std
::
string
::
size_type
pos
=
mime
.
find
(
"/"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
string
tail
=
mime
.
substr
(
pos
+
1
);
if
(
tail
==
"mp4"
)
format
=
StreamFormat
::
MP4
;
else
if
(
tail
==
"mp2t"
)
format
=
StreamFormat
::
MPEG2TS
;
}
return
format
;
}
void
Stream
::
create
(
demux_t
*
demux
,
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
,
AbstractStreamOutputFactory
&
factory
)
SegmentTracker
*
tracker
,
const
AbstractStreamOutputFactory
*
factory
)
{
output
=
factory
.
cre
at
e
(
demux
,
format
);
updateForm
at
(
demux
,
format
,
factory
);
adaptationLogic
=
logic
;
segmentTracker
=
tracker
;
}
void
Stream
::
updateFormat
(
demux_t
*
demux
,
StreamFormat
&
newformat
,
const
AbstractStreamOutputFactory
*
factory
)
{
if
(
format
==
newformat
&&
output
)
return
;
delete
output
;
format
=
newformat
;
output
=
factory
->
create
(
demux
,
format
);
if
(
!
output
)
throw
VLC_EGENERIC
;
}
bool
Stream
::
isEOF
()
const
{
return
false
;
...
...
@@ -104,21 +96,29 @@ bool Stream::isEOF() const
mtime_t
Stream
::
getPCR
()
const
{
if
(
!
output
)
return
0
;
return
output
->
getPCR
();
}
mtime_t
Stream
::
getFirstDTS
()
const
{
if
(
!
output
)
return
0
;
return
output
->
getFirstDTS
();
}
int
Stream
::
getGroup
()
const
{
if
(
!
output
)
return
0
;
return
output
->
getGroup
();
}
int
Stream
::
esCount
()
const
{
if
(
!
output
)
return
0
;
return
output
->
esCount
();
}
...
...
@@ -129,7 +129,7 @@ bool Stream::operator ==(const Stream &stream) const
Chunk
*
Stream
::
getChunk
()
{
if
(
currentChunk
==
NULL
)
if
(
currentChunk
==
NULL
&&
output
)
{
currentChunk
=
segmentTracker
->
getNextChunk
(
type
,
output
->
switchAllowed
());
if
(
currentChunk
==
NULL
)
...
...
@@ -145,6 +145,9 @@ bool Stream::seekAble() const
Stream
::
status
Stream
::
demux
(
HTTPConnectionManager
*
connManager
,
mtime_t
nz_deadline
,
bool
send
)
{
if
(
!
output
)
return
Stream
::
status_eof
;
if
(
nz_deadline
+
VLC_TS_0
>
output
->
getPCR
())
/* not already demuxed */
{
/* need to read, demuxer still buffering, ... */
...
...
@@ -225,13 +228,19 @@ size_t Stream::read(HTTPConnectionManager *connManager)
readsize
=
block
->
i_buffer
;
output
->
pushBlock
(
block
);
if
(
output
)
output
->
pushBlock
(
block
);
else
block_Release
(
block
);
return
readsize
;
}
bool
Stream
::
setPosition
(
mtime_t
time
,
bool
tryonly
)
{
if
(
!
output
)
return
false
;
bool
ret
=
segmentTracker
->
setPosition
(
time
,
output
->
reinitsOnSeek
(),
tryonly
);
if
(
!
tryonly
&&
ret
)
{
...
...
@@ -623,21 +632,3 @@ void BaseStreamOutput::esOutDestroy(es_out_t *fakees)
me
->
realdemux
->
out
->
pf_destroy
(
me
->
realdemux
->
out
);
}
/* !Static callbacks */
AbstractStreamOutput
*
DefaultStreamOutputFactory
::
create
(
demux_t
*
demux
,
int
format
)
const
{
switch
(
format
)
{
case
StreamFormat
::
MP4
:
return
new
BaseStreamOutput
(
demux
,
"mp4"
);
case
StreamFormat
::
MPEG2TS
:
return
new
BaseStreamOutput
(
demux
,
"ts"
);
default:
throw
VLC_EBADVAR
;
break
;
}
return
NULL
;
}
modules/demux/adaptative/Streams.hpp
View file @
bfdc2b60
...
...
@@ -29,6 +29,7 @@
#include <vlc_common.h>
#include <vlc_es.h>
#include "StreamsType.hpp"
#include "StreamFormat.hpp"
namespace
adaptative
{
...
...
@@ -55,14 +56,13 @@ namespace adaptative
class
Stream
{
public:
Stream
(
const
std
::
string
&
mime
);
Stream
(
const
StreamType
,
const
StreamFormat
);
Stream
(
const
StreamType
,
const
StreamFormat
&
);
~
Stream
();
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
*
,
AbstractStreamOutputFactory
&
);
SegmentTracker
*
,
const
AbstractStreamOutputFactory
*
);
void
updateFormat
(
demux_t
*
,
StreamFormat
&
,
const
AbstractStreamOutputFactory
*
);
bool
isEOF
()
const
;
mtime_t
getPCR
()
const
;
mtime_t
getFirstDTS
()
const
;
...
...
@@ -77,7 +77,7 @@ namespace adaptative
private:
Chunk
*
getChunk
();
void
init
(
const
StreamType
,
const
StreamFormat
);
void
init
(
const
StreamType
,
const
StreamFormat
&
);
size_t
read
(
HTTPConnectionManager
*
);
StreamType
type
;
StreamFormat
format
;
...
...
@@ -114,13 +114,8 @@ namespace adaptative
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
;
virtual
~
AbstractStreamOutputFactory
()
{}
virtual
AbstractStreamOutput
*
create
(
demux_t
*
,
const
StreamFormat
&
)
const
=
0
;
};
class
BaseStreamOutput
:
public
AbstractStreamOutput
...
...
modules/demux/adaptative/StreamsType.hpp
View file @
bfdc2b60
...
...
@@ -31,13 +31,6 @@ namespace adaptative
APPLICATION
};
enum
StreamFormat
{
UNSUPPORTED
=
0
,
MP4
,
MPEG2TS
};
static
const
int
StreamTypeCount
=
APPLICATION
+
1
;
}
...
...
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
View file @
bfdc2b60
...
...
@@ -35,6 +35,7 @@
#include "SegmentTemplate.h"
#include "BasePeriod.h"
using
namespace
adaptative
;
using
namespace
adaptative
::
playlist
;
BaseAdaptationSet
::
BaseAdaptationSet
(
BasePeriod
*
period
)
:
...
...
@@ -50,12 +51,9 @@ BaseAdaptationSet::~BaseAdaptationSet ()
childs
.
clear
();
}
const
std
::
string
&
BaseAdaptationSet
::
get
MimeType
()
const
StreamFormat
BaseAdaptationSet
::
get
StreamFormat
()
const
{
if
(
mimeType
.
empty
()
&&
!
representations
.
empty
())
return
representations
.
front
()
->
getMimeType
();
else
return
mimeType
;
return
StreamFormat
();
}
std
::
vector
<
BaseRepresentation
*>&
BaseAdaptationSet
::
getRepresentations
()
...
...
modules/demux/adaptative/playlist/BaseAdaptationSet.h
View file @
bfdc2b60
...
...
@@ -30,6 +30,7 @@
#include "CommonAttributesElements.h"
#include "SegmentInformation.hpp"
#include "../StreamFormat.hpp"
namespace
adaptative
{
...
...
@@ -45,7 +46,7 @@ namespace adaptative
BaseAdaptationSet
(
BasePeriod
*
);
virtual
~
BaseAdaptationSet
();
virtual
const
std
::
string
&
getMimeType
()
const
;
/*reimpl*/
virtual
StreamFormat
getStreamFormat
()
const
;
/*reimpl*/
std
::
vector
<
BaseRepresentation
*>&
getRepresentations
();
void
setSwitchPolicy
(
bool
value
);
bool
getBitstreamSwitching
()
const
;
...
...
modules/demux/adaptative/playlist/BaseRepresentation.cpp
View file @
bfdc2b60
...
...
@@ -31,6 +31,7 @@
#include "BaseAdaptationSet.h"
#include "SegmentTemplate.h"
using
namespace
adaptative
;
using
namespace
adaptative
::
playlist
;
BaseRepresentation
::
BaseRepresentation
(
BaseAdaptationSet
*
set
)
:
...
...
@@ -44,6 +45,11 @@ BaseRepresentation::~BaseRepresentation ()
{
}
StreamFormat
BaseRepresentation
::
getStreamFormat
()
const
{
return
StreamFormat
();
}
uint64_t
BaseRepresentation
::
getBandwidth
()
const
{
return
bandwidth
;
...
...
modules/demux/adaptative/playlist/BaseRepresentation.h
View file @
bfdc2b60
...
...
@@ -30,6 +30,7 @@
#include "CommonAttributesElements.h"
#include "SegmentInformation.hpp"
#include "../StreamFormat.hpp"
namespace
adaptative
{
...
...
@@ -46,6 +47,7 @@ namespace adaptative
BaseRepresentation
(
BaseAdaptationSet
*
);
virtual
~
BaseRepresentation
();
virtual
StreamFormat
getStreamFormat
()
const
;
/*
* @return The bitrate required for this representation
* in bits per seconds.
...
...
modules/demux/dash/DASHManager.cpp
View file @
bfdc2b60
...
...
@@ -29,6 +29,7 @@
#include <inttypes.h>
#include "DASHManager.h"
#include "DASHStreamFormat.hpp"
#include "mpd/MPDFactory.h"
#include "xml/DOMParser.h"
#include "../adaptative/logic/RateBasedAdaptationLogic.h"
...
...
@@ -42,9 +43,25 @@ using namespace dash;
using
namespace
dash
::
mpd
;
using
namespace
adaptative
::
logic
;
AbstractStreamOutput
*
DASHStreamOutputFactory
::
create
(
demux_t
*
demux
,
const
StreamFormat
&
format
)
const
{
unsigned
fmt
=
format
;
switch
(
fmt
)
{
case
DASHStreamFormat
::
MP4
:
return
new
BaseStreamOutput
(
demux
,
"mp4"
);
case
DASHStreamFormat
::
MPEG2TS
:
return
new
BaseStreamOutput
(
demux
,
"ts"
);
}
return
NULL
;
}
DASHManager
::
DASHManager
(
MPD
*
mpd
,
AbstractStreamOutputFactory
*
factory
,
AbstractAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
)
:
PlaylistManager
(
mpd
,
type
,
stream
)
PlaylistManager
(
mpd
,
factory
,
type
,
stream
)
{
}
...
...
modules/demux/dash/DASHManager.h
View file @
bfdc2b60
...
...
@@ -33,10 +33,17 @@ namespace dash
{
using
namespace
adaptative
;
class
DASHStreamOutputFactory
:
public
AbstractStreamOutputFactory
{
public:
virtual
AbstractStreamOutput
*
create
(
demux_t
*
,
const
StreamFormat
&
)
const
;
};
class
DASHManager
:
public
PlaylistManager
{
public:
DASHManager
(
mpd
::
MPD
*
mpd
,
AbstractStreamOutputFactory
*
,
logic
::
AbstractAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
);
virtual
~
DASHManager
();
...
...
modules/demux/dash/DASHStreamFormat.hpp
0 → 100644
View file @
bfdc2b60
/*
* DASHStreamFormat.hpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef DASHSTREAMFORMAT_HPP
#define DASHSTREAMFORMAT_HPP
#include "../adaptative/StreamFormat.hpp"
#include <string>
namespace
dash
{
using
namespace
adaptative
;
class
DASHStreamFormat
:
public
StreamFormat
{
public:
static
const
unsigned
MPEG2TS
=
StreamFormat
::
UNSUPPORTED
+
1
;
static
const
unsigned
MP4
=
StreamFormat
::
UNSUPPORTED
+
2
;
static
StreamFormat
mimeToFormat
(
const
std
::
string
&
mime
)
{
std
::
string
::
size_type
pos
=
mime
.
find
(
"/"
);
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
string
tail
=
mime
.
substr
(
pos
+
1
);
if
(
tail
==
"mp4"
)
return
StreamFormat
(
DASHStreamFormat
::
MP4
);
else
if
(
tail
==
"mp2t"
)
return
StreamFormat
(
DASHStreamFormat
::
MPEG2TS
);
}
return
StreamFormat
();
}
};
}
#endif // DASHSTREAMFORMAT_HPP
modules/demux/dash/dash.cpp
View file @
bfdc2b60
...
...
@@ -141,6 +141,7 @@ static int Open(vlc_object_t *p_obj)
p_sys
->
p_mpd
=
mpd
;
int
logic
=
var_InheritInteger
(
p_obj
,
"dash-logic"
);
DASHManager
*
p_dashManager
=
new
DASHManager
(
p_sys
->
p_mpd
,
new
(
std
::
nothrow
)
DASHStreamOutputFactory
,
static_cast
<
AbstractAdaptationLogic
::
LogicType
>
(
logic
),
p_demux
->
s
);
...
...
modules/demux/dash/mpd/AdaptationSet.cpp
View file @
bfdc2b60
...
...
@@ -25,6 +25,7 @@
#include "AdaptationSet.h"
#include "Representation.h"
#include "Period.h"
#include "../DASHStreamFormat.hpp"
using
namespace
dash
::
mpd
;
...
...
@@ -39,6 +40,22 @@ AdaptationSet::~AdaptationSet()
{
}
StreamFormat
AdaptationSet
::
getStreamFormat
()
const
{
if
(
!
getMimeType
().
empty
())
{
return
DASHStreamFormat
::
mimeToFormat
(
getMimeType
());
}
else
if
(
!
representations
.
empty
())
{
return
representations
.
front
()
->
getStreamFormat
();