gmyth-upnp/src/gmyth_upnp.h
author renatofilho
Fri May 25 14:14:18 2007 +0100 (2007-05-25)
branchtrunk
changeset 712 8d28bf09d12f
parent 700 9ade4c5e5db8
child 754 cb885ee44618
permissions -rw-r--r--
[svn r718] fixed bug for mpeg files
melunko@250
     1
/**
melunko@250
     2
 * GMyth Library
melunko@250
     3
 *
melunko@250
     4
 * @file gmyth/gmyth_upnp.h
melunko@250
     5
 * 
melunko@250
     6
 * @brief <p> GMythUPnP allows that a MythTV frontend discovers a 
melunko@250
     7
 * MythTV backend, using the UPnP architecture.
melunko@250
     8
 *
melunko@250
     9
 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
melunko@250
    10
 * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
melunko@250
    11
 *
melunko@250
    12
 * This program is free software; you can redistribute it and/or modify
melunko@250
    13
 * it under the terms of the GNU Lesser General Public License as published by
melunko@250
    14
 * the Free Software Foundation; either version 2 of the License, or
melunko@250
    15
 * (at your option) any later version.
melunko@250
    16
 *
melunko@250
    17
 * This program is distributed in the hope that it will be useful,
melunko@250
    18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
melunko@250
    19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
melunko@250
    20
 * GNU General Public License for more details.
melunko@250
    21
 *
melunko@250
    22
 * You should have received a copy of the GNU Lesser General Public License
melunko@250
    23
 * along with this program; if not, write to the Free Software
melunko@250
    24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
melunko@250
    25
 *   
melunko@250
    26
 */
melunko@250
    27
melunko@250
    28
#ifndef _GMYTH_UPNP_H_
melunko@250
    29
#define _GMYTH_UPNP_H_
melunko@250
    30
melunko@250
    31
#include <glib.h>
melunko@250
    32
#include <glib-object.h>
melunko@250
    33
melunko@250
    34
#include <stdlib.h>
melunko@250
    35
#include <stdio.h>
melunko@250
    36
#include <string.h>
melunko@250
    37
melunko@250
    38
#include <cybergarage/upnp/cupnp.h>
rosfran@260
    39
#include <gmyth/gmyth_backendinfo.h>
melunko@250
    40
melunko@250
    41
G_BEGIN_DECLS
melunko@250
    42
melunko@250
    43
#define GMYTH_UPNP_TYPE               (gmyth_upnp_get_type ())
melunko@250
    44
#define GMYTH_UPNP(obj)          		 	(G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE, GMythUPnP))
melunko@250
    45
#define GMYTH_UPNP_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE, GMythUPnPClass))
melunko@250
    46
#define IS_GMYTH_UPNP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE))
melunko@250
    47
#define IS_GMYTH_UPNP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE))
melunko@250
    48
#define GMYTH_UPNP_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_UPNP_TYPE, GMythUPnPClass))
melunko@250
    49
melunko@250
    50
typedef struct _GMythUPnP         GMythUPnP;
melunko@250
    51
typedef struct _GMythUPnPClass    GMythUPnPClass;
rosfran@696
    52
typedef struct _GMythUPnPPrivate  GMythUPnPPrivate;
melunko@250
    53
melunko@250
    54
/****************************************
melunko@250
    55
* Data Type
melunko@250
    56
****************************************/
melunko@250
    57
rosfran@696
    58
typedef enum upnp_device_list_status {
rosfran@696
    59
	GMYTH_UPNP_DEVICE_ADDED = 0,
rosfran@699
    60
	GMYTH_UPNP_DEVICE_UPDATED,
rosfran@699
    61
	GMYTH_UPNP_DEVICE_REMOVED
rosfran@696
    62
} GMythUPnPDeviceStatus;
rosfran@696
    63
rosfran@706
    64
typedef void (*GMythUPnPDeviceListener) ( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar *dev );
rosfran@696
    65
melunko@250
    66
struct _GMythUPnPClass
melunko@250
    67
{
rosfran@696
    68
	GObjectClass parent_class;
melunko@250
    69
rosfran@696
    70
	/* callbacks */
rosfran@696
    71
	guint device_found_handler_signal_id;
rosfran@696
    72
rosfran@696
    73
	GMythUPnPDeviceListener device_found_handler;
rosfran@696
    74
rosfran@696
    75
	/* no one for now */
melunko@250
    76
};
melunko@250
    77
rosfran@696
    78
struct _GMythUPnPDevice {
rosfran@696
    79
	gchar *uri;
rosfran@696
    80
	gchar *host;
rosfran@696
    81
	gint port;
rosfran@696
    82
	gchar *protocol;
rosfran@696
    83
};
rosfran@696
    84
rosfran@696
    85
typedef struct _GMythUPnPDevice GMythUPnPDevice;
rosfran@696
    86
melunko@250
    87
struct _GMythUPnP {
melunko@250
    88
	
melunko@250
    89
	GObject parent;
rosfran@696
    90
	GMythUPnPPrivate *priv;
melunko@250
    91
	
rosfran@696
    92
melunko@250
    93
	CgUpnpControlPoint* control_point;
melunko@250
    94
	
melunko@250
    95
	gchar *udn;
melunko@250
    96
	
rosfran@696
    97
	GMythBackendInfo *backend_info;
rosfran@696
    98
melunko@250
    99
	gboolean upnp_dev_found;
melunko@250
   100
};
melunko@250
   101
melunko@250
   102
GType       			gmyth_upnp_get_type (void);
rosfran@696
   103
GMythUPnP *			gmyth_upnp_new ( GMythBackendInfo *gmyth_backend_info, 
rosfran@696
   104
						GMythUPnPDeviceListener handler );
rosfran@699
   105
rosfran@699
   106
GList *				gmyth_upnp_do_search_sync( GMythUPnP* gmyth_upnp );
rosfran@699
   107
rosfran@696
   108
GMythBackendInfo*		gmyth_upnp_get_backend_info ( GMythUPnP *gmyth_upnp );
melunko@250
   109
rosfran@706
   110
gchar *				gmyth_upnp_device_status_to_string( GMythUPnPDeviceStatus status );
rosfran@706
   111
melunko@250
   112
G_END_DECLS
melunko@250
   113
melunko@250
   114
#endif /* _GMYTH_UPNP_H_ */