Improving log (stdout) format, unsuccessful fix for server disconnects
This commit is contained in:
parent
f435ab534d
commit
db18d01797
|
@ -6,7 +6,7 @@ set(CMAKE_CXX_COMPILER clang++)
|
|||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0>=2.70.2)
|
||||
pkg_check_modules(GST-B REQUIRED IMPORTED_TARGET gstreamer-base-1.0>=1.18.0)
|
||||
pkg_check_modules(GST-B REQUIRED IMPORTED_TARGET gstreamer-base-1.0>=1.18.6)
|
||||
pkg_check_modules(YAML-CPP REQUIRED IMPORTED_TARGET yaml-cpp>=0.7.0)
|
||||
pkg_check_modules(LIBCURL REQUIRED IMPORTED_TARGET libcurl>=7.81.0)
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
std::string time_str{std::ctime(&time)};
|
||||
time_str.pop_back();
|
||||
std::cout << time_str << ": playing " << std::quoted(current_track)
|
||||
std::cout << "- " << time_str << ": playing " << std::quoted(current_track)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
continue;
|
||||
if (!std::ifstream(line).good()) {
|
||||
// if (config.log_debug)
|
||||
std::cout << "FILE UNREADABLE: " << std::quoted(line) << std::endl;
|
||||
std::cout << "-- FILE UNREADABLE: " << std::quoted(line) << std::endl;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -218,6 +218,7 @@ private:
|
|||
typedef enum {
|
||||
INT_STATUS_UNKNOWN_FILETYPE = std::uint16_t(1 << 0),
|
||||
INT_STATUS_NO_PAD_LINKED = std::uint16_t(1 << 1),
|
||||
INT_STATUS_SHOUT2SEND_ERRORED = std::uint16_t(1 << 2),
|
||||
} InternalStatus;
|
||||
std::uint16_t internal_status_{0};
|
||||
std::string current_title{""};
|
||||
|
@ -448,6 +449,21 @@ public:
|
|||
instance.internal_status_ |= INT_STATUS_UNKNOWN_FILETYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Unfortunately, handling this error only is insufficient. Moreover, the
|
||||
* pipeline sometimes just quits in these cases without being able to catch
|
||||
* the error anywhere: no error codes, no exceptions, nothing. In those cases,
|
||||
* not even code after the g_main_loop_run() gets executed.
|
||||
*
|
||||
*/
|
||||
// inline static void cb_shout2send_connectionproblem(
|
||||
// GstElement *element, gint arg0, StreamerInternals &instance) {
|
||||
// instance.internal_status_ |= INT_STATUS_SHOUT2SEND_ERRORED;
|
||||
// std::cout << "cb_shout2send_connectionproblem: "
|
||||
// << GST_ELEMENT_NAME(element) << std::endl;
|
||||
// }
|
||||
|
||||
inline void change_to_next_track() {
|
||||
is_title_set = false;
|
||||
GstStateChangeReturn ret;
|
||||
|
@ -500,6 +516,8 @@ public:
|
|||
|
||||
inline void change_streamtitle(const std::string &title) {
|
||||
is_title_set = true;
|
||||
if (!title.empty())
|
||||
std::cout << "-- Title: " << std::quoted(title) << std::endl;
|
||||
if (!config.stream.use_track_metadata) {
|
||||
if (current_title ==
|
||||
config.stream.title_prefix + config.stream.title_suffix)
|
||||
|
@ -590,6 +608,13 @@ public:
|
|||
change_to_next_track();
|
||||
}
|
||||
|
||||
inline void process_buserror_shoutsend_connerror(GstMessage &msg) {
|
||||
internal_status_ &= ~INT_STATUS_SHOUT2SEND_ERRORED;
|
||||
std::cout << "process_buserror_shoutsend_connerror: "
|
||||
<< std::quoted(GST_OBJECT_NAME(msg.src)) << std::endl;
|
||||
// change_to_next_track();
|
||||
}
|
||||
|
||||
inline void handle_typefind_error(GstMessage &msg) {
|
||||
GError *err;
|
||||
gchar *debug;
|
||||
|
@ -631,6 +656,10 @@ public:
|
|||
|
||||
inline static void handle_cb_bus_message(
|
||||
GstBus &bus, GstMessage &msg, StreamerInternals &instance) {
|
||||
if (instance.config.log_debug)
|
||||
std::cout << "BUS MESSAGE: "
|
||||
<< gst_message_type_get_name(GST_MESSAGE_TYPE(&msg))
|
||||
<< std::endl;
|
||||
switch (GST_MESSAGE_TYPE(&msg)) {
|
||||
case GST_MESSAGE_APPLICATION: {
|
||||
instance.process_busmsg_app(*gst_message_get_structure(&msg));
|
||||
|
@ -670,6 +699,8 @@ public:
|
|||
return instance.process_buserror_unknown_type();
|
||||
if (instance.internal_status_ & INT_STATUS_NO_PAD_LINKED)
|
||||
return instance.process_buserror_no_pad_linked();
|
||||
// if (instance.internal_status_ & INT_STATUS_SHOUT2SEND_ERRORED)
|
||||
// return instance.process_buserror_shoutsend_connerror(msg);
|
||||
instance.throw_on_unhandled_buserror(msg);
|
||||
break;
|
||||
}
|
||||
|
@ -793,6 +824,9 @@ public:
|
|||
decodebin, "unknown-type", G_CALLBACK(cb_decodebin_unknown_type), this);
|
||||
g_signal_connect(
|
||||
decodebin, "no-more-pads", G_CALLBACK(cb_decodebin_no_more_pads), this);
|
||||
// g_signal_connect(
|
||||
// shout2sendsink, "connection-problem",
|
||||
// G_CALLBACK(cb_shout2send_connectionproblem), this);
|
||||
g_object_set(
|
||||
filesrc, "location", playlist_handler.current_track.c_str(), nullptr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue