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