gmyth/src/gmyth_recorder.h
author rosfran
Wed May 23 19:50:41 2007 +0100 (2007-05-23)
branchtrunk
changeset 701 2f28edb4d804
parent 698 9019388af980
child 750 312d6bc514f3
permissions -rw-r--r--
[svn r707] Fixed the wrong commentary indentation.
     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  * This program is free software; you can redistribute it and/or modify
    16  * it under the terms of the GNU Lesser General Public License as published by
    17  * the Free Software Foundation; either version 2 of the License, or
    18  * (at your option) any later version.
    19  *
    20  * This program is distributed in the hope that it will be useful,
    21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23  * GNU General Public License for more details.
    24  *
    25  * You should have received a copy of the GNU Lesser General Public License
    26  * along with this program; if not, write to the Free Software
    27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    28  */
    29 
    30 #ifndef __GMYTH_RECORDER_H__
    31 #define __GMYTH_RECORDER_H__
    32 
    33 #include <glib-object.h>
    34 
    35 #include "gmyth_socket.h"
    36 #include "gmyth_programinfo.h"
    37 
    38 #include <stdio.h>
    39 #include <stdlib.h>
    40 #include <string.h>
    41 #include <netdb.h>
    42 #include <sys/socket.h>
    43 #include <unistd.h>
    44 
    45 G_BEGIN_DECLS
    46 #define GMYTH_RECORDER_TYPE               (gmyth_recorder_get_type ())
    47 #define GMYTH_RECORDER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECORDER_TYPE, GMythRecorder))
    48 #define GMYTH_RECORDER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECORDER_TYPE, GMythRecorderClass))
    49 #define IS_GMYTH_RECORDER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_RECORDER_TYPE))
    50 #define IS_GMYTH_RECORDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECORDER_TYPE))
    51 #define GMYTH_RECORDER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_RECORDER_TYPE, GMythRecorderClass))
    52 typedef struct _GMythRecorder GMythRecorder;
    53 typedef struct _GMythRecorderClass GMythRecorderClass;
    54 
    55 struct _GMythRecorderClass
    56     {
    57         GObjectClass parent_class;
    58 
    59         /* callbacks */
    60         /* no one for now */
    61     };
    62 
    63 struct _GMythRecorder
    64     {
    65         GObject parent;
    66 
    67         /* socket descriptor */
    68         GMythSocket *myth_socket;
    69 
    70         gint recorder_num;
    71         GString *hostname;
    72         gint port;
    73 
    74         GList *progs_info_list;
    75 
    76         GMutex *mutex;
    77     };
    78 
    79 typedef enum _GMythRecorderChannelChangeDirection
    80     {
    81         CHANNEL_DIRECTION_UP = 0,
    82         CHANNEL_DIRECTION_DOWN,
    83         CHANNEL_DIRECTION_FAVORITE,
    84         CHANNEL_DIRECTION_SAME
    85     } GMythRecorderChannelChangeDirection;
    86 
    87 typedef enum _GMythRecorderBrowseDirection
    88     {
    89         BROWSE_DIRECTION_SAME = 0,  /* Stay in the same place */
    90         BROWSE_DIRECTION_UP,    /* Move up one slot (down one channel) */
    91         BROWSE_DIRECTION_DOWN,  /* Move down one slot (up one channel) */
    92         BROWSE_DIRECTION_LEFT,  /* Move left one slot (down one time slot) */
    93         BROWSE_DIRECTION_RIGHT, /* Move right one slot (up one time slot) */
    94         BROWSE_DIRECTION_FAVORITE   /* Move to the next favorite slot */
    95     } GMythRecorderBrowseDirection;
    96 
    97 GType gmyth_recorder_get_type ( void );
    98 
    99 GMythRecorder *gmyth_recorder_new ( int num, GString * hostname, gshort port );
   100 
   101 void gmyth_recorder_close ( GMythRecorder * recorder );
   102 
   103 gboolean gmyth_recorder_setup ( GMythRecorder * recorder );
   104 gboolean gmyth_recorder_spawntv ( GMythRecorder * recorder,
   105                                   GString * tvchain_id );
   106 
   107 gboolean gmyth_recorder_spawntv_no_tvchain ( GMythRecorder * recorder );
   108 
   109 gboolean gmyth_recorder_stop_livetv ( GMythRecorder * recorder );
   110 
   111 gboolean gmyth_recorder_send_frontend_ready_command ( GMythRecorder *
   112                                                       recorder );
   113 
   114 gboolean gmyth_recorder_check_channel ( GMythRecorder * recorder,
   115                                         gint channel );
   116 
   117 gboolean gmyth_recorder_check_channel_name ( GMythRecorder * recorder,
   118                                              gchar * channel );
   119 
   120 gboolean gmyth_recorder_set_channel ( GMythRecorder * recorder, gint channel );
   121 
   122 gboolean gmyth_recorder_set_channel_name ( GMythRecorder * recorder,
   123                                            const gchar * channel );
   124 
   125 gboolean gmyth_recorder_change_channel ( GMythRecorder * recorder,
   126                                          const
   127                                          GMythRecorderChannelChangeDirection
   128                                          direction );
   129 
   130 GList *gmyth_recorder_get_channel_list ( GMythRecorder * recorder );
   131 
   132 gboolean gmyth_recorder_pause_recording ( GMythRecorder * recorder );
   133 
   134 GMythProgramInfo *gmyth_recorder_get_current_program_info ( GMythRecorder *
   135                                                             recorder );
   136 
   137 GMythProgramInfo *gmyth_recorder_get_next_program_info ( GMythRecorder *
   138                                                          recorder,
   139                                                          const
   140                                                          GMythRecorderBrowseDirection
   141                                                          direction );
   142 
   143 GMythRecorder *gmyth_recorder_get_recorder_from_num ( gint rec_id );
   144 
   145 gint64 gmyth_recorder_get_file_position ( GMythRecorder * recorder );
   146 
   147 gboolean gmyth_recorder_is_recording ( GMythRecorder * recorder );
   148 
   149 gboolean gmyth_recorder_finish_recording ( GMythRecorder * recorder );
   150 
   151 gboolean gmyth_recorder_stop_playing ( GMythRecorder * recorder );
   152 
   153 gboolean gmyth_recorder_free_tuner ( GMythRecorder * recorder );
   154 
   155 gdouble gmyth_recorder_get_framerate ( GMythRecorder * recorder );
   156 
   157 G_END_DECLS
   158 #endif /* __GMYTH_REMOTE_ENCODER_H__ */