rosfran@175: /* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */ rosfran@175: /** rosfran@175: * GMyth Library rosfran@175: * rosfran@175: * @file gmyth/gmyth_monitor_handler.h rosfran@175: * rosfran@175: * @brief

GMythMonitorHandler deals with the streaming media events remote/local rosfran@175: * that are sent to the MythTV frontend. rosfran@175: * rosfran@175: * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. rosfran@175: * @author Rosfran Lins Borges rosfran@175: * rosfran@175: *//* rosfran@175: * rosfran@175: * This program is free software; you can redistribute it and/or modify rosfran@175: * it under the terms of the GNU Lesser General Public License as published by rosfran@175: * the Free Software Foundation; either version 2 of the License, or rosfran@175: * (at your option) any later version. rosfran@175: * rosfran@175: * This program is distributed in the hope that it will be useful, rosfran@175: * but WITHOUT ANY WARRANTY; without even the implied warranty of rosfran@175: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rosfran@175: * GNU General Public License for more details. rosfran@175: * rosfran@175: * You should have received a copy of the GNU Lesser General Public License rosfran@175: * along with this program; if not, write to the Free Software rosfran@175: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rosfran@175: */ rosfran@175: rosfran@175: #ifndef __GMYTH_MONITOR_HANDLER_H__ rosfran@175: #define __GMYTH_MONITOR_HANDLER_H__ rosfran@175: rosfran@175: #include rosfran@175: #include leo_sobral@213: #include leo_sobral@213: #include leo_sobral@213: #include rosfran@175: leo_sobral@213: #include leo_sobral@213: #include leo_sobral@213: #include rosfran@216: rosfran@175: #include "gmyth_socket.h" rosfran@175: #include "gmyth_uri.h" rosfran@175: leo_sobral@213: G_BEGIN_DECLS rosfran@175: rosfran@175: #define GMYTH_MONITOR_HANDLER_TYPE (gmyth_monitor_handler_get_type ()) rosfran@175: #define GMYTH_MONITOR_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandler)) rosfran@175: #define GMYTH_MONITOR_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass)) rosfran@175: #define IS_GMYTH_MONITOR_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_MONITOR_HANDLER_TYPE)) rosfran@175: #define IS_GMYTH_MONITOR_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE)) rosfran@175: #define GMYTH_MONITOR_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass)) rosfran@175: rosfran@175: #define GMYTHTV_MONITOR_HANDLER_READ_ERROR -314 rosfran@175: rosfran@216: enum { rosfran@216: GMYTH_BACKEND_NO_MESSAGE = 0, rosfran@216: GMYTH_BACKEND_PROGRAM_INFO_CHANGED, rosfran@216: GMYTH_BACKEND_STOP_LIVETV rosfran@216: }; rosfran@216: rosfran@175: typedef struct _GMythMonitorHandler GMythMonitorHandler; rosfran@175: typedef struct _GMythMonitorHandlerClass GMythMonitorHandlerClass; rosfran@175: rosfran@175: struct _GMythMonitorHandlerClass rosfran@175: { rosfran@175: GObjectClass parent_class; rosfran@175: rosfran@203: /* callbacks */ rosfran@203: guint backend_events_handler_signal_id; rosfran@203: rosfran@203: /* signal default handlers */ rosfran@232: void (*backend_events_handler) (GMythMonitorHandler *monitor, gint msg_code, gchar* message ); rosfran@175: }; rosfran@175: rosfran@175: struct _GMythMonitorHandler rosfran@175: { rosfran@175: GObject parent; rosfran@175: rosfran@175: /* MythTV version number */ rosfran@175: gint mythtv_version; rosfran@175: rosfran@175: /* socket descriptors */ rosfran@175: GMythSocket *event_sock; rosfran@216: rosfran@232: GThreadPool *monitor_th; rosfran@220: rosfran@232: // gboolean* (*gmyth_monitor_handler_listener)( GMythMonitorHandler *monitor ); rosfran@232: void (*gmyth_monitor_handler_listener)( GMythMonitorHandler *monitor, gpointer user_data ); rosfran@220: rosfran@175: gchar *hostname; rosfran@175: gint port; rosfran@175: rosfran@175: gint64 actual_index; rosfran@175: rosfran@233: gboolean allow_msgs_listener; rosfran@233: rosfran@175: /* stores the messages coming from the backend */ rosfran@216: GHashTable *backend_msgs; rosfran@216: rosfran@175: }; rosfran@175: rosfran@175: GType gmyth_monitor_handler_get_type (void); rosfran@175: rosfran@216: GMythMonitorHandler* gmyth_monitor_handler_new ( void ); rosfran@175: rosfran@229: gboolean gmyth_monitor_handler_open (GMythMonitorHandler *monitor, const gchar *hostname, gint port); rosfran@175: rosfran@175: gboolean gmyth_monitor_handler_start (GMythMonitorHandler *monitor); rosfran@175: rosfran@175: void gmyth_monitor_handler_close (GMythMonitorHandler *monitor); rosfran@175: leo_sobral@213: G_END_DECLS rosfran@175: rosfran@175: #endif /* __GMYTH_MONITOR_HANDLER_H__ */