# HG changeset patch # User melunko # Date 1164922194 0 # Node ID 2db0e1da044ad93a1acdd43a42e5558c19a9bbf1 # Parent 517da097a26157823c3ef02ab825a47f9fde8a52 [svn r160] Filetransfer interface now receives GMythBackendInfo and file name instead of URI diff -r 517da097a261 -r 2db0e1da044a gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Thu Nov 30 21:29:38 2006 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Thu Nov 30 21:29:54 2006 +0000 @@ -654,9 +654,10 @@ gst_mythtv_src_start ( GstBaseSrc * bsrc ) { GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc); + GMythURI *gmyth_uri = NULL; + gchar* filename = NULL; GString *chain_id_local = NULL; - gboolean ret = TRUE; if ( G_UNLIKELY (src->update_prog_chain) ) @@ -668,14 +669,18 @@ goto done; } +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); + src->backend_info = gmyth_backend_info_new_with_uri( src->uri_name ); + +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); if ( src->live_tv ) { - src->backend_info = gmyth_backend_info_new_with_uri( src->uri_name ); src->spawn_livetv = gmyth_livetv_new( ); if ( gmyth_livetv_setup( src->spawn_livetv, src->backend_info ) == FALSE ) { ret = FALSE; goto init_failed; } +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); /* set up the uri variable */ src->uri_name = g_strdup( src->spawn_livetv->proginfo->pathname->str ); chain_id_local = gmyth_tvchain_get_id( src->spawn_livetv->tvchain ); @@ -683,26 +688,30 @@ src->live_chain_id = g_strdup( chain_id_local->str ); GST_INFO_OBJECT( src, "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); } - //if ( src->uri_name == NULL || strlen( src->uri_name ) <= 0 ) - // gmyth_context_initialize(); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); src->live_tv_id = src->spawn_livetv->recorder->recorder_num; GST_LOG_OBJECT( src, "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); } - //src->file_transfer = gmyth_file_transfer_new( src->live_tv_id, - // g_string_new( src->uri_name ), -1, src->mythtv_version ); - src->file_transfer = gmyth_file_transfer_new( ); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); + src->file_transfer = gmyth_file_transfer_new( src->backend_info ); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); if ( src->file_transfer == NULL ) { goto init_failed; } GST_INFO_OBJECT( src, "[%s] uri = %s.\n", __FUNCTION__, src->uri_name ); - - ret = gmyth_file_transfer_open( src->file_transfer, g_string_new( src->uri_name ) ); - - /* sets the Playback monitor connection */ - //ret = gmyth_file_transfer_playback_setup( &(src->file_transfer), src->live_tv ); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); + gmyth_uri = gmyth_uri_new_with_value (src->uri_name); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); + + filename = gmyth_uri_get_path (gmyth_uri); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); + ret = gmyth_file_transfer_open( src->file_transfer, filename); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); + g_object_unref (gmyth_uri); +printf ("XXX %s %d\n", __FUNCTION__, __LINE__); if ( src->live_tv == TRUE && ret == TRUE ) { /* loop finished, set the max tries variable to zero again... */ @@ -823,16 +832,17 @@ GST_LOG_OBJECT( src, "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); } - src->file_transfer = gmyth_file_transfer_new(); + // we do not need to create a new file transfer, just close the previous one and open with the new file name + // src->file_transfer = gmyth_file_transfer_new( src->backend_info); + gmyth_file_transfer_close (src->backend_info); if ( src->file_transfer == NULL ) { goto init_failed; } - ret = gmyth_file_transfer_open( src->file_transfer, g_string_new( src->uri_name ) ); - - /* sets the Playback monitor connection */ - //ret = gmyth_file_transfer_playback_setup( &(src->file_transfer), src->live_tv ); + GMythURI *myth_uri = gmyth_uri_new_with_value (src->uri_name); + ret = gmyth_file_transfer_open( src->file_transfer, gmyth_uri_get_path (myth_uri) ); + g_object_unref (myth_uri); if ( src->live_tv == TRUE && ret == TRUE ) { /* loop finished, set the max tries variable to zero again... */ @@ -845,8 +855,6 @@ g_usleep( 1000 ); } - /* sets the FileTransfer instance connection (video/audio download) */ - //ret = gmyth_file_transfer_setup( &(src->file_transfer), src->live_tv ); if ( ret == FALSE ) { #ifndef GST_DISABLE_GST_DEBUG @@ -949,6 +957,17 @@ src->mythtv_caps = NULL; } + if (src->backend_info != NULL) { + g_object_unref (src->backend_info); + src->backend_info = NULL; + } + + if (src->file_transfer != NULL) { + gmyth_file_transfer_close (src->file_transfer); + g_object_unref (src->file_transfer); + src->file_transfer = NULL; + } + src->eos = FALSE; return TRUE;