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
42880f79
Commit
42880f79
authored
Sep 29, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add SourceStream
parent
fe5049dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
246 additions
and
0 deletions
+246
-0
modules/demux/Makefile.am
modules/demux/Makefile.am
+3
-0
modules/demux/adaptative/ChunksSource.hpp
modules/demux/adaptative/ChunksSource.hpp
+39
-0
modules/demux/adaptative/plumbing/SourceStream.cpp
modules/demux/adaptative/plumbing/SourceStream.cpp
+139
-0
modules/demux/adaptative/plumbing/SourceStream.hpp
modules/demux/adaptative/plumbing/SourceStream.hpp
+65
-0
No files found.
modules/demux/Makefile.am
View file @
42880f79
...
...
@@ -307,8 +307,11 @@ libadaptative_plugin_la_SOURCES = \
demux/adaptative/plumbing/FakeESOut.hpp
\
demux/adaptative/plumbing/FakeESOutID.cpp
\
demux/adaptative/plumbing/FakeESOutID.hpp
\
demux/adaptative/plumbing/SourceStream.cpp
\
demux/adaptative/plumbing/SourceStream.hpp
\
demux/adaptative/plumbing/StreamOutput.cpp
\
demux/adaptative/plumbing/StreamOutput.hpp
\
demux/adaptative/ChunksSource.hpp
\
demux/adaptative/PlaylistManager.cpp
\
demux/adaptative/PlaylistManager.h
\
demux/adaptative/SegmentTracker.cpp
\
...
...
modules/demux/adaptative/ChunksSource.hpp
0 → 100644
View file @
42880f79
/*
* ChunksSource.hpp
*****************************************************************************
* Copyright © 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 CHUNKSSOURCE_HPP
#define CHUNKSSOURCE_HPP
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
namespace
adaptative
{
class
ChunksSource
{
public:
virtual
block_t
*
readNextBlock
(
size_t
)
=
0
;
};
}
#endif // CHUNKSSOURCE_HPP
modules/demux/adaptative/plumbing/SourceStream.cpp
0 → 100644
View file @
42880f79
/*
* SourceStream.cpp
*****************************************************************************
* Copyright © 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 "SourceStream.hpp"
#include "../ChunksSource.hpp"
#include <vlc_stream.h>
#include <vlc_demux.h>
using
namespace
adaptative
;
ChunksSourceStream
::
ChunksSourceStream
(
vlc_object_t
*
p_obj
,
ChunksSource
*
source_
)
{
p_block
=
NULL
;
b_eof
=
false
;
custom_stream
=
stream_CustomNew
(
p_obj
,
delete_Callback
);
if
(
!
custom_stream
)
throw
VLC_EGENERIC
;
custom_stream
->
pf_control
=
control_Callback
;
custom_stream
->
pf_read
=
read_Callback
;
custom_stream
->
pf_readdir
=
NULL
;
custom_stream
->
pf_seek
=
seek_Callback
;
custom_stream
->
p_sys
=
reinterpret_cast
<
stream_sys_t
*>
(
this
);
source
=
source_
;
}
ChunksSourceStream
::~
ChunksSourceStream
()
{
if
(
custom_stream
)
stream_Delete
(
custom_stream
);
Reset
();
}
void
ChunksSourceStream
::
Reset
()
{
if
(
p_block
)
block_Release
(
p_block
);
p_block
=
NULL
;
b_eof
=
false
;
}
stream_t
*
ChunksSourceStream
::
getStream
()
{
return
custom_stream
;
}
ssize_t
ChunksSourceStream
::
Read
(
uint8_t
*
buf
,
size_t
size
)
{
size_t
i_copied
=
0
;
size_t
i_toread
=
size
;
while
(
i_toread
&&
!
b_eof
)
{
if
(
!
p_block
&&
!
(
p_block
=
source
->
readNextBlock
(
i_toread
)))
{
b_eof
=
true
;
break
;
}
if
(
p_block
->
i_buffer
>
i_toread
)
{
if
(
buf
)
memcpy
(
buf
+
i_copied
,
p_block
->
p_buffer
,
i_toread
);
i_copied
+=
i_toread
;
p_block
->
p_buffer
+=
i_toread
;
p_block
->
i_buffer
-=
i_toread
;
i_toread
=
0
;
}
else
{
if
(
buf
)
memcpy
(
buf
+
i_copied
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
i_copied
+=
p_block
->
i_buffer
;
i_toread
-=
p_block
->
i_buffer
;
block_Release
(
p_block
);
p_block
=
NULL
;
}
}
return
i_copied
;
}
ssize_t
ChunksSourceStream
::
read_Callback
(
stream_t
*
s
,
void
*
buf
,
size_t
size
)
{
ChunksSourceStream
*
me
=
reinterpret_cast
<
ChunksSourceStream
*>
(
s
->
p_sys
);
return
me
->
Read
(
reinterpret_cast
<
uint8_t
*>
(
buf
),
size
);
}
int
ChunksSourceStream
::
seek_Callback
(
stream_t
*
,
uint64_t
)
{
return
VLC_EGENERIC
;
}
int
ChunksSourceStream
::
control_Callback
(
stream_t
*
,
int
i_query
,
va_list
args
)
{
switch
(
i_query
)
{
case
STREAM_GET_SIZE
:
*
(
va_arg
(
args
,
uint64_t
*
))
=
0
;
return
VLC_SUCCESS
;
case
STREAM_CAN_SEEK
:
case
STREAM_CAN_FASTSEEK
:
case
STREAM_CAN_PAUSE
:
case
STREAM_CAN_CONTROL_PACE
:
*
va_arg
(
args
,
bool
*
)
=
false
;
return
VLC_SUCCESS
;
case
STREAM_GET_PTS_DELAY
:
*
(
va_arg
(
args
,
uint64_t
*
))
=
DEFAULT_PTS_DELAY
;
return
VLC_SUCCESS
;
default:
return
VLC_EGENERIC
;
}
}
void
ChunksSourceStream
::
delete_Callback
(
stream_t
*
)
{
}
modules/demux/adaptative/plumbing/SourceStream.hpp
0 → 100644
View file @
42880f79
/*
* SourceStream.hpp
*****************************************************************************
* Copyright © 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 SOURCESTREAM_HPP
#define SOURCESTREAM_HPP
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_block.h>
namespace
adaptative
{
class
ChunksSource
;
class
AbstractSourceStream
{
public:
virtual
~
AbstractSourceStream
()
{}
virtual
stream_t
*
getStream
()
=
0
;
virtual
void
Reset
()
=
0
;
};
class
ChunksSourceStream
:
public
AbstractSourceStream
{
public:
ChunksSourceStream
(
vlc_object_t
*
,
ChunksSource
*
);
virtual
~
ChunksSourceStream
();
virtual
stream_t
*
getStream
();
/* impl */
virtual
void
Reset
();
/* impl */
protected:
ssize_t
Read
(
uint8_t
*
,
size_t
);
private:
block_t
*
p_block
;
bool
b_eof
;
static
ssize_t
read_Callback
(
stream_t
*
,
void
*
,
size_t
);
static
int
seek_Callback
(
stream_t
*
,
uint64_t
);
static
int
control_Callback
(
stream_t
*
,
int
i_query
,
va_list
);
static
void
delete_Callback
(
stream_t
*
);
stream_t
*
custom_stream
;
ChunksSource
*
source
;
};
}
#endif // SOURCESTREAM_HPP
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