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
d84d7803
Commit
d84d7803
authored
Oct 30, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: refactor atoms reader
parent
05663f7b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
39 deletions
+126
-39
modules/demux/Makefile.am
modules/demux/Makefile.am
+4
-2
modules/demux/adaptative/mp4/AtomsReader.cpp
modules/demux/adaptative/mp4/AtomsReader.cpp
+10
-25
modules/demux/adaptative/mp4/AtomsReader.hpp
modules/demux/adaptative/mp4/AtomsReader.hpp
+2
-9
modules/demux/dash/mp4/IndexReader.cpp
modules/demux/dash/mp4/IndexReader.cpp
+58
-0
modules/demux/dash/mp4/IndexReader.hpp
modules/demux/dash/mp4/IndexReader.hpp
+49
-0
modules/demux/dash/mpd/DASHSegment.cpp
modules/demux/dash/mpd/DASHSegment.cpp
+3
-3
No files found.
modules/demux/Makefile.am
View file @
d84d7803
...
...
@@ -292,6 +292,8 @@ libadaptative_plugin_la_SOURCES = \
demux/adaptative/logic/RateBasedAdaptationLogic.cpp
\
demux/adaptative/logic/Representationselectors.hpp
\
demux/adaptative/logic/Representationselectors.cpp
\
demux/adaptative/mp4/AtomsReader.cpp
\
demux/adaptative/mp4/AtomsReader.hpp
\
demux/adaptative/http/BytesRange.cpp
\
demux/adaptative/http/BytesRange.hpp
\
demux/adaptative/http/Chunk.cpp
\
...
...
@@ -362,8 +364,8 @@ libadaptative_dash_SOURCES = \
demux/dash/mpd/Representation.h
\
demux/dash/mpd/TrickModeType.cpp
\
demux/dash/mpd/TrickModeType.h
\
demux/dash/mp4/
Atoms
Reader.cpp
\
demux/dash/mp4/
Atoms
Reader.hpp
\
demux/dash/mp4/
Index
Reader.cpp
\
demux/dash/mp4/
Index
Reader.hpp
\
demux/dash/DASHManager.cpp
\
demux/dash/DASHManager.h
\
demux/dash/DASHStream.cpp
\
...
...
modules/demux/
dash
/mp4/AtomsReader.cpp
→
modules/demux/
adaptative
/mp4/AtomsReader.cpp
View file @
d84d7803
...
...
@@ -18,11 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "AtomsReader.hpp"
#include "../mpd/Representation.h"
#include "../mpd/MPD.h"
using
namespace
dash
::
mp4
;
using
namespace
dash
::
mpd
;
using
namespace
adaptative
::
mp4
;
AtomsReader
::
AtomsReader
(
vlc_object_t
*
object_
)
{
...
...
@@ -31,6 +28,11 @@ AtomsReader::AtomsReader(vlc_object_t *object_)
}
AtomsReader
::~
AtomsReader
()
{
clean
();
}
void
AtomsReader
::
clean
()
{
while
(
rootbox
&&
rootbox
->
p_first
)
{
...
...
@@ -39,12 +41,13 @@ AtomsReader::~AtomsReader()
rootbox
->
p_first
=
p_next
;
}
delete
rootbox
;
rootbox
=
NULL
;
}
bool
AtomsReader
::
parseBlock
(
block_t
*
p_block
,
BaseRepresentation
*
rep
)
bool
AtomsReader
::
parseBlock
(
block_t
*
p_block
)
{
if
(
!
rep
)
return
false
;
if
(
rootbox
)
clean
()
;
stream_t
*
stream
=
stream_MemoryNew
(
object
,
p_block
->
p_buffer
,
p_block
->
i_buffer
,
true
);
if
(
stream
)
...
...
@@ -63,24 +66,6 @@ bool AtomsReader::parseBlock(block_t *p_block, BaseRepresentation *rep)
#ifndef NDEBUG
MP4_BoxDumpStructure
(
stream
,
rootbox
);
#endif
MP4_Box_t
*
sidxbox
=
MP4_BoxGet
(
rootbox
,
"sidx"
);
if
(
sidxbox
)
{
Representation
::
SplitPoint
point
;
std
::
vector
<
Representation
::
SplitPoint
>
splitlist
;
MP4_Box_data_sidx_t
*
sidx
=
sidxbox
->
data
.
p_sidx
;
point
.
offset
=
sidx
->
i_first_offset
;
point
.
time
=
0
;
for
(
uint16_t
i
=
0
;
i
<
sidx
->
i_reference_count
&&
sidx
->
i_timescale
;
i
++
)
{
splitlist
.
push_back
(
point
);
point
.
offset
+=
sidx
->
p_items
[
i
].
i_referenced_size
;
point
.
time
+=
CLOCK_FREQ
*
sidx
->
p_items
[
i
].
i_subsegment_duration
/
sidx
->
i_timescale
;
}
rep
->
SplitUsingIndex
(
splitlist
);
rep
->
getPlaylist
()
->
debug
();
}
}
stream_Delete
(
stream
);
}
...
...
modules/demux/
dash
/mp4/AtomsReader.hpp
→
modules/demux/
adaptative
/mp4/AtomsReader.hpp
View file @
d84d7803
...
...
@@ -31,14 +31,6 @@ extern "C" {
}
namespace
adaptative
{
namespace
playlist
{
class
BaseRepresentation
;
}
}
namespace
dash
{
namespace
mp4
{
...
...
@@ -47,7 +39,8 @@ namespace dash
public:
AtomsReader
(
vlc_object_t
*
);
~
AtomsReader
();
bool
parseBlock
(
block_t
*
,
adaptative
::
playlist
::
BaseRepresentation
*
);
void
clean
();
bool
parseBlock
(
block_t
*
);
protected:
vlc_object_t
*
object
;
...
...
modules/demux/dash/mp4/IndexReader.cpp
0 → 100644
View file @
d84d7803
/*
* IndexReader.cpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN and VLC 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 "IndexReader.hpp"
#include "../mpd/Representation.h"
#include "../mpd/MPD.h"
using
namespace
adaptative
::
mp4
;
using
namespace
dash
::
mp4
;
using
namespace
dash
::
mpd
;
IndexReader
::
IndexReader
(
vlc_object_t
*
obj
)
:
AtomsReader
(
obj
)
{
}
bool
IndexReader
::
parseIndex
(
block_t
*
p_block
,
BaseRepresentation
*
rep
)
{
if
(
!
rep
||
!
parseBlock
(
p_block
))
return
false
;
MP4_Box_t
*
sidxbox
=
MP4_BoxGet
(
rootbox
,
"sidx"
);
if
(
sidxbox
)
{
Representation
::
SplitPoint
point
;
std
::
vector
<
Representation
::
SplitPoint
>
splitlist
;
MP4_Box_data_sidx_t
*
sidx
=
sidxbox
->
data
.
p_sidx
;
point
.
offset
=
sidx
->
i_first_offset
;
point
.
time
=
0
;
for
(
uint16_t
i
=
0
;
i
<
sidx
->
i_reference_count
&&
sidx
->
i_timescale
;
i
++
)
{
splitlist
.
push_back
(
point
);
point
.
offset
+=
sidx
->
p_items
[
i
].
i_referenced_size
;
point
.
time
+=
CLOCK_FREQ
*
sidx
->
p_items
[
i
].
i_subsegment_duration
/
sidx
->
i_timescale
;
}
rep
->
SplitUsingIndex
(
splitlist
);
rep
->
getPlaylist
()
->
debug
();
}
return
true
;
}
modules/demux/dash/mp4/IndexReader.hpp
0 → 100644
View file @
d84d7803
/*
* IndexReader.hpp
*****************************************************************************
* Copyright (C) 2015 - VideoLAN and VLC 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 INDEXREADER_HPP
#define INDEXREADER_HPP
#include "../adaptative/mp4/AtomsReader.hpp"
namespace
adaptative
{
namespace
playlist
{
class
BaseRepresentation
;
}
}
namespace
dash
{
namespace
mp4
{
using
namespace
adaptative
::
mp4
;
using
namespace
adaptative
::
playlist
;
class
IndexReader
:
public
AtomsReader
{
public:
IndexReader
(
vlc_object_t
*
);
bool
parseIndex
(
block_t
*
,
BaseRepresentation
*
);
};
}
}
#endif // INDEXREADER_HPP
modules/demux/dash/mpd/DASHSegment.cpp
View file @
d84d7803
...
...
@@ -28,7 +28,7 @@
#include "DASHSegment.h"
#include "../adaptative/playlist/BaseRepresentation.h"
#include "../mp4/
Atoms
Reader.hpp"
#include "../mp4/
Index
Reader.hpp"
#include "../adaptative/playlist/AbstractPlaylist.hpp"
#include "../adaptative/playlist/SegmentChunk.hpp"
...
...
@@ -46,6 +46,6 @@ void DashIndexSegment::onChunkDownload(block_t **pp_block, SegmentChunk *, BaseR
if
(
!
rep
)
return
;
Atoms
Reader
br
(
rep
->
getPlaylist
()
->
getVLCObject
());
br
.
parse
Block
(
*
pp_block
,
rep
);
Index
Reader
br
(
rep
->
getPlaylist
()
->
getVLCObject
());
br
.
parse
Index
(
*
pp_block
,
rep
);
}
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