mythtv_plugin/myth_file_transfer.h
author leo_sobral
Wed Sep 20 23:59:48 2006 +0100 (2006-09-20)
branchtrunk
changeset 2 bd3829c2e9c9
permissions -rwxr-xr-x
[svn r3] imported to sf repository
     1 /* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */
     2 
     3 #ifndef __MYTH_FILE_TRANSFER_H__
     4 #define __MYTH_FILE_TRANSFER_H__
     5 
     6 #include <glib-object.h>
     7 
     8 #include <gmyth/gmyth_socket.h>
     9 #include "myth_uri.h"
    10 #include "myth_livetv.h"
    11 
    12 #include <stdio.h>
    13 #include <stdlib.h>
    14 #include <string.h>
    15 #include <netdb.h>
    16 #include <sys/socket.h>
    17 #include <unistd.h>
    18 
    19 #define G_BEGIN_DECLS
    20 
    21 #define MYTH_FILE_TRANSFER_TYPE               (myth_file_transfer_get_type ())
    22 #define MYTH_FILE_TRANSFER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), MYTH_FILE_TRANSFER_TYPE, MythFileTransfer))
    23 #define MYTH_FILE_TRANSFER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), MYTH_FILE_TRANSFER_TYPE, MythFileTransferClass))
    24 #define IS_MYTH_FILE_TRANSFER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MYTH_FILE_TRANSFER_TYPE))
    25 #define IS_MYTH_FILE_TRANSFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MYTH_FILE_TRANSFER_TYPE))
    26 #define MYTH_FILE_TRANSFER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), MYTH_FILE_TRANSFER_TYPE, MythFileTransferClass))
    27 
    28 
    29 typedef struct _MythFileTransfer         MythFileTransfer;
    30 typedef struct _MythFileTransferClass    MythFileTransferClass;
    31 
    32 struct _MythFileTransferClass
    33 {
    34 	GObjectClass parent_class;
    35 
    36 	/* callbacks */
    37 	/* no one for now */
    38 };
    39 
    40 struct _MythFileTransfer
    41 {
    42 	GObject parent;
    43 
    44 	/* Myth URI structure */
    45 	const MythURI *uri;
    46 	
    47 	/* MythTV version number */	
    48 	gint mythtv_version;
    49 
    50 	/* socket descriptors */
    51 	GMythSocket *control_sock;
    52 	GMythSocket *event_sock;
    53 	GMythSocket *sock;
    54 
    55 	guint64 readposition;
    56 	guint64 filesize;
    57 	gboolean timeoutisfast;
    58 	gboolean userreadahead;
    59 	gboolean live_tv;
    60 	gint retries;
    61 
    62 	GString *query;
    63 
    64 	gint rec_id;
    65 	gint recordernum;
    66 	gint card_id;
    67 	GString *hostname;
    68 	gint port;
    69 };
    70 
    71 GType          myth_file_transfer_get_type        (void);
    72 
    73 MythFileTransfer* myth_file_transfer_new (gint num, GString *hostname, gshort port, gint mythtv_version );
    74 
    75 gint myth_file_transfer_read(MythFileTransfer *transfer, void *data, gint size, gboolean read_unlimited);
    76 
    77 guint64 myth_file_transfer_seek(MythFileTransfer *transfer, guint64 pos, gint whence);
    78 
    79 gboolean myth_file_transfer_playback_setup( MythFileTransfer **transfer, gboolean live_tv );
    80 
    81 gboolean myth_file_transfer_setup( MythFileTransfer **transfer, gboolean live_tv );
    82 
    83 gboolean myth_file_transfer_livetv_setup( MythFileTransfer **transfer, GMythSocket *live_sock );
    84 
    85 void myth_file_transfer_spawntv ( MythFileTransfer *file_transfer, GString *tvchain_id );
    86 
    87 gboolean myth_file_transfer_is_recording( MythFileTransfer *file_transfer );
    88 
    89 guint64  myth_file_transfer_get_file_position( MythFileTransfer *file_transfer );
    90 
    91 #define G_END_DECLS
    92 
    93 #endif /* __MYTH_FILE_TRANSFER_H__ */