# HG changeset patch # User rosfran # Date 1169665333 0 # Node ID 414a430c1e0df91f52586dd154ddb229321cf9b8 # Parent c81bc5ed0ccb0e63a295b2ad54c6073476c68f33 [svn r299] Fixes a log of wasteful GMythProgramInfo usage. diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_file_transfer.c --- a/gmyth/src/gmyth_file_transfer.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_file_transfer.c Wed Jan 24 19:02:13 2007 +0000 @@ -597,7 +597,8 @@ } g_free (data_buffer); } /* if */ - } else { + } else if ( transfer->priv != NULL && transfer->priv->livetv != NULL && + transfer->priv->do_next_program_chain ) { total_read = GMYTHTV_FILE_TRANSFER_READ_ERROR; g_object_unref (strlist); strlist = NULL; diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_livetv.c --- a/gmyth/src/gmyth_livetv.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_livetv.c Wed Jan 24 19:02:13 2007 +0000 @@ -170,6 +170,27 @@ } else gmyth_debug( "LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n"); } + } + case GMYTH_BACKEND_DONE_RECORDING: + { + gmyth_debug( "LIVETV Program Changed request received [ msg = %s ]. Watching if the new "\ + "TV Chain ID is the same as the old one...\n", message ); + if ( g_ascii_strcasecmp ( message, (gmyth_tvchain_get_id( live_tv->tvchain ))->str ) != 0 ) { + gmyth_debug( "OK!!! MOVED to the next program chain [actual == %s]!", + (gmyth_tvchain_get_id( live_tv->tvchain ))->str ); + /* advertises the FileTransfer about the program info changed */ + if ( live_tv->file_transfer != NULL ) + { + gmyth_debug( "Emitting signal to the FileTransfer... [ \"program-info-changed \" ]" ); + + gmyth_file_transfer_emit_program_info_changed_signal( live_tv->file_transfer, + msg_code, (gpointer)live_tv ); + + //gmyth_livetv_monitor_handler_stop( live_tv ); + } else + gmyth_debug( "LIVETV file_transfer is NULL!!! Cannot move to the next program chain event received.\n"); + } + break; } default: diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_monitor_handler.c --- a/gmyth/src/gmyth_monitor_handler.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_monitor_handler.c Wed Jan 24 19:02:13 2007 +0000 @@ -322,13 +322,16 @@ { if ( g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "LIVETV_CHAIN" ) || - /* g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "RECORDING_LIST_CHANGE" ) || - g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "SCHEDULE_CHANGE" ) || */ + g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "RECORDING_LIST_CHANGE" ) || + g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "SCHEDULE_CHANGE" ) || g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "LIVETV_WATCH" ) ) { gmyth_debug( "MONITOR: message type == GMYTH_BACKEND_PROGRAM_INFO_CHANGED, msg = %s", *back_msg_action ); msg_type = GMYTH_BACKEND_PROGRAM_INFO_CHANGED; - } + } else if ( g_strstr_len( *back_msg_action, strlen( *back_msg_action ), "DONE_RECORDING" ) ) { + gmyth_debug( "MONITOR: message type == GMYTH_BACKEND_DONE_RECORDING, msg = %s", *back_msg_action ); + msg_type = GMYTH_BACKEND_DONE_RECORDING; + } //g_hash_table_insert ( monitor->backend_msgs, // &(monitor->actual_index), *back_msg_action ); diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_monitor_handler.h --- a/gmyth/src/gmyth_monitor_handler.h Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_monitor_handler.h Wed Jan 24 19:02:13 2007 +0000 @@ -57,6 +57,7 @@ enum { GMYTH_BACKEND_NO_MESSAGE = 0, GMYTH_BACKEND_PROGRAM_INFO_CHANGED, + GMYTH_BACKEND_DONE_RECORDING, GMYTH_BACKEND_STOP_LIVETV }; diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_programinfo.c --- a/gmyth/src/gmyth_programinfo.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_programinfo.c Wed Jan 24 19:02:13 2007 +0000 @@ -58,54 +58,16 @@ static void gmyth_program_info_init (GMythProgramInfo *gmyth_program_info) -{ - - gmyth_program_info->chanid = NULL; - - /** The program start time. */ - gmyth_program_info->startts = NULL; - /** The program end time. */ - gmyth_program_info->endts = NULL; - /** The recording schedule start time. */ - gmyth_program_info->recstartts = NULL; - /** The recording schedule end time */ - gmyth_program_info->recendts = NULL; - - /** The program title. */ - gmyth_program_info->title = NULL; - /** The program subtitle. */ - gmyth_program_info->subtitle = NULL; - /** The program description. */ - gmyth_program_info->description = NULL; - /** The program category. */ - gmyth_program_info->category = NULL; - - gmyth_program_info->chanstr = NULL; - gmyth_program_info->chansign = NULL; - /** The associated channel name. */ - gmyth_program_info->channame = NULL; +{ gmyth_program_info->chancommfree = 0; - gmyth_program_info->chanOutputFilters = NULL; - - gmyth_program_info->seriesid = NULL; - /** The program unique id. */ - gmyth_program_info->programid = NULL; - gmyth_program_info->catType = NULL; - - gmyth_program_info->sortTitle = NULL; /** A flag informing if the program has video or not. */ gmyth_program_info->isVideo = FALSE; gmyth_program_info->lenMins = 0; - gmyth_program_info->year = NULL; gmyth_program_info->stars = 0.0f; gmyth_program_info->repeat = 0; - gmyth_program_info->originalAirDate = NULL; - gmyth_program_info->lastmodified = NULL; - gmyth_program_info->lastInUseTime = NULL; - gmyth_program_info->hasAirDate = FALSE; gmyth_program_info->spread = 0; @@ -126,29 +88,186 @@ gmyth_program_info->shareable = FALSE; gmyth_program_info->duplicate = FALSE; - gmyth_program_info->schedulerid = NULL; gmyth_program_info->findid = 0; gmyth_program_info->programflags = 0; gmyth_program_info->transcoder = 0; - gmyth_program_info->recgroup = NULL; - gmyth_program_info->playgroup = NULL; gmyth_program_info->recpriority = 0; /** The file size of the recorded program.*/ gmyth_program_info->filesize = -1; - - /** The file name of the recorded program.*/ - gmyth_program_info->pathname = NULL; - gmyth_program_info->hostname = NULL; + } static void gmyth_program_info_dispose (GObject *object) { - //GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object); + GMythProgramInfo *gmyth_program_info = GMYTH_PROGRAM_INFO(object); + + if ( gmyth_program_info->chanid != NULL ) + { + g_string_free( gmyth_program_info->chanid, TRUE ); + gmyth_program_info->chanid = NULL; + } + + /** The program start time. */ + if ( gmyth_program_info->startts != NULL ) + { + g_free( gmyth_program_info->startts); + gmyth_program_info->startts = NULL; + } + + /** The program end time. */ + if ( gmyth_program_info->endts != NULL ) + { + g_free( gmyth_program_info->endts ); + gmyth_program_info->endts = NULL; + } + + /** The recording schedule start time. */ + if ( gmyth_program_info->recstartts != NULL ) + { + g_free( gmyth_program_info->recstartts ); + gmyth_program_info->recstartts = NULL; + } + + /** The recording schedule end time */ + if ( gmyth_program_info->recendts != NULL ) + { + g_free(gmyth_program_info->recendts); + gmyth_program_info->recendts = NULL; + } + + /** The program title. */ + if (gmyth_program_info->title != NULL ) + { + g_string_free(gmyth_program_info->title, TRUE); + gmyth_program_info->title = NULL; + } + + /** The program subtitle. */ + if (gmyth_program_info->subtitle != NULL ) + { + g_string_free(gmyth_program_info->subtitle, TRUE ); + gmyth_program_info->subtitle = NULL; + } + /** The program description. */ + if ( gmyth_program_info->description != NULL ) + { + g_string_free( gmyth_program_info->description, TRUE ); + gmyth_program_info->description = NULL; + } + + /** The program category. */ + if ( gmyth_program_info->category != NULL ) + { + g_string_free( gmyth_program_info->category, TRUE ); + gmyth_program_info->category = NULL; + } + + if ( gmyth_program_info->chanstr != NULL ) + { + g_string_free( gmyth_program_info->chanstr, TRUE ); + gmyth_program_info->chanstr = NULL; + } + if ( gmyth_program_info->chansign != NULL ) + { + g_string_free( gmyth_program_info->chansign, TRUE ); + gmyth_program_info->chansign = NULL; + } + /** The associated channel name. */ + if ( gmyth_program_info->channame != NULL ) + { + g_string_free( gmyth_program_info->channame, TRUE ); + gmyth_program_info->channame = NULL; + } + if ( gmyth_program_info->chanOutputFilters != NULL ) + { + g_string_free( gmyth_program_info->chanOutputFilters, TRUE ); + gmyth_program_info->chanOutputFilters = NULL; + } + + if ( gmyth_program_info->seriesid != NULL ) + { + g_string_free( gmyth_program_info->chanOutputFilters, TRUE ); + gmyth_program_info->chanOutputFilters = NULL; + + } + /** The program unique id. */ + if ( gmyth_program_info->programid != NULL ) + { + g_string_free( gmyth_program_info->programid, TRUE ); + gmyth_program_info->programid = NULL; + + } + if ( gmyth_program_info->catType != NULL ) + { + g_string_free( gmyth_program_info->catType, TRUE ); + gmyth_program_info->catType = NULL; + + } + + if ( gmyth_program_info->sortTitle != NULL ) + { + g_string_free( gmyth_program_info->sortTitle, TRUE ); + gmyth_program_info->sortTitle = NULL; + + } + + if ( gmyth_program_info->year != NULL ) + { + g_string_free( gmyth_program_info->year, TRUE ); + gmyth_program_info->year = NULL; + + } + + if ( gmyth_program_info->originalAirDate != NULL ) + { + g_free( gmyth_program_info->originalAirDate); + gmyth_program_info->originalAirDate = NULL; + } + if ( gmyth_program_info->lastmodified != NULL ) + { + g_free( gmyth_program_info->lastmodified ); + gmyth_program_info->lastmodified = NULL; + + } + if (gmyth_program_info->lastInUseTime != NULL) + { + g_free( gmyth_program_info->lastInUseTime ); + gmyth_program_info->lastInUseTime = NULL; + } + + if ( gmyth_program_info->schedulerid != NULL ) + { + g_string_free( gmyth_program_info->schedulerid, TRUE ); + gmyth_program_info->schedulerid = NULL; + } + + if ( gmyth_program_info->recgroup != NULL ) + { + g_string_free( gmyth_program_info->recgroup, TRUE ); + gmyth_program_info->recgroup = NULL; + } + if ( gmyth_program_info->playgroup != NULL ) + { + g_string_free( gmyth_program_info->playgroup, TRUE ); + gmyth_program_info->playgroup = NULL; + } + + /** The file name of the recorded program.*/ + if ( gmyth_program_info->pathname != NULL) + { + g_string_free( gmyth_program_info->pathname, TRUE ); + gmyth_program_info->pathname = NULL; + } + if ( gmyth_program_info->hostname != NULL ) + { + g_string_free( gmyth_program_info->hostname, TRUE ); + gmyth_program_info->hostname = NULL; + } G_OBJECT_CLASS (gmyth_program_info_parent_class)->dispose (object); } diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_scheduler.c --- a/gmyth/src/gmyth_scheduler.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_scheduler.c Wed Jan 24 19:02:13 2007 +0000 @@ -531,7 +531,7 @@ MYSQL_ROW msql_row = mysql_fetch_row (msql_res); if (msql_row) { - proginfo = g_new0 (GMythProgramInfo, 1); + proginfo = gmyth_program_info_new(); proginfo->chanid = g_string_new (msql_row[0]); proginfo->startts = gmyth_util_string_to_time_val (msql_row[23]); diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_socket.c --- a/gmyth/src/gmyth_socket.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_socket.c Wed Jan 24 19:02:13 2007 +0000 @@ -342,11 +342,12 @@ g_free (localaddr); break; } - +/* if (localaddr != NULL) { g_free (localaddr); localaddr = NULL; } + */ addr_info0 = addr_info0->ai_next; }; diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_uri.c --- a/gmyth/src/gmyth_uri.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_uri.c Wed Jan 24 19:02:13 2007 +0000 @@ -342,12 +342,16 @@ gboolean gmyth_uri_is_livetv( GMythURI* uri ) { + gboolean ret = FALSE; g_return_val_if_fail( uri != NULL && uri->uri != NULL && uri->uri->str != NULL, FALSE ); - gmyth_debug( "This URI is a LiveTV recording..." ); + ret = ( g_strstr_len( uri->uri->str, strlen( uri->uri->str ), "/?" ) != NULL ); - return ( g_strstr_len( uri->uri->str, strlen( uri->uri->str ), "/?" ) != NULL ); + if ( ret ) + gmyth_debug( "This URI is a LiveTV recording..." ); + + return ret; } diff -r c81bc5ed0ccb -r 414a430c1e0d gmyth/src/gmyth_util.c --- a/gmyth/src/gmyth_util.c Wed Jan 24 18:53:43 2007 +0000 +++ b/gmyth/src/gmyth_util.c Wed Jan 24 19:02:13 2007 +0000 @@ -426,7 +426,7 @@ if (res == TRUE) { GMythStringList *slist; - GMythProgramInfo *program; + GMythProgramInfo *program = NULL; program = gmyth_program_info_new(); program->pathname = g_string_new (filename); @@ -440,9 +440,7 @@ res = (gmyth_string_list_get_int (slist, 0) == 1); - // fixme: we should do this in a program_info_free() function - g_string_free (program->pathname, TRUE); - g_free (program); + g_object_unref (program); g_object_unref (slist);