maemo-ui/src/mmyth_tvplayer.c
author melunko
Wed Jan 10 20:52:55 2007 +0000 (2007-01-10)
branchtrunk
changeset 256 7776e35d59d4
parent 208 c3c073032757
child 414 0d3d926bc374
permissions -rw-r--r--
[svn r257] some debug messages removed
     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, const gchar *filename)
   357 {
   358 	// FIXME: we should receive the uri instead of filename
   359 	const gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
   360 	const 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 
   386 	tvplayer->livetv = gmyth_livetv_new ();
   387 
   388 	if ( !gmyth_livetv_setup( tvplayer->livetv, tvplayer->backend_info ) )
   389 		goto error;
   390 	
   391 	return res;
   392 
   393 error:
   394 	res = FALSE;
   395 	if ( tvplayer->livetv != NULL ) {
   396 		g_object_unref( tvplayer->livetv );
   397 	}
   398 
   399 	if ( tvplayer->local_hostname != NULL ) {
   400 		g_string_free( tvplayer->local_hostname, TRUE );
   401 	}
   402 
   403 	if ( tvplayer->recorder != NULL ) {
   404 		g_object_unref (tvplayer->recorder);
   405 		tvplayer->recorder = NULL;
   406 	}
   407 
   408 	if ( tvplayer->tvchain != NULL ) {
   409 		g_object_unref (tvplayer->tvchain);
   410 		tvplayer->tvchain = NULL;
   411 	}
   412 
   413 	if ( tvplayer->proginfo != NULL ) {
   414 		g_object_unref (tvplayer->proginfo);
   415 		tvplayer->proginfo = NULL;
   416 	}
   417 
   418 	return res;
   419 
   420 }
   421 
   422 /** Sets the GTK video widget for the tv player. 
   423  *
   424  * @param tvplayer the object instance.
   425  * @param videow the GTK video window.
   426  * @return TRUE if successfull, FALSE if any error happens.
   427  */
   428 gboolean
   429 mmyth_tvplayer_set_widget (MMythTVPlayer *tvplayer, GtkWidget *videow)
   430 {
   431 	tvplayer->videow = videow;
   432 	g_object_ref (videow);
   433 	
   434 	g_debug ("[%s] Setting widget for tv player render", __FUNCTION__);
   435 	
   436     tvplayer->expose_handler = g_signal_connect (tvplayer->videow, "expose-event", 
   437                                                  G_CALLBACK (expose_cb), tvplayer);
   438 
   439     //g_signal_connect(miptv_ui->videow, "size_request", G_CALLBACK(cb_preferred_video_size), miptv_ui);
   440 
   441     return TRUE;
   442 }
   443 
   444 static gboolean
   445 bus_call (GstBus * bus, GstMessage * msg, gpointer data)
   446 {
   447     //MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data );
   448     //GMainLoop *loop = tvplayer->loop;
   449 
   450     switch (GST_MESSAGE_TYPE (msg)) {
   451         case GST_MESSAGE_EOS:
   452 			printf ("End of stream\n");
   453             //g_idle_add ((GSourceFunc) idle_eos, data);
   454             gst_element_set_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), GST_STATE_NULL );
   455 	    gst_element_set_locked_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), TRUE );
   456             break;
   457         case GST_MESSAGE_ERROR:
   458         {
   459                 gchar *debug;
   460                 GError *err;
   461 
   462                 gst_message_parse_error (msg, &err, &debug);
   463                 g_free (debug);
   464 
   465                 printf ("Error: %s\n", err->message);
   466                 g_error_free (err);
   467 
   468                 //g_main_loop_quit (loop);
   469         }
   470             break;
   471         default:
   472             printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg)));
   473             printf ("\n");
   474             break;
   475     }
   476 
   477     return TRUE;
   478 }
   479 
   480 
   481 #if 0
   482 static gboolean
   483 idle_state (gpointer data)
   484 {
   485     GstPlayerWindowStateChange *st = data;
   486 
   487     if (st->old_state == GST_STATE_PLAYING) {
   488         if (st->miptv_ui->idle_id != 0) {
   489             g_source_remove (st->miptv_ui->idle_id);
   490             st->miptv_ui->idle_id = 0;
   491         }
   492     }
   493     else if (st->new_state == GST_STATE_PLAYING) {
   494         if (st->miptv_ui->idle_id != 0)
   495             g_source_remove (st->miptv_ui->idle_id);
   496 
   497         st->miptv_ui->idle_id = g_idle_add (cb_iterate, st->miptv_ui);
   498     }
   499 
   500     /* new movie loaded? */
   501     if (st->old_state == GST_STATE_READY && st->new_state > GST_STATE_READY) {
   502 
   503         /* gboolean have_video = FALSE; */
   504 
   505         gtk_widget_show (st->miptv_ui->videow);
   506 
   507         gtk_window_resize (GTK_WINDOW (st->miptv_ui->main_window), 1, 1);
   508 
   509     }
   510 
   511     /* discarded movie? */
   512     if (st->old_state > GST_STATE_READY && st->new_state == GST_STATE_READY) {
   513 
   514         if (st->miptv_ui->tagcache) {
   515             gst_tag_list_free (st->miptv_ui->tagcache);
   516             st->miptv_ui->tagcache = NULL;
   517         }
   518     }
   519 
   520     gst_object_unref (GST_OBJECT (st->play));
   521     //g_object_unref (G_OBJECT (st->win));
   522     g_free (st);
   523 
   524     /* once */
   525     return FALSE;
   526 }
   527 
   528 #endif
   529 
   530 /** Stops playing the current A/V.
   531  *
   532  * FIXME: How to proceed differently between livetv 
   533  * and recorded content?
   534  *
   535  * @param tvplayer the object instance.
   536  * @return void 
   537  */
   538 void
   539 mmyth_tvplayer_stop_playing (MMythTVPlayer *tvplayer) 
   540 {
   541     g_debug ("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__);
   542 
   543     gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL);
   544     
   545     if (tvplayer->is_livetv) {
   546 	    if (!gmyth_recorder_stop_livetv (tvplayer->recorder)) {
   547 	    	g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__);	
   548 	    }
   549     }
   550 }
   551 
   552 /** Queries if the tvplayer is active playing A/V content.
   553  *
   554  * @param tvplayer the object instance.
   555  * @return TRUE if the tvplayer is active, FALSE otherwise.
   556  */
   557 gboolean
   558 mmyth_tvplayer_is_playing (MMythTVPlayer *tvplayer)
   559 {
   560 	return (GST_STATE (tvplayer->gst_pipeline) == GST_STATE_PLAYING);
   561 }
   562 
   563 /** Static function that sets the tvplayer state to PLAYING.
   564  *
   565  * @param tvplayer the object instance.
   566  * @return TRUE if the tvplayer is active, FALSE otherwise.
   567  */
   568 static gboolean
   569 idle_play (gpointer data)
   570 {
   571     MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data);
   572 
   573 	g_debug ("MMythTVPlayer: Setting pipeline state to PLAYING\n");
   574 
   575     gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_PLAYING);
   576 
   577     return FALSE;
   578 }
   579 
   580 /** Start playing A/V with the tvplayer attributes.
   581  *
   582  * @param tvplayer the object instance.
   583  */
   584 void
   585 mmyth_tvplayer_start_playing (MMythTVPlayer *tvplayer)
   586 {
   587 
   588 	// FIXME: Move this to livetv_setup??
   589 	if (tvplayer->is_livetv) {
   590 
   591 	#if 0
   592 		if (!tvplayer || !(tvplayer->proginfo) || !(tvplayer->local_hostname)
   593 				|| !(tvplayer->gst_source)) {
   594 			g_warning ("GMythtvPlayer not ready to start playing\n");		
   595 		}
   596 
   597 		if (!(tvplayer->proginfo->pathname)) {
   598 			g_warning ("[%s] Playback url is null, could not play the myth content", __FUNCTION__);
   599 			return;
   600 		}
   601 
   602 		g_debug ("MMythTVPlayer: Start playing %s", tvplayer->proginfo->pathname->str);
   603 #endif
   604 		g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live",
   605 				TRUE, NULL);
   606 #if 0
   607 		if ( tvplayer->tvchain != NULL ) {
   608 			GString *str_chainid = gmyth_tvchain_get_id(tvplayer->tvchain);
   609 			g_print( "[%s]\tCHAIN ID: %s\n", __FUNCTION__, str_chainid->str );
   610 
   611 			g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-chainid", 
   612 					g_strdup( str_chainid->str ), NULL);      
   613 			if ( str_chainid!=NULL)
   614 				g_string_free( str_chainid, FALSE );
   615 		}
   616 
   617 		if ( tvplayer->recorder != NULL )	
   618 			g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id",
   619 					tvplayer->recorder->recorder_num, NULL );
   620 		g_debug ("[%s] Setting location to %s", __FUNCTION__, 
   621 				tvplayer->proginfo->pathname->str);
   622 
   623 		/* Sets the gstreamer properties acording to the service access address */
   624 		g_object_set (G_OBJECT (tvplayer->gst_source), "location",
   625 				tvplayer->proginfo->pathname->str, NULL);              
   626 #endif
   627 	}
   628 
   629 	g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-version",
   630               MYTHTV_VERSION_DEFAULT, NULL);
   631 
   632     g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-debug",
   633               TRUE, NULL);
   634 
   635     g_idle_add (idle_play, tvplayer);
   636 
   637 }
   638