PlaylistManager.h 3.61 KB
Newer Older
1
2
3
4
/*
 * PlaylistManager.h
 *****************************************************************************
 * Copyright © 2010 - 2011 Klagenfurt University
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
5
 *             2015 VideoLAN and VLC Authors
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 *
 * 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 PLAYLISTMANAGER_H_
#define PLAYLISTMANAGER_H_

#include "logic/AbstractAdaptationLogic.h"
#include "Streams.hpp"
27
#include <vector>
28

29
namespace adaptive
30
31
32
33
{
    namespace playlist
    {
        class AbstractPlaylist;
34
        class BasePeriod;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    }

    namespace http
    {
        class HTTPConnectionManager;
    }

    using namespace playlist;
    using namespace logic;
    using namespace http;

    class PlaylistManager
    {
        public:
49
            PlaylistManager( demux_t *, AbstractPlaylist *,
50
                             AbstractStreamFactory *,
51
                             AbstractAdaptationLogic::LogicType type );
52
53
            virtual ~PlaylistManager    ();

54
            bool    start();
55

56
            AbstractStream::status demux(mtime_t, bool);
57
            virtual bool needsUpdate() const;
58
            virtual bool updatePlaylist();
59
            virtual void scheduleNextUpdate();
60

61
62
63
64
            /* static callbacks */
            static int control_callback(demux_t *, int, va_list);
            static int demux_callback(demux_t *);

65
        protected:
66
67
68
69
            /* Demux calls */
            virtual int doControl(int, va_list);
            virtual int doDemux(int64_t);

70
71
72
73
            virtual bool    setPosition(mtime_t);
            virtual mtime_t getDuration() const;
            mtime_t getPCR() const;
            mtime_t getFirstDTS() const;
74
75
76
77

            virtual mtime_t getFirstPlaybackTime() const;
            mtime_t getCurrentPlaybackTime() const;

78
            int     esCount() const;
79
            void pruneLiveStream();
80
            virtual bool reactivateStream(AbstractStream *);
81
82
            bool setupPeriod();
            void unsetPeriod();
83
            /* local factories */
84
85
            virtual AbstractAdaptationLogic *createLogic(AbstractAdaptationLogic::LogicType,
                                                         HTTPConnectionManager *);
86
87
88

            HTTPConnectionManager              *conManager;
            AbstractAdaptationLogic::LogicType  logicType;
89
            AbstractAdaptationLogic             *logic;
90
            AbstractPlaylist                    *playlist;
91
            AbstractStreamFactory               *streamFactory;
92
            demux_t                             *p_demux;
93
            std::vector<AbstractStream *>        streams;
94
            time_t                               nextPlaylistupdate;
95
            mtime_t                              i_nzpcr;
96
            mtime_t                              i_firstpcr;
97
            BasePeriod                          *currentPeriod;
98
            int                                  failedupdates;
99
100
101
102
103
    };

}

#endif /* PLAYLISTMANAGER_H_ */