Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Martin Finkel
VLC
Commits
8f095301
Commit
8f095301
authored
Feb 21, 2018
by
François Cartegnie
🤞
Browse files
demux: adaptive: move mime to format conversion
parent
b6a4a1b6
Changes
7
Hide whitespace changes
Inline
Side-by-side
modules/demux/adaptive/StreamFormat.cpp
View file @
8f095301
...
...
@@ -23,6 +23,7 @@
#endif
#include "StreamFormat.hpp"
#include <algorithm>
using
namespace
adaptive
;
...
...
@@ -58,6 +59,26 @@ StreamFormat::StreamFormat( unsigned formatid_ )
formatid
=
formatid_
;
}
StreamFormat
::
StreamFormat
(
const
std
::
string
&
mimetype
)
{
std
::
string
mime
=
mimetype
;
std
::
transform
(
mime
.
begin
(),
mime
.
end
(),
mime
.
begin
(),
::
tolower
);
std
::
string
::
size_type
pos
=
mime
.
find
(
"/"
);
formatid
=
UNSUPPORTED
;
if
(
pos
!=
std
::
string
::
npos
)
{
std
::
string
tail
=
mime
.
substr
(
pos
+
1
);
if
(
tail
==
"mp4"
)
formatid
=
StreamFormat
::
MP4
;
else
if
(
tail
==
"mp2t"
)
formatid
=
StreamFormat
::
MPEG2TS
;
else
if
(
tail
==
"vtt"
)
formatid
=
StreamFormat
::
WEBVTT
;
else
if
(
tail
==
"ttml+xml"
)
formatid
=
StreamFormat
::
TTML
;
}
}
StreamFormat
::~
StreamFormat
()
{
...
...
modules/demux/adaptive/StreamFormat.hpp
View file @
8f095301
...
...
@@ -37,6 +37,7 @@ namespace adaptive
static
const
unsigned
UNKNOWN
=
0xFF
;
/* will probe */
StreamFormat
(
unsigned
=
UNSUPPORTED
);
explicit
StreamFormat
(
const
std
::
string
&
mime
);
~
StreamFormat
();
operator
unsigned
()
const
;
std
::
string
str
()
const
;
...
...
modules/demux/adaptive/plumbing/Demuxer.cpp
View file @
8f095301
...
...
@@ -27,6 +27,7 @@
#include <vlc_stream.h>
#include <vlc_demux.h>
#include "SourceStream.hpp"
#include "../StreamFormat.hpp"
#include "CommandsQueue.hpp"
#include "../ChunksSource.hpp"
...
...
modules/demux/dash/mpd/AdaptationSet.cpp
View file @
8f095301
...
...
@@ -46,7 +46,7 @@ AdaptationSet::~AdaptationSet()
StreamFormat
AdaptationSet
::
getStreamFormat
()
const
{
if
(
!
getMimeType
().
empty
())
return
MPD
::
mimeTo
Format
(
getMimeType
());
return
Stream
Format
(
getMimeType
());
else
return
BaseAdaptationSet
::
getStreamFormat
();
}
...
...
modules/demux/dash/mpd/MPD.cpp
View file @
8f095301
...
...
@@ -65,24 +65,6 @@ Profile MPD::getProfile() const
return
profile
;
}
StreamFormat
MPD
::
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
(
StreamFormat
::
MP4
);
else
if
(
tail
==
"mp2t"
)
return
StreamFormat
(
StreamFormat
::
MPEG2TS
);
else
if
(
tail
==
"vtt"
)
return
StreamFormat
(
StreamFormat
::
WEBVTT
);
else
if
(
tail
==
"ttml+xml"
)
return
StreamFormat
(
StreamFormat
::
TTML
);
}
return
StreamFormat
();
}
void
MPD
::
debug
()
{
msg_Dbg
(
p_object
,
"MPD profile=%s mediaPresentationDuration=%"
PRId64
...
...
modules/demux/dash/mpd/MPD.h
View file @
8f095301
...
...
@@ -48,8 +48,6 @@ namespace dash
virtual
bool
isLive
()
const
;
virtual
void
debug
();
static
StreamFormat
mimeToFormat
(
const
std
::
string
&
);
Property
<
ProgramInformation
*>
programInfo
;
private:
...
...
modules/demux/dash/mpd/Representation.cpp
View file @
8f095301
...
...
@@ -51,9 +51,9 @@ Representation::~Representation ()
StreamFormat
Representation
::
getStreamFormat
()
const
{
if
(
getMimeType
().
empty
())
return
MPD
::
mimeTo
Format
(
adaptationSet
->
getMimeType
());
return
Stream
Format
(
adaptationSet
->
getMimeType
());
else
return
MPD
::
mimeTo
Format
(
getMimeType
());
return
Stream
Format
(
getMimeType
());
}
TrickModeType
*
Representation
::
getTrickModeType
()
const
...
...
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