[svn r70] Renamed these remote_encoder source files to recorder. trunk
authorrosfran
Mon Nov 06 22:59:51 2006 +0000 (2006-11-06)
branchtrunk
changeset 69f7c91518d8f4
parent 68 8113a3dce6ce
child 70 4ba74b706853
[svn r70] Renamed these remote_encoder source files to recorder.
gmyth/src/gmyth_remote_encoder.c
gmyth/src/gmyth_remote_encoder.h
     1.1 --- a/gmyth/src/gmyth_remote_encoder.c	Mon Nov 06 22:57:44 2006 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,207 +0,0 @@
     1.4 -/**
     1.5 - * GMyth Library
     1.6 - *
     1.7 - * @file gmyth/gmyth_remote_encoder.c
     1.8 - * 
     1.9 - * @brief <p> GMythRemoteEncoder class defines functions for playing live tv.
    1.10 - *
    1.11 - * The remote encoder is used by gmyth_tvplayer to setup livetv. 
    1.12 - *
    1.13 - * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    1.14 - * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
    1.15 - *
    1.16 - *//*
    1.17 - * 
    1.18 - * This program is free software; you can redistribute it and/or modify
    1.19 - * it under the terms of the GNU Lesser General Public License as published by
    1.20 - * the Free Software Foundation; either version 2 of the License, or
    1.21 - * (at your option) any later version.
    1.22 - *
    1.23 - * This program is distributed in the hope that it will be useful,
    1.24 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.25 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.26 - * GNU General Public License for more details.
    1.27 - *
    1.28 - * You should have received a copy of the GNU Lesser General Public License
    1.29 - * along with this program; if not, write to the Free Software
    1.30 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.31 - */
    1.32 -
    1.33 -#include "gmyth_remote_encoder.h"
    1.34 -
    1.35 -#include <assert.h>
    1.36 -
    1.37 -#include "gmyth_stringlist.h"
    1.38 -
    1.39 -static void gmyth_remote_encoder_class_init          (GMythRemoteEncoderClass *klass);
    1.40 -static void gmyth_remote_encoder_init                (GMythRemoteEncoder *object);
    1.41 -
    1.42 -static void gmyth_remote_encoder_dispose  (GObject *object);
    1.43 -static void gmyth_remote_encoder_finalize (GObject *object);
    1.44 -
    1.45 -G_DEFINE_TYPE(GMythRemoteEncoder, gmyth_remote_encoder, G_TYPE_OBJECT)
    1.46 -    
    1.47 -static void
    1.48 -gmyth_remote_encoder_class_init (GMythRemoteEncoderClass *klass)
    1.49 -{
    1.50 -    GObjectClass *gobject_class;
    1.51 -
    1.52 -    gobject_class = (GObjectClass *) klass;
    1.53 -	
    1.54 -    gobject_class->dispose  = gmyth_remote_encoder_dispose;
    1.55 -    gobject_class->finalize = gmyth_remote_encoder_finalize;	
    1.56 -}
    1.57 -
    1.58 -static void
    1.59 -gmyth_remote_encoder_init (GMythRemoteEncoder *gmyth_remote_encoder)
    1.60 -{
    1.61 -}
    1.62 -
    1.63 -static void
    1.64 -gmyth_remote_encoder_dispose  (GObject *object)
    1.65 -{
    1.66 -    // GMythRemoteEncoder *gmyth_remote_encoder = GMYTH_REMOTE_ENCODER(object);
    1.67 -    
    1.68 -	G_OBJECT_CLASS (gmyth_remote_encoder_parent_class)->dispose (object);
    1.69 -}
    1.70 -
    1.71 -
    1.72 -static void
    1.73 -gmyth_remote_encoder_finalize (GObject *object)
    1.74 -{
    1.75 -	g_signal_handlers_destroy (object);
    1.76 -
    1.77 -    GMythRemoteEncoder *remote_encoder = GMYTH_REMOTE_ENCODER(object);
    1.78 -
    1.79 -	g_debug ("[%s] Closing control socket", __FUNCTION__);
    1.80 -	gmyth_socket_close_connection(remote_encoder->myth_socket);
    1.81 -	g_object_unref (remote_encoder->myth_socket);
    1.82 -    
    1.83 -    G_OBJECT_CLASS (gmyth_remote_encoder_parent_class)->finalize (object);
    1.84 -}
    1.85 -
    1.86 -/** Creates a new instance of GMythRemoteEncoder.
    1.87 - * 
    1.88 - * @return a new instance of GMythRemoteEncoder.
    1.89 - */
    1.90 -GMythRemoteEncoder*
    1.91 -gmyth_remote_encoder_new (int num, GString *hostname, gshort port)
    1.92 -{
    1.93 -	GMythRemoteEncoder *encoder = GMYTH_REMOTE_ENCODER ( g_object_new (
    1.94 -			GMYTH_REMOTE_ENCODER_TYPE, FALSE ));
    1.95 -			
    1.96 -	encoder->recorder_num = num;
    1.97 -	encoder->hostname = g_string_new (hostname->str);
    1.98 -	encoder->port = port;
    1.99 -	
   1.100 -	return encoder;
   1.101 -}
   1.102 -
   1.103 -/** Configures the remote encoder instance connecting it to Mythtv backend.
   1.104 - * 
   1.105 - * @param remote_encoder the GMythRemoteEncoder instance.
   1.106 - * @return TRUE if successfull, FALSE if any error happens.
   1.107 - */
   1.108 -gboolean
   1.109 -gmyth_remote_encoder_setup (GMythRemoteEncoder *remote_encoder)
   1.110 -{
   1.111 -	assert (remote_encoder);
   1.112 -	g_debug ("[%s] Creating socket and connecting to backend", __FUNCTION__);
   1.113 -
   1.114 -	if (remote_encoder->myth_socket == NULL) { 
   1.115 -		
   1.116 -		remote_encoder->myth_socket = gmyth_socket_new ();
   1.117 -		
   1.118 -		if (!gmyth_socket_connect_to_backend (remote_encoder->myth_socket, remote_encoder->hostname->str, 
   1.119 -					remote_encoder->port, TRUE) ) {
   1.120 -			g_warning ("GMythRemoteEncoder: Connection to backend failed");	
   1.121 -			return FALSE;
   1.122 -		}
   1.123 -
   1.124 -	} else {
   1.125 -		g_warning("Remote encoder socket already created\n");
   1.126 -	}
   1.127 -
   1.128 -	return TRUE;
   1.129 -}
   1.130 -
   1.131 -/** Sends the SPAWN_LIVETV command through Mythtv protocol. This command
   1.132 - * requests the backend to start capturing TV content.
   1.133 - * 
   1.134 - * @param remote_encoder The GMythRemoteEncoder instance.
   1.135 - * @param tvchain_id The tvchain unique id.
   1.136 - * @return true if success, false if any error happens.
   1.137 - */
   1.138 -gboolean
   1.139 -gmyth_remote_encoder_spawntv (GMythRemoteEncoder *remote_encoder, GString *tvchain_id)
   1.140 -{
   1.141 -	GMythStringList *str_list;
   1.142 -	GString *tmp_str;
   1.143 -	
   1.144 -	g_debug ("[%s] Spawntv with tvchain_id = %s", __FUNCTION__, tvchain_id->str);
   1.145 -	
   1.146 -	str_list = gmyth_string_list_new ();
   1.147 -	
   1.148 -	tmp_str = g_string_new ("QUERY_RECORDER ");
   1.149 -	g_string_append_printf (tmp_str, "%d", remote_encoder->recorder_num); 
   1.150 -	
   1.151 -	gmyth_string_list_append_string (str_list, tmp_str);
   1.152 -	gmyth_string_list_append_string (str_list, g_string_new ("SPAWN_LIVETV"));
   1.153 -	gmyth_string_list_append_string (str_list, tvchain_id);
   1.154 -	gmyth_string_list_append_int (str_list, 0); // PIP = FALSE (0)
   1.155 -
   1.156 -	gmyth_socket_sendreceive_stringlist (remote_encoder->myth_socket, str_list);
   1.157 -	
   1.158 -    g_string_free (tmp_str, TRUE);
   1.159 -    
   1.160 -    tmp_str = gmyth_string_list_get_string (str_list, 0);
   1.161 -    if (tmp_str == NULL) {
   1.162 -    	g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str);
   1.163 -    	return FALSE;
   1.164 -	}
   1.165 -	
   1.166 -    if (g_ascii_strncasecmp (tmp_str->str, "ok", 2)) {
   1.167 -    	g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str);
   1.168 -	    g_object_unref (str_list);
   1.169 -    	return FALSE;
   1.170 -    }
   1.171 -
   1.172 -    g_object_unref (str_list);
   1.173 -    return TRUE;
   1.174 -
   1.175 -}
   1.176 -
   1.177 -/** Sends the command STOP_LIVETV to Mythtv backend.
   1.178 - * 
   1.179 - * @param remote_encoder the GMythRemoteEncoder instance.
   1.180 - * @return true if success, false if any error happens.
   1.181 - */
   1.182 -gboolean
   1.183 -gmyth_remote_encoder_stop_livetv (GMythRemoteEncoder *remote_encoder)
   1.184 -{
   1.185 -	GMythStringList *str_list;
   1.186 -	GString *tmp_str;
   1.187 -
   1.188 -	g_debug ("[%s]", __FUNCTION__);
   1.189 -
   1.190 -	str_list = gmyth_string_list_new ();
   1.191 -
   1.192 -	tmp_str = g_string_new ("QUERY_RECORDER ");
   1.193 -	g_string_append_printf (tmp_str, "%d", remote_encoder->recorder_num); 
   1.194 -	gmyth_string_list_append_string (str_list, g_string_new ("STOP_LIVETV"));
   1.195 -
   1.196 -	gmyth_socket_sendreceive_stringlist (remote_encoder->myth_socket, str_list);
   1.197 -
   1.198 -	g_string_free (tmp_str, TRUE);
   1.199 -
   1.200 -	tmp_str = gmyth_string_list_get_string (str_list, 0);
   1.201 -	if (g_ascii_strncasecmp (tmp_str->str, "ok", 2)) {
   1.202 -		g_warning ("[%s] Stop livetv request returned %s", __FUNCTION__, tmp_str->str);
   1.203 -		g_object_unref (str_list);
   1.204 -		return FALSE;
   1.205 -	}
   1.206 -
   1.207 -	g_object_unref (str_list);
   1.208 -	return TRUE;
   1.209 -
   1.210 -}
     2.1 --- a/gmyth/src/gmyth_remote_encoder.h	Mon Nov 06 22:57:44 2006 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,89 +0,0 @@
     2.4 -/**
     2.5 - * GMyth Library
     2.6 - *
     2.7 - * @file gmyth/gmyth_remote_encoder.h
     2.8 - * 
     2.9 - * @brief <p> GMythRemoteEncoder class defines functions for playing live tv.
    2.10 - *
    2.11 - * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    2.12 - * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
    2.13 - *
    2.14 - *//*
    2.15 - * 
    2.16 - * This program is free software; you can redistribute it and/or modify
    2.17 - * it under the terms of the GNU Lesser General Public License as published by
    2.18 - * the Free Software Foundation; either version 2 of the License, or
    2.19 - * (at your option) any later version.
    2.20 - *
    2.21 - * This program is distributed in the hope that it will be useful,
    2.22 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.23 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.24 - * GNU General Public License for more details.
    2.25 - *
    2.26 - * You should have received a copy of the GNU Lesser General Public License
    2.27 - * along with this program; if not, write to the Free Software
    2.28 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.29 - */
    2.30 -
    2.31 -#ifndef __GMYTH_REMOTE_ENCODER_H__
    2.32 -#define __GMYTH_REMOTE_ENCODER_H__
    2.33 -
    2.34 -#include <glib-object.h>
    2.35 -
    2.36 -#include "gmyth_socket.h"
    2.37 -
    2.38 -#include <stdio.h>
    2.39 -#include <stdlib.h>
    2.40 -#include <string.h>
    2.41 -#include <netdb.h>
    2.42 -#include <sys/socket.h>
    2.43 -#include <unistd.h>
    2.44 -
    2.45 -G_BEGIN_DECLS
    2.46 -
    2.47 -#define GMYTH_REMOTE_ENCODER_TYPE               (gmyth_remote_encoder_get_type ())
    2.48 -#define GMYTH_REMOTE_ENCODER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_REMOTE_ENCODER_TYPE, GMythRemoteEncoder))
    2.49 -#define GMYTH_REMOTE_ENCODER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_REMOTE_ENCODER_TYPE, GMythRemoteEncoderClass))
    2.50 -#define IS_GMYTH_REMOTE_ENCODER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_REMOTE_ENCODER_TYPE))
    2.51 -#define IS_GMYTH_REMOTE_ENCODER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_REMOTE_ENCODER_TYPE))
    2.52 -#define GMYTH_REMOTE_ENCODER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_REMOTE_ENCODER_TYPE, GMythRemoteEncoderClass))
    2.53 -
    2.54 -
    2.55 -typedef struct _GMythRemoteEncoder         GMythRemoteEncoder;
    2.56 -typedef struct _GMythRemoteEncoderClass    GMythRemoteEncoderClass;
    2.57 -
    2.58 -struct _GMythRemoteEncoderClass
    2.59 -{
    2.60 -  GObjectClass parent_class;
    2.61 -
    2.62 -  /* callbacks */
    2.63 -  /* no one for now */
    2.64 -};
    2.65 -
    2.66 -struct _GMythRemoteEncoder
    2.67 -{
    2.68 -    GObject parent;
    2.69 -
    2.70 -    /* socket descriptor */
    2.71 -    GMythSocket *myth_socket;
    2.72 -    
    2.73 -    int recorder_num;
    2.74 -    GString *hostname;
    2.75 -    int port;
    2.76 -};
    2.77 -
    2.78 -
    2.79 -GType   gmyth_remote_encoder_get_type   (void);
    2.80 -
    2.81 -GMythRemoteEncoder* gmyth_remote_encoder_new    (int num,
    2.82 -                                                 GString *hostname,
    2.83 -                                                 gshort port);
    2.84 -
    2.85 -gboolean gmyth_remote_encoder_setup     (GMythRemoteEncoder *encoder);
    2.86 -gboolean gmyth_remote_encoder_spawntv   (GMythRemoteEncoder *remote_encoder,
    2.87 -                                         GString *tvchain_id);
    2.88 -gboolean gmyth_remote_encoder_stop_livetv (GMythRemoteEncoder *remote_encoder);
    2.89 -
    2.90 -G_END_DECLS
    2.91 -
    2.92 -#endif /* __GMYTH_REMOTE_ENCODER_H__ */