diff -r 000000000000 -r 6d5596b9eb95 branches/gmyth-0.1b/src/gmyth_file_transfer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/branches/gmyth-0.1b/src/gmyth_file_transfer.h Wed Feb 14 21:28:49 2007 +0000 @@ -0,0 +1,122 @@ +/* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */ +/** + * GMyth Library + * + * @file gmyth/gmyth_file_transfer.h + * + * @brief

GMythFileTransfer deals with the file streaming media remote/local + * transfering to the MythTV frontend. + * + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. + * @author Rosfran Lins Borges + * + *//* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __GMYTH_FILE_TRANSFER_H__ +#define __GMYTH_FILE_TRANSFER_H__ + +#include +#include + +#include "gmyth_socket.h" +#include "gmyth_uri.h" +#include "gmyth_backendinfo.h" + +#include +#include +#include +#include +#include +#include + +G_BEGIN_DECLS + +#define GMYTH_FILE_TRANSFER_TYPE (gmyth_file_transfer_get_type ()) +#define GMYTH_FILE_TRANSFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransfer)) +#define GMYTH_FILE_TRANSFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass)) +#define IS_GMYTH_FILE_TRANSFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE)) +#define IS_GMYTH_FILE_TRANSFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE)) +#define GMYTH_FILE_TRANSFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass)) + +#define GMYTHTV_FILE_TRANSFER_READ_ERROR -314 +#define GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN -315 + +typedef struct _GMythFileTransfer GMythFileTransfer; +typedef struct _GMythFileTransferClass GMythFileTransferClass; +typedef struct _GMythFileTransferPrivate GMythFileTransferPrivate; + +struct _GMythFileTransferClass +{ + GObjectClass parent_class; + + /* callbacks */ + guint program_info_changed_handler_signal_id; + + /* signal default handlers */ + void (*program_info_changed_handler) ( GMythFileTransfer *transfer, + gint msg_code, gpointer livetv_transfer ); +}; + +struct _GMythFileTransfer +{ + GObject parent; + + /* Myth URI structure */ + gchar *filename; + GMythBackendInfo *backend_info; + + /* MythTV version number */ + gint mythtv_version; + + /* socket descriptors */ + GMythSocket *control_sock; + GMythSocket *sock; + + GMutex *mutex; + + gint64 readposition; + guint64 filesize; + gint file_id; + + GMythFileTransferPrivate *priv; + +}; + +GType gmyth_file_transfer_get_type (void); +GMythFileTransfer *gmyth_file_transfer_new (const GMythBackendInfo *backend_info); +gboolean gmyth_file_transfer_open (GMythFileTransfer *transfer, + const gchar* filename); +void gmyth_file_transfer_close (GMythFileTransfer *transfer); +gboolean gmyth_file_transfer_is_open (GMythFileTransfer *transfer); +gint gmyth_file_transfer_read (GMythFileTransfer *transfer, + GByteArray *data, + gint size, + gboolean read_unlimited); +gint64 gmyth_file_transfer_seek (GMythFileTransfer *transfer, + guint64 pos, + gint whence); +gboolean gmyth_file_transfer_settimeout (GMythFileTransfer *transfer, gboolean fast); +guint64 gmyth_file_transfer_get_filesize (GMythFileTransfer *transfer); + +void gmyth_file_transfer_emit_program_info_changed_signal ( GMythFileTransfer *transfer, + gint msg_code, + gpointer live_tv ); + +G_END_DECLS + +#endif /* __GMYTH_FILE_TRANSFER_H__ */