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

« back to all changes in this revision

Viewing changes to src/mcs/testsourcemediamanager.cpp

  • Committer: Tarmac
  • Author(s): Simon Fels
  • Date: 2016-03-15 08:36:21 UTC
  • mfrom: (130.1.1 ac-drop-gstreamer)
  • Revision ID: tarmac-20160315083621-f5ptj1tls050zpbq
Drop gstreamer backend

We're not going to support gstreamer as a streaming backend as of now. However this doesn't prevent us from bringing it back later but for now we want to remove that code portion to keep the code base we have to maintain as focused as possible and not ship code we never test or use.

Approved by Thomas Voß, PS Jenkins bot.

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
 
#include <sstream>
19
 
 
20
 
#include <gst/gst.h>
21
 
 
22
 
#include "logger.h"
23
 
#include "testsourcemediamanager.h"
24
 
#include "utils.h"
25
 
#include "logging.h"
26
 
 
27
 
#include "mcs/video/videoformat.h"
28
 
 
29
 
namespace mcs {
30
 
std::shared_ptr<TestSourceMediaManager> TestSourceMediaManager::create(const std::string &remote_address) {
31
 
    return std::shared_ptr<TestSourceMediaManager>{new TestSourceMediaManager{remote_address}};
32
 
}
33
 
 
34
 
TestSourceMediaManager::TestSourceMediaManager(const std::string &remote_address) :
35
 
    remote_address_(remote_address) {
36
 
}
37
 
 
38
 
TestSourceMediaManager::~TestSourceMediaManager() {
39
 
}
40
 
 
41
 
SharedGObject<GstElement> TestSourceMediaManager::ConstructPipeline(const wds::H264VideoFormat &format) {
42
 
    auto profile = mcs::video::ExtractH264Profile(format);
43
 
    auto rr = mcs::video::ExtractRateAndResolution(format);
44
 
 
45
 
#if 0
46
 
    std::stringstream ss;
47
 
    ss << Utils::Sprintf("videotestsrc ! video/x-raw,format=I420,framerate=%d/1,width=%d,height=%d,pixel-aspect-ratio=1/1 ! ", rr.framerate, rr.width, rr.height);
48
 
    ss << "x264enc tune=zerolatency byte-stream=true ! ";
49
 
    ss << Utils::Sprintf("video/x-h264,profile=%s ! ", profile.c_str());
50
 
    ss << "mpegtsmux ! rtpmp2tpay ! ";
51
 
    ss << Utils::Sprintf("udpsink name=sink host=%s port=%d", remote_address_.c_str(), sink_port1_);
52
 
#else
53
 
    std::stringstream ss;
54
 
    ss << "ximagesrc ! ";
55
 
    ss << Utils::Sprintf("videoconvert ! video/x-raw,format=I420,framerate=%d/1,pixel-aspect-ratio=1/1 ! ", rr.framerate);
56
 
    ss << Utils::Sprintf("videoscale ! video/x-raw,width=%d,height=%d ! ", rr.width, rr.height);
57
 
    ss << "queue2 ! ";
58
 
    ss << "x264enc byte-stream=true tune=zerolatency interlaced=false ! ";
59
 
    ss << Utils::Sprintf("video/x-h264,profile=%s !", profile.c_str());
60
 
    ss << "mpegtsmux ! rtpmp2tpay ! ";
61
 
    ss << Utils::Sprintf("udpsink name=sink host=%s port=%d", remote_address_.c_str(), sink_port1_);
62
 
#endif
63
 
 
64
 
    DEBUG("pipeline: %s", ss.str());
65
 
 
66
 
    GError *error = nullptr;
67
 
    GstElement *pipeline = gst_parse_launch(ss.str().c_str(), &error);
68
 
    if (error) {
69
 
        ERROR("Failed to setup GStreamer pipeline: %s", error->message);
70
 
        g_error_free(error);
71
 
        return nullptr;
72
 
    }
73
 
 
74
 
    return make_shared_gobject(pipeline);
75
 
}
76
 
} // namespace mcs