gmyth/src/gmyth_file_transfer.h
author rosfran
Thu Apr 12 14:58:13 2007 +0100 (2007-04-12)
branchtrunk
changeset 530 ad51640dd2cd
parent 529 dfa28b22a36c
child 545 7f0a3066f6ab
permissions -rwxr-xr-x
[svn r535] Fixed to the older GMythFileTransfer revision (no GObject inheritance).
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_file_transfer.h
     5  * 
     6  * @brief <p> GMythFileTransfer deals with the file streaming media remote/local
     7  * transfering to the MythTV frontend.
     8  *
     9  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    10  * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
    11  *
    12  *//*
    13  * 
    14  * This program is free software; you can redistribute it and/or modify
    15  * it under the terms of the GNU Lesser General Public License as published by
    16  * the Free Software Foundation; either version 2 of the License, or
    17  * (at your option) any later version.
    18  *
    19  * This program is distributed in the hope that it will be useful,
    20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22  * GNU General Public License for more details.
    23  *
    24  * You should have received a copy of the GNU Lesser General Public License
    25  * along with this program; if not, write to the Free Software
    26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    27  */
    28  
    29 #ifndef __GMYTH_FILE_TRANSFER_H__
    30 #define __GMYTH_FILE_TRANSFER_H__
    31 
    32 #include <glib-object.h>
    33 #include <glib.h>
    34 
    35 #include "gmyth_socket.h"
    36 #include "gmyth_uri.h"
    37 #include "gmyth_backendinfo.h"
    38 
    39 #include <stdio.h>
    40 #include <stdlib.h>
    41 #include <string.h>
    42 #include <netdb.h>
    43 #include <sys/socket.h>
    44 #include <unistd.h>
    45 
    46 G_BEGIN_DECLS
    47 
    48 #define GMYTH_FILE_TRANSFER_TYPE               (gmyth_file_transfer_get_type ())
    49 #define GMYTH_FILE_TRANSFER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransfer))
    50 #define GMYTH_FILE_TRANSFER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
    51 #define IS_GMYTH_FILE_TRANSFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_FILE_TRANSFER_TYPE))
    52 #define IS_GMYTH_FILE_TRANSFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_FILE_TRANSFER_TYPE))
    53 #define GMYTH_FILE_TRANSFER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_FILE_TRANSFER_TYPE, GMythFileTransferClass))
    54 
    55 typedef enum {
    56     GMYTH_FILE_TRANSFER_READ_OK                 = 0,
    57 	GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN    = 1,
    58 	GMYTH_FILE_TRANSFER_READ_ERROR              = 2,
    59 	GMYTH_FILE_TRANSFER_READ_EOF                = 3
    60 } GMythFileTransferReadResult;
    61 
    62 
    63 typedef struct _GMythFileTransfer         GMythFileTransfer;
    64 typedef struct _GMythFileTransferClass    GMythFileTransferClass;
    65 typedef struct _GMythFileTransferPrivate  GMythFileTransferPrivate;
    66 
    67 struct _GMythFileTransfer
    68 {
    69 	GObject 				parent;
    70 };
    71 
    72 
    73 struct _GMythFileTransferClass
    74 {
    75 	GObjectClass parent_class;
    76 
    77 	/* callbacks */
    78 	guint program_info_changed_handler_signal_id;
    79 
    80     /* signal default handlers */
    81     void (*program_info_changed_handler) ( GMythFileTransfer *transfer, 
    82 										gint msg_code, gpointer livetv_recorder );
    83 };
    84 
    85 
    86 GType               gmyth_file_transfer_get_type        (void);
    87 GMythFileTransfer*  gmyth_file_transfer_new             (GMythBackendInfo *backend_info);
    88 gchar*              gmyth_file_transfer_get_file_name   (GMythFileTransfer *transfer);
    89 gboolean            gmyth_file_transfer_open            (GMythFileTransfer *transfer, 
    90                                 					     const gchar* filename);
    91 void                gmyth_file_transfer_close           (GMythFileTransfer *transfer);
    92 gboolean            gmyth_file_transfer_is_open         (GMythFileTransfer *transfer);
    93 GMythFileTransferReadResult
    94                     gmyth_file_transfer_read            (GMythFileTransfer *transfer, 
    95                                                          GByteArray *data, 
    96                                                          gint size, 
    97                                                          gboolean read_unlimited);
    98 gint64              gmyth_file_transfer_seek            (GMythFileTransfer *transfer, 
    99                                                          guint64 pos, 
   100                                                          gint whence);
   101 gboolean            gmyth_file_transfer_settimeout      (GMythFileTransfer *transfer, 
   102                                                          gboolean fast);
   103 guint64             gmyth_file_transfer_get_filesize    (GMythFileTransfer *transfer);
   104 
   105 void                gmyth_file_transfer_emit_program_info_changed_signal ( 
   106                                                         GMythFileTransfer *transfer, 
   107 														gint msg_code,
   108 														gpointer live_tv_recorder );
   109 
   110 G_END_DECLS
   111 
   112 #endif /* __GMYTH_FILE_TRANSFER_H__ */