[svn r299] Fixes a log of wasteful GMythProgramInfo usage.
1.1 --- a/gmyth/src/gmyth_file_transfer.c Wed Jan 24 18:53:43 2007 +0000
1.2 +++ b/gmyth/src/gmyth_file_transfer.c Wed Jan 24 19:02:13 2007 +0000
1.3 @@ -597,7 +597,8 @@
1.4 }
1.5 g_free (data_buffer);
1.6 } /* if */
1.7 - } else {
1.8 + } else if ( transfer->priv != NULL && transfer->priv->livetv != NULL &&
1.9 + transfer->priv->do_next_program_chain ) {
1.10 total_read = GMYTHTV_FILE_TRANSFER_READ_ERROR;
1.11 g_object_unref (strlist);
1.12 strlist = NULL;
2.1 --- a/gmyth/src/gmyth_livetv.c Wed Jan 24 18:53:43 2007 +0000
2.2 +++ b/gmyth/src/gmyth_livetv.c Wed Jan 24 19:02:13 2007 +0000
2.3 @@ -170,6 +170,27 @@
2.4 } else
2.5 gmyth_debug( "LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
2.6 }
2.7 + }
2.8 + case GMYTH_BACKEND_DONE_RECORDING:
2.9 + {
2.10 + gmyth_debug( "LIVETV Program Changed request received [ msg = %s ]. Watching if the new "\
2.11 + "TV Chain ID is the same as the old one...\n", message );
2.12 + if ( g_ascii_strcasecmp ( message, (gmyth_tvchain_get_id( live_tv->tvchain ))->str ) != 0 ) {
2.13 + gmyth_debug( "OK!!! MOVED to the next program chain [actual == %s]!",
2.14 + (gmyth_tvchain_get_id( live_tv->tvchain ))->str );
2.15 + /* advertises the FileTransfer about the program info changed */
2.16 + if ( live_tv->file_transfer != NULL )
2.17 + {
2.18 + gmyth_debug( "Emitting signal to the FileTransfer... [ \"program-info-changed \" ]" );
2.19 +
2.20 + gmyth_file_transfer_emit_program_info_changed_signal( live_tv->file_transfer,
2.21 + msg_code, (gpointer)live_tv );
2.22 +
2.23 + //gmyth_livetv_monitor_handler_stop( live_tv );
2.24 + } else
2.25 + gmyth_debug( "LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n");
2.26 + }
2.27 +
2.28 break;
2.29 }
2.30 default:
3.1 --- a/gmyth/src/gmyth_monitor_handler.c Wed Jan 24 18:53:43 2007 +0000
3.2 +++ b/gmyth/src/gmyth_monitor_handler.c Wed Jan 24 19:02:13 2007 +0000
3.3 @@ -322,13 +322,16 @@
3.4 {
3.5
3.6 if ( g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "LIVETV_CHAIN" ) ||
3.7 - /* g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "RECORDING_LIST_CHANGE" ) ||
3.8 - g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "SCHEDULE_CHANGE" ) || */
3.9 + g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "RECORDING_LIST_CHANGE" ) ||
3.10 + g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "SCHEDULE_CHANGE" ) ||
3.11 g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "LIVETV_WATCH" ) )
3.12 {
3.13 gmyth_debug( "MONITOR: message type == GMYTH_BACKEND_PROGRAM_INFO_CHANGED, msg = %s", *back_msg_action );
3.14 msg_type = GMYTH_BACKEND_PROGRAM_INFO_CHANGED;
3.15 - }
3.16 + } else if ( g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "DONE_RECORDING" ) ) {
3.17 + gmyth_debug( "MONITOR: message type == GMYTH_BACKEND_DONE_RECORDING, msg = %s", *back_msg_action );
3.18 + msg_type = GMYTH_BACKEND_DONE_RECORDING;
3.19 + }
3.20
3.21 //g_hash_table_insert ( monitor->backend_msgs,
3.22 // &(monitor->actual_index), *back_msg_action );
4.1 --- a/gmyth/src/gmyth_monitor_handler.h Wed Jan 24 18:53:43 2007 +0000
4.2 +++ b/gmyth/src/gmyth_monitor_handler.h Wed Jan 24 19:02:13 2007 +0000
4.3 @@ -57,6 +57,7 @@
4.4 enum {
4.5 GMYTH_BACKEND_NO_MESSAGE = 0,
4.6 GMYTH_BACKEND_PROGRAM_INFO_CHANGED,
4.7 + GMYTH_BACKEND_DONE_RECORDING,
4.8 GMYTH_BACKEND_STOP_LIVETV
4.9 };
4.10
5.1 --- a/gmyth/src/gmyth_programinfo.c Wed Jan 24 18:53:43 2007 +0000
5.2 +++ b/gmyth/src/gmyth_programinfo.c Wed Jan 24 19:02:13 2007 +0000
5.3 @@ -58,54 +58,16 @@
5.4
5.5 static void
5.6 gmyth_program_info_init (GMythProgramInfo *gmyth_program_info)
5.7 -{
5.8 -
5.9 - gmyth_program_info->chanid = NULL;
5.10 -
5.11 - /** The program start time. */
5.12 - gmyth_program_info->startts = NULL;
5.13 - /** The program end time. */
5.14 - gmyth_program_info->endts = NULL;
5.15 - /** The recording schedule start time. */
5.16 - gmyth_program_info->recstartts = NULL;
5.17 - /** The recording schedule end time */
5.18 - gmyth_program_info->recendts = NULL;
5.19 -
5.20 - /** The program title. */
5.21 - gmyth_program_info->title = NULL;
5.22 - /** The program subtitle. */
5.23 - gmyth_program_info->subtitle = NULL;
5.24 - /** The program description. */
5.25 - gmyth_program_info->description = NULL;
5.26 - /** The program category. */
5.27 - gmyth_program_info->category = NULL;
5.28 -
5.29 - gmyth_program_info->chanstr = NULL;
5.30 - gmyth_program_info->chansign = NULL;
5.31 - /** The associated channel name. */
5.32 - gmyth_program_info->channame = NULL;
5.33 +{
5.34 gmyth_program_info->chancommfree = 0;
5.35 - gmyth_program_info->chanOutputFilters = NULL;
5.36 -
5.37 - gmyth_program_info->seriesid = NULL;
5.38 - /** The program unique id. */
5.39 - gmyth_program_info->programid = NULL;
5.40 - gmyth_program_info->catType = NULL;
5.41 -
5.42 - gmyth_program_info->sortTitle = NULL;
5.43
5.44 /** A flag informing if the program has video or not. */
5.45 gmyth_program_info->isVideo = FALSE;
5.46 gmyth_program_info->lenMins = 0;
5.47
5.48 - gmyth_program_info->year = NULL;
5.49 gmyth_program_info->stars = 0.0f;
5.50 gmyth_program_info->repeat = 0;
5.51
5.52 - gmyth_program_info->originalAirDate = NULL;
5.53 - gmyth_program_info->lastmodified = NULL;
5.54 - gmyth_program_info->lastInUseTime = NULL;
5.55 -
5.56 gmyth_program_info->hasAirDate = FALSE;
5.57
5.58 gmyth_program_info->spread = 0;
5.59 @@ -126,29 +88,186 @@
5.60 gmyth_program_info->shareable = FALSE;
5.61 gmyth_program_info->duplicate = FALSE;
5.62
5.63 - gmyth_program_info->schedulerid = NULL;
5.64 gmyth_program_info->findid = 0;
5.65
5.66 gmyth_program_info->programflags = 0;
5.67 gmyth_program_info->transcoder = 0;
5.68
5.69 - gmyth_program_info->recgroup = NULL;
5.70 - gmyth_program_info->playgroup = NULL;
5.71 gmyth_program_info->recpriority = 0;
5.72
5.73 /** The file size of the recorded program.*/
5.74 gmyth_program_info->filesize = -1;
5.75 -
5.76 - /** The file name of the recorded program.*/
5.77 - gmyth_program_info->pathname = NULL;
5.78 - gmyth_program_info->hostname = NULL;
5.79 +
5.80
5.81 }
5.82
5.83 static void
5.84 gmyth_program_info_dispose (GObject *object)
5.85 {
5.86 - //GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object);
5.87 + GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object);
5.88 +
5.89 + if ( gmyth_program_info->chanid != NULL )
5.90 + {
5.91 + g_string_free( gmyth_program_info->chanid, TRUE );
5.92 + gmyth_program_info->chanid = NULL;
5.93 + }
5.94 +
5.95 + /** The program start time. */
5.96 + if ( gmyth_program_info->startts != NULL )
5.97 + {
5.98 + g_free( gmyth_program_info->startts);
5.99 + gmyth_program_info->startts = NULL;
5.100 + }
5.101 +
5.102 + /** The program end time. */
5.103 + if ( gmyth_program_info->endts != NULL )
5.104 + {
5.105 + g_free( gmyth_program_info->endts );
5.106 + gmyth_program_info->endts = NULL;
5.107 + }
5.108 +
5.109 + /** The recording schedule start time. */
5.110 + if ( gmyth_program_info->recstartts != NULL )
5.111 + {
5.112 + g_free( gmyth_program_info->recstartts );
5.113 + gmyth_program_info->recstartts = NULL;
5.114 + }
5.115 +
5.116 + /** The recording schedule end time */
5.117 + if ( gmyth_program_info->recendts != NULL )
5.118 + {
5.119 + g_free(gmyth_program_info->recendts);
5.120 + gmyth_program_info->recendts = NULL;
5.121 + }
5.122 +
5.123 + /** The program title. */
5.124 + if (gmyth_program_info->title != NULL )
5.125 + {
5.126 + g_string_free(gmyth_program_info->title, TRUE);
5.127 + gmyth_program_info->title = NULL;
5.128 + }
5.129 +
5.130 + /** The program subtitle. */
5.131 + if (gmyth_program_info->subtitle != NULL )
5.132 + {
5.133 + g_string_free(gmyth_program_info->subtitle, TRUE );
5.134 + gmyth_program_info->subtitle = NULL;
5.135 + }
5.136 + /** The program description. */
5.137 + if ( gmyth_program_info->description != NULL )
5.138 + {
5.139 + g_string_free( gmyth_program_info->description, TRUE );
5.140 + gmyth_program_info->description = NULL;
5.141 + }
5.142 +
5.143 + /** The program category. */
5.144 + if ( gmyth_program_info->category != NULL )
5.145 + {
5.146 + g_string_free( gmyth_program_info->category, TRUE );
5.147 + gmyth_program_info->category = NULL;
5.148 + }
5.149 +
5.150 + if ( gmyth_program_info->chanstr != NULL )
5.151 + {
5.152 + g_string_free( gmyth_program_info->chanstr, TRUE );
5.153 + gmyth_program_info->chanstr = NULL;
5.154 + }
5.155 + if ( gmyth_program_info->chansign != NULL )
5.156 + {
5.157 + g_string_free( gmyth_program_info->chansign, TRUE );
5.158 + gmyth_program_info->chansign = NULL;
5.159 + }
5.160 + /** The associated channel name. */
5.161 + if ( gmyth_program_info->channame != NULL )
5.162 + {
5.163 + g_string_free( gmyth_program_info->channame, TRUE );
5.164 + gmyth_program_info->channame = NULL;
5.165 + }
5.166 + if ( gmyth_program_info->chanOutputFilters != NULL )
5.167 + {
5.168 + g_string_free( gmyth_program_info->chanOutputFilters, TRUE );
5.169 + gmyth_program_info->chanOutputFilters = NULL;
5.170 + }
5.171 +
5.172 + if ( gmyth_program_info->seriesid != NULL )
5.173 + {
5.174 + g_string_free( gmyth_program_info->chanOutputFilters, TRUE );
5.175 + gmyth_program_info->chanOutputFilters = NULL;
5.176 +
5.177 + }
5.178 + /** The program unique id. */
5.179 + if ( gmyth_program_info->programid != NULL )
5.180 + {
5.181 + g_string_free( gmyth_program_info->programid, TRUE );
5.182 + gmyth_program_info->programid = NULL;
5.183 +
5.184 + }
5.185 + if ( gmyth_program_info->catType != NULL )
5.186 + {
5.187 + g_string_free( gmyth_program_info->catType, TRUE );
5.188 + gmyth_program_info->catType = NULL;
5.189 +
5.190 + }
5.191 +
5.192 + if ( gmyth_program_info->sortTitle != NULL )
5.193 + {
5.194 + g_string_free( gmyth_program_info->sortTitle, TRUE );
5.195 + gmyth_program_info->sortTitle = NULL;
5.196 +
5.197 + }
5.198 +
5.199 + if ( gmyth_program_info->year != NULL )
5.200 + {
5.201 + g_string_free( gmyth_program_info->year, TRUE );
5.202 + gmyth_program_info->year = NULL;
5.203 +
5.204 + }
5.205 +
5.206 + if ( gmyth_program_info->originalAirDate != NULL )
5.207 + {
5.208 + g_free( gmyth_program_info->originalAirDate);
5.209 + gmyth_program_info->originalAirDate = NULL;
5.210 + }
5.211 + if ( gmyth_program_info->lastmodified != NULL )
5.212 + {
5.213 + g_free( gmyth_program_info->lastmodified );
5.214 + gmyth_program_info->lastmodified = NULL;
5.215 +
5.216 + }
5.217 + if (gmyth_program_info->lastInUseTime != NULL)
5.218 + {
5.219 + g_free( gmyth_program_info->lastInUseTime );
5.220 + gmyth_program_info->lastInUseTime = NULL;
5.221 + }
5.222 +
5.223 + if ( gmyth_program_info->schedulerid != NULL )
5.224 + {
5.225 + g_string_free( gmyth_program_info->schedulerid, TRUE );
5.226 + gmyth_program_info->schedulerid = NULL;
5.227 + }
5.228 +
5.229 + if ( gmyth_program_info->recgroup != NULL )
5.230 + {
5.231 + g_string_free( gmyth_program_info->recgroup, TRUE );
5.232 + gmyth_program_info->recgroup = NULL;
5.233 + }
5.234 + if ( gmyth_program_info->playgroup != NULL )
5.235 + {
5.236 + g_string_free( gmyth_program_info->playgroup, TRUE );
5.237 + gmyth_program_info->playgroup = NULL;
5.238 + }
5.239 +
5.240 + /** The file name of the recorded program.*/
5.241 + if ( gmyth_program_info->pathname != NULL)
5.242 + {
5.243 + g_string_free( gmyth_program_info->pathname, TRUE );
5.244 + gmyth_program_info->pathname = NULL;
5.245 + }
5.246 + if ( gmyth_program_info->hostname != NULL )
5.247 + {
5.248 + g_string_free( gmyth_program_info->hostname, TRUE );
5.249 + gmyth_program_info->hostname = NULL;
5.250 + }
5.251
5.252 G_OBJECT_CLASS (gmyth_program_info_parent_class)->dispose (object);
5.253 }
6.1 --- a/gmyth/src/gmyth_scheduler.c Wed Jan 24 18:53:43 2007 +0000
6.2 +++ b/gmyth/src/gmyth_scheduler.c Wed Jan 24 19:02:13 2007 +0000
6.3 @@ -531,7 +531,7 @@
6.4 MYSQL_ROW msql_row = mysql_fetch_row (msql_res);
6.5 if (msql_row) {
6.6
6.7 - proginfo = g_new0 (GMythProgramInfo, 1);
6.8 + proginfo = gmyth_program_info_new();
6.9
6.10 proginfo->chanid = g_string_new (msql_row[0]);
6.11 proginfo->startts = gmyth_util_string_to_time_val (msql_row[23]);
7.1 --- a/gmyth/src/gmyth_socket.c Wed Jan 24 18:53:43 2007 +0000
7.2 +++ b/gmyth/src/gmyth_socket.c Wed Jan 24 19:02:13 2007 +0000
7.3 @@ -342,11 +342,12 @@
7.4 g_free (localaddr);
7.5 break;
7.6 }
7.7 -
7.8 +/*
7.9 if (localaddr != NULL) {
7.10 g_free (localaddr);
7.11 localaddr = NULL;
7.12 }
7.13 + */
7.14
7.15 addr_info0 = addr_info0->ai_next;
7.16 };
8.1 --- a/gmyth/src/gmyth_uri.c Wed Jan 24 18:53:43 2007 +0000
8.2 +++ b/gmyth/src/gmyth_uri.c Wed Jan 24 19:02:13 2007 +0000
8.3 @@ -342,12 +342,16 @@
8.4 gboolean
8.5 gmyth_uri_is_livetv( GMythURI* uri )
8.6 {
8.7 + gboolean ret = FALSE;
8.8
8.9 g_return_val_if_fail( uri != NULL && uri->uri != NULL && uri->uri->str != NULL, FALSE );
8.10
8.11 - gmyth_debug( "This URI is a LiveTV recording..." );
8.12 + ret = ( g_strstr_len( uri->uri->str, strlen( uri->uri->str ), "/?" ) != NULL );
8.13
8.14 - return ( g_strstr_len( uri->uri->str, strlen( uri->uri->str ), "/?" ) != NULL );
8.15 + if ( ret )
8.16 + gmyth_debug( "This URI is a LiveTV recording..." );
8.17 +
8.18 + return ret;
8.19
8.20 }
8.21
9.1 --- a/gmyth/src/gmyth_util.c Wed Jan 24 18:53:43 2007 +0000
9.2 +++ b/gmyth/src/gmyth_util.c Wed Jan 24 19:02:13 2007 +0000
9.3 @@ -426,7 +426,7 @@
9.4
9.5 if (res == TRUE) {
9.6 GMythStringList *slist;
9.7 - GMythProgramInfo *program;
9.8 + GMythProgramInfo *program = NULL;
9.9
9.10 program = gmyth_program_info_new();
9.11 program->pathname = g_string_new (filename);
9.12 @@ -440,9 +440,7 @@
9.13
9.14 res = (gmyth_string_list_get_int (slist, 0) == 1);
9.15
9.16 - // fixme: we should do this in a program_info_free() function
9.17 - g_string_free (program->pathname, TRUE);
9.18 - g_free (program);
9.19 + g_object_unref (program);
9.20
9.21 g_object_unref (slist);
9.22