1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/branches/gmyth-0.1b/src/gmyth_file_transfer.h Wed Feb 14 23:06:17 2007 +0000
1.3 @@ -0,0 +1,122 @@
1.4 +/* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */
1.5 +/**
1.6 + * GMyth Library
1.7 + *
1.8 + * @file gmyth/gmyth_file_transfer.h
1.9 + *
1.10 + * @brief <p> GMythFileTransfer deals with the file streaming media remote/local
1.11 + * transfering to the MythTV frontend.
1.12 + *
1.13 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
1.14 + * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
1.15 + *
1.16 + *//*
1.17 + *
1.18 + * This program is free software; you can redistribute it and/or modify
1.19 + * it under the terms of the GNU Lesser General Public License as published by
1.20 + * the Free Software Foundation; either version 2 of the License, or
1.21 + * (at your option) any later version.
1.22 + *
1.23 + * This program is distributed in the hope that it will be useful,
1.24 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.25 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.26 + * GNU General Public License for more details.
1.27 + *
1.28 + * You should have received a copy of the GNU Lesser General Public License
1.29 + * along with this program; if not, write to the Free Software
1.30 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1.31 + */
1.32 +
1.33 +#ifndef __GMYTH_FILE_TRANSFER_H__
1.34 +#define __GMYTH_FILE_TRANSFER_H__
1.35 +
1.36 +#include <glib-object.h>
1.37 +#include <glib.h>
1.38 +
1.39 +#include "gmyth_socket.h"
1.40 +#include "gmyth_uri.h"
1.41 +#include "gmyth_backendinfo.h"
1.42 +
1.43 +#include <stdio.h>
1.44 +#include <stdlib.h>
1.45 +#include <string.h>
1.46 +#include <netdb.h>
1.47 +#include <sys/socket.h>
1.48 +#include <unistd.h>
1.49 +
1.50 +G_BEGIN_DECLS
1.51 +
1.52 +#define GMYTH_FILE_TRANSFER_TYPE (gmyth_file_transfer_get_type ())
1.53 +#define GMYTH_FILE_TRANSFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransfer))
1.54 +#define GMYTH_FILE_TRANSFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
1.55 +#define IS_GMYTH_FILE_TRANSFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE))
1.56 +#define IS_GMYTH_FILE_TRANSFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE))
1.57 +#define GMYTH_FILE_TRANSFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
1.58 +
1.59 +#define GMYTHTV_FILE_TRANSFER_READ_ERROR -314
1.60 +#define GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN -315
1.61 +
1.62 +typedef struct _GMythFileTransfer GMythFileTransfer;
1.63 +typedef struct _GMythFileTransferClass GMythFileTransferClass;
1.64 +typedef struct _GMythFileTransferPrivate GMythFileTransferPrivate;
1.65 +
1.66 +struct _GMythFileTransferClass
1.67 +{
1.68 + GObjectClass parent_class;
1.69 +
1.70 + /* callbacks */
1.71 + guint program_info_changed_handler_signal_id;
1.72 +
1.73 + /* signal default handlers */
1.74 + void (*program_info_changed_handler) ( GMythFileTransfer *transfer,
1.75 + gint msg_code, gpointer livetv_transfer );
1.76 +};
1.77 +
1.78 +struct _GMythFileTransfer
1.79 +{
1.80 + GObject parent;
1.81 +
1.82 + /* Myth URI structure */
1.83 + gchar *filename;
1.84 + GMythBackendInfo *backend_info;
1.85 +
1.86 + /* MythTV version number */
1.87 + gint mythtv_version;
1.88 +
1.89 + /* socket descriptors */
1.90 + GMythSocket *control_sock;
1.91 + GMythSocket *sock;
1.92 +
1.93 + GMutex *mutex;
1.94 +
1.95 + gint64 readposition;
1.96 + guint64 filesize;
1.97 + gint file_id;
1.98 +
1.99 + GMythFileTransferPrivate *priv;
1.100 +
1.101 +};
1.102 +
1.103 +GType gmyth_file_transfer_get_type (void);
1.104 +GMythFileTransfer *gmyth_file_transfer_new (const GMythBackendInfo *backend_info);
1.105 +gboolean gmyth_file_transfer_open (GMythFileTransfer *transfer,
1.106 + const gchar* filename);
1.107 +void gmyth_file_transfer_close (GMythFileTransfer *transfer);
1.108 +gboolean gmyth_file_transfer_is_open (GMythFileTransfer *transfer);
1.109 +gint gmyth_file_transfer_read (GMythFileTransfer *transfer,
1.110 + GByteArray *data,
1.111 + gint size,
1.112 + gboolean read_unlimited);
1.113 +gint64 gmyth_file_transfer_seek (GMythFileTransfer *transfer,
1.114 + guint64 pos,
1.115 + gint whence);
1.116 +gboolean gmyth_file_transfer_settimeout (GMythFileTransfer *transfer, gboolean fast);
1.117 +guint64 gmyth_file_transfer_get_filesize (GMythFileTransfer *transfer);
1.118 +
1.119 +void gmyth_file_transfer_emit_program_info_changed_signal ( GMythFileTransfer *transfer,
1.120 + gint msg_code,
1.121 + gpointer live_tv );
1.122 +
1.123 +G_END_DECLS
1.124 +
1.125 +#endif /* __GMYTH_FILE_TRANSFER_H__ */