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