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