maemo-ui/src/mmyth_tvplayer.c
branchtrunk
changeset 771 b4480dd29fc8
parent 415 c44e40bb613c
     1.1 --- a/maemo-ui/src/mmyth_tvplayer.c	Mon Mar 19 21:53:51 2007 +0000
     1.2 +++ b/maemo-ui/src/mmyth_tvplayer.c	Tue Jul 03 21:45:39 2007 +0100
     1.3 @@ -9,202 +9,210 @@
     1.4   * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
     1.5   * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
     1.6   *
     1.7 - *//*
     1.8 - * 
     1.9 - * This program is free software; you can redistribute it and/or modify
    1.10 - * it under the terms of the GNU Lesser General Public License as published by
    1.11 - * the Free Software Foundation; either version 2 of the License, or
    1.12 - * (at your option) any later version.
    1.13 - *
    1.14 - * This program is distributed in the hope that it will be useful,
    1.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 - * GNU General Public License for more details.
    1.18 - *
    1.19 - * You should have received a copy of the GNU Lesser General Public License
    1.20 - * along with this program; if not, write to the Free Software
    1.21 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.22 - */
    1.23 +    *//*
    1.24 +    * 
    1.25 +    * This program is free software; you can redistribute it and/or modify
    1.26 +    * it under the terms of the GNU Lesser General Public License as published by
    1.27 +    * the Free Software Foundation; either version 2 of the License, or
    1.28 +    * (at your option) any later version.
    1.29 +    *
    1.30 +    * This program is distributed in the hope that it will be useful,
    1.31 +    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.32 +    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.33 +    * GNU General Public License for more details.
    1.34 +    *
    1.35 +    * You should have received a copy of the GNU Lesser General Public License
    1.36 +    * along with this program; if not, write to the Free Software
    1.37 +    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.38 +    */
    1.39  
    1.40  #include "mmyth_tvplayer.h"
    1.41 - 
    1.42 +
    1.43  #include <gdk/gdkx.h>
    1.44  
    1.45  #include <gmyth/gmyth_remote_util.h>
    1.46  
    1.47  #define MYTHTV_VERSION_DEFAULT	30
    1.48  
    1.49 -typedef struct _GstPlayerWindowStateChange
    1.50 -{
    1.51 -    GstElement *play;
    1.52 -    GstState old_state, new_state;
    1.53 -    MMythTVPlayer *tvplayer;
    1.54 +typedef struct _GstPlayerWindowStateChange {
    1.55 +    GstElement     *play;
    1.56 +    GstState        old_state,
    1.57 +                    new_state;
    1.58 +    MMythTVPlayer  *tvplayer;
    1.59  } GstPlayerWindowStateChange;
    1.60  
    1.61 -typedef struct _GstPlayerWindowTagFound
    1.62 -{
    1.63 -    GstElement *play;
    1.64 -    GstTagList *taglist;
    1.65 -    MMythTVPlayer *tvplayer;
    1.66 +typedef struct _GstPlayerWindowTagFound {
    1.67 +    GstElement     *play;
    1.68 +    GstTagList     *taglist;
    1.69 +    MMythTVPlayer  *tvplayer;
    1.70  } GstPlayerWindowTagFound;
    1.71  
    1.72  /*
    1.73 -static gboolean idle_state (gpointer data);
    1.74 -*/
    1.75 -static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data);
    1.76 + * static gboolean idle_state (gpointer data); 
    1.77 + */
    1.78 +static gboolean bus_call(GstBus * bus, GstMessage * msg, gpointer data);
    1.79  
    1.80 -static void mmyth_tvplayer_class_init          (MMythTVPlayerClass *klass);
    1.81 -static void mmyth_tvplayer_init                (MMythTVPlayer *object);
    1.82 +static void     mmyth_tvplayer_class_init(MMythTVPlayerClass * klass);
    1.83 +static void     mmyth_tvplayer_init(MMythTVPlayer * object);
    1.84  
    1.85 -static void mmyth_tvplayer_dispose  (GObject *object);
    1.86 -static void mmyth_tvplayer_finalize (GObject *object);
    1.87 +static void     mmyth_tvplayer_dispose(GObject * object);
    1.88 +static void     mmyth_tvplayer_finalize(GObject * object);
    1.89  
    1.90  G_DEFINE_TYPE(MMythTVPlayer, mmyth_tvplayer, G_TYPE_OBJECT)
    1.91  
    1.92 -static gboolean mmyth_tvplayer_create_pipeline (MMythTVPlayer* tvplayer);
    1.93 -static void     new_pad_cb (GstElement *element, 
    1.94 -                            GstPad *pad, gpointer data);
    1.95 +    static gboolean mmyth_tvplayer_create_pipeline(MMythTVPlayer *
    1.96 +                                                   tvplayer);
    1.97 +    static void     new_pad_cb(GstElement * element, GstPad * pad,
    1.98 +                               gpointer data);
    1.99  
   1.100 -static gboolean expose_cb (GtkWidget * widget, 
   1.101 -                           GdkEventExpose * event, 
   1.102 -                           gpointer user_data);
   1.103 +    static gboolean expose_cb(GtkWidget * widget,
   1.104 +                              GdkEventExpose * event, gpointer user_data);
   1.105  
   1.106 -static void
   1.107 -mmyth_tvplayer_class_init (MMythTVPlayerClass *klass)
   1.108 +    static void
   1.109 +                    mmyth_tvplayer_class_init(MMythTVPlayerClass * klass)
   1.110  {
   1.111 -	GObjectClass *gobject_class;
   1.112 +    GObjectClass   *gobject_class;
   1.113  
   1.114 -	gobject_class = (GObjectClass *) klass;
   1.115 +    gobject_class = (GObjectClass *) klass;
   1.116  
   1.117 -	gobject_class->dispose  = mmyth_tvplayer_dispose;
   1.118 -	gobject_class->finalize = mmyth_tvplayer_finalize;	
   1.119 +    gobject_class->dispose = mmyth_tvplayer_dispose;
   1.120 +    gobject_class->finalize = mmyth_tvplayer_finalize;
   1.121  }
   1.122  
   1.123  static void
   1.124 -new_pad_cb (GstElement *element, GstPad *pad, gpointer data)
   1.125 +new_pad_cb(GstElement * element, GstPad * pad, gpointer data)
   1.126  {
   1.127 -	MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data);
   1.128 -	GstPadLinkReturn ret;
   1.129 -	char *s;
   1.130 -	
   1.131 -	s = gst_caps_to_string (pad->caps);
   1.132 +    MMythTVPlayer  *tvplayer = MMYTH_TVPLAYER(data);
   1.133 +    GstPadLinkReturn ret;
   1.134 +    char           *s;
   1.135  
   1.136 -	if ( s[0] == 'a') {
   1.137 -		ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue1, "sink"));
   1.138 -	} else {
   1.139 -		ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue1, "sink")); 
   1.140 -	}
   1.141 -	
   1.142 -	g_free(s);
   1.143 +    s = gst_caps_to_string(pad->caps);
   1.144 +
   1.145 +    if (s[0] == 'a') {
   1.146 +        ret =
   1.147 +            gst_pad_link(pad,
   1.148 +                         gst_element_get_pad(tvplayer->audioqueue1,
   1.149 +                                             "sink"));
   1.150 +    } else {
   1.151 +        ret =
   1.152 +            gst_pad_link(pad,
   1.153 +                         gst_element_get_pad(tvplayer->videoqueue1,
   1.154 +                                             "sink"));
   1.155 +    }
   1.156 +
   1.157 +    g_free(s);
   1.158  }
   1.159  
   1.160 -static gboolean
   1.161 -expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
   1.162 +static          gboolean
   1.163 +expose_cb(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
   1.164  {
   1.165 -	MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data);
   1.166 +    MMythTVPlayer  *tvplayer = MMYTH_TVPLAYER(user_data);
   1.167  
   1.168 -	if (tvplayer && tvplayer->videow) {
   1.169 -		gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink),
   1.170 -				GDK_WINDOW_XWINDOW (widget->window));
   1.171 -		return TRUE;
   1.172 -	}
   1.173 +    if (tvplayer && tvplayer->videow) {
   1.174 +        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY
   1.175 +                                     (tvplayer->gst_videosink),
   1.176 +                                     GDK_WINDOW_XWINDOW(widget->window));
   1.177 +        return TRUE;
   1.178 +    }
   1.179  
   1.180 -	g_warning ("MMythTVPlayer expose called before setting video window\n");
   1.181 +    g_warning("MMythTVPlayer expose called before setting video window\n");
   1.182  
   1.183 -	return FALSE;
   1.184 +    return FALSE;
   1.185  }
   1.186  
   1.187  static void
   1.188 -mmyth_tvplayer_init (MMythTVPlayer *tvplayer)
   1.189 +mmyth_tvplayer_init(MMythTVPlayer * tvplayer)
   1.190  {
   1.191 -	tvplayer->gst_pipeline = NULL;
   1.192 -	tvplayer->gst_source = NULL;
   1.193 -	tvplayer->gst_videodec = NULL;
   1.194 -	tvplayer->gst_videosink = NULL;
   1.195 -	tvplayer->gst_videocolortrs = NULL;
   1.196 -	tvplayer->videoqueue1 = NULL;
   1.197 -	tvplayer->videoqueue2 = NULL;
   1.198 -	tvplayer->audioqueue1 = NULL;
   1.199 -	tvplayer->audioqueue2 = NULL;   
   1.200 +    tvplayer->gst_pipeline = NULL;
   1.201 +    tvplayer->gst_source = NULL;
   1.202 +    tvplayer->gst_videodec = NULL;
   1.203 +    tvplayer->gst_videosink = NULL;
   1.204 +    tvplayer->gst_videocolortrs = NULL;
   1.205 +    tvplayer->videoqueue1 = NULL;
   1.206 +    tvplayer->videoqueue2 = NULL;
   1.207 +    tvplayer->audioqueue1 = NULL;
   1.208 +    tvplayer->audioqueue2 = NULL;
   1.209  
   1.210 -	/* GTKWidget for rendering the video */
   1.211 -	tvplayer->videow = NULL;
   1.212 -	tvplayer->expose_handler = 0;
   1.213 +    /*
   1.214 +     * GTKWidget for rendering the video 
   1.215 +     */
   1.216 +    tvplayer->videow = NULL;
   1.217 +    tvplayer->expose_handler = 0;
   1.218  
   1.219 -	tvplayer->backend_hostname = NULL;
   1.220 -	tvplayer->backend_port = 0;
   1.221 -	tvplayer->local_hostname = NULL;
   1.222 +    tvplayer->backend_hostname = NULL;
   1.223 +    tvplayer->backend_port = 0;
   1.224 +    tvplayer->local_hostname = NULL;
   1.225  
   1.226 -	tvplayer->recorder = NULL;
   1.227 -	tvplayer->tvchain = NULL;
   1.228 -	tvplayer->proginfo = NULL;
   1.229 +    tvplayer->recorder = NULL;
   1.230 +    tvplayer->tvchain = NULL;
   1.231 +    tvplayer->proginfo = NULL;
   1.232  }
   1.233  
   1.234  static void
   1.235 -mmyth_tvplayer_dispose (GObject *object)
   1.236 +mmyth_tvplayer_dispose(GObject * object)
   1.237  {
   1.238  
   1.239 -	G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->dispose (object);
   1.240 +    G_OBJECT_CLASS(mmyth_tvplayer_parent_class)->dispose(object);
   1.241  }
   1.242  
   1.243  static void
   1.244 -mmyth_tvplayer_finalize (GObject *object)
   1.245 +mmyth_tvplayer_finalize(GObject * object)
   1.246  {
   1.247 -	g_signal_handlers_destroy (object);
   1.248 +    g_signal_handlers_destroy(object);
   1.249  
   1.250 -	MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (object);
   1.251 +    MMythTVPlayer  *tvplayer = MMYTH_TVPLAYER(object);
   1.252  
   1.253 -	g_debug ("[%s] Finalizing tvplayer", __FUNCTION__);
   1.254 -	
   1.255 -	if (tvplayer->videow != NULL) {
   1.256 -		if (g_signal_handler_is_connected (tvplayer->videow, 
   1.257 -						tvplayer->expose_handler)) {
   1.258 -			g_signal_handler_disconnect (tvplayer->videow,
   1.259 -				tvplayer->expose_handler);
   1.260 -		}
   1.261 -		g_object_unref (tvplayer->videow);
   1.262 -	}
   1.263 -	
   1.264 -	if ( tvplayer->recorder != NULL )
   1.265 -		g_object_unref (tvplayer->recorder);
   1.266 -	if ( tvplayer->tvchain != NULL )
   1.267 -		g_object_unref (tvplayer->tvchain);
   1.268 -	if ( tvplayer->proginfo != NULL )
   1.269 -		g_object_unref (tvplayer->proginfo);	
   1.270 +    g_debug("[%s] Finalizing tvplayer", __FUNCTION__);
   1.271  
   1.272 -	// Release Gstreamer elements
   1.273 -	if ( tvplayer->gst_pipeline != NULL )
   1.274 -		g_object_unref (tvplayer->gst_pipeline);	
   1.275 -	if ( tvplayer->gst_source != NULL )
   1.276 -		g_object_unref (tvplayer->gst_source);	
   1.277 -	if ( tvplayer->gst_videodec != NULL )
   1.278 -		g_object_unref (tvplayer->gst_videodec);	
   1.279 -	if ( tvplayer->gst_videocolortrs != NULL )
   1.280 -		g_object_unref (tvplayer->gst_videocolortrs);
   1.281 -	if ( tvplayer->gst_videosink != NULL )
   1.282 -		g_object_unref (tvplayer->gst_videosink);	
   1.283 -	if ( tvplayer->videoqueue1 != NULL )
   1.284 -		g_object_unref (tvplayer->videoqueue1);
   1.285 -	if ( tvplayer->videoqueue2 != NULL )
   1.286 -		g_object_unref (tvplayer->videoqueue2);
   1.287 -	if ( tvplayer->audioqueue1 != NULL )
   1.288 -		g_object_unref (tvplayer->audioqueue1);	
   1.289 -	if ( tvplayer->audioqueue2 != NULL )
   1.290 -		g_object_unref (tvplayer->audioqueue2);	
   1.291 +    if (tvplayer->videow != NULL) {
   1.292 +        if (g_signal_handler_is_connected(tvplayer->videow,
   1.293 +                                          tvplayer->expose_handler)) {
   1.294 +            g_signal_handler_disconnect(tvplayer->videow,
   1.295 +                                        tvplayer->expose_handler);
   1.296 +        }
   1.297 +        g_object_unref(tvplayer->videow);
   1.298 +    }
   1.299  
   1.300 -	G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->finalize (object);
   1.301 +    if (tvplayer->recorder != NULL)
   1.302 +        g_object_unref(tvplayer->recorder);
   1.303 +    if (tvplayer->tvchain != NULL)
   1.304 +        g_object_unref(tvplayer->tvchain);
   1.305 +    if (tvplayer->proginfo != NULL)
   1.306 +        g_object_unref(tvplayer->proginfo);
   1.307 +
   1.308 +    // Release Gstreamer elements
   1.309 +    if (tvplayer->gst_pipeline != NULL)
   1.310 +        g_object_unref(tvplayer->gst_pipeline);
   1.311 +    if (tvplayer->gst_source != NULL)
   1.312 +        g_object_unref(tvplayer->gst_source);
   1.313 +    if (tvplayer->gst_videodec != NULL)
   1.314 +        g_object_unref(tvplayer->gst_videodec);
   1.315 +    if (tvplayer->gst_videocolortrs != NULL)
   1.316 +        g_object_unref(tvplayer->gst_videocolortrs);
   1.317 +    if (tvplayer->gst_videosink != NULL)
   1.318 +        g_object_unref(tvplayer->gst_videosink);
   1.319 +    if (tvplayer->videoqueue1 != NULL)
   1.320 +        g_object_unref(tvplayer->videoqueue1);
   1.321 +    if (tvplayer->videoqueue2 != NULL)
   1.322 +        g_object_unref(tvplayer->videoqueue2);
   1.323 +    if (tvplayer->audioqueue1 != NULL)
   1.324 +        g_object_unref(tvplayer->audioqueue1);
   1.325 +    if (tvplayer->audioqueue2 != NULL)
   1.326 +        g_object_unref(tvplayer->audioqueue2);
   1.327 +
   1.328 +    G_OBJECT_CLASS(mmyth_tvplayer_parent_class)->finalize(object);
   1.329  }
   1.330  
   1.331  /** Creates a new instance of MMythTVPlayer. 
   1.332   * 
   1.333   * @return a new instance of MMythTVPlayer.
   1.334   */
   1.335 -MMythTVPlayer *
   1.336 -mmyth_tvplayer_new ()
   1.337 +MMythTVPlayer  *
   1.338 +mmyth_tvplayer_new()
   1.339  {
   1.340 -    MMythTVPlayer *tvplayer = 
   1.341 -        MMYTH_TVPLAYER (g_object_new(MMYTH_TVPLAYER_TYPE, NULL));
   1.342 -    
   1.343 +    MMythTVPlayer  *tvplayer =
   1.344 +        MMYTH_TVPLAYER(g_object_new(MMYTH_TVPLAYER_TYPE, NULL));
   1.345 +
   1.346      return tvplayer;
   1.347  }
   1.348  
   1.349 @@ -215,18 +223,21 @@
   1.350   * successfully, FALSE otherwise.
   1.351   */
   1.352  gboolean
   1.353 -mmyth_tvplayer_initialize (MMythTVPlayer *tvplayer, GMythBackendInfo *backend_info)
   1.354 +mmyth_tvplayer_initialize(MMythTVPlayer * tvplayer,
   1.355 +                          GMythBackendInfo * backend_info)
   1.356  {
   1.357 -	tvplayer->backend_info = backend_info;
   1.358 +    tvplayer->backend_info = backend_info;
   1.359  
   1.360 -	if (!mmyth_tvplayer_create_pipeline (tvplayer)) {
   1.361 -		g_warning ("[%s] Error while creating pipeline. TV Player not initialized", __FUNCTION__);
   1.362 -		return FALSE;
   1.363 -	} else {
   1.364 -		g_debug ("[%s] GStreamer pipeline created", __FUNCTION__);	
   1.365 -	}
   1.366 +    if (!mmyth_tvplayer_create_pipeline(tvplayer)) {
   1.367 +        g_warning
   1.368 +            ("[%s] Error while creating pipeline. TV Player not initialized",
   1.369 +             __FUNCTION__);
   1.370 +        return FALSE;
   1.371 +    } else {
   1.372 +        g_debug("[%s] GStreamer pipeline created", __FUNCTION__);
   1.373 +    }
   1.374  
   1.375 -	return TRUE;
   1.376 +    return TRUE;
   1.377  }
   1.378  
   1.379  /** Creates the GStreamer pipeline used by the player.
   1.380 @@ -235,124 +246,147 @@
   1.381   * @return gboolean TRUE if the pipeline was created 
   1.382   * successfully, FALSE otherwise.
   1.383   */
   1.384 -static gboolean
   1.385 -mmyth_tvplayer_create_pipeline (MMythTVPlayer* tvplayer)
   1.386 +static          gboolean
   1.387 +mmyth_tvplayer_create_pipeline(MMythTVPlayer * tvplayer)
   1.388  {
   1.389 -    GstElement *pipeline;
   1.390 -    GstElement *source, *parser;
   1.391 -    GstElement *videodec, *videosink;
   1.392 -    GstElement *videocolortrs;
   1.393 -#ifndef MAEMO_PLATFORM    
   1.394 -    GstElement *audiodec, *audioconv, *audioqueue2;
   1.395 +    GstElement     *pipeline;
   1.396 +    GstElement     *source,
   1.397 +                   *parser;
   1.398 +    GstElement     *videodec,
   1.399 +                   *videosink;
   1.400 +    GstElement     *videocolortrs;
   1.401 +#ifndef MAEMO_PLATFORM
   1.402 +    GstElement     *audiodec,
   1.403 +                   *audioconv,
   1.404 +                   *audioqueue2;
   1.405  #endif
   1.406 -    GstElement *audiosink;
   1.407 -    GstElement *videoqueue1, *videoqueue2, *audioqueue1;
   1.408 +    GstElement     *audiosink;
   1.409 +    GstElement     *videoqueue1,
   1.410 +                   *videoqueue2,
   1.411 +                   *audioqueue1;
   1.412  
   1.413 -    g_debug ("MMythTVPlayer: Setting the Gstreamer pipeline\n");
   1.414 -	
   1.415 -    pipeline = gst_pipeline_new ("video-player");
   1.416 -    source = gst_element_factory_make ("mythtvsrc", "myth-source");
   1.417 -    parser = gst_element_factory_make ("nuvdemux", "nuv-demux");
   1.418 +    g_debug("MMythTVPlayer: Setting the Gstreamer pipeline\n");
   1.419  
   1.420 -    /* Gstreamer Video elements */
   1.421 -    videoqueue1 = gst_element_factory_make ("queue", "video-queue1");
   1.422 -    videodec = gst_element_factory_make ("ffdec_mpeg4", "video-decoder");
   1.423 -    videoqueue2 = gst_element_factory_make ("queue", "video-queue2");
   1.424 -    videocolortrs = gst_element_factory_make ("ffmpegcolorspace", "image-color-transforms");
   1.425 +    pipeline = gst_pipeline_new("video-player");
   1.426 +    source = gst_element_factory_make("mythtvsrc", "myth-source");
   1.427 +    parser = gst_element_factory_make("nuvdemux", "nuv-demux");
   1.428 +
   1.429 +    /*
   1.430 +     * Gstreamer Video elements 
   1.431 +     */
   1.432 +    videoqueue1 = gst_element_factory_make("queue", "video-queue1");
   1.433 +    videodec = gst_element_factory_make("ffdec_mpeg4", "video-decoder");
   1.434 +    videoqueue2 = gst_element_factory_make("queue", "video-queue2");
   1.435 +    videocolortrs =
   1.436 +        gst_element_factory_make("ffmpegcolorspace",
   1.437 +                                 "image-color-transforms");
   1.438  
   1.439  #ifdef MAEMO_PLATFORM
   1.440 -    videosink = gst_element_factory_make ("sdlvideosink", "image-output");
   1.441 +    videosink = gst_element_factory_make("sdlvideosink", "image-output");
   1.442  #else
   1.443 -    videosink = gst_element_factory_make ("xvimagesink", "image-output");
   1.444 +    videosink = gst_element_factory_make("xvimagesink", "image-output");
   1.445  #endif
   1.446 -    
   1.447 -    /* Gstreamer Audio elements */
   1.448 -    audioqueue1 = gst_element_factory_make ("queue", "audio-queue1");
   1.449 -#ifdef MAEMO_PLATFORM    
   1.450 -    audiosink = gst_element_factory_make ("dspmp3sink", "audio-output");
   1.451 -#else    
   1.452 -		audioqueue2 = gst_element_factory_make ("queue", "audio-queue2");
   1.453 -    audiodec = gst_element_factory_make ("mad", "audio-decoder");
   1.454 -    audioconv = gst_element_factory_make ("audioconvert", "audio-converter");
   1.455 -    audiosink = gst_element_factory_make ("alsasink", "audio-output");
   1.456 -#endif    
   1.457 -    
   1.458 +
   1.459 +    /*
   1.460 +     * Gstreamer Audio elements 
   1.461 +     */
   1.462 +    audioqueue1 = gst_element_factory_make("queue", "audio-queue1");
   1.463 +#ifdef MAEMO_PLATFORM
   1.464 +    audiosink = gst_element_factory_make("dspmp3sink", "audio-output");
   1.465 +#else
   1.466 +    audioqueue2 = gst_element_factory_make("queue", "audio-queue2");
   1.467 +    audiodec = gst_element_factory_make("mad", "audio-decoder");
   1.468 +    audioconv =
   1.469 +        gst_element_factory_make("audioconvert", "audio-converter");
   1.470 +    audiosink = gst_element_factory_make("alsasink", "audio-output");
   1.471 +#endif
   1.472 +
   1.473      if (!(pipeline && source && parser && videodec && videosink) ||
   1.474 -    	!(videoqueue1 && videoqueue2 && audioqueue1 && audiosink)) {
   1.475 -        /* FIXME: hanlde the error correctly */
   1.476 -        /* video_alignment is not being created (below) 
   1.477 -           and is causing problems to the ui */
   1.478 +        !(videoqueue1 && videoqueue2 && audioqueue1 && audiosink)) {
   1.479 +        /*
   1.480 +         * FIXME: hanlde the error correctly 
   1.481 +         */
   1.482 +        /*
   1.483 +         * video_alignment is not being created (below) and is causing
   1.484 +         * problems to the ui 
   1.485 +         */
   1.486  
   1.487 -	    tvplayer->gst_pipeline = NULL;
   1.488 -	    tvplayer->gst_videodec = NULL;
   1.489 -	    tvplayer->gst_videosink = NULL;
   1.490 -	    tvplayer->gst_videocolortrs = NULL;
   1.491 -           
   1.492 -        g_warning ("GstElement creation error!\n");
   1.493 +        tvplayer->gst_pipeline = NULL;
   1.494 +        tvplayer->gst_videodec = NULL;
   1.495 +        tvplayer->gst_videosink = NULL;
   1.496 +        tvplayer->gst_videocolortrs = NULL;
   1.497 +
   1.498 +        g_warning("GstElement creation error!\n");
   1.499          return FALSE;
   1.500      }
   1.501 -
   1.502 -#ifndef MAEMO_PLATFORM    
   1.503 +#ifndef MAEMO_PLATFORM
   1.504      if (!(audiodec && audioconv)) {
   1.505 -        g_warning ("GstElement for audio stream creation error!");
   1.506 +        g_warning("GstElement for audio stream creation error!");
   1.507          return FALSE;
   1.508      }
   1.509 -#endif    
   1.510 -    
   1.511 +#endif
   1.512 +
   1.513      tvplayer->gst_pipeline = pipeline;
   1.514      tvplayer->gst_source = source;
   1.515      tvplayer->gst_videodec = videodec;
   1.516      tvplayer->gst_videosink = videosink;
   1.517      tvplayer->gst_videocolortrs = videocolortrs;
   1.518 -    g_object_ref (tvplayer->gst_pipeline);
   1.519 -    g_object_ref (tvplayer->gst_source);
   1.520 -    g_object_ref (tvplayer->gst_videodec);
   1.521 -    g_object_ref (tvplayer->gst_videosink);
   1.522 -    g_object_ref (tvplayer->gst_videocolortrs);
   1.523 +    g_object_ref(tvplayer->gst_pipeline);
   1.524 +    g_object_ref(tvplayer->gst_source);
   1.525 +    g_object_ref(tvplayer->gst_videodec);
   1.526 +    g_object_ref(tvplayer->gst_videosink);
   1.527 +    g_object_ref(tvplayer->gst_videocolortrs);
   1.528  
   1.529      tvplayer->videoqueue1 = videoqueue1;
   1.530      tvplayer->videoqueue2 = videoqueue2;
   1.531      tvplayer->audioqueue1 = audioqueue1;
   1.532 -    g_object_ref (tvplayer->videoqueue1);
   1.533 -    g_object_ref (tvplayer->videoqueue2);
   1.534 -    g_object_ref (tvplayer->audioqueue1);
   1.535 -    
   1.536 +    g_object_ref(tvplayer->videoqueue1);
   1.537 +    g_object_ref(tvplayer->videoqueue2);
   1.538 +    g_object_ref(tvplayer->audioqueue1);
   1.539 +
   1.540  #ifndef MAEMO_PLATFORM
   1.541      tvplayer->audioqueue2 = audioqueue2;
   1.542 -    g_object_ref (tvplayer->audioqueue2);
   1.543 +    g_object_ref(tvplayer->audioqueue2);
   1.544  #endif
   1.545 -  	
   1.546 -    //g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
   1.547 -    g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
   1.548  
   1.549 -    gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)),
   1.550 -                       bus_call, tvplayer);
   1.551 +    // g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
   1.552 +    g_object_set(G_OBJECT(audiosink), "sync", FALSE, NULL);
   1.553  
   1.554 -    gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue1,
   1.555 -    			videodec, videoqueue2, videocolortrs, videosink, NULL );
   1.556 +    gst_bus_add_watch(gst_pipeline_get_bus
   1.557 +                      (GST_PIPELINE(tvplayer->gst_pipeline)), bus_call,
   1.558 +                      tvplayer);
   1.559 +
   1.560 +    gst_bin_add_many(GST_BIN(pipeline), source, parser, videoqueue1,
   1.561 +                     videodec, videoqueue2, videocolortrs, videosink,
   1.562 +                     NULL);
   1.563  
   1.564  #ifndef MAEMO_PLATFORM
   1.565 -			gst_bin_add_many ( GST_BIN(pipeline), audioqueue1, audiodec, audioconv, audioqueue2, audiosink, NULL );
   1.566 +    gst_bin_add_many(GST_BIN(pipeline), audioqueue1, audiodec, audioconv,
   1.567 +                     audioqueue2, audiosink, NULL);
   1.568  #else
   1.569 -			gst_bin_add_many ( GST_BIN(pipeline), audioqueue1, audiosink, NULL);
   1.570 +    gst_bin_add_many(GST_BIN(pipeline), audioqueue1, audiosink, NULL);
   1.571  #endif
   1.572  
   1.573      {
   1.574 -//        GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL);
   1.575 -//        gst_element_link_filtered(source, parser, rtpcaps);
   1.576 +        // GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp",
   1.577 +        // NULL);
   1.578 +        // gst_element_link_filtered(source, parser, rtpcaps);
   1.579      }
   1.580 -    
   1.581 -    gst_element_link (source, parser);
   1.582 -    gst_element_link_many (videoqueue1, videodec, videoqueue2, videocolortrs, videosink, NULL);
   1.583 -    
   1.584 +
   1.585 +    gst_element_link(source, parser);
   1.586 +    gst_element_link_many(videoqueue1, videodec, videoqueue2,
   1.587 +                          videocolortrs, videosink, NULL);
   1.588 +
   1.589  #ifndef MAEMO_PLATFORM
   1.590 -    gst_element_link_many (videosink, audioqueue1, audiodec, audioconv, audioqueue2, audiosink, NULL);
   1.591 +    gst_element_link_many(videosink, audioqueue1, audiodec, audioconv,
   1.592 +                          audioqueue2, audiosink, NULL);
   1.593  #else
   1.594 -		gst_element_link_many (videosink, audioqueue1, audiosink, NULL);
   1.595 +    gst_element_link_many(videosink, audioqueue1, audiosink, NULL);
   1.596  #endif
   1.597 -    
   1.598 -    g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad_cb), tvplayer);
   1.599 -    
   1.600 +
   1.601 +    g_signal_connect(parser, "pad-added", G_CALLBACK(new_pad_cb),
   1.602 +                     tvplayer);
   1.603 +
   1.604      return TRUE;
   1.605  }
   1.606  
   1.607 @@ -366,22 +400,26 @@
   1.608   * @return TRUE if successfull, FALSE if any error happens.
   1.609   */
   1.610  gboolean
   1.611 -mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, const gchar *filename)
   1.612 +mmyth_tvplayer_record_setup(MMythTVPlayer * tvplayer,
   1.613 +                            const gchar * filename)
   1.614  {
   1.615 -	// FIXME: we should receive the uri instead of filename
   1.616 -	const gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
   1.617 -	const gint port = gmyth_backend_info_get_port(tvplayer->backend_info);
   1.618 -	
   1.619 -	GString *fullpath = g_string_new ("myth://");
   1.620 -	g_string_append_printf (fullpath, "%s:%d/%s", hostname, port, filename);
   1.621 -	
   1.622 -	tvplayer->is_livetv = FALSE;
   1.623 +    // FIXME: we should receive the uri instead of filename
   1.624 +    const gchar    *hostname =
   1.625 +        gmyth_backend_info_get_hostname(tvplayer->backend_info);
   1.626 +    const gint      port =
   1.627 +        gmyth_backend_info_get_port(tvplayer->backend_info);
   1.628  
   1.629 -	g_debug ("[%s] Setting record uri to gstreamer pipeline to %s", __FUNCTION__, fullpath->str);
   1.630 -		
   1.631 -    g_object_set (G_OBJECT (tvplayer->gst_source), "location",
   1.632 -          fullpath->str, NULL);
   1.633 -          
   1.634 +    GString        *fullpath = g_string_new("myth://");
   1.635 +    g_string_append_printf(fullpath, "%s:%d/%s", hostname, port, filename);
   1.636 +
   1.637 +    tvplayer->is_livetv = FALSE;
   1.638 +
   1.639 +    g_debug("[%s] Setting record uri to gstreamer pipeline to %s",
   1.640 +            __FUNCTION__, fullpath->str);
   1.641 +
   1.642 +    g_object_set(G_OBJECT(tvplayer->gst_source), "location",
   1.643 +                 fullpath->str, NULL);
   1.644 +
   1.645      return TRUE;
   1.646  }
   1.647  
   1.648 @@ -392,43 +430,43 @@
   1.649   * @return TRUE if successfull, FALSE if any error happens.
   1.650   */
   1.651  gboolean
   1.652 -mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer)
   1.653 +mmyth_tvplayer_livetv_setup(MMythTVPlayer * tvplayer)
   1.654  {
   1.655 -	gboolean res = TRUE;
   1.656 +    gboolean        res = TRUE;
   1.657  
   1.658 -	tvplayer->livetv = gmyth_livetv_new ();
   1.659 +    tvplayer->livetv = gmyth_livetv_new();
   1.660  
   1.661 -	if ( !gmyth_livetv_setup( tvplayer->livetv, tvplayer->backend_info ) )
   1.662 -		goto error;
   1.663 -	
   1.664 -	return res;
   1.665 +    if (!gmyth_livetv_setup(tvplayer->livetv, tvplayer->backend_info))
   1.666 +        goto error;
   1.667  
   1.668 -error:
   1.669 -	res = FALSE;
   1.670 -	if ( tvplayer->livetv != NULL ) {
   1.671 -		g_object_unref( tvplayer->livetv );
   1.672 -	}
   1.673 +    return res;
   1.674  
   1.675 -	if ( tvplayer->local_hostname != NULL ) {
   1.676 -		g_string_free( tvplayer->local_hostname, TRUE );
   1.677 -	}
   1.678 +  error:
   1.679 +    res = FALSE;
   1.680 +    if (tvplayer->livetv != NULL) {
   1.681 +        g_object_unref(tvplayer->livetv);
   1.682 +    }
   1.683  
   1.684 -	if ( tvplayer->recorder != NULL ) {
   1.685 -		g_object_unref (tvplayer->recorder);
   1.686 -		tvplayer->recorder = NULL;
   1.687 -	}
   1.688 +    if (tvplayer->local_hostname != NULL) {
   1.689 +        g_string_free(tvplayer->local_hostname, TRUE);
   1.690 +    }
   1.691  
   1.692 -	if ( tvplayer->tvchain != NULL ) {
   1.693 -		g_object_unref (tvplayer->tvchain);
   1.694 -		tvplayer->tvchain = NULL;
   1.695 -	}
   1.696 +    if (tvplayer->recorder != NULL) {
   1.697 +        g_object_unref(tvplayer->recorder);
   1.698 +        tvplayer->recorder = NULL;
   1.699 +    }
   1.700  
   1.701 -	if ( tvplayer->proginfo != NULL ) {
   1.702 -		g_object_unref (tvplayer->proginfo);
   1.703 -		tvplayer->proginfo = NULL;
   1.704 -	}
   1.705 +    if (tvplayer->tvchain != NULL) {
   1.706 +        g_object_unref(tvplayer->tvchain);
   1.707 +        tvplayer->tvchain = NULL;
   1.708 +    }
   1.709  
   1.710 -	return res;
   1.711 +    if (tvplayer->proginfo != NULL) {
   1.712 +        g_object_unref(tvplayer->proginfo);
   1.713 +        tvplayer->proginfo = NULL;
   1.714 +    }
   1.715 +
   1.716 +    return res;
   1.717  
   1.718  }
   1.719  
   1.720 @@ -439,52 +477,56 @@
   1.721   * @return TRUE if successfull, FALSE if any error happens.
   1.722   */
   1.723  gboolean
   1.724 -mmyth_tvplayer_set_widget (MMythTVPlayer *tvplayer, GtkWidget *videow)
   1.725 +mmyth_tvplayer_set_widget(MMythTVPlayer * tvplayer, GtkWidget * videow)
   1.726  {
   1.727 -	tvplayer->videow = videow;
   1.728 -	g_object_ref (videow);
   1.729 -	
   1.730 -	g_debug ("[%s] Setting widget for tv player render", __FUNCTION__);
   1.731 -	
   1.732 -    tvplayer->expose_handler = g_signal_connect (tvplayer->videow, "expose-event", 
   1.733 -                                                 G_CALLBACK (expose_cb), tvplayer);
   1.734 +    tvplayer->videow = videow;
   1.735 +    g_object_ref(videow);
   1.736  
   1.737 -    //g_signal_connect(miptv_ui->videow, "size_request", G_CALLBACK(cb_preferred_video_size), miptv_ui);
   1.738 +    g_debug("[%s] Setting widget for tv player render", __FUNCTION__);
   1.739 +
   1.740 +    tvplayer->expose_handler =
   1.741 +        g_signal_connect(tvplayer->videow, "expose-event",
   1.742 +                         G_CALLBACK(expose_cb), tvplayer);
   1.743 +
   1.744 +    // g_signal_connect(miptv_ui->videow, "size_request",
   1.745 +    // G_CALLBACK(cb_preferred_video_size), miptv_ui);
   1.746  
   1.747      return TRUE;
   1.748  }
   1.749  
   1.750 -static gboolean
   1.751 -bus_call (GstBus * bus, GstMessage * msg, gpointer data)
   1.752 +static          gboolean
   1.753 +bus_call(GstBus * bus, GstMessage * msg, gpointer data)
   1.754  {
   1.755 -    //MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data );
   1.756 -    //GMainLoop *loop = tvplayer->loop;
   1.757 +    // MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data );
   1.758 +    // GMainLoop *loop = tvplayer->loop;
   1.759  
   1.760 -    switch (GST_MESSAGE_TYPE (msg)) {
   1.761 -        case GST_MESSAGE_EOS:
   1.762 -			printf ("End of stream\n");
   1.763 -            //g_idle_add ((GSourceFunc) idle_eos, data);
   1.764 -            gst_element_set_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), GST_STATE_NULL );
   1.765 -	    gst_element_set_locked_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), TRUE );
   1.766 -            break;
   1.767 -        case GST_MESSAGE_ERROR:
   1.768 +    switch (GST_MESSAGE_TYPE(msg)) {
   1.769 +    case GST_MESSAGE_EOS:
   1.770 +        printf("End of stream\n");
   1.771 +        // g_idle_add ((GSourceFunc) idle_eos, data);
   1.772 +        gst_element_set_state(GST_ELEMENT(GST_MESSAGE_SRC(msg)),
   1.773 +                              GST_STATE_NULL);
   1.774 +        gst_element_set_locked_state(GST_ELEMENT(GST_MESSAGE_SRC(msg)),
   1.775 +                                     TRUE);
   1.776 +        break;
   1.777 +    case GST_MESSAGE_ERROR:
   1.778          {
   1.779 -                gchar *debug;
   1.780 -                GError *err;
   1.781 +            gchar          *debug;
   1.782 +            GError         *err;
   1.783  
   1.784 -                gst_message_parse_error (msg, &err, &debug);
   1.785 -                g_free (debug);
   1.786 +            gst_message_parse_error(msg, &err, &debug);
   1.787 +            g_free(debug);
   1.788  
   1.789 -                printf ("Error: %s\n", err->message);
   1.790 -                g_error_free (err);
   1.791 +            printf("Error: %s\n", err->message);
   1.792 +            g_error_free(err);
   1.793  
   1.794 -                //g_main_loop_quit (loop);
   1.795 +            // g_main_loop_quit (loop);
   1.796          }
   1.797 -            break;
   1.798 -        default:
   1.799 -            printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg)));
   1.800 -            printf ("\n");
   1.801 -            break;
   1.802 +        break;
   1.803 +    default:
   1.804 +        printf(gst_message_type_get_name(GST_MESSAGE_TYPE(msg)));
   1.805 +        printf("\n");
   1.806 +        break;
   1.807      }
   1.808  
   1.809      return TRUE;
   1.810 @@ -492,49 +534,58 @@
   1.811  
   1.812  
   1.813  #if 0
   1.814 -static gboolean
   1.815 -idle_state (gpointer data)
   1.816 +static          gboolean
   1.817 +idle_state(gpointer data)
   1.818  {
   1.819      GstPlayerWindowStateChange *st = data;
   1.820  
   1.821      if (st->old_state == GST_STATE_PLAYING) {
   1.822          if (st->miptv_ui->idle_id != 0) {
   1.823 -            g_source_remove (st->miptv_ui->idle_id);
   1.824 +            g_source_remove(st->miptv_ui->idle_id);
   1.825              st->miptv_ui->idle_id = 0;
   1.826          }
   1.827 -    }
   1.828 -    else if (st->new_state == GST_STATE_PLAYING) {
   1.829 +    } else if (st->new_state == GST_STATE_PLAYING) {
   1.830          if (st->miptv_ui->idle_id != 0)
   1.831 -            g_source_remove (st->miptv_ui->idle_id);
   1.832 +            g_source_remove(st->miptv_ui->idle_id);
   1.833  
   1.834 -        st->miptv_ui->idle_id = g_idle_add (cb_iterate, st->miptv_ui);
   1.835 +        st->miptv_ui->idle_id = g_idle_add(cb_iterate, st->miptv_ui);
   1.836      }
   1.837  
   1.838 -    /* new movie loaded? */
   1.839 -    if (st->old_state == GST_STATE_READY && st->new_state > GST_STATE_READY) {
   1.840 +    /*
   1.841 +     * new movie loaded? 
   1.842 +     */
   1.843 +    if (st->old_state == GST_STATE_READY
   1.844 +        && st->new_state > GST_STATE_READY) {
   1.845  
   1.846 -        /* gboolean have_video = FALSE; */
   1.847 +        /*
   1.848 +         * gboolean have_video = FALSE; 
   1.849 +         */
   1.850  
   1.851 -        gtk_widget_show (st->miptv_ui->videow);
   1.852 +        gtk_widget_show(st->miptv_ui->videow);
   1.853  
   1.854 -        gtk_window_resize (GTK_WINDOW (st->miptv_ui->main_window), 1, 1);
   1.855 +        gtk_window_resize(GTK_WINDOW(st->miptv_ui->main_window), 1, 1);
   1.856  
   1.857      }
   1.858  
   1.859 -    /* discarded movie? */
   1.860 -    if (st->old_state > GST_STATE_READY && st->new_state == GST_STATE_READY) {
   1.861 +    /*
   1.862 +     * discarded movie? 
   1.863 +     */
   1.864 +    if (st->old_state > GST_STATE_READY
   1.865 +        && st->new_state == GST_STATE_READY) {
   1.866  
   1.867          if (st->miptv_ui->tagcache) {
   1.868 -            gst_tag_list_free (st->miptv_ui->tagcache);
   1.869 +            gst_tag_list_free(st->miptv_ui->tagcache);
   1.870              st->miptv_ui->tagcache = NULL;
   1.871          }
   1.872      }
   1.873  
   1.874 -    gst_object_unref (GST_OBJECT (st->play));
   1.875 -    //g_object_unref (G_OBJECT (st->win));
   1.876 -    g_free (st);
   1.877 +    gst_object_unref(GST_OBJECT(st->play));
   1.878 +    // g_object_unref (G_OBJECT (st->win));
   1.879 +    g_free(st);
   1.880  
   1.881 -    /* once */
   1.882 +    /*
   1.883 +     * once 
   1.884 +     */
   1.885      return FALSE;
   1.886  }
   1.887  
   1.888 @@ -549,16 +600,17 @@
   1.889   * @return void 
   1.890   */
   1.891  void
   1.892 -mmyth_tvplayer_stop_playing (MMythTVPlayer *tvplayer) 
   1.893 +mmyth_tvplayer_stop_playing(MMythTVPlayer * tvplayer)
   1.894  {
   1.895 -    g_debug ("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__);
   1.896 +    g_debug("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__);
   1.897  
   1.898 -    gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL);
   1.899 -    
   1.900 +    gst_element_set_state(tvplayer->gst_pipeline, GST_STATE_NULL);
   1.901 +
   1.902      if (tvplayer->is_livetv) {
   1.903 -	    if (!gmyth_recorder_stop_livetv (tvplayer->recorder)) {
   1.904 -	    	g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__);	
   1.905 -	    }
   1.906 +        if (!gmyth_recorder_stop_livetv(tvplayer->recorder)) {
   1.907 +            g_warning("[%s] Error while stoping remote encoder",
   1.908 +                      __FUNCTION__);
   1.909 +        }
   1.910      }
   1.911  }
   1.912  
   1.913 @@ -568,9 +620,9 @@
   1.914   * @return TRUE if the tvplayer is active, FALSE otherwise.
   1.915   */
   1.916  gboolean
   1.917 -mmyth_tvplayer_is_playing (MMythTVPlayer *tvplayer)
   1.918 +mmyth_tvplayer_is_playing(MMythTVPlayer * tvplayer)
   1.919  {
   1.920 -	return (GST_STATE (tvplayer->gst_pipeline) == GST_STATE_PLAYING);
   1.921 +    return (GST_STATE(tvplayer->gst_pipeline) == GST_STATE_PLAYING);
   1.922  }
   1.923  
   1.924  /** Static function that sets the tvplayer state to PLAYING.
   1.925 @@ -578,14 +630,14 @@
   1.926   * @param tvplayer the object instance.
   1.927   * @return TRUE if the tvplayer is active, FALSE otherwise.
   1.928   */
   1.929 -static gboolean
   1.930 -idle_play (gpointer data)
   1.931 +static          gboolean
   1.932 +idle_play(gpointer data)
   1.933  {
   1.934 -    MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data);
   1.935 +    MMythTVPlayer  *tvplayer = MMYTH_TVPLAYER(data);
   1.936  
   1.937 -	g_debug ("MMythTVPlayer: Setting pipeline state to PLAYING\n");
   1.938 +    g_debug("MMythTVPlayer: Setting pipeline state to PLAYING\n");
   1.939  
   1.940 -    gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_PLAYING);
   1.941 +    gst_element_set_state(tvplayer->gst_pipeline, GST_STATE_PLAYING);
   1.942  
   1.943      return FALSE;
   1.944  }
   1.945 @@ -595,57 +647,66 @@
   1.946   * @param tvplayer the object instance.
   1.947   */
   1.948  void
   1.949 -mmyth_tvplayer_start_playing (MMythTVPlayer *tvplayer)
   1.950 +mmyth_tvplayer_start_playing(MMythTVPlayer * tvplayer)
   1.951  {
   1.952  
   1.953 -	// FIXME: Move this to livetv_setup??
   1.954 -	if (tvplayer->is_livetv) {
   1.955 +    // FIXME: Move this to livetv_setup??
   1.956 +    if (tvplayer->is_livetv) {
   1.957  
   1.958 -	#if 0
   1.959 -		if (!tvplayer || !(tvplayer->proginfo) || !(tvplayer->local_hostname)
   1.960 -				|| !(tvplayer->gst_source)) {
   1.961 -			g_warning ("GMythtvPlayer not ready to start playing\n");		
   1.962 -		}
   1.963 +#if 0
   1.964 +        if (!tvplayer || !(tvplayer->proginfo)
   1.965 +            || !(tvplayer->local_hostname)
   1.966 +            || !(tvplayer->gst_source)) {
   1.967 +            g_warning("GMythtvPlayer not ready to start playing\n");
   1.968 +        }
   1.969  
   1.970 -		if (!(tvplayer->proginfo->pathname)) {
   1.971 -			g_warning ("[%s] Playback url is null, could not play the myth content", __FUNCTION__);
   1.972 -			return;
   1.973 -		}
   1.974 +        if (!(tvplayer->proginfo->pathname)) {
   1.975 +            g_warning
   1.976 +                ("[%s] Playback url is null, could not play the myth content",
   1.977 +                 __FUNCTION__);
   1.978 +            return;
   1.979 +        }
   1.980  
   1.981 -		g_debug ("MMythTVPlayer: Start playing %s", tvplayer->proginfo->pathname->str);
   1.982 +        g_debug("MMythTVPlayer: Start playing %s",
   1.983 +                tvplayer->proginfo->pathname->str);
   1.984  #endif
   1.985 -		g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live",
   1.986 -				TRUE, NULL);
   1.987 +        g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-live",
   1.988 +                     TRUE, NULL);
   1.989  #if 0
   1.990 -		if ( tvplayer->tvchain != NULL ) {
   1.991 -			GString *str_chainid = gmyth_tvchain_get_id(tvplayer->tvchain);
   1.992 -			g_print( "[%s]\tCHAIN ID: %s\n", __FUNCTION__, str_chainid->str );
   1.993 +        if (tvplayer->tvchain != NULL) {
   1.994 +            GString        *str_chainid =
   1.995 +                gmyth_tvchain_get_id(tvplayer->tvchain);
   1.996 +            g_print("[%s]\tCHAIN ID: %s\n", __FUNCTION__,
   1.997 +                    str_chainid->str);
   1.998  
   1.999 -			g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-chainid", 
  1.1000 -					g_strdup( str_chainid->str ), NULL);      
  1.1001 -			if ( str_chainid!=NULL)
  1.1002 -				g_string_free( str_chainid, FALSE );
  1.1003 -		}
  1.1004 +            g_object_set(G_OBJECT(tvplayer->gst_source),
  1.1005 +                         "mythtv-live-chainid", g_strdup(str_chainid->str),
  1.1006 +                         NULL);
  1.1007 +            if (str_chainid != NULL)
  1.1008 +                g_string_free(str_chainid, FALSE);
  1.1009 +        }
  1.1010  
  1.1011 -		if ( tvplayer->recorder != NULL )	
  1.1012 -			g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id",
  1.1013 -					tvplayer->recorder->recorder_num, NULL );
  1.1014 -		g_debug ("[%s] Setting location to %s", __FUNCTION__, 
  1.1015 -				tvplayer->proginfo->pathname->str);
  1.1016 +        if (tvplayer->recorder != NULL)
  1.1017 +            g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-live-id",
  1.1018 +                         tvplayer->recorder->recorder_num, NULL);
  1.1019 +        g_debug("[%s] Setting location to %s", __FUNCTION__,
  1.1020 +                tvplayer->proginfo->pathname->str);
  1.1021  
  1.1022 -		/* Sets the gstreamer properties acording to the service access address */
  1.1023 -		g_object_set (G_OBJECT (tvplayer->gst_source), "location",
  1.1024 -				tvplayer->proginfo->pathname->str, NULL);              
  1.1025 +        /*
  1.1026 +         * Sets the gstreamer properties acording to the service access
  1.1027 +         * address 
  1.1028 +         */
  1.1029 +        g_object_set(G_OBJECT(tvplayer->gst_source), "location",
  1.1030 +                     tvplayer->proginfo->pathname->str, NULL);
  1.1031  #endif
  1.1032 -	}
  1.1033 +    }
  1.1034  
  1.1035 -	g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-version",
  1.1036 -              MYTHTV_VERSION_DEFAULT, NULL);
  1.1037 +    g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-version",
  1.1038 +                 MYTHTV_VERSION_DEFAULT, NULL);
  1.1039  
  1.1040 -    g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-debug",
  1.1041 -              TRUE, NULL);
  1.1042 +    g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-debug",
  1.1043 +                 TRUE, NULL);
  1.1044  
  1.1045 -    g_idle_add (idle_play, tvplayer);
  1.1046 +    g_idle_add(idle_play, tvplayer);
  1.1047  
  1.1048  }
  1.1049 -