# HG changeset patch
# User rosfran
# Date 1162853991 0
# Node ID f7c91518d8f459ffd0fc5553ef1fd460e994622e
# Parent 8113a3dce6cebef7dd9a264991139531338d8646
[svn r70] Renamed these remote_encoder source files to recorder.
diff -r 8113a3dce6ce -r f7c91518d8f4 gmyth/src/gmyth_remote_encoder.c
--- a/gmyth/src/gmyth_remote_encoder.c Mon Nov 06 22:57:44 2006 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/**
- * GMyth Library
- *
- * @file gmyth/gmyth_remote_encoder.c
- *
- * @brief
GMythRemoteEncoder class defines functions for playing live tv.
- *
- * The remote encoder is used by gmyth_tvplayer to setup livetv.
- *
- * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
- * @author Hallyson Luiz de Morais Melo
- *
- *//*
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "gmyth_remote_encoder.h"
-
-#include
-
-#include "gmyth_stringlist.h"
-
-static void gmyth_remote_encoder_class_init (GMythRemoteEncoderClass *klass);
-static void gmyth_remote_encoder_init (GMythRemoteEncoder *object);
-
-static void gmyth_remote_encoder_dispose (GObject *object);
-static void gmyth_remote_encoder_finalize (GObject *object);
-
-G_DEFINE_TYPE(GMythRemoteEncoder, gmyth_remote_encoder, G_TYPE_OBJECT)
-
-static void
-gmyth_remote_encoder_class_init (GMythRemoteEncoderClass *klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
-
- gobject_class->dispose = gmyth_remote_encoder_dispose;
- gobject_class->finalize = gmyth_remote_encoder_finalize;
-}
-
-static void
-gmyth_remote_encoder_init (GMythRemoteEncoder *gmyth_remote_encoder)
-{
-}
-
-static void
-gmyth_remote_encoder_dispose (GObject *object)
-{
- // GMythRemoteEncoder *gmyth_remote_encoder = GMYTH_REMOTE_ENCODER(object);
-
- G_OBJECT_CLASS (gmyth_remote_encoder_parent_class)->dispose (object);
-}
-
-
-static void
-gmyth_remote_encoder_finalize (GObject *object)
-{
- g_signal_handlers_destroy (object);
-
- GMythRemoteEncoder *remote_encoder = GMYTH_REMOTE_ENCODER(object);
-
- g_debug ("[%s] Closing control socket", __FUNCTION__);
- gmyth_socket_close_connection(remote_encoder->myth_socket);
- g_object_unref (remote_encoder->myth_socket);
-
- G_OBJECT_CLASS (gmyth_remote_encoder_parent_class)->finalize (object);
-}
-
-/** Creates a new instance of GMythRemoteEncoder.
- *
- * @return a new instance of GMythRemoteEncoder.
- */
-GMythRemoteEncoder*
-gmyth_remote_encoder_new (int num, GString *hostname, gshort port)
-{
- GMythRemoteEncoder *encoder = GMYTH_REMOTE_ENCODER ( g_object_new (
- GMYTH_REMOTE_ENCODER_TYPE, FALSE ));
-
- encoder->recorder_num = num;
- encoder->hostname = g_string_new (hostname->str);
- encoder->port = port;
-
- return encoder;
-}
-
-/** Configures the remote encoder instance connecting it to Mythtv backend.
- *
- * @param remote_encoder the GMythRemoteEncoder instance.
- * @return TRUE if successfull, FALSE if any error happens.
- */
-gboolean
-gmyth_remote_encoder_setup (GMythRemoteEncoder *remote_encoder)
-{
- assert (remote_encoder);
- g_debug ("[%s] Creating socket and connecting to backend", __FUNCTION__);
-
- if (remote_encoder->myth_socket == NULL) {
-
- remote_encoder->myth_socket = gmyth_socket_new ();
-
- if (!gmyth_socket_connect_to_backend (remote_encoder->myth_socket, remote_encoder->hostname->str,
- remote_encoder->port, TRUE) ) {
- g_warning ("GMythRemoteEncoder: Connection to backend failed");
- return FALSE;
- }
-
- } else {
- g_warning("Remote encoder socket already created\n");
- }
-
- return TRUE;
-}
-
-/** Sends the SPAWN_LIVETV command through Mythtv protocol. This command
- * requests the backend to start capturing TV content.
- *
- * @param remote_encoder The GMythRemoteEncoder instance.
- * @param tvchain_id The tvchain unique id.
- * @return true if success, false if any error happens.
- */
-gboolean
-gmyth_remote_encoder_spawntv (GMythRemoteEncoder *remote_encoder, GString *tvchain_id)
-{
- GMythStringList *str_list;
- GString *tmp_str;
-
- g_debug ("[%s] Spawntv with tvchain_id = %s", __FUNCTION__, tvchain_id->str);
-
- str_list = gmyth_string_list_new ();
-
- tmp_str = g_string_new ("QUERY_RECORDER ");
- g_string_append_printf (tmp_str, "%d", remote_encoder->recorder_num);
-
- gmyth_string_list_append_string (str_list, tmp_str);
- gmyth_string_list_append_string (str_list, g_string_new ("SPAWN_LIVETV"));
- gmyth_string_list_append_string (str_list, tvchain_id);
- gmyth_string_list_append_int (str_list, 0); // PIP = FALSE (0)
-
- gmyth_socket_sendreceive_stringlist (remote_encoder->myth_socket, str_list);
-
- g_string_free (tmp_str, TRUE);
-
- tmp_str = gmyth_string_list_get_string (str_list, 0);
- if (tmp_str == NULL) {
- g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str);
- return FALSE;
- }
-
- if (g_ascii_strncasecmp (tmp_str->str, "ok", 2)) {
- g_warning ("[%s] Spawntv request returned %s", __FUNCTION__, tmp_str->str);
- g_object_unref (str_list);
- return FALSE;
- }
-
- g_object_unref (str_list);
- return TRUE;
-
-}
-
-/** Sends the command STOP_LIVETV to Mythtv backend.
- *
- * @param remote_encoder the GMythRemoteEncoder instance.
- * @return true if success, false if any error happens.
- */
-gboolean
-gmyth_remote_encoder_stop_livetv (GMythRemoteEncoder *remote_encoder)
-{
- GMythStringList *str_list;
- GString *tmp_str;
-
- g_debug ("[%s]", __FUNCTION__);
-
- str_list = gmyth_string_list_new ();
-
- tmp_str = g_string_new ("QUERY_RECORDER ");
- g_string_append_printf (tmp_str, "%d", remote_encoder->recorder_num);
- gmyth_string_list_append_string (str_list, g_string_new ("STOP_LIVETV"));
-
- gmyth_socket_sendreceive_stringlist (remote_encoder->myth_socket, str_list);
-
- g_string_free (tmp_str, TRUE);
-
- tmp_str = gmyth_string_list_get_string (str_list, 0);
- if (g_ascii_strncasecmp (tmp_str->str, "ok", 2)) {
- g_warning ("[%s] Stop livetv request returned %s", __FUNCTION__, tmp_str->str);
- g_object_unref (str_list);
- return FALSE;
- }
-
- g_object_unref (str_list);
- return TRUE;
-
-}
diff -r 8113a3dce6ce -r f7c91518d8f4 gmyth/src/gmyth_remote_encoder.h
--- a/gmyth/src/gmyth_remote_encoder.h Mon Nov 06 22:57:44 2006 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/**
- * GMyth Library
- *
- * @file gmyth/gmyth_remote_encoder.h
- *
- * @brief GMythRemoteEncoder class defines functions for playing live tv.
- *
- * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
- * @author Hallyson Luiz de Morais Melo
- *
- *//*
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __GMYTH_REMOTE_ENCODER_H__
-#define __GMYTH_REMOTE_ENCODER_H__
-
-#include
-
-#include "gmyth_socket.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-G_BEGIN_DECLS
-
-#define GMYTH_REMOTE_ENCODER_TYPE (gmyth_remote_encoder_get_type ())
-#define GMYTH_REMOTE_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_REMOTE_ENCODER_TYPE, GMythRemoteEncoder))
-#define GMYTH_REMOTE_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_REMOTE_ENCODER_TYPE, GMythRemoteEncoderClass))
-#define IS_GMYTH_REMOTE_ENCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_REMOTE_ENCODER_TYPE))
-#define IS_GMYTH_REMOTE_ENCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_REMOTE_ENCODER_TYPE))
-#define GMYTH_REMOTE_ENCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_REMOTE_ENCODER_TYPE, GMythRemoteEncoderClass))
-
-
-typedef struct _GMythRemoteEncoder GMythRemoteEncoder;
-typedef struct _GMythRemoteEncoderClass GMythRemoteEncoderClass;
-
-struct _GMythRemoteEncoderClass
-{
- GObjectClass parent_class;
-
- /* callbacks */
- /* no one for now */
-};
-
-struct _GMythRemoteEncoder
-{
- GObject parent;
-
- /* socket descriptor */
- GMythSocket *myth_socket;
-
- int recorder_num;
- GString *hostname;
- int port;
-};
-
-
-GType gmyth_remote_encoder_get_type (void);
-
-GMythRemoteEncoder* gmyth_remote_encoder_new (int num,
- GString *hostname,
- gshort port);
-
-gboolean gmyth_remote_encoder_setup (GMythRemoteEncoder *encoder);
-gboolean gmyth_remote_encoder_spawntv (GMythRemoteEncoder *remote_encoder,
- GString *tvchain_id);
-gboolean gmyth_remote_encoder_stop_livetv (GMythRemoteEncoder *remote_encoder);
-
-G_END_DECLS
-
-#endif /* __GMYTH_REMOTE_ENCODER_H__ */