[svn r468] Function to free the remotely allocated TV tuner.
4 * @file gmyth/gmyth_recprofile.c
6 * @brief <p> This file contains the recprofile class.
8 * Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
9 * @author Artur Duque de Souza <artur.souza@indt.org.br>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 #include "gmyth_recprofile.h"
39 #include "gmyth_util.h"
40 #include "gmyth_debug.h"
41 #include "gmyth_http.h"
43 static void gmyth_recprofile_class_init (GMythRecProfileClass *klass);
44 static void gmyth_recprofile_init (GMythRecProfile *object);
46 static void gmyth_recprofile_dispose (GObject *object);
47 static void gmyth_recprofile_finalize (GObject *object);
49 G_DEFINE_TYPE(GMythRecProfile, gmyth_recprofile, G_TYPE_OBJECT)
52 gmyth_recprofile_class_init (GMythRecProfileClass *klass)
54 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
55 gobject_class->dispose = gmyth_recprofile_dispose;
56 gobject_class->finalize = gmyth_recprofile_finalize;
60 gmyth_recprofile_init (GMythRecProfile *recprofile)
65 gmyth_recprofile_dispose (GObject *object)
67 GMythRecProfile *recprofile = GMYTH_RECPROFILE(object);
70 g_free(recprofile->name);
72 if (recprofile->group)
73 g_free(recprofile->group);
75 if (recprofile->vcodec)
76 g_free(recprofile->vcodec);
78 if (recprofile->acodec)
79 g_free(recprofile->acodec);
81 if (recprofile->options)
82 g_free(recprofile->options);
84 G_OBJECT_CLASS (gmyth_recprofile_parent_class)->dispose (object);
88 gmyth_recprofile_finalize (GObject *object)
90 g_signal_handlers_destroy (object);
91 G_OBJECT_CLASS (gmyth_recprofile_parent_class)->finalize (object);
95 * Creates a new instance of GMythRecProfile.
97 * @return a new instance of GMythRecProfile.
100 gmyth_recprofile_new (void)
102 GMythRecProfile *recprofile = GMYTH_RECPROFILE\
103 (g_object_new(GMYTH_RECPROFILE_TYPE, NULL));
106 recprofile->name = NULL;
107 recprofile->group = NULL;
108 recprofile->vcodec = NULL;
109 recprofile->acodec = NULL;
110 recprofile->options = NULL;
118 * gmyth_recprofile_get_profile_list
119 * @brief get profile list from the backend
120 * @param backend_info GMythBackendInfo*
124 GSList* gmyth_recprofile_get_profile_list (GMythBackendInfo *backend_info)
126 return gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
131 * gmyth_recprofile_create_profile
132 * @brief get profile list from the backend
133 * @param backend_info GMythBackendInfo*
134 * @param profile GMythRecProfile*
135 * @return gint representing the result
138 gint gmyth_recprofile_create_profile (GMythBackendInfo *backend_info,
139 GMythRecProfile* profile)
141 return gmyth_http_create_rec_profile (backend_info, profile);
146 * gmyth_recprofile_del_profile
147 * @brief del profile from the backend
148 * @param backend_info GMythBackendInfo*
149 * @param id profile's id
150 * @return gint representing the result
153 gint gmyth_recprofile_del_profile_list (GMythBackendInfo *backend_info,
156 return gmyth_http_del_rec_profile(backend_info, id);
161 * gmyth_recprofile_set_id
162 * @brief set recprofile's id
163 * @param rec GMythRecProfile*
164 * @param id profile's id
165 * @return gint representing the result
168 gint gmyth_recprofile_set_id (GMythRecProfile* rec, gint id)
176 * gmyth_recprofile_set
177 * @brief set recprofile's property
178 * @param rec GMythRecProfile*
179 * @param member the member you want to modify
180 * @param value the value
181 * @return gint representing the result
184 gint gmyth_recprofile_set (GMythRecProfile* rec,
185 gchar* member, gchar* value)
190 if (g_ascii_strcasecmp(member, "name") == 0)
191 rec->name = g_strndup(value, strlen(value));
193 if (g_ascii_strcasecmp(member, "group") == 0)
194 rec->group = g_strndup(value, strlen(value));
196 if (g_ascii_strcasecmp(member, "vcodec") == 0)
197 rec->vcodec = g_strndup(value, strlen(value));
199 if (g_ascii_strcasecmp(member, "acodec") == 0)
200 rec->acodec = g_strndup(value, strlen(value));
212 * gmyth_recprofile_set_name
213 * @brief set recprofile's name
214 * @param rec GMythRecProfile*
215 * @param name profile's name
216 * @return gint representing the result
219 gint gmyth_recprofile_set_name (GMythRecProfile* rec, gchar* name)
221 return gmyth_recprofile_set(rec, "name", name);
226 * gmyth_recprofile_set_group
227 * @brief set recprofile's group
228 * @param rec GMythRecProfile*
229 * @param group profile's group
230 * @return gint representing the result
233 gint gmyth_recprofile_set_group (GMythRecProfile* rec, gchar* group)
235 return gmyth_recprofile_set(rec, "group", group);
240 * gmyth_recprofile_set_vcodec
241 * @brief set recprofile's vcodec
242 * @param rec GMythRecProfile*
243 * @param vcodec profile's vcodec
244 * @return gint representing the result
247 gint gmyth_recprofile_set_vcodec (GMythRecProfile* rec, gchar* vcodec)
249 return gmyth_recprofile_set(rec, "vcodec", vcodec);
254 * gmyth_recprofile_set_acodec
255 * @brief set recprofile's acodec
256 * @param rec GMythRecProfile*
257 * @param acodec profile's acodec
258 * @return gint representing the result
261 gint gmyth_recprofile_set_acodec (GMythRecProfile* rec, gchar* acodec)
263 return gmyth_recprofile_set(rec, "acodec", acodec);