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
1diff --git a/debian/aethercast-tools.install b/debian/aethercast-tools.install
2index 1ff7ff0..a00e91a 100644
3--- a/debian/aethercast-tools.install
4+++ b/debian/aethercast-tools.install
5@@ -1,2 +1,2 @@
6-usr/bin/mirscreencast_to_stream
7+usr/bin/aethercast-streamer
8 usr/lib/*/aethercast/tools/libaethercast-lttng.so
9diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
10index 178ad9d..eaf863e 100644
11--- a/tools/CMakeLists.txt
12+++ b/tools/CMakeLists.txt
13@@ -21,16 +21,16 @@ include_directories(
14 ${GST_INCLUDE_DIRS}
15 )
16
17-set(MIRSCREENCAST_TO_STREAM_SOURCES
18+set(AETHERCAST_STREAMER_SOURCES
19 simplesource.cpp
20- mirscreencast_to_stream.cpp)
21+ streamer.cpp)
22
23-add_executable(mirscreencast_to_stream
24- ${MIRSCREENCAST_TO_STREAM_SOURCES})
25-target_link_libraries(mirscreencast_to_stream aethercast-core)
26+add_executable(aethercast-streamer
27+ ${AETHERCAST_STREAMER_SOURCES})
28+target_link_libraries(aethercast-streamer aethercast-core)
29
30 install(
31- TARGETS mirscreencast_to_stream
32+ TARGETS aethercast-streamer
33 RUNTIME DESTINATION bin
34 )
35
36diff --git a/tools/mirscreencast_to_stream.cpp b/tools/mirscreencast_to_stream.cpp
37deleted file mode 100644
38index 503dcee..0000000
39--- a/tools/mirscreencast_to_stream.cpp
40+++ /dev/null
41@@ -1,116 +0,0 @@
42-/*
43- * Copyright (C) 2016 Canonical, Ltd.
44- *
45- * This program is free software; you can redistribute it and/or modify
46- * it under the terms of the GNU General Public License as published by
47- * the Free Software Foundation; either version 2 of the License, or
48- * (at your option) any later version.
49- *
50- * This program is distributed in the hope that it will be useful,
51- * but WITHOUT ANY WARRANTY; without even the implied warranty of
52- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53- * GNU General Public License for more details.
54- *
55- * You should have received a copy of the GNU General Public License
56- * along with this program; if not, write to the Free Software
57- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
58- *
59- */
60-
61-
62-#include <signal.h>
63-#include <sys/time.h>
64-#include <sys/resource.h>
65-
66-#include <string>
67-#include <iostream>
68-#include <chrono>
69-
70-#include <boost/program_options.hpp>
71-
72-#include <ac/logger.h>
73-#include <ac/glib_wrapper.h>
74-
75-#include "simplesource.h"
76-
77-static GMainLoop *main_loop = nullptr;
78-
79-namespace {
80-const std::chrono::seconds kShutdownGracePreriod{1};
81-const std::int16_t kProcessPriorityUrgentDisplay{-8};
82-ac::tools::SimpleSource::Ptr source;
83-
84-static gboolean OnSignalRaised(gpointer user_data) {
85- AC_DEBUG("Exiting");
86-
87- g_timeout_add_seconds(kShutdownGracePreriod.count(), [](gpointer user_data) {
88- g_main_loop_quit(main_loop);
89- return FALSE;
90- }, nullptr);
91-
92- // This will bring down the whole pipeline and terminate everything
93- // correctly.
94- source.reset();
95-
96- // A second SIGTERM should really terminate us and also overlay
97- // the grace period for a proper shutdown we're performing.
98- return FALSE;
99-}
100-}
101-
102-int main(int argc, char **argv) {
103- std::string remote_address;
104- int port = 0;
105- bool debug = false;
106-
107- g_unix_signal_add(SIGINT, OnSignalRaised, nullptr);
108- g_unix_signal_add(SIGTERM, OnSignalRaised, nullptr);
109-
110- main_loop = g_main_loop_new(nullptr, FALSE);
111-
112- boost::program_options::options_description desc("Usage");
113- desc.add_options()
114- ("help,h", "displays this message")
115- ("remote,r",
116- boost::program_options::value<std::string>(&remote_address), "Remote host address")
117- ("port,p",
118- boost::program_options::value<int>(&port), "Port to use")
119- ("debug,d",
120- boost::program_options::bool_switch(&debug), "Enable verbose debug output");
121-
122- boost::program_options::variables_map vm;
123- try {
124- boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
125- boost::program_options::notify(vm);
126- }
127- catch(boost::program_options::error& e) {
128- std::cerr << e.what() << std::endl << std::endl;
129- std::cerr << desc << std::endl;
130- return EXIT_FAILURE;
131- }
132-
133- if (vm.count("help")) {
134- std::cout << desc << std::endl;
135- return EXIT_SUCCESS;
136- }
137-
138- if (remote_address.length() == 0)
139- throw std::runtime_error("Invalid address supplied");
140-
141- if (port == 0)
142- throw std::runtime_error("Invalid or no port supplied");
143-
144- setpriority(PRIO_PROCESS, 0, kProcessPriorityUrgentDisplay);
145-
146- if (debug)
147- ac::Log().Init(ac::Logger::Severity::kDebug);
148-
149- source = ac::tools::SimpleSource::Create(remote_address, port);
150- source->Start();
151-
152- g_main_loop_run(main_loop);
153-
154- g_main_loop_unref(main_loop);
155-
156- return EXIT_SUCCESS;
157-}
158diff --git a/tools/streamer.cpp b/tools/streamer.cpp
159new file mode 100644
160index 0000000..503dcee
161--- /dev/null
162+++ b/tools/streamer.cpp
163@@ -0,0 +1,116 @@
164+/*
165+ * Copyright (C) 2016 Canonical, Ltd.
166+ *
167+ * This program is free software; you can redistribute it and/or modify
168+ * it under the terms of the GNU General Public License as published by
169+ * the Free Software Foundation; either version 2 of the License, or
170+ * (at your option) any later version.
171+ *
172+ * This program is distributed in the hope that it will be useful,
173+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
174+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
175+ * GNU General Public License for more details.
176+ *
177+ * You should have received a copy of the GNU General Public License
178+ * along with this program; if not, write to the Free Software
179+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
180+ *
181+ */
182+
183+
184+#include <signal.h>
185+#include <sys/time.h>
186+#include <sys/resource.h>
187+
188+#include <string>
189+#include <iostream>
190+#include <chrono>
191+
192+#include <boost/program_options.hpp>
193+
194+#include <ac/logger.h>
195+#include <ac/glib_wrapper.h>
196+
197+#include "simplesource.h"
198+
199+static GMainLoop *main_loop = nullptr;
200+
201+namespace {
202+const std::chrono::seconds kShutdownGracePreriod{1};
203+const std::int16_t kProcessPriorityUrgentDisplay{-8};
204+ac::tools::SimpleSource::Ptr source;
205+
206+static gboolean OnSignalRaised(gpointer user_data) {
207+ AC_DEBUG("Exiting");
208+
209+ g_timeout_add_seconds(kShutdownGracePreriod.count(), [](gpointer user_data) {
210+ g_main_loop_quit(main_loop);
211+ return FALSE;
212+ }, nullptr);
213+
214+ // This will bring down the whole pipeline and terminate everything
215+ // correctly.
216+ source.reset();
217+
218+ // A second SIGTERM should really terminate us and also overlay
219+ // the grace period for a proper shutdown we're performing.
220+ return FALSE;
221+}
222+}
223+
224+int main(int argc, char **argv) {
225+ std::string remote_address;
226+ int port = 0;
227+ bool debug = false;
228+
229+ g_unix_signal_add(SIGINT, OnSignalRaised, nullptr);
230+ g_unix_signal_add(SIGTERM, OnSignalRaised, nullptr);
231+
232+ main_loop = g_main_loop_new(nullptr, FALSE);
233+
234+ boost::program_options::options_description desc("Usage");
235+ desc.add_options()
236+ ("help,h", "displays this message")
237+ ("remote,r",
238+ boost::program_options::value<std::string>(&remote_address), "Remote host address")
239+ ("port,p",
240+ boost::program_options::value<int>(&port), "Port to use")
241+ ("debug,d",
242+ boost::program_options::bool_switch(&debug), "Enable verbose debug output");
243+
244+ boost::program_options::variables_map vm;
245+ try {
246+ boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
247+ boost::program_options::notify(vm);
248+ }
249+ catch(boost::program_options::error& e) {
250+ std::cerr << e.what() << std::endl << std::endl;
251+ std::cerr << desc << std::endl;
252+ return EXIT_FAILURE;
253+ }
254+
255+ if (vm.count("help")) {
256+ std::cout << desc << std::endl;
257+ return EXIT_SUCCESS;
258+ }
259+
260+ if (remote_address.length() == 0)
261+ throw std::runtime_error("Invalid address supplied");
262+
263+ if (port == 0)
264+ throw std::runtime_error("Invalid or no port supplied");
265+
266+ setpriority(PRIO_PROCESS, 0, kProcessPriorityUrgentDisplay);
267+
268+ if (debug)
269+ ac::Log().Init(ac::Logger::Severity::kDebug);
270+
271+ source = ac::tools::SimpleSource::Create(remote_address, port);
272+ source->Start();
273+
274+ g_main_loop_run(main_loop);
275+
276+ g_main_loop_unref(main_loop);
277+
278+ return EXIT_SUCCESS;
279+}

Subscribers

People subscribed via source and target branches