void monitor_connection::handle_read(const boost::system::error_code &err, std::size_t bytes_transferred) { if (err || bytes_transferred < 1) { close(); return; } switch (m_buffer[0]) { case 'i': case 'I': async_write(get_information()); break; case 's': case 'S': { const char *result = "Stopping...\n"; boost::asio::async_write(m_socket, boost::asio::buffer(result, strlen(result)), std::bind(&monitor_connection::handle_stop_write, shared_from_this(), std::placeholders::_1, std::placeholders::_2)); break; } default: case 'h': case 'H': async_write("i - statistics information\n" "s - stop server\n" "h - this help message\n"); break; } }
std::string Result::_create_node_name() const { std::stringstream ss; ss << "info_"; io::pNode info = get_information(); if (info->get_children()) { ss << info->size(); } else { ss << 0; } return ss.str(); }
void MediaInfo::on_bus_message(const Glib::RefPtr<Gst::Message>& msg) { //log_info("MediaInfo::on_bus_message"); if (msg->get_message_type() & Gst::MESSAGE_ERROR) { Glib::RefPtr<Gst::MessageError> error_msg = Glib::RefPtr<Gst::MessageError>::cast_dynamic(msg); log_info("Error: " << msg->get_source()->get_name() << ": " << error_msg->parse().what()); //assert(!"Failure"); Glib::signal_idle().connect(sigc::mem_fun(this, &MediaInfo::shutdown)); } else if (msg->get_message_type() & Gst::MESSAGE_STATE_CHANGED) { Glib::RefPtr<Gst::MessageStateChanged> state_msg = Glib::RefPtr<Gst::MessageStateChanged>::cast_dynamic(msg); Gst::State oldstate; Gst::State newstate; Gst::State pending; state_msg->parse(oldstate, newstate, pending); //log_info("-- message: " << msg->get_source()->get_name() << " " << oldstate << " " << newstate); if (msg->get_source() == m_pipeline && newstate == Gst::STATE_PAUSED) { get_information(); Glib::signal_idle().connect(sigc::mem_fun(this, &MediaInfo::shutdown)); } } else if (msg->get_message_type() & Gst::MESSAGE_TAG) { if (true) { log_info("TAG: "); auto tag_msg = Glib::RefPtr<Gst::MessageTag>::cast_dynamic(msg); log_info("<<<<<<<<<<<<<<: " << tag_msg); Gst::TagList tag_list = tag_msg->parse(); log_info(" is_empty: " << tag_list.is_empty()); tag_list.foreach(ForEach(tag_list)); log_info(">>>>>>>>>>>>>>"); if (false) // does not work { Glib::RefPtr<Gst::Pad> pad = tag_msg->parse_pad(); log_info(" PAD: " << pad); } } } }
t_tag *parse_conf(int fd, char **conf, char *conf_line) { t_tag *tag_list; tag_list = NULL; while ((read(fd, conf_line, 1024)) > 0) conf = my_strscat(conf, conf_line); if (conf != NULL) { conf = my_str_to_wordtab(conf[0], "\t \n"); tag_list = get_information(conf); if (tag_list != NULL) return (tag_list); else { fprintf(stderr, "Empty conf for IRC Channels\n"); tag_list = create_tag("#default"); } free(conf_line); free_tab(conf); } return (tag_list); }
DECLSPEC_MANACOMMONS void Result::add_information(io::pNode node) { io::pNode output = get_information(); output->append(node); }