3 *****************************************************************************
4 * Copyright © 2010 - 2011 Klagenfurt University
5 * 2015 VideoLAN and VLC Authors
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
22 #ifndef PLAYLISTMANAGER_H_
23 #define PLAYLISTMANAGER_H_
25 #include "logic/AbstractAdaptationLogic.h"
26 #include "Streams.hpp"
29 #include <vlc_cxx_helpers.hpp>
41 class AbstractConnectionManager
;
44 using namespace playlist
;
45 using namespace logic
;
50 PlaylistManager( demux_t
*,
53 AbstractStreamFactory
*,
54 AbstractAdaptationLogic::LogicType type
);
55 virtual ~PlaylistManager ();
62 AbstractStream::BufferingStatus
bufferize(vlc_tick_t
, vlc_tick_t
, vlc_tick_t
);
63 AbstractStream::Status
dequeue(vlc_tick_t
, vlc_tick_t
*);
65 virtual bool needsUpdate() const;
66 virtual bool updatePlaylist();
67 virtual void scheduleNextUpdate();
69 /* static callbacks */
70 static int control_callback(demux_t
*, int, va_list);
71 static int demux_callback(demux_t
*);
75 virtual int doControl(int, va_list);
76 virtual int doDemux(vlc_tick_t
);
78 void setLivePause(bool);
79 virtual bool setPosition(vlc_tick_t
);
80 vlc_tick_t
getResumeTime() const;
81 vlc_tick_t
getFirstDTS() const;
82 unsigned getActiveStreamsCount() const;
84 virtual vlc_tick_t
getFirstPlaybackTime() const;
85 vlc_tick_t
getCurrentDemuxTime() const;
86 vlc_tick_t
getMinAheadTime() const;
88 virtual bool reactivateStream(AbstractStream
*);
92 void updateControlsPosition();
95 virtual AbstractAdaptationLogic
*createLogic(AbstractAdaptationLogic::LogicType
,
96 AbstractConnectionManager
*);
97 virtual AbstractBufferingLogic
*createBufferingLogic() const;
99 SharedResources
*resources
;
100 AbstractAdaptationLogic::LogicType logicType
;
101 AbstractAdaptationLogic
*logic
;
102 AbstractBufferingLogic
*bufferingLogic
;
103 BasePlaylist
*playlist
;
104 AbstractStreamFactory
*streamFactory
;
106 std::vector
<AbstractStream
*> streams
;
107 BasePeriod
*currentPeriod
;
109 /* shared with demux/buffering */
113 vlc_tick_t i_firstpcr
;
114 mutable vlc_mutex_t lock
;
118 /* buffering process */
119 time_t nextPlaylistupdate
;
128 mutable vlc_mutex_t lock
;
129 vlc_tick_t playlistStart
;
130 vlc_tick_t playlistEnd
;
131 vlc_tick_t playlistLength
;
136 void setBufferingRunState(bool);
138 static void * managerThread(void *);
139 vlc::threads::mutex lock
;
140 vlc::threads::condition_variable waitcond
;
145 vlc_tick_t pause_start
;
150 #endif /* PLAYLISTMANAGER_H_ */