Merge ~morphis/aethercast/+git/aethercast:rename-to-streamer into aethercast:master

Proposed by Simon Fels
Status: Needs review
Proposed branch: ~morphis/aethercast/+git/aethercast:rename-to-streamer
Merge into: aethercast:master
Diff against target: 279 lines (+123/-123)
4 files modified
debian/aethercast-tools.install (+1/-1)
dev/null (+0/-116)
tools/CMakeLists.txt (+6/-6)
tools/streamer.cpp (+116/-0)
Reviewer Review Type Date Requested Status
Jim Hodapp (community) code Approve
Review via email: mp+304460@code.launchpad.net

Commit message

Rename mirscreencast_to_stream to aethercast-streamer

Description of the change

The rename was overdue for a long time.

This MP also serves as a testing point for the new git support just being added to citrain.

To post a comment you must log in.
Revision history for this message
Jim Hodapp (jhodapp) wrote :

LGTM

review: Approve (code)

Unmerged commits

9ae31ba... by Simon Fels

Rename mirscreencast_to_stream to aethercast-streamer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/aethercast-tools.install b/debian/aethercast-tools.install
index 1ff7ff0..a00e91a 100644
--- a/debian/aethercast-tools.install
+++ b/debian/aethercast-tools.install
@@ -1,2 +1,2 @@
1usr/bin/mirscreencast_to_stream1usr/bin/aethercast-streamer
2usr/lib/*/aethercast/tools/libaethercast-lttng.so2usr/lib/*/aethercast/tools/libaethercast-lttng.so
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 178ad9d..eaf863e 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -21,16 +21,16 @@ include_directories(
21 ${GST_INCLUDE_DIRS}21 ${GST_INCLUDE_DIRS}
22)22)
2323
24set(MIRSCREENCAST_TO_STREAM_SOURCES24set(AETHERCAST_STREAMER_SOURCES
25 simplesource.cpp25 simplesource.cpp
26 mirscreencast_to_stream.cpp)26 streamer.cpp)
2727
28add_executable(mirscreencast_to_stream28add_executable(aethercast-streamer
29 ${MIRSCREENCAST_TO_STREAM_SOURCES})29 ${AETHERCAST_STREAMER_SOURCES})
30target_link_libraries(mirscreencast_to_stream aethercast-core)30target_link_libraries(aethercast-streamer aethercast-core)
3131
32install(32install(
33 TARGETS mirscreencast_to_stream33 TARGETS aethercast-streamer
34 RUNTIME DESTINATION bin34 RUNTIME DESTINATION bin
35)35)
3636
diff --git a/tools/mirscreencast_to_stream.cpp b/tools/mirscreencast_to_stream.cpp
37deleted file mode 10064437deleted file mode 100644
index 503dcee..0000000
--- a/tools/mirscreencast_to_stream.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
20
21#include <signal.h>
22#include <sys/time.h>
23#include <sys/resource.h>
24
25#include <string>
26#include <iostream>
27#include <chrono>
28
29#include <boost/program_options.hpp>
30
31#include <ac/logger.h>
32#include <ac/glib_wrapper.h>
33
34#include "simplesource.h"
35
36static GMainLoop *main_loop = nullptr;
37
38namespace {
39const std::chrono::seconds kShutdownGracePreriod{1};
40const std::int16_t kProcessPriorityUrgentDisplay{-8};
41ac::tools::SimpleSource::Ptr source;
42
43static gboolean OnSignalRaised(gpointer user_data) {
44 AC_DEBUG("Exiting");
45
46 g_timeout_add_seconds(kShutdownGracePreriod.count(), [](gpointer user_data) {
47 g_main_loop_quit(main_loop);
48 return FALSE;
49 }, nullptr);
50
51 // This will bring down the whole pipeline and terminate everything
52 // correctly.
53 source.reset();
54
55 // A second SIGTERM should really terminate us and also overlay
56 // the grace period for a proper shutdown we're performing.
57 return FALSE;
58}
59}
60
61int main(int argc, char **argv) {
62 std::string remote_address;
63 int port = 0;
64 bool debug = false;
65
66 g_unix_signal_add(SIGINT, OnSignalRaised, nullptr);
67 g_unix_signal_add(SIGTERM, OnSignalRaised, nullptr);
68
69 main_loop = g_main_loop_new(nullptr, FALSE);
70
71 boost::program_options::options_description desc("Usage");
72 desc.add_options()
73 ("help,h", "displays this message")
74 ("remote,r",
75 boost::program_options::value<std::string>(&remote_address), "Remote host address")
76 ("port,p",
77 boost::program_options::value<int>(&port), "Port to use")
78 ("debug,d",
79 boost::program_options::bool_switch(&debug), "Enable verbose debug output");
80
81 boost::program_options::variables_map vm;
82 try {
83 boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
84 boost::program_options::notify(vm);
85 }
86 catch(boost::program_options::error& e) {
87 std::cerr << e.what() << std::endl << std::endl;
88 std::cerr << desc << std::endl;
89 return EXIT_FAILURE;
90 }
91
92 if (vm.count("help")) {
93 std::cout << desc << std::endl;
94 return EXIT_SUCCESS;
95 }
96
97 if (remote_address.length() == 0)
98 throw std::runtime_error("Invalid address supplied");
99
100 if (port == 0)
101 throw std::runtime_error("Invalid or no port supplied");
102
103 setpriority(PRIO_PROCESS, 0, kProcessPriorityUrgentDisplay);
104
105 if (debug)
106 ac::Log().Init(ac::Logger::Severity::kDebug);
107
108 source = ac::tools::SimpleSource::Create(remote_address, port);
109 source->Start();
110
111 g_main_loop_run(main_loop);
112
113 g_main_loop_unref(main_loop);
114
115 return EXIT_SUCCESS;
116}
diff --git a/tools/streamer.cpp b/tools/streamer.cpp
117new file mode 1006440new file mode 100644
index 0000000..503dcee
--- /dev/null
+++ b/tools/streamer.cpp
@@ -0,0 +1,116 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
20
21#include <signal.h>
22#include <sys/time.h>
23#include <sys/resource.h>
24
25#include <string>
26#include <iostream>
27#include <chrono>
28
29#include <boost/program_options.hpp>
30
31#include <ac/logger.h>
32#include <ac/glib_wrapper.h>
33
34#include "simplesource.h"
35
36static GMainLoop *main_loop = nullptr;
37
38namespace {
39const std::chrono::seconds kShutdownGracePreriod{1};
40const std::int16_t kProcessPriorityUrgentDisplay{-8};
41ac::tools::SimpleSource::Ptr source;
42
43static gboolean OnSignalRaised(gpointer user_data) {
44 AC_DEBUG("Exiting");
45
46 g_timeout_add_seconds(kShutdownGracePreriod.count(), [](gpointer user_data) {
47 g_main_loop_quit(main_loop);
48 return FALSE;
49 }, nullptr);
50
51 // This will bring down the whole pipeline and terminate everything
52 // correctly.
53 source.reset();
54
55 // A second SIGTERM should really terminate us and also overlay
56 // the grace period for a proper shutdown we're performing.
57 return FALSE;
58}
59}
60
61int main(int argc, char **argv) {
62 std::string remote_address;
63 int port = 0;
64 bool debug = false;
65
66 g_unix_signal_add(SIGINT, OnSignalRaised, nullptr);
67 g_unix_signal_add(SIGTERM, OnSignalRaised, nullptr);
68
69 main_loop = g_main_loop_new(nullptr, FALSE);
70
71 boost::program_options::options_description desc("Usage");
72 desc.add_options()
73 ("help,h", "displays this message")
74 ("remote,r",
75 boost::program_options::value<std::string>(&remote_address), "Remote host address")
76 ("port,p",
77 boost::program_options::value<int>(&port), "Port to use")
78 ("debug,d",
79 boost::program_options::bool_switch(&debug), "Enable verbose debug output");
80
81 boost::program_options::variables_map vm;
82 try {
83 boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
84 boost::program_options::notify(vm);
85 }
86 catch(boost::program_options::error& e) {
87 std::cerr << e.what() << std::endl << std::endl;
88 std::cerr << desc << std::endl;
89 return EXIT_FAILURE;
90 }
91
92 if (vm.count("help")) {
93 std::cout << desc << std::endl;
94 return EXIT_SUCCESS;
95 }
96
97 if (remote_address.length() == 0)
98 throw std::runtime_error("Invalid address supplied");
99
100 if (port == 0)
101 throw std::runtime_error("Invalid or no port supplied");
102
103 setpriority(PRIO_PROCESS, 0, kProcessPriorityUrgentDisplay);
104
105 if (debug)
106 ac::Log().Init(ac::Logger::Severity::kDebug);
107
108 source = ac::tools::SimpleSource::Create(remote_address, port);
109 source->Start();
110
111 g_main_loop_run(main_loop);
112
113 g_main_loop_unref(main_loop);
114
115 return EXIT_SUCCESS;
116}

Subscribers

People subscribed via source and target branches