~phablet-team/aethercast/fix-for-microsoft-dongle

« back to all changes in this revision

Viewing changes to src/mcs/mir/sourcemediamanager.h

Add hardware encoding and video streaming support.

The hardware encoding is currently only for Android 5.x based devices. On all others encoding will simply not work. The streaming part of aethercast (MPEGTS packetizing, RTP sending) as based on some code from Android.

Approved by PS Jenkins bot, Thomas Voß, Jim Hodapp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
#ifndef MCS_MIR_SOURCEMEDIAMANAGERNEXT_H_
 
19
#define MCS_MIR_SOURCEMEDIAMANAGERNEXT_H_
 
20
 
 
21
#include <memory>
 
22
 
 
23
#include "mcs/basesourcemediamanager.h"
 
24
 
 
25
#include "mcs/common/executor.h"
 
26
 
 
27
#include "mcs/video/baseencoder.h"
 
28
 
 
29
#include "mcs/streaming/mediasender.h"
 
30
 
 
31
#include "mcs/mir/screencast.h"
 
32
#include "mcs/mir/streamrenderer.h"
 
33
 
 
34
namespace mcs {
 
35
namespace mir {
 
36
 
 
37
class SourceMediaManager : public mcs::BaseSourceMediaManager {
 
38
public:
 
39
    typedef std::shared_ptr<SourceMediaManager> Ptr;
 
40
 
 
41
    enum class State {
 
42
        Playing,
 
43
        Paused,
 
44
        Stopped
 
45
    };
 
46
 
 
47
    static Ptr Create(const std::string &remote_address);
 
48
 
 
49
    ~SourceMediaManager();
 
50
 
 
51
    void Play() override;
 
52
    void Pause() override;
 
53
    void Teardown() override;
 
54
    bool IsPaused() const override;
 
55
 
 
56
    void SendIDRPicture() override;
 
57
 
 
58
    int GetLocalRtpPort() const override;
 
59
 
 
60
private:
 
61
    SourceMediaManager(const std::string &remote_address);
 
62
 
 
63
    void StartPipeline();
 
64
    void StopPipeline();
 
65
 
 
66
protected:
 
67
    bool Configure() override;
 
68
 
 
69
private:
 
70
    std::string remote_address_;
 
71
    State state_;
 
72
    mcs::video::BaseEncoder::Ptr encoder_;
 
73
    mcs::common::Executor::Ptr encoder_executor_;
 
74
    mcs::mir::Screencast::Ptr connector_;
 
75
    mcs::mir::StreamRenderer::Ptr renderer_;
 
76
    mcs::streaming::MediaSender::Ptr sender_;
 
77
};
 
78
 
 
79
} // namespace mir
 
80
} // namespace mcs
 
81
 
 
82
#endif