gmyth/src/gmyth_recorder.h
author rosfran
Tue Mar 27 21:31:34 2007 +0100 (2007-03-27)
branchtrunk
changeset 463 771f91aa9d5d
parent 462 0e6de3b59f57
child 472 e5618b012121
permissions -rw-r--r--
[svn r468] Function to free the remotely allocated TV tuner.
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_recorder.h
     5  * 
     6  * @brief <p> GMythRecorder defines functions for playing live tv.
     7  *
     8  * The remote encoder is used by gmyth_tvplayer to setup livetv. 
     9  *
    10  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    11  * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
    12  * @author Rosfran Borges <rosfran.borges@indt.org.br>
    13  *
    14  *//*
    15  * 
    16  * This program is free software; you can redistribute it and/or modify
    17  * it under the terms of the GNU Lesser General Public License as published by
    18  * the Free Software Foundation; either version 2 of the License, or
    19  * (at your option) any later version.
    20  *
    21  * This program is distributed in the hope that it will be useful,
    22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    24  * GNU General Public License for more details.
    25  *
    26  * You should have received a copy of the GNU Lesser General Public License
    27  * along with this program; if not, write to the Free Software
    28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    29  */
    30 
    31 #ifndef __GMYTH_RECORDER_H__
    32 #define __GMYTH_RECORDER_H__
    33 
    34 #include <glib-object.h>
    35 
    36 #include "gmyth_socket.h"
    37 #include "gmyth_programinfo.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_RECORDER_TYPE               (gmyth_recorder_get_type ())
    49 #define GMYTH_RECORDER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECORDER_TYPE, GMythRecorder))
    50 #define GMYTH_RECORDER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECORDER_TYPE, GMythRecorderClass))
    51 #define IS_GMYTH_RECORDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECORDER_TYPE))
    52 #define IS_GMYTH_RECORDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECORDER_TYPE))
    53 #define GMYTH_RECORDER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_RECORDER_TYPE, GMythRecorderClass))
    54 
    55 
    56 typedef struct _GMythRecorder         GMythRecorder;
    57 typedef struct _GMythRecorderClass    GMythRecorderClass;
    58 
    59 struct _GMythRecorderClass
    60 {
    61   GObjectClass parent_class;
    62 
    63   /* callbacks */
    64   /* no one for now */
    65 };
    66 
    67 struct _GMythRecorder
    68 {
    69     GObject parent;
    70 
    71     /* socket descriptor */
    72     GMythSocket *myth_socket;
    73     
    74     gint recorder_num;
    75     GString *hostname;
    76     gint port;
    77     
    78     GList* progs_info_list;
    79     
    80     GMutex *mutex;
    81 };
    82 
    83 typedef enum _GMythRecorderChannelChangeDirection {
    84 	CHANNEL_DIRECTION_UP = 0,
    85 	CHANNEL_DIRECTION_DOWN,
    86 	CHANNEL_DIRECTION_FAVORITE,
    87 	CHANNEL_DIRECTION_SAME
    88 } GMythRecorderChannelChangeDirection;
    89 
    90 typedef enum _GMythRecorderBrowseDirection {
    91 	BROWSE_DIRECTION_SAME = 0,     	  /* Stay in the same place */
    92  	BROWSE_DIRECTION_UP,          		/* Move up one slot (down one channel) */
    93 	BROWSE_DIRECTION_DOWN,        		/* Move down one slot (up one channel) */
    94 	BROWSE_DIRECTION_LEFT,        		/* Move left one slot (down one time slot) */
    95 	BROWSE_DIRECTION_RIGHT,       		/* Move right one slot (up one time slot) */
    96 	BROWSE_DIRECTION_FAVORITE    			/* Move to the next favorite slot */
    97 } GMythRecorderBrowseDirection;
    98 
    99 GType   gmyth_recorder_get_type   	(void);
   100 
   101 GMythRecorder* gmyth_recorder_new    (int num,
   102 	                                     GString *hostname,
   103 	                                     gshort port);
   104 	                                     
   105 void		 gmyth_recorder_close  (GMythRecorder *recorder);
   106 
   107 gboolean gmyth_recorder_setup     (GMythRecorder *recorder);
   108 gboolean gmyth_recorder_spawntv   (GMythRecorder *recorder,
   109                                          GString *tvchain_id);
   110                                          
   111 gboolean gmyth_recorder_spawntv_no_tvchain (GMythRecorder *recorder);
   112 
   113 gboolean gmyth_recorder_stop_livetv (GMythRecorder *recorder);
   114 
   115 gboolean gmyth_recorder_send_frontend_ready_command (GMythRecorder *recorder);
   116 
   117 gboolean gmyth_recorder_check_channel (GMythRecorder *recorder, gint channel);
   118 
   119 gboolean gmyth_recorder_check_channel_name (GMythRecorder *recorder, gchar* channel);
   120 
   121 gboolean gmyth_recorder_set_channel   (GMythRecorder *recorder,
   122                                        gint channel);
   123                                          
   124 gboolean gmyth_recorder_set_channel_name (GMythRecorder *recorder, 
   125 																					const gchar* channel);
   126 																					
   127 gboolean gmyth_recorder_change_channel (GMythRecorder *recorder, 
   128 												const GMythRecorderChannelChangeDirection direction);
   129 																					
   130 gboolean gmyth_recorder_pause_recording ( GMythRecorder *recorder );
   131 
   132 GMythProgramInfo *gmyth_recorder_get_current_program_info ( GMythRecorder *recorder );
   133 
   134 GMythProgramInfo *gmyth_recorder_get_next_program_info ( GMythRecorder *recorder,
   135 												const GMythRecorderBrowseDirection direction);
   136 												
   137 GMythRecorder *gmyth_recorder_get_recorder_from_num ( gint rec_id );
   138 
   139 gint64 	 gmyth_recorder_get_file_position ( GMythRecorder *recorder );
   140 
   141 gboolean gmyth_recorder_is_recording ( GMythRecorder *recorder );
   142 
   143 gboolean 	gmyth_recorder_finish_recording ( GMythRecorder *recorder );
   144 
   145 gboolean    gmyth_recorder_stop_playing( GMythRecorder *recorder);
   146 
   147 gboolean    gmyth_recorder_free_tuner( GMythRecorder *recorder);
   148 
   149 G_END_DECLS
   150 
   151 #endif /* __GMYTH_REMOTE_ENCODER_H__ */