gmyth/src/gmyth_file_transfer.h
author rosfran
Mon Dec 04 19:57:37 2006 +0000 (2006-12-04)
branchtrunk
changeset 184 2dedc1bb30ba
parent 177 85b47c66a241
child 187 653d06bca826
permissions -rwxr-xr-x
[svn r185] Some fixes to FileTransfer using URI.
rosfran@41
     1
/* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */
rosfran@68
     2
/**
rosfran@68
     3
 * GMyth Library
rosfran@68
     4
 *
rosfran@68
     5
 * @file gmyth/gmyth_file_transfer.h
rosfran@68
     6
 * 
rosfran@68
     7
 * @brief <p> GMythFileTransfer deals with the file streaming media remote/local
rosfran@68
     8
 * transfering to the MythTV frontend.
rosfran@68
     9
 *
rosfran@68
    10
 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
rosfran@68
    11
 * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
rosfran@68
    12
 *
rosfran@68
    13
 *//*
rosfran@68
    14
 * 
rosfran@68
    15
 * This program is free software; you can redistribute it and/or modify
rosfran@68
    16
 * it under the terms of the GNU Lesser General Public License as published by
rosfran@68
    17
 * the Free Software Foundation; either version 2 of the License, or
rosfran@68
    18
 * (at your option) any later version.
rosfran@68
    19
 *
rosfran@68
    20
 * This program is distributed in the hope that it will be useful,
rosfran@68
    21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
rosfran@68
    22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
rosfran@68
    23
 * GNU General Public License for more details.
rosfran@68
    24
 *
rosfran@68
    25
 * You should have received a copy of the GNU Lesser General Public License
rosfran@68
    26
 * along with this program; if not, write to the Free Software
rosfran@68
    27
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
rosfran@68
    28
 */
rosfran@68
    29
 
rosfran@41
    30
#ifndef __GMYTH_FILE_TRANSFER_H__
rosfran@41
    31
#define __GMYTH_FILE_TRANSFER_H__
rosfran@41
    32
rosfran@41
    33
#include <glib-object.h>
rosfran@54
    34
#include <glib.h>
rosfran@41
    35
rosfran@42
    36
#include "gmyth_socket.h"
rosfran@42
    37
#include "gmyth_uri.h"
rosfran@42
    38
#include "gmyth_livetv.h"
melunko@158
    39
#include "gmyth_backendinfo.h"
rosfran@177
    40
#include "gmyth_monitor_handler.h"
rosfran@41
    41
rosfran@41
    42
#include <stdio.h>
rosfran@41
    43
#include <stdlib.h>
rosfran@41
    44
#include <string.h>
rosfran@41
    45
#include <netdb.h>
rosfran@41
    46
#include <sys/socket.h>
rosfran@41
    47
#include <unistd.h>
rosfran@41
    48
rosfran@41
    49
#define G_BEGIN_DECLS
rosfran@41
    50
rosfran@41
    51
#define GMYTH_FILE_TRANSFER_TYPE               (gmyth_file_transfer_get_type ())
rosfran@41
    52
#define GMYTH_FILE_TRANSFER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransfer))
rosfran@41
    53
#define GMYTH_FILE_TRANSFER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
rosfran@41
    54
#define IS_GMYTH_FILE_TRANSFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE))
rosfran@41
    55
#define IS_GMYTH_FILE_TRANSFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE))
rosfran@41
    56
#define GMYTH_FILE_TRANSFER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
rosfran@41
    57
rosfran@54
    58
#define GMYTHTV_FILE_TRANSFER_READ_ERROR	-314
rosfran@41
    59
rosfran@41
    60
typedef struct _GMythFileTransfer         GMythFileTransfer;
rosfran@41
    61
typedef struct _GMythFileTransferClass    GMythFileTransferClass;
rosfran@41
    62
rosfran@41
    63
struct _GMythFileTransferClass
rosfran@41
    64
{
rosfran@41
    65
	GObjectClass parent_class;
rosfran@41
    66
rosfran@41
    67
	/* callbacks */
rosfran@41
    68
	/* no one for now */
rosfran@41
    69
};
rosfran@41
    70
rosfran@41
    71
struct _GMythFileTransfer
rosfran@41
    72
{
rosfran@41
    73
	GObject parent;
rosfran@41
    74
rosfran@41
    75
	/* Myth URI structure */
rosfran@177
    76
	GMythURI *uri;
rosfran@177
    77
	GString* hostname;
rosfran@177
    78
	gint port;
melunko@158
    79
	gchar* filename;
melunko@158
    80
	GMythBackendInfo *backend_info;
rosfran@41
    81
	
rosfran@41
    82
	/* MythTV version number */	
rosfran@41
    83
	gint mythtv_version;
rosfran@41
    84
rosfran@41
    85
	/* socket descriptors */
rosfran@41
    86
	GMythSocket *control_sock;
rosfran@115
    87
	GMythSocket *event_sock;
rosfran@41
    88
	GMythSocket *sock;
rosfran@177
    89
	
rosfran@177
    90
	GMythMonitorHandler *monitor;
rosfran@41
    91
rosfran@54
    92
	gint64 readposition;
rosfran@41
    93
	guint64 filesize;
rosfran@41
    94
melunko@112
    95
	gint file_id;
rosfran@41
    96
};
rosfran@41
    97
rosfran@184
    98
GType          		 gmyth_file_transfer_get_type        (void);
rosfran@41
    99
rosfran@177
   100
GMythFileTransfer* gmyth_file_transfer_new ( const GMythBackendInfo *backend_info );
rosfran@41
   101
rosfran@177
   102
GMythFileTransfer* gmyth_file_transfer_new_with_uri ( const gchar* uri_str );
rosfran@177
   103
rosfran@184
   104
gboolean 					 gmyth_file_transfer_open ( GMythFileTransfer *transfer, 
rosfran@184
   105
							const gchar* filename );
rosfran@177
   106
melunko@112
   107
void gmyth_file_transfer_close (GMythFileTransfer *transfer);
rosfran@41
   108
melunko@112
   109
gboolean gmyth_file_transfer_is_open (GMythFileTransfer *transfer);
rosfran@177
   110
rosfran@177
   111
gint gmyth_file_transfer_read(GMythFileTransfer *transfer, GByteArray *data, 
rosfran@177
   112
							gint size, gboolean read_unlimited);
rosfran@177
   113
							
rosfran@41
   114
gint64 gmyth_file_transfer_seek(GMythFileTransfer *transfer, guint64 pos, gint whence);
rosfran@177
   115
melunko@112
   116
gboolean gmyth_file_transfer_settimeout( GMythFileTransfer *transfer, gboolean fast);
rosfran@177
   117
renatofilho@147
   118
guint64 gmyth_file_transfer_get_filesize (GMythFileTransfer *transfer);
rosfran@41
   119
rosfran@41
   120
#define G_END_DECLS
rosfran@41
   121
rosfran@41
   122
#endif /* __GMYTH_FILE_TRANSFER_H__ */