maemo-ui/src/mmyth_tvplayer.c
author rosfran
Wed Dec 06 20:22:48 2006 +0000 (2006-12-06)
branchtrunk
changeset 208 c3c073032757
parent 99 404189e73f8e
child 244 c88244670b08
permissions -rw-r--r--
[svn r209] Removed gmyth_settings, put gmyth_backend* functions.
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/mmyth_tvplayer.c
     5  * 
     6  * @brief <p> This component provides playback of the remote A/V using
     7  * GStreamer.
     8  * 
     9  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    10  * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
    11  *
    12  *//*
    13  * 
    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.
    18  *
    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.
    23  *
    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
    27  */
    28 
    29 #include "mmyth_tvplayer.h"
    30  
    31 #include <gdk/gdkx.h>
    32 
    33 #include <gmyth/gmyth_remote_util.h>
    34 
    35 #define MYTHTV_VERSION_DEFAULT	30
    36 
    37 typedef struct _GstPlayerWindowStateChange
    38 {
    39     GstElement *play;
    40     GstState old_state, new_state;
    41     MMythTVPlayer *tvplayer;
    42 } GstPlayerWindowStateChange;
    43 
    44 typedef struct _GstPlayerWindowTagFound
    45 {
    46     GstElement *play;
    47     GstTagList *taglist;
    48     MMythTVPlayer *tvplayer;
    49 } GstPlayerWindowTagFound;
    50 
    51 /*
    52 static gboolean idle_state (gpointer data);
    53 */
    54 static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data);
    55 
    56 static void mmyth_tvplayer_class_init          (MMythTVPlayerClass *klass);
    57 static void mmyth_tvplayer_init                (MMythTVPlayer *object);
    58 
    59 static void mmyth_tvplayer_dispose  (GObject *object);
    60 static void mmyth_tvplayer_finalize (GObject *object);
    61 
    62 G_DEFINE_TYPE(MMythTVPlayer, mmyth_tvplayer, G_TYPE_OBJECT)
    63 
    64 static gboolean mmyth_tvplayer_create_pipeline (MMythTVPlayer* tvplayer);
    65 static void     new_pad_cb (GstElement *element, 
    66                             GstPad *pad, gpointer data);
    67 
    68 static gboolean expose_cb (GtkWidget * widget, 
    69                            GdkEventExpose * event, 
    70                            gpointer user_data);
    71 
    72 static void
    73 mmyth_tvplayer_class_init (MMythTVPlayerClass *klass)
    74 {
    75 	GObjectClass *gobject_class;
    76 
    77 	gobject_class = (GObjectClass *) klass;
    78 
    79 	gobject_class->dispose  = mmyth_tvplayer_dispose;
    80 	gobject_class->finalize = mmyth_tvplayer_finalize;	
    81 }
    82 
    83 static void
    84 new_pad_cb (GstElement *element, GstPad *pad, gpointer data)
    85 {
    86 	MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data);
    87 	GstPadLinkReturn ret;
    88 	char *s;
    89 	
    90 	s = gst_caps_to_string (pad->caps);
    91 
    92 	if ( s[0] == 'a') {
    93 		ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue1, "sink"));
    94 	} else {
    95 		ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue1, "sink")); 
    96 	}
    97 	
    98 	g_free(s);
    99 }
   100 
   101 static gboolean
   102 expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
   103 {
   104 	MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data);
   105 
   106 	if (tvplayer && tvplayer->videow) {
   107 		gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink),
   108 				GDK_WINDOW_XWINDOW (widget->window));
   109 		return TRUE;
   110 	}
   111 
   112 	g_warning ("MMythTVPlayer expose called before setting video window\n");
   113 
   114 	return FALSE;
   115 }
   116 
   117 static void
   118 mmyth_tvplayer_init (MMythTVPlayer *tvplayer)
   119 {
   120 	tvplayer->gst_pipeline = NULL;
   121 	tvplayer->gst_source = NULL;
   122 	tvplayer->gst_videodec = NULL;
   123 	tvplayer->gst_videosink = NULL;
   124 	tvplayer->gst_videocolortrs = NULL;
   125 	tvplayer->videoqueue1 = NULL;
   126 	tvplayer->videoqueue2 = NULL;
   127 	tvplayer->audioqueue1 = NULL;
   128 	tvplayer->audioqueue2 = NULL;   
   129 
   130 	/* GTKWidget for rendering the video */
   131 	tvplayer->videow = NULL;
   132 	tvplayer->expose_handler = 0;
   133 
   134 	tvplayer->backend_hostname = NULL;
   135 	tvplayer->backend_port = 0;
   136 	tvplayer->local_hostname = NULL;
   137 
   138 	tvplayer->recorder = NULL;
   139 	tvplayer->tvchain = NULL;
   140 	tvplayer->proginfo = NULL;
   141 }
   142 
   143 static void
   144 mmyth_tvplayer_dispose (GObject *object)
   145 {
   146 
   147 	G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->dispose (object);
   148 }
   149 
   150 static void
   151 mmyth_tvplayer_finalize (GObject *object)
   152 {
   153 	g_signal_handlers_destroy (object);
   154 
   155 	MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (object);
   156 
   157 	g_debug ("[%s] Finalizing tvplayer", __FUNCTION__);
   158 	
   159 	if (tvplayer->videow != NULL) {
   160 		if (g_signal_handler_is_connected (tvplayer->videow, 
   161 						tvplayer->expose_handler)) {
   162 			g_signal_handler_disconnect (tvplayer->videow,
   163 				tvplayer->expose_handler);
   164 		}
   165 		g_object_unref (tvplayer->videow);
   166 	}
   167 	
   168 	if ( tvplayer->recorder != NULL )
   169 		g_object_unref (tvplayer->recorder);
   170 	if ( tvplayer->tvchain != NULL )
   171 		g_object_unref (tvplayer->tvchain);
   172 	if ( tvplayer->proginfo != NULL )
   173 		g_object_unref (tvplayer->proginfo);	
   174 
   175 	// Release Gstreamer elements
   176 	if ( tvplayer->gst_pipeline != NULL )
   177 		g_object_unref (tvplayer->gst_pipeline);	
   178 	if ( tvplayer->gst_source != NULL )
   179 		g_object_unref (tvplayer->gst_source);	
   180 	if ( tvplayer->gst_videodec != NULL )
   181 		g_object_unref (tvplayer->gst_videodec);	
   182 	if ( tvplayer->gst_videocolortrs != NULL )
   183 		g_object_unref (tvplayer->gst_videocolortrs);
   184 	if ( tvplayer->gst_videosink != NULL )
   185 		g_object_unref (tvplayer->gst_videosink);	
   186 	if ( tvplayer->videoqueue1 != NULL )
   187 		g_object_unref (tvplayer->videoqueue1);
   188 	if ( tvplayer->videoqueue2 != NULL )
   189 		g_object_unref (tvplayer->videoqueue2);
   190 	if ( tvplayer->audioqueue1 != NULL )
   191 		g_object_unref (tvplayer->audioqueue1);	
   192 	if ( tvplayer->audioqueue2 != NULL )
   193 		g_object_unref (tvplayer->audioqueue2);	
   194 
   195 	G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->finalize (object);
   196 }
   197 
   198 /** Creates a new instance of MMythTVPlayer. 
   199  * 
   200  * @return a new instance of MMythTVPlayer.
   201  */
   202 MMythTVPlayer *
   203 mmyth_tvplayer_new ()
   204 {
   205     MMythTVPlayer *tvplayer = 
   206         MMYTH_TVPLAYER (g_object_new(MMYTH_TVPLAYER_TYPE, NULL));
   207     
   208     return tvplayer;
   209 }
   210 
   211 /** Initializes the tv player.
   212  *
   213  * @param tvplayer the object instance.
   214  * @return gboolean TRUE if the pipeline was created 
   215  * successfully, FALSE otherwise.
   216  */
   217 gboolean
   218 mmyth_tvplayer_initialize (MMythTVPlayer *tvplayer, GMythBackendInfo *backend_info)
   219 {
   220 	tvplayer->backend_info = backend_info;
   221 
   222 	if (!mmyth_tvplayer_create_pipeline (tvplayer)) {
   223 		g_warning ("[%s] Error while creating pipeline. TV Player not initialized", __FUNCTION__);
   224 		return FALSE;
   225 	} else {
   226 		g_debug ("[%s] GStreamer pipeline created", __FUNCTION__);	
   227 	}
   228 
   229 	return TRUE;
   230 }
   231 
   232 /** Creates the GStreamer pipeline used by the player.
   233  *
   234  * @param tvplayer the object instance.
   235  * @return gboolean TRUE if the pipeline was created 
   236  * successfully, FALSE otherwise.
   237  */
   238 static gboolean
   239 mmyth_tvplayer_create_pipeline (MMythTVPlayer* tvplayer)
   240 {
   241     GstElement *pipeline;
   242     GstElement *source, *parser;
   243     GstElement *videodec, *videosink;
   244     GstElement *videocolortrs;
   245 #ifndef MAEMO_PLATFORM    
   246     GstElement *audiodec, *audioconv;
   247 #endif
   248     GstElement *audiosink;
   249     GstElement *videoqueue1, *videoqueue2, *audioqueue1, *audioqueue2;
   250 
   251     g_debug ("MMythTVPlayer: Setting the Gstreamer pipeline\n");
   252 	
   253     pipeline = gst_pipeline_new ("video-player");
   254     source = gst_element_factory_make ("mythtvsrc", "myth-source");
   255     parser = gst_element_factory_make ("nuvdemux", "nuv-demux");
   256 
   257     /* Gstreamer Video elements */
   258     videoqueue1 = gst_element_factory_make ("queue", "video-queue1");
   259     videodec = gst_element_factory_make ("ffdec_mpeg4", "video-decoder");
   260     videoqueue2 = gst_element_factory_make ("queue", "video-queue2");
   261     videocolortrs = gst_element_factory_make ("ffmpegcolorspace", "image-color-transforms");
   262 
   263 #ifdef MAEMO_PLATFORM
   264     videosink = gst_element_factory_make ("sdlvideosink", "image-output");
   265 #else
   266     videosink = gst_element_factory_make ("xvimagesink", "image-output");
   267 #endif
   268     
   269     /* Gstreamer Audio elements */
   270     audioqueue1 = gst_element_factory_make ("queue", "audio-queue1");    
   271     audioqueue2 = gst_element_factory_make ("queue", "audio-queue2");
   272 #ifdef MAEMO_PLATFORM    
   273     audiosink = gst_element_factory_make ("dspmp3sink", "audio-output");
   274 #else    
   275     audiodec = gst_element_factory_make ("mad", "audio-decoder");
   276     audioconv = gst_element_factory_make ("audioconvert", "audio-converter");
   277     audiosink = gst_element_factory_make ("alsasink", "audio-output");
   278 #endif    
   279     
   280     if (!(pipeline && source && parser && videodec && videosink) ||
   281     	!(videoqueue1 && videoqueue2 && audioqueue1 && audioqueue2 && audiosink)) {
   282         /* FIXME: hanlde the error correctly */
   283         /* video_alignment is not being created (below) 
   284            and is causing problems to the ui */
   285 
   286 	    tvplayer->gst_pipeline = NULL;
   287 	    tvplayer->gst_videodec = NULL;
   288 	    tvplayer->gst_videosink = NULL;
   289 	    tvplayer->gst_videocolortrs = NULL;
   290            
   291         g_warning ("GstElement creation error!\n");
   292         return FALSE;
   293     }
   294 
   295 #ifndef MAEMO_PLATFORM    
   296     if (!(audiodec && audioconv)) {
   297         g_warning ("GstElement for audio stream creation error!");
   298         return FALSE;
   299     }
   300 #endif    
   301     
   302     tvplayer->gst_pipeline = pipeline;
   303     tvplayer->gst_source = source;
   304     tvplayer->gst_videodec = videodec;
   305     tvplayer->gst_videosink = videosink;
   306     tvplayer->gst_videocolortrs = videocolortrs;
   307     g_object_ref (tvplayer->gst_pipeline);
   308     g_object_ref (tvplayer->gst_source);
   309     g_object_ref (tvplayer->gst_videodec);
   310     g_object_ref (tvplayer->gst_videosink);
   311     g_object_ref (tvplayer->gst_videocolortrs);
   312 
   313     tvplayer->videoqueue1 = videoqueue1;
   314     tvplayer->videoqueue2 = videoqueue2;
   315     tvplayer->audioqueue1 = audioqueue1;
   316     tvplayer->audioqueue2 = audioqueue2;
   317     g_object_ref (tvplayer->videoqueue1);
   318     g_object_ref (tvplayer->videoqueue2);
   319     g_object_ref (tvplayer->audioqueue1);
   320     g_object_ref (tvplayer->audioqueue2);
   321   	
   322     //g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
   323     g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
   324 
   325     gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)),
   326                        bus_call, tvplayer);
   327 
   328     gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue1,
   329     			videodec, videoqueue2, videocolortrs, videosink, audioqueue1, 
   330 			audiodec, audioconv, audioqueue2, audiosink, NULL);
   331 
   332     {
   333 //        GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL);
   334 //        gst_element_link_filtered(source, parser, rtpcaps);
   335     }
   336     
   337     gst_element_link (source, parser);
   338     gst_element_link_many (videoqueue1, videodec, videoqueue2, videocolortrs, videosink, NULL);
   339     gst_element_link_many (audioqueue1, audiodec, audioconv, audioqueue2, audiosink, NULL);
   340     
   341     g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad_cb), tvplayer);
   342     
   343     return TRUE;
   344 }
   345 
   346 /** Configures the backend and the tv player 
   347  * for playing the recorded content A/V.
   348  *
   349  * FIXME: Change filename to program info or other structure about the recorded
   350  *
   351  * @param tvplayer the object instance.
   352  * @param filename the file uri of the recorded content to be played.
   353  * @return TRUE if successfull, FALSE if any error happens.
   354  */
   355 gboolean
   356 mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, gchar *filename)
   357 {
   358 	// FIXME: we should receive the uri instead of filename
   359 	gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
   360 	gint port = gmyth_backend_info_get_port(tvplayer->backend_info);
   361 	
   362 	GString *fullpath = g_string_new ("myth://");
   363 	g_string_append_printf (fullpath, "%s:%d/%s", hostname, port, filename);
   364 	
   365 	tvplayer->is_livetv = FALSE;
   366 
   367 	g_debug ("[%s] Setting record uri to gstreamer pipeline to %s", __FUNCTION__, fullpath->str);
   368 		
   369     g_object_set (G_OBJECT (tvplayer->gst_source), "location",
   370           fullpath->str, NULL);
   371           
   372     return TRUE;
   373 }
   374 
   375 /** Configures the backend and the tv player 
   376  * for playing the live tv.
   377  *
   378  * @param tvplayer the object instance.
   379  * @return TRUE if successfull, FALSE if any error happens.
   380  */
   381 gboolean
   382 mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer)
   383 {
   384 	gboolean res = TRUE;
   385 	gchar *hostname;
   386 
   387 	tvplayer->livetv = gmyth_livetv_new ();
   388 
   389 	if ( !gmyth_livetv_setup( tvplayer->livetv, tvplayer->backend_info ) )
   390 		goto error;
   391 	
   392 	return res;
   393 
   394 error:
   395 	res = FALSE;
   396 	if ( tvplayer->livetv != NULL ) {
   397 		g_object_unref( tvplayer->livetv );
   398 	}
   399 
   400 	if ( tvplayer->local_hostname != NULL ) {
   401 		g_string_free( tvplayer->local_hostname, TRUE );
   402 	}
   403 
   404 	if ( tvplayer->recorder != NULL ) {
   405 		g_object_unref (tvplayer->recorder);
   406 		tvplayer->recorder = NULL;
   407 	}
   408 
   409 	if ( tvplayer->tvchain != NULL ) {
   410 		g_object_unref (tvplayer->tvchain);
   411 		tvplayer->tvchain = NULL;
   412 	}
   413 
   414 	if ( tvplayer->proginfo != NULL ) {
   415 		g_object_unref (tvplayer->proginfo);
   416 		tvplayer->proginfo = NULL;
   417 	}
   418 
   419 	return res;
   420 
   421 }
   422 
   423 /** Sets the GTK video widget for the tv player. 
   424  *
   425  * @param tvplayer the object instance.
   426  * @param videow the GTK video window.
   427  * @return TRUE if successfull, FALSE if any error happens.
   428  */
   429 gboolean
   430 mmyth_tvplayer_set_widget (MMythTVPlayer *tvplayer, GtkWidget *videow)
   431 {
   432 	tvplayer->videow = videow;
   433 	g_object_ref (videow);
   434 	
   435 	g_debug ("[%s] Setting widget for tv player render", __FUNCTION__);
   436 	
   437     tvplayer->expose_handler = g_signal_connect (tvplayer->videow, "expose-event", 
   438                                                  G_CALLBACK (expose_cb), tvplayer);
   439 
   440     //g_signal_connect(miptv_ui->videow, "size_request", G_CALLBACK(cb_preferred_video_size), miptv_ui);
   441 
   442     return TRUE;
   443 }
   444 
   445 static gboolean
   446 bus_call (GstBus * bus, GstMessage * msg, gpointer data)
   447 {
   448     //MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data );
   449     //GMainLoop *loop = tvplayer->loop;
   450 
   451     switch (GST_MESSAGE_TYPE (msg)) {
   452         case GST_MESSAGE_EOS:
   453 			printf ("End of stream\n");
   454             //g_idle_add ((GSourceFunc) idle_eos, data);
   455             gst_element_set_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), GST_STATE_NULL );
   456 	    gst_element_set_locked_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), TRUE );
   457             break;
   458         case GST_MESSAGE_ERROR:
   459         {
   460                 gchar *debug;
   461                 GError *err;
   462 
   463                 gst_message_parse_error (msg, &err, &debug);
   464                 g_free (debug);
   465 
   466                 printf ("Error: %s\n", err->message);
   467                 g_error_free (err);
   468 
   469                 //g_main_loop_quit (loop);
   470         }
   471             break;
   472         default:
   473             printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg)));
   474             printf ("\n");
   475             break;
   476     }
   477 
   478     return TRUE;
   479 }
   480 
   481 
   482 #if 0
   483 static gboolean
   484 idle_state (gpointer data)
   485 {
   486     GstPlayerWindowStateChange *st = data;
   487 
   488     if (st->old_state == GST_STATE_PLAYING) {
   489         if (st->miptv_ui->idle_id != 0) {
   490             g_source_remove (st->miptv_ui->idle_id);
   491             st->miptv_ui->idle_id = 0;
   492         }
   493     }
   494     else if (st->new_state == GST_STATE_PLAYING) {
   495         if (st->miptv_ui->idle_id != 0)
   496             g_source_remove (st->miptv_ui->idle_id);
   497 
   498         st->miptv_ui->idle_id = g_idle_add (cb_iterate, st->miptv_ui);
   499     }
   500 
   501     /* new movie loaded? */
   502     if (st->old_state == GST_STATE_READY && st->new_state > GST_STATE_READY) {
   503 
   504         /* gboolean have_video = FALSE; */
   505 
   506         gtk_widget_show (st->miptv_ui->videow);
   507 
   508         gtk_window_resize (GTK_WINDOW (st->miptv_ui->main_window), 1, 1);
   509 
   510     }
   511 
   512     /* discarded movie? */
   513     if (st->old_state > GST_STATE_READY && st->new_state == GST_STATE_READY) {
   514 
   515         if (st->miptv_ui->tagcache) {
   516             gst_tag_list_free (st->miptv_ui->tagcache);
   517             st->miptv_ui->tagcache = NULL;
   518         }
   519     }
   520 
   521     gst_object_unref (GST_OBJECT (st->play));
   522     //g_object_unref (G_OBJECT (st->win));
   523     g_free (st);
   524 
   525     /* once */
   526     return FALSE;
   527 }
   528 
   529 #endif
   530 
   531 /** Stops playing the current A/V.
   532  *
   533  * FIXME: How to proceed differently between livetv 
   534  * and recorded content?
   535  *
   536  * @param tvplayer the object instance.
   537  * @return void 
   538  */
   539 void
   540 mmyth_tvplayer_stop_playing (MMythTVPlayer *tvplayer) 
   541 {
   542     g_debug ("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__);
   543 
   544     gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL);
   545     
   546     if (tvplayer->is_livetv) {
   547 	    if (!gmyth_recorder_stop_livetv (tvplayer->recorder)) {
   548 	    	g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__);	
   549 	    }
   550     }
   551 }
   552 
   553 /** Queries if the tvplayer is active playing A/V content.
   554  *
   555  * @param tvplayer the object instance.
   556  * @return TRUE if the tvplayer is active, FALSE otherwise.
   557  */
   558 gboolean
   559 mmyth_tvplayer_is_playing (MMythTVPlayer *tvplayer)
   560 {
   561 	return (GST_STATE (tvplayer->gst_pipeline) == GST_STATE_PLAYING);
   562 }
   563 
   564 /** Static function that sets the tvplayer state to PLAYING.
   565  *
   566  * @param tvplayer the object instance.
   567  * @return TRUE if the tvplayer is active, FALSE otherwise.
   568  */
   569 static gboolean
   570 idle_play (gpointer data)
   571 {
   572     MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data);
   573 
   574 	g_debug ("MMythTVPlayer: Setting pipeline state to PLAYING\n");
   575 
   576     gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_PLAYING);
   577 
   578     return FALSE;
   579 }
   580 
   581 /** Start playing A/V with the tvplayer attributes.
   582  *
   583  * @param tvplayer the object instance.
   584  */
   585 void
   586 mmyth_tvplayer_start_playing (MMythTVPlayer *tvplayer)
   587 {
   588 
   589 	// FIXME: Move this to livetv_setup??
   590 	if (tvplayer->is_livetv) {
   591 
   592 	#if 0
   593 		if (!tvplayer || !(tvplayer->proginfo) || !(tvplayer->local_hostname)
   594 				|| !(tvplayer->gst_source)) {
   595 			g_warning ("GMythtvPlayer not ready to start playing\n");		
   596 		}
   597 
   598 		if (!(tvplayer->proginfo->pathname)) {
   599 			g_warning ("[%s] Playback url is null, could not play the myth content", __FUNCTION__);
   600 			return;
   601 		}
   602 
   603 		g_debug ("MMythTVPlayer: Start playing %s", tvplayer->proginfo->pathname->str);
   604 #endif
   605 		g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live",
   606 				TRUE, NULL);
   607 #if 0
   608 		if ( tvplayer->tvchain != NULL ) {
   609 			GString *str_chainid = gmyth_tvchain_get_id(tvplayer->tvchain);
   610 			g_print( "[%s]\tCHAIN ID: %s\n", __FUNCTION__, str_chainid->str );
   611 
   612 			g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-chainid", 
   613 					g_strdup( str_chainid->str ), NULL);      
   614 			if ( str_chainid!=NULL)
   615 				g_string_free( str_chainid, FALSE );
   616 		}
   617 
   618 		if ( tvplayer->recorder != NULL )	
   619 			g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id",
   620 					tvplayer->recorder->recorder_num, NULL );
   621 		g_debug ("[%s] Setting location to %s", __FUNCTION__, 
   622 				tvplayer->proginfo->pathname->str);
   623 
   624 		/* Sets the gstreamer properties acording to the service access address */
   625 		g_object_set (G_OBJECT (tvplayer->gst_source), "location",
   626 				tvplayer->proginfo->pathname->str, NULL);              
   627 #endif
   628 	}
   629 
   630 	g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-version",
   631               MYTHTV_VERSION_DEFAULT, NULL);
   632 
   633     g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-debug",
   634               TRUE, NULL);
   635 
   636     g_idle_add (idle_play, tvplayer);
   637 
   638 }
   639