[svn r758] fixed indent using GNU Style trunk
authorrenatofilho
Thu Jun 14 18:21:53 2007 +0100 (2007-06-14)
branchtrunk
changeset 752b7f71ba285da
parent 751 3cf3c6019e3b
child 753 8ee634511c1e
[svn r758] fixed indent using GNU Style
gmyth-stream/gmemcoder/src/gmencoder.c
gmyth-stream/gmemcoder/src/gmencoder.h
gmyth-stream/gmemcoder/src/main.c
gmyth-stream/gmemcoder/tests/main.c
     1.1 --- a/gmyth-stream/gmemcoder/src/gmencoder.c	Thu Jun 14 18:21:08 2007 +0100
     1.2 +++ b/gmyth-stream/gmemcoder/src/gmencoder.c	Thu Jun 14 18:21:53 2007 +0100
     1.3 @@ -21,1020 +21,1045 @@
     1.4  
     1.5  struct _SetupInfo
     1.6  {
     1.7 -    gchar* video_encode;
     1.8 -    gchar* mux_name;
     1.9 -    gchar** video_encode_prop;
    1.10 -    gdouble video_fps;
    1.11 -    gdouble video_rate;
    1.12 -    guint video_width;
    1.13 -    guint video_height;
    1.14 -    gchar* audio_encode;
    1.15 -    gchar** audio_encode_prop;
    1.16 -    guint audio_rate;
    1.17 +  gchar *video_encode;
    1.18 +  gchar *mux_name;
    1.19 +  gchar **video_encode_prop;
    1.20 +  gdouble video_fps;
    1.21 +  gdouble video_rate;
    1.22 +  guint video_width;
    1.23 +  guint video_height;
    1.24 +  gchar *audio_encode;
    1.25 +  gchar **audio_encode_prop;
    1.26 +  guint audio_rate;
    1.27  };
    1.28  
    1.29  
    1.30  struct _GMencoderPrivate
    1.31  {
    1.32 -    GstElement *pipe;
    1.33 -    GstElement *abin;
    1.34 -    GstElement *vbin;
    1.35 -    GstElement *sink;
    1.36 -    GstElement *src;
    1.37 -    gboolean ready;
    1.38 -    SetupInfo *info;
    1.39 -    GstClockTime videot;
    1.40 -    GstClockTime audiot;
    1.41 -    gint fd;
    1.42 -    gint sources;
    1.43 -    gint tick_id;
    1.44 -    gint64 duration;
    1.45 +  GstElement *pipe;
    1.46 +  GstElement *abin;
    1.47 +  GstElement *vbin;
    1.48 +  GstElement *sink;
    1.49 +  GstElement *src;
    1.50 +  gboolean ready;
    1.51 +  SetupInfo *info;
    1.52 +  GstClockTime videot;
    1.53 +  GstClockTime audiot;
    1.54 +  gint fd;
    1.55 +  gint sources;
    1.56 +  gint tick_id;
    1.57 +  gint64 duration;
    1.58  };
    1.59  
    1.60 -enum {
    1.61 -    PAUSED,
    1.62 -    PLAYING,
    1.63 -    STOPED,
    1.64 -    EOS,
    1.65 -    ERROR,
    1.66 -    LAST_SIGNAL
    1.67 +enum
    1.68 +{
    1.69 +  PAUSED,
    1.70 +  PLAYING,
    1.71 +  STOPED,
    1.72 +  EOS,
    1.73 +  ERROR,
    1.74 +  LAST_SIGNAL
    1.75  };
    1.76  
    1.77 -static void g_mencoder_class_init       (GMencoderClass *klass);
    1.78 -static void g_mencoder_init             (GMencoder *object);
    1.79 -static void g_mencoder_dispose  	(GObject *object);
    1.80 -static void g_mencoder_finalize 	(GObject *object);
    1.81 -static GstElement*
    1.82 -_create_audio_bin           (const gchar* encode,
    1.83 -                             gchar** encode_prop,
    1.84 -                             gint rate);
    1.85 -static GstElement*
    1.86 -_create_video_bin           (const gchar* encode,
    1.87 -                             gchar** encode_prop,
    1.88 -                             gdouble fps,
    1.89 -                             gint rate,
    1.90 -                             guint width,
    1.91 -                             guint height);
    1.92 +static void g_mencoder_class_init(GMencoderClass * klass);
    1.93 +static void g_mencoder_init(GMencoder * object);
    1.94 +static void g_mencoder_dispose(GObject * object);
    1.95 +static void g_mencoder_finalize(GObject * object);
    1.96 +static GstElement *_create_audio_bin(const gchar * encode,
    1.97 +									 gchar ** encode_prop, gint rate);
    1.98 +static GstElement *_create_video_bin(const gchar * encode,
    1.99 +									 gchar ** encode_prop,
   1.100 +									 gdouble fps,
   1.101 +									 gint rate, guint width, guint height);
   1.102  
   1.103  static gboolean
   1.104 -_pipeline_bus_cb            (GstBus     *bus,
   1.105 -                             GstMessage *msg,
   1.106 -                             gpointer    user_data);
   1.107 +_pipeline_bus_cb(GstBus * bus, GstMessage * msg, gpointer user_data);
   1.108  
   1.109 -static void _decodebin_new_pad_cb 	(GstElement* object,
   1.110 -                                         GstPad* pad,
   1.111 -                                         gboolean flag,
   1.112 -                                         gpointer user_data);
   1.113 +static void _decodebin_new_pad_cb(GstElement * object,
   1.114 +								  GstPad * pad,
   1.115 +								  gboolean flag, gpointer user_data);
   1.116  
   1.117 -static void  _decodebin_unknown_type_cb (GstElement* object,
   1.118 -                                         GstPad* pad,
   1.119 -                                         GstCaps* caps,
   1.120 -                                         gpointer user_data);
   1.121 +static void _decodebin_unknown_type_cb(GstElement * object,
   1.122 +									   GstPad * pad,
   1.123 +									   GstCaps * caps, gpointer user_data);
   1.124  
   1.125 -static void _close_output              (GMencoder *self);
   1.126 -static void _open_output               (GMencoder *self,
   1.127 -                                        const gchar* uri);
   1.128 +static void _close_output(GMencoder * self);
   1.129 +static void _open_output(GMencoder * self, const gchar * uri);
   1.130  
   1.131 -static GstElement* _create_source       (const gchar* uri);
   1.132 -static GstElement*_create_pipeline      (GMencoder *self,
   1.133 -                                         const gchar* video_encode,
   1.134 -                                         const gchar* mux_name,
   1.135 -                                         gchar** video_encode_prop,
   1.136 -                                         gdouble video_fps,
   1.137 -                                         gdouble video_rate,
   1.138 -                                         guint video_width,
   1.139 -                                         guint video_height,
   1.140 -                                         const gchar* audio_encode,
   1.141 -                                         gchar** audio_encode_prop,
   1.142 -                                         guint audio_rate);
   1.143 +static GstElement *_create_source(const gchar * uri);
   1.144 +static GstElement *_create_pipeline(GMencoder * self,
   1.145 +									const gchar * video_encode,
   1.146 +									const gchar * mux_name,
   1.147 +									gchar ** video_encode_prop,
   1.148 +									gdouble video_fps,
   1.149 +									gdouble video_rate,
   1.150 +									guint video_width,
   1.151 +									guint video_height,
   1.152 +									const gchar * audio_encode,
   1.153 +									gchar ** audio_encode_prop,
   1.154 +									guint audio_rate);
   1.155  
   1.156 -static gboolean _tick_cb  (gpointer data);
   1.157 +static gboolean _tick_cb(gpointer data);
   1.158  
   1.159  static guint g_mencoder_signals[LAST_SIGNAL] = { 0 };
   1.160  
   1.161  G_DEFINE_TYPE(GMencoder, g_mencoder, G_TYPE_OBJECT)
   1.162 +	 static void g_mencoder_class_init(GMencoderClass * klass)
   1.163 +{
   1.164 +  GObjectClass *object_class;
   1.165 +  object_class = (GObjectClass *) klass;
   1.166 +  g_type_class_add_private(klass, sizeof(GMencoderPrivate));
   1.167  
   1.168 -static void
   1.169 -g_mencoder_class_init (GMencoderClass *klass)
   1.170 -{
   1.171 -    GObjectClass *object_class;
   1.172 -    object_class = (GObjectClass *) klass;
   1.173 -    g_type_class_add_private (klass, sizeof (GMencoderPrivate));
   1.174 +  object_class->dispose = g_mencoder_dispose;
   1.175 +  object_class->finalize = g_mencoder_finalize;
   1.176  
   1.177 -    object_class->dispose  = g_mencoder_dispose;
   1.178 -    object_class->finalize = g_mencoder_finalize;
   1.179 +  g_mencoder_signals[PAUSED] =
   1.180 +	g_signal_new("paused",
   1.181 +				 G_OBJECT_CLASS_TYPE(object_class),
   1.182 +				 G_SIGNAL_RUN_FIRST,
   1.183 +				 0, NULL, NULL,
   1.184 +				 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
   1.185  
   1.186 -    g_mencoder_signals[PAUSED] =
   1.187 -        g_signal_new ("paused",
   1.188 -                      G_OBJECT_CLASS_TYPE (object_class),
   1.189 -                      G_SIGNAL_RUN_FIRST,
   1.190 -                      0, NULL, NULL,
   1.191 -                      g_cclosure_marshal_VOID__VOID,
   1.192 -                      G_TYPE_NONE, 0);
   1.193 +  g_mencoder_signals[PLAYING] =
   1.194 +	g_signal_new("playing",
   1.195 +				 G_OBJECT_CLASS_TYPE(object_class),
   1.196 +				 G_SIGNAL_RUN_FIRST,
   1.197 +				 0, NULL, NULL,
   1.198 +				 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
   1.199  
   1.200 -    g_mencoder_signals[PLAYING] =
   1.201 -        g_signal_new ("playing",
   1.202 -                      G_OBJECT_CLASS_TYPE (object_class),
   1.203 -                      G_SIGNAL_RUN_FIRST,
   1.204 -                      0, NULL, NULL,
   1.205 -                      g_cclosure_marshal_VOID__VOID,
   1.206 -                      G_TYPE_NONE, 0);
   1.207 +  g_mencoder_signals[STOPED] =
   1.208 +	g_signal_new("stoped",
   1.209 +				 G_OBJECT_CLASS_TYPE(object_class),
   1.210 +				 G_SIGNAL_RUN_FIRST,
   1.211 +				 0, NULL, NULL,
   1.212 +				 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
   1.213  
   1.214 -    g_mencoder_signals[STOPED] =
   1.215 -        g_signal_new ("stoped",
   1.216 -                      G_OBJECT_CLASS_TYPE (object_class),
   1.217 -                      G_SIGNAL_RUN_FIRST,
   1.218 -                      0, NULL, NULL,
   1.219 -                      g_cclosure_marshal_VOID__VOID,
   1.220 -                      G_TYPE_NONE, 0);
   1.221 +  g_mencoder_signals[EOS] =
   1.222 +	g_signal_new("eos",
   1.223 +				 G_OBJECT_CLASS_TYPE(object_class),
   1.224 +				 G_SIGNAL_RUN_FIRST,
   1.225 +				 0, NULL, NULL,
   1.226 +				 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
   1.227  
   1.228 -    g_mencoder_signals[EOS] =
   1.229 -        g_signal_new ("eos",
   1.230 -                      G_OBJECT_CLASS_TYPE (object_class),
   1.231 -                      G_SIGNAL_RUN_FIRST,
   1.232 -                      0, NULL, NULL,
   1.233 -                      g_cclosure_marshal_VOID__VOID,
   1.234 -                      G_TYPE_NONE, 0);
   1.235 -
   1.236 -    g_mencoder_signals[ERROR] =
   1.237 -        g_signal_new ("error",
   1.238 -                      G_OBJECT_CLASS_TYPE (object_class),
   1.239 -                      G_SIGNAL_RUN_LAST,
   1.240 -                      0, NULL, NULL,
   1.241 -                      g_cclosure_marshal_VOID__STRING,
   1.242 -                      G_TYPE_NONE, 1, G_TYPE_STRING);
   1.243 +  g_mencoder_signals[ERROR] =
   1.244 +	g_signal_new("error",
   1.245 +				 G_OBJECT_CLASS_TYPE(object_class),
   1.246 +				 G_SIGNAL_RUN_LAST,
   1.247 +				 0, NULL, NULL,
   1.248 +				 g_cclosure_marshal_VOID__STRING,
   1.249 +				 G_TYPE_NONE, 1, G_TYPE_STRING);
   1.250  }
   1.251  
   1.252  static void
   1.253 -g_mencoder_init (GMencoder *self)
   1.254 +g_mencoder_init(GMencoder * self)
   1.255  {
   1.256 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
   1.257 -    priv->info = g_new0 (SetupInfo, 1);
   1.258 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
   1.259 +  priv->info = g_new0(SetupInfo, 1);
   1.260  }
   1.261  
   1.262  static void
   1.263 -g_mencoder_dispose (GObject *object)
   1.264 +g_mencoder_dispose(GObject * object)
   1.265  {
   1.266  }
   1.267  
   1.268  static void
   1.269 -g_mencoder_finalize (GObject *object)
   1.270 +g_mencoder_finalize(GObject * object)
   1.271  {
   1.272 -    //TODO: clear vars
   1.273 -    g_mencoder_close_stream (G_MENCODER (object));
   1.274 + //TODO: clear vars
   1.275 +  g_mencoder_close_stream(G_MENCODER(object));
   1.276  }
   1.277  
   1.278 -GMencoder*
   1.279 -g_mencoder_new (void)
   1.280 +GMencoder *
   1.281 +g_mencoder_new(void)
   1.282  {
   1.283 -    return g_object_new (G_TYPE_MENCODER, NULL);
   1.284 +  return g_object_new(G_TYPE_MENCODER, NULL);
   1.285  }
   1.286  
   1.287  
   1.288  static void
   1.289 -_obj_set_prop (GObject *obj,
   1.290 -               const gchar *prop_name,
   1.291 -               const gchar *prop_val)
   1.292 +_obj_set_prop(GObject * obj, const gchar * prop_name, const gchar * prop_val)
   1.293  {
   1.294 -    GValue p = {0};
   1.295 -    GValue v = {0};
   1.296 -    GParamSpec *s = NULL;
   1.297 -    GObjectClass *k = G_OBJECT_GET_CLASS (obj);
   1.298 +  GValue p = { 0 };
   1.299 +  GValue v = { 0 };
   1.300 +  GParamSpec *s = NULL;
   1.301 +  GObjectClass *k = G_OBJECT_GET_CLASS(obj);
   1.302  
   1.303  
   1.304 -    g_value_init (&v, G_TYPE_STRING);
   1.305 -    g_value_set_string (&v, prop_val);
   1.306 +  g_value_init(&v, G_TYPE_STRING);
   1.307 +  g_value_set_string(&v, prop_val);
   1.308  
   1.309 -    s = g_object_class_find_property (k, prop_name);
   1.310 -    if (s == NULL) {
   1.311 -        g_print ("Invalid property name: %s\n", prop_name);
   1.312 -        return;
   1.313 -    }
   1.314 +  s = g_object_class_find_property(k, prop_name);
   1.315 +  if (s == NULL)
   1.316 +	{
   1.317 +	  g_print("Invalid property name: %s\n", prop_name);
   1.318 +	  return;
   1.319 +	}
   1.320  
   1.321 -    g_value_init (&p, s->value_type);
   1.322 -    switch (s->value_type)
   1.323 -        {
   1.324 -        case G_TYPE_INT:
   1.325 -            g_value_set_int (&p, atoi (prop_val));
   1.326 -            break;
   1.327 -        case G_TYPE_STRING:
   1.328 -            g_value_set_string (&p, prop_val);
   1.329 -            break;
   1.330 -        default:
   1.331 -            return;
   1.332 -        }
   1.333 +  g_value_init(&p, s->value_type);
   1.334 +  switch (s->value_type)
   1.335 +	{
   1.336 +	case G_TYPE_INT:
   1.337 +	  g_value_set_int(&p, atoi(prop_val));
   1.338 +	  break;
   1.339 +	case G_TYPE_STRING:
   1.340 +	  g_value_set_string(&p, prop_val);
   1.341 +	  break;
   1.342 +	default:
   1.343 +	  return;
   1.344 +	}
   1.345  
   1.346 -    g_object_set_property (obj, prop_name, &p);
   1.347 -    g_value_unset (&v);
   1.348 -    g_value_unset (&p);
   1.349 +  g_object_set_property(obj, prop_name, &p);
   1.350 +  g_value_unset(&v);
   1.351 +  g_value_unset(&p);
   1.352  }
   1.353  
   1.354 -static GstElement*
   1.355 -_create_element_with_prop (const gchar* factory_name,
   1.356 -                           const gchar* element_name,
   1.357 -                           gchar** prop)
   1.358 +static GstElement *
   1.359 +_create_element_with_prop(const gchar * factory_name,
   1.360 +						  const gchar * element_name, gchar ** prop)
   1.361  {
   1.362 -    GstElement *ret;
   1.363 -    int i;
   1.364 +  GstElement *ret;
   1.365 +  int i;
   1.366  
   1.367 -    ret = gst_element_factory_make (factory_name, element_name);
   1.368 -    if (ret == NULL)
   1.369 -        return NULL;
   1.370 +  ret = gst_element_factory_make(factory_name, element_name);
   1.371 +  if (ret == NULL)
   1.372 +	return NULL;
   1.373  
   1.374 -    if (prop != NULL) {
   1.375 -        for (i=0; i < g_strv_length (prop); i++) {
   1.376 -            if (prop[i] != NULL) {
   1.377 -            	char** v = g_strsplit(prop[i], "=", 2);
   1.378 -            	if (g_strv_length (v) == 2) {
   1.379 -                    _obj_set_prop (G_OBJECT (ret), v[0], v[1]);
   1.380 -            	}
   1.381 -            	g_strfreev (v);
   1.382 -            }
   1.383 -        }
   1.384 -    }
   1.385 +  if (prop != NULL)
   1.386 +	{
   1.387 +	  for (i = 0; i < g_strv_length(prop); i++)
   1.388 +		{
   1.389 +		  if (prop[i] != NULL)
   1.390 +			{
   1.391 +			  char **v = g_strsplit(prop[i], "=", 2);
   1.392 +			  if (g_strv_length(v) == 2)
   1.393 +				{
   1.394 +				  _obj_set_prop(G_OBJECT(ret), v[0], v[1]);
   1.395 +				}
   1.396 +			  g_strfreev(v);
   1.397 +			}
   1.398 +		}
   1.399 +	}
   1.400  
   1.401 -    return ret;
   1.402 +  return ret;
   1.403  
   1.404  }
   1.405  
   1.406 -static GstElement*
   1.407 -_create_audio_bin (const gchar* encode,
   1.408 -                   gchar** encode_prop,
   1.409 -                   gint rate)
   1.410 +static GstElement *
   1.411 +_create_audio_bin(const gchar * encode, gchar ** encode_prop, gint rate)
   1.412  {
   1.413 -    GstElement *abin = NULL;
   1.414 -    GstElement *aqueue = NULL;
   1.415 -    GstElement *aconvert = NULL;
   1.416 -    GstElement *aencode = NULL;
   1.417 -    GstElement *aqueue_src = NULL;
   1.418 -    GstPad *apad = NULL;
   1.419 +  GstElement *abin = NULL;
   1.420 +  GstElement *aqueue = NULL;
   1.421 +  GstElement *aconvert = NULL;
   1.422 +  GstElement *aencode = NULL;
   1.423 +  GstElement *aqueue_src = NULL;
   1.424 +  GstPad *apad = NULL;
   1.425  
   1.426 -    //audio/x-raw-int ! queue ! audioconvert ! faac ! rtpmp4gpay !  udpsink name=upd_audio host=224.0.0.1 port=5002
   1.427 -    abin 	= gst_bin_new ("abin");
   1.428 -    aqueue	= gst_element_factory_make ("queue", "aqueue");
   1.429 -    aconvert= gst_element_factory_make ("audioconvert", "aconvert");
   1.430 -    aencode = _create_element_with_prop ((encode ? encode : "lame"), "aencode", encode_prop);
   1.431 -    aqueue_src= gst_element_factory_make ("queue", "aqueue_src");
   1.432 + //audio/x-raw-int ! queue ! audioconvert ! faac ! rtpmp4gpay !  udpsink name=upd_audio host=224.0.0.1 port=5002
   1.433 +  abin = gst_bin_new("abin");
   1.434 +  aqueue = gst_element_factory_make("queue", "aqueue");
   1.435 +  aconvert = gst_element_factory_make("audioconvert", "aconvert");
   1.436 +  aencode =
   1.437 +	_create_element_with_prop((encode ? encode : "lame"), "aencode",
   1.438 +							  encode_prop);
   1.439 +  aqueue_src = gst_element_factory_make("queue", "aqueue_src");
   1.440  
   1.441 -    if ((abin == NULL) || (aqueue == NULL) || (aconvert == NULL)
   1.442 -        || (aencode == NULL) || (aqueue_src == NULL)) {
   1.443 -        g_warning ("Audio elements not found");
   1.444 -        goto error;
   1.445 +  if ((abin == NULL) || (aqueue == NULL) || (aconvert == NULL)
   1.446 +	  || (aencode == NULL) || (aqueue_src == NULL))
   1.447 +	{
   1.448 +	  g_warning("Audio elements not found");
   1.449 +	  goto error;
   1.450 +	}
   1.451 +
   1.452 +  g_object_set(G_OBJECT(aencode), "bitrate", 32, NULL);
   1.453 + /*
   1.454 +    if (rate > 0) {
   1.455 +    g_object_set (G_OBJECT (aencode), "bitrate", 32, NULL);
   1.456      }
   1.457 +  */
   1.458  
   1.459 -    g_object_set (G_OBJECT (aencode), "bitrate", 32, NULL);
   1.460 -    /*
   1.461 -      if (rate > 0) {
   1.462 -      g_object_set (G_OBJECT (aencode), "bitrate", 32, NULL);
   1.463 -      }
   1.464 -    */
   1.465 +  gst_bin_add_many(GST_BIN(abin), aqueue, aconvert, aencode, aqueue_src,
   1.466 +				   NULL);
   1.467 +  if (gst_element_link_many(aqueue, aconvert, aencode, aqueue_src, NULL) ==
   1.468 +	  FALSE)
   1.469 +	{
   1.470 +	  g_warning("Not Link audio elements");
   1.471 +	}
   1.472  
   1.473 -    gst_bin_add_many (GST_BIN (abin), aqueue, aconvert, aencode, aqueue_src, NULL);
   1.474 -    if (gst_element_link_many (aqueue, aconvert, aencode, aqueue_src, NULL) == FALSE) {
   1.475 -        g_warning ("Not Link audio elements");
   1.476 -    }
   1.477 + //TODO: apply audio rate
   1.478  
   1.479 -    //TODO: apply audio rate
   1.480 + // ghost pad the audio bin
   1.481 +  apad = gst_element_get_pad(aqueue, "sink");
   1.482 +  gst_element_add_pad(abin, gst_ghost_pad_new("sink", apad));
   1.483 +  gst_object_unref(apad);
   1.484  
   1.485 -    // ghost pad the audio bin
   1.486 -    apad = gst_element_get_pad (aqueue, "sink");
   1.487 -    gst_element_add_pad (abin, gst_ghost_pad_new("sink", apad));
   1.488 -    gst_object_unref (apad);
   1.489 +  apad = gst_element_get_pad(aqueue_src, "src");
   1.490 +  gst_element_add_pad(abin, gst_ghost_pad_new("src", apad));
   1.491 +  gst_object_unref(apad);
   1.492  
   1.493 -    apad = gst_element_get_pad (aqueue_src, "src");
   1.494 -    gst_element_add_pad (abin, gst_ghost_pad_new("src", apad));
   1.495 -    gst_object_unref (apad);
   1.496 +  return abin;
   1.497 +error:
   1.498 +  if (abin != NULL)
   1.499 +	gst_object_unref(abin);
   1.500  
   1.501 -    return abin;
   1.502 -  error:
   1.503 -    if (abin != NULL)
   1.504 -        gst_object_unref (abin);
   1.505 +  if (aqueue != NULL)
   1.506 +	gst_object_unref(aqueue);
   1.507  
   1.508 -    if (aqueue != NULL)
   1.509 -        gst_object_unref (aqueue);
   1.510 +  if (aconvert != NULL)
   1.511 +	gst_object_unref(aconvert);
   1.512  
   1.513 -    if (aconvert != NULL)
   1.514 -        gst_object_unref (aconvert);
   1.515 +  if (aencode != NULL)
   1.516 +	gst_object_unref(aencode);
   1.517  
   1.518 -    if (aencode != NULL)
   1.519 -        gst_object_unref (aencode);
   1.520 +  if (aqueue_src != NULL)
   1.521 +	gst_object_unref(aqueue_src);
   1.522  
   1.523 -    if (aqueue_src != NULL)
   1.524 -        gst_object_unref (aqueue_src);
   1.525 +  if (apad != NULL)
   1.526 +	gst_object_unref(apad);
   1.527  
   1.528 -    if (apad != NULL)
   1.529 -        gst_object_unref (apad);
   1.530 -
   1.531 -    return NULL;
   1.532 +  return NULL;
   1.533  }
   1.534  
   1.535  
   1.536  
   1.537  
   1.538  //queue ! videoscale ! video/x-raw-yuv,width=240,height=144 ! colorspace ! rate ! encode ! queue
   1.539 -static GstElement*
   1.540 -_create_video_bin (const gchar* encode,
   1.541 -                   gchar** encode_prop,
   1.542 -                   gdouble fps,
   1.543 -                   gint rate,
   1.544 -                   guint width,
   1.545 -                   guint height)
   1.546 +static GstElement *
   1.547 +_create_video_bin(const gchar * encode,
   1.548 +				  gchar ** encode_prop,
   1.549 +				  gdouble fps, gint rate, guint width, guint height)
   1.550  {
   1.551 -    GstElement *vbin = NULL;
   1.552 -    GstElement *vqueue = NULL;
   1.553 -    GstElement* vqueue_src = NULL;
   1.554 -    GstElement *vcolorspace = NULL;
   1.555 -    GstElement *vencode = NULL;
   1.556 -    GstElement *vrate = NULL;
   1.557 -    GstPad *vpad = NULL;
   1.558 +  GstElement *vbin = NULL;
   1.559 +  GstElement *vqueue = NULL;
   1.560 +  GstElement *vqueue_src = NULL;
   1.561 +  GstElement *vcolorspace = NULL;
   1.562 +  GstElement *vencode = NULL;
   1.563 +  GstElement *vrate = NULL;
   1.564 +  GstPad *vpad = NULL;
   1.565  
   1.566 -    vbin    = gst_bin_new ("vbin");
   1.567 -    vqueue	= gst_element_factory_make ("queue", "vqueue");
   1.568 -    vcolorspace = gst_element_factory_make ("ffmpegcolorspace", "colorspace");
   1.569 +  vbin = gst_bin_new("vbin");
   1.570 +  vqueue = gst_element_factory_make("queue", "vqueue");
   1.571 +  vcolorspace = gst_element_factory_make("ffmpegcolorspace", "colorspace");
   1.572  
   1.573 -    vencode = _create_element_with_prop (
   1.574 -        (encode != NULL ? encode : "ffenc_mpeg1video"),
   1.575 -        "vencode", encode_prop);
   1.576 -    vqueue_src = gst_element_factory_make ("queue", "queue_src");
   1.577 +  vencode = _create_element_with_prop((encode !=
   1.578 +									   NULL ? encode : "ffenc_mpeg1video"),
   1.579 +									  "vencode", encode_prop);
   1.580 +  vqueue_src = gst_element_factory_make("queue", "queue_src");
   1.581  
   1.582 -    if ((vbin == NULL) || (vqueue == NULL) || (vcolorspace == NULL)
   1.583 -        || (vencode == NULL) || (vqueue_src == NULL)) {
   1.584 -        g_warning ("Video elements not found");
   1.585 -        goto error;
   1.586 -    }
   1.587 +  if ((vbin == NULL) || (vqueue == NULL) || (vcolorspace == NULL)
   1.588 +	  || (vencode == NULL) || (vqueue_src == NULL))
   1.589 +	{
   1.590 +	  g_warning("Video elements not found");
   1.591 +	  goto error;
   1.592 +	}
   1.593  
   1.594 -    gst_bin_add_many (GST_BIN (vbin), vqueue, vcolorspace, vencode, vqueue_src, NULL);
   1.595 +  gst_bin_add_many(GST_BIN(vbin), vqueue, vcolorspace, vencode, vqueue_src,
   1.596 +				   NULL);
   1.597  
   1.598 -    if ((width > 0) && (height > 0)) {
   1.599 -        //Scalling video
   1.600 -        GstCaps *vcaps;
   1.601 -        GstElement *vscale  = gst_element_factory_make ("videoscale", "vscale");
   1.602 +  if ((width > 0) && (height > 0))
   1.603 +	{
   1.604 +	 //Scalling video
   1.605 +	  GstCaps *vcaps;
   1.606 +	  GstElement *vscale = gst_element_factory_make("videoscale", "vscale");
   1.607  
   1.608 -        gst_bin_add (GST_BIN (vbin), vscale);
   1.609 +	  gst_bin_add(GST_BIN(vbin), vscale);
   1.610  
   1.611 -        vcaps = gst_caps_new_simple ("video/x-raw-yuv",
   1.612 -                                     "width", G_TYPE_INT, width,
   1.613 -                                     "height", G_TYPE_INT, height,
   1.614 -                                     NULL);
   1.615 +	  vcaps = gst_caps_new_simple("video/x-raw-yuv",
   1.616 +								  "width", G_TYPE_INT, width,
   1.617 +								  "height", G_TYPE_INT, height, NULL);
   1.618  
   1.619 -        gst_element_link (vqueue, vscale);
   1.620 +	  gst_element_link(vqueue, vscale);
   1.621  
   1.622 -        if (gst_element_link_filtered (vscale, vcolorspace, vcaps) == FALSE) {
   1.623 -            g_warning ("Fail to resize video");
   1.624 -            gst_object_unref (vcaps);
   1.625 -            gst_object_unref (vscale);
   1.626 -            goto error;
   1.627 -        }
   1.628 -        gst_caps_unref (vcaps);
   1.629 -    } else {
   1.630 -        gst_element_link (vqueue, vcolorspace);
   1.631 -    }
   1.632 +	  if (gst_element_link_filtered(vscale, vcolorspace, vcaps) == FALSE)
   1.633 +		{
   1.634 +		  g_warning("Fail to resize video");
   1.635 +		  gst_object_unref(vcaps);
   1.636 +		  gst_object_unref(vscale);
   1.637 +		  goto error;
   1.638 +		}
   1.639 +	  gst_caps_unref(vcaps);
   1.640 +	}
   1.641 +  else
   1.642 +	{
   1.643 +	  gst_element_link(vqueue, vcolorspace);
   1.644 +	}
   1.645  
   1.646 -    if (fps > 0) {
   1.647 -        //Changing the video fps
   1.648 -        GstCaps *vcaps;
   1.649 -        vrate   = gst_element_factory_make ("videorate", "vrate");
   1.650 +  if (fps > 0)
   1.651 +	{
   1.652 +	 //Changing the video fps
   1.653 +	  GstCaps *vcaps;
   1.654 +	  vrate = gst_element_factory_make("videorate", "vrate");
   1.655  
   1.656 -        gst_bin_add (GST_BIN (vbin), vrate);
   1.657 +	  gst_bin_add(GST_BIN(vbin), vrate);
   1.658  
   1.659 -    	if (gst_element_link (vcolorspace, vrate) == FALSE) {
   1.660 -            g_warning ("Fail to link video elements");
   1.661 -            goto error;
   1.662 -    	}
   1.663 +	  if (gst_element_link(vcolorspace, vrate) == FALSE)
   1.664 +		{
   1.665 +		  g_warning("Fail to link video elements");
   1.666 +		  goto error;
   1.667 +		}
   1.668  
   1.669 -    	vcaps = gst_caps_new_simple ("video/x-raw-yuv",
   1.670 -                                     "framerate", GST_TYPE_FRACTION,  (int) (fps * 1000), 1000, NULL);
   1.671 +	  vcaps = gst_caps_new_simple("video/x-raw-yuv",
   1.672 +								  "framerate", GST_TYPE_FRACTION,
   1.673 +								  (int) (fps * 1000), 1000, NULL);
   1.674  
   1.675 -        if (gst_element_link_filtered (vrate, vencode, vcaps) == FALSE) {
   1.676 -            g_warning ("Fail to link vrate with vencode.");
   1.677 -            goto error;
   1.678 -        }
   1.679 -        gst_caps_unref (vcaps);
   1.680 -    } else {
   1.681 -        if (gst_element_link (vcolorspace, vencode) == FALSE) {
   1.682 -            g_warning ("Fail to link colorspace and video encode element.");
   1.683 -            goto error;
   1.684 -        }
   1.685 -    }
   1.686 +	  if (gst_element_link_filtered(vrate, vencode, vcaps) == FALSE)
   1.687 +		{
   1.688 +		  g_warning("Fail to link vrate with vencode.");
   1.689 +		  goto error;
   1.690 +		}
   1.691 +	  gst_caps_unref(vcaps);
   1.692 +	}
   1.693 +  else
   1.694 +	{
   1.695 +	  if (gst_element_link(vcolorspace, vencode) == FALSE)
   1.696 +		{
   1.697 +		  g_warning("Fail to link colorspace and video encode element.");
   1.698 +		  goto error;
   1.699 +		}
   1.700 +	}
   1.701  
   1.702 -    gst_element_link (vencode, vqueue_src);
   1.703 +  gst_element_link(vencode, vqueue_src);
   1.704  
   1.705 -    // ghost pad the video  bin
   1.706 -    vpad = gst_element_get_pad (vqueue, "sink");
   1.707 -    gst_element_add_pad (vbin, gst_ghost_pad_new ("sink", vpad));
   1.708 -    gst_object_unref (vpad);
   1.709 + // ghost pad the video  bin
   1.710 +  vpad = gst_element_get_pad(vqueue, "sink");
   1.711 +  gst_element_add_pad(vbin, gst_ghost_pad_new("sink", vpad));
   1.712 +  gst_object_unref(vpad);
   1.713  
   1.714 -    vpad = gst_element_get_pad (vqueue_src, "src");
   1.715 -    gst_element_add_pad (vbin, gst_ghost_pad_new ("src", vpad));
   1.716 -    gst_object_unref (vpad);
   1.717 +  vpad = gst_element_get_pad(vqueue_src, "src");
   1.718 +  gst_element_add_pad(vbin, gst_ghost_pad_new("src", vpad));
   1.719 +  gst_object_unref(vpad);
   1.720  
   1.721 -    return vbin;
   1.722 +  return vbin;
   1.723  
   1.724 -  error:
   1.725 -    if (vpad != NULL)
   1.726 -        gst_object_unref (vpad);
   1.727 +error:
   1.728 +  if (vpad != NULL)
   1.729 +	gst_object_unref(vpad);
   1.730  
   1.731 -    if (vbin != NULL)
   1.732 -        gst_object_unref (vbin);
   1.733 +  if (vbin != NULL)
   1.734 +	gst_object_unref(vbin);
   1.735  
   1.736 -    if (vqueue != NULL)
   1.737 -        gst_object_unref (vqueue);
   1.738 +  if (vqueue != NULL)
   1.739 +	gst_object_unref(vqueue);
   1.740  
   1.741 -    if (vencode != NULL)
   1.742 -        gst_object_unref (vencode);
   1.743 +  if (vencode != NULL)
   1.744 +	gst_object_unref(vencode);
   1.745  
   1.746 -    if (vqueue_src != NULL)
   1.747 -        gst_object_unref (vqueue_src);
   1.748 +  if (vqueue_src != NULL)
   1.749 +	gst_object_unref(vqueue_src);
   1.750  
   1.751 -    if (vcolorspace != NULL)
   1.752 -        gst_object_unref (vcolorspace);
   1.753 +  if (vcolorspace != NULL)
   1.754 +	gst_object_unref(vcolorspace);
   1.755  
   1.756 -    return NULL;
   1.757 +  return NULL;
   1.758  }
   1.759  
   1.760  
   1.761  
   1.762  void
   1.763 -g_mencoder_setup_stream (GMencoder *self,
   1.764 -                         const gchar* mux_name,
   1.765 -                         const gchar* video_encode,
   1.766 -                         gchar** video_encode_prop,
   1.767 -                         gdouble video_fps,
   1.768 -                         gdouble video_rate,
   1.769 -                         guint video_width,
   1.770 -                         guint video_height,
   1.771 -                         const gchar* audio_encode,
   1.772 -                         gchar** audio_encode_prop,
   1.773 -                         guint audio_rate,
   1.774 -                         const gchar* out_uri)
   1.775 +g_mencoder_setup_stream(GMencoder * self,
   1.776 +						const gchar * mux_name,
   1.777 +						const gchar * video_encode,
   1.778 +						gchar ** video_encode_prop,
   1.779 +						gdouble video_fps,
   1.780 +						gdouble video_rate,
   1.781 +						guint video_width,
   1.782 +						guint video_height,
   1.783 +						const gchar * audio_encode,
   1.784 +						gchar ** audio_encode_prop,
   1.785 +						guint audio_rate, const gchar * out_uri)
   1.786  {
   1.787 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
   1.788 -    if (priv->ready == TRUE) {
   1.789 -        g_warning ("Stream already configured. You need close stream first.");
   1.790 -        return;
   1.791 -    }
   1.792 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
   1.793 +  if (priv->ready == TRUE)
   1.794 +	{
   1.795 +	  g_warning("Stream already configured. You need close stream first.");
   1.796 +	  return;
   1.797 +	}
   1.798  
   1.799 -    _close_output (self);
   1.800 -    _open_output (self, out_uri);
   1.801 +  _close_output(self);
   1.802 +  _open_output(self, out_uri);
   1.803  
   1.804 -    priv->sources = 0;
   1.805 -    priv->pipe = _create_pipeline (self,
   1.806 -                                   video_encode,
   1.807 -                                   mux_name,
   1.808 -                                   video_encode_prop,
   1.809 -                                   video_fps,
   1.810 -                                   video_rate,
   1.811 -                                   video_width,
   1.812 -                                   video_height,
   1.813 -                                   audio_encode,
   1.814 -                                   audio_encode_prop,
   1.815 -                                   audio_rate);
   1.816 +  priv->sources = 0;
   1.817 +  priv->pipe = _create_pipeline(self,
   1.818 +								video_encode,
   1.819 +								mux_name,
   1.820 +								video_encode_prop,
   1.821 +								video_fps,
   1.822 +								video_rate,
   1.823 +								video_width,
   1.824 +								video_height,
   1.825 +								audio_encode, audio_encode_prop, audio_rate);
   1.826  
   1.827  }
   1.828  
   1.829  
   1.830  gboolean
   1.831 -g_mencoder_append_uri (GMencoder *self,
   1.832 -                       const gchar* uri)
   1.833 +g_mencoder_append_uri(GMencoder * self, const gchar * uri)
   1.834  {
   1.835 -    GstPad *pad_src;
   1.836 -    GstPad *pad_sink;
   1.837 -    GstElement *src;
   1.838 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
   1.839 -    gboolean ret = FALSE;
   1.840 -    GstElement *ap = NULL;
   1.841 -    GstElement *vp = NULL;
   1.842 +  GstPad *pad_src;
   1.843 +  GstPad *pad_sink;
   1.844 +  GstElement *src;
   1.845 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
   1.846 +  gboolean ret = FALSE;
   1.847 +  GstElement *ap = NULL;
   1.848 +  GstElement *vp = NULL;
   1.849  
   1.850  
   1.851 -    g_return_val_if_fail (priv->pipe != NULL, FALSE);
   1.852 -    g_return_val_if_fail (priv->ready == FALSE, FALSE);
   1.853 +  g_return_val_if_fail(priv->pipe != NULL, FALSE);
   1.854 +  g_return_val_if_fail(priv->ready == FALSE, FALSE);
   1.855  
   1.856  #ifndef SUPPORT_MULT_INPUT
   1.857 -    g_return_val_if_fail (priv->sources < 1, FALSE);
   1.858 +  g_return_val_if_fail(priv->sources < 1, FALSE);
   1.859  #endif
   1.860  
   1.861 -    src = _create_source (uri);
   1.862 -    if (src == NULL)
   1.863 -        return FALSE;
   1.864 +  src = _create_source(uri);
   1.865 +  if (src == NULL)
   1.866 +	return FALSE;
   1.867  
   1.868 -    priv->src = gst_bin_get_by_name (GST_BIN (src), "src");
   1.869 +  priv->src = gst_bin_get_by_name(GST_BIN(src), "src");
   1.870  
   1.871 -    gst_bin_add (GST_BIN (priv->pipe), src);
   1.872 +  gst_bin_add(GST_BIN(priv->pipe), src);
   1.873  
   1.874  #ifdef SUPPORT_MULT_INPUT
   1.875 -    ap = gst_bin_get_by_name (GST_BIN (priv->pipe), "ap");
   1.876 -    vp = gst_bin_get_by_name (GST_BIN (priv->pipe), "vp");
   1.877 +  ap = gst_bin_get_by_name(GST_BIN(priv->pipe), "ap");
   1.878 +  vp = gst_bin_get_by_name(GST_BIN(priv->pipe), "vp");
   1.879  #else
   1.880 -    ap = gst_bin_get_by_name (GST_BIN (priv->pipe), "abin");
   1.881 -    vp = gst_bin_get_by_name (GST_BIN (priv->pipe), "vbin");
   1.882 +  ap = gst_bin_get_by_name(GST_BIN(priv->pipe), "abin");
   1.883 +  vp = gst_bin_get_by_name(GST_BIN(priv->pipe), "vbin");
   1.884  #endif
   1.885  
   1.886 -    if ((vp == NULL)  || (ap == NULL)) {
   1.887 -        g_warning  ("Fail to get output bin");
   1.888 -        goto error;
   1.889 -    }
   1.890 +  if ((vp == NULL) || (ap == NULL))
   1.891 +	{
   1.892 +	  g_warning("Fail to get output bin");
   1.893 +	  goto error;
   1.894 +	}
   1.895  
   1.896 -    pad_src = gst_element_get_pad (src, "src_audio");
   1.897 -    pad_sink = gst_element_get_compatible_pad (ap,
   1.898 -                                               pad_src,
   1.899 -                                               gst_pad_get_caps (pad_src));
   1.900 +  pad_src = gst_element_get_pad(src, "src_audio");
   1.901 +  pad_sink = gst_element_get_compatible_pad(ap,
   1.902 +											pad_src,
   1.903 +											gst_pad_get_caps(pad_src));
   1.904  
   1.905 -    if ((pad_sink == NULL) || (pad_src == NULL))
   1.906 -        goto error;
   1.907 +  if ((pad_sink == NULL) || (pad_src == NULL))
   1.908 +	goto error;
   1.909  
   1.910 -    GstPadLinkReturn lret = gst_pad_link (pad_src, pad_sink);
   1.911 -    if (lret != GST_PAD_LINK_OK)
   1.912 -        goto error;
   1.913 +  GstPadLinkReturn lret = gst_pad_link(pad_src, pad_sink);
   1.914 +  if (lret != GST_PAD_LINK_OK)
   1.915 +	goto error;
   1.916  
   1.917 -    gst_object_unref (pad_src);
   1.918 -    gst_object_unref (pad_sink);
   1.919 +  gst_object_unref(pad_src);
   1.920 +  gst_object_unref(pad_sink);
   1.921  
   1.922 -    pad_src = gst_element_get_pad (src, "src_video");
   1.923 -    pad_sink = gst_element_get_compatible_pad (vp,
   1.924 -                                               pad_src,
   1.925 -                                               gst_pad_get_caps (pad_src));
   1.926 +  pad_src = gst_element_get_pad(src, "src_video");
   1.927 +  pad_sink = gst_element_get_compatible_pad(vp,
   1.928 +											pad_src,
   1.929 +											gst_pad_get_caps(pad_src));
   1.930  
   1.931 -    if ((pad_src == NULL) || (pad_sink == NULL))
   1.932 -        goto error;
   1.933 +  if ((pad_src == NULL) || (pad_sink == NULL))
   1.934 +	goto error;
   1.935  
   1.936 -    if (gst_pad_link (pad_src, pad_sink) != GST_PAD_LINK_OK) {
   1.937 -        g_warning ("invalid source. video");
   1.938 -        goto error;
   1.939 -    }
   1.940 +  if (gst_pad_link(pad_src, pad_sink) != GST_PAD_LINK_OK)
   1.941 +	{
   1.942 +	  g_warning("invalid source. video");
   1.943 +	  goto error;
   1.944 +	}
   1.945  
   1.946 -    priv->sources++;
   1.947 -    ret = TRUE;
   1.948 -  error:
   1.949 +  priv->sources++;
   1.950 +  ret = TRUE;
   1.951 +error:
   1.952  
   1.953 -    if ((src != NULL) && (ret == FALSE)) {
   1.954 -        gst_bin_remove (GST_BIN (priv->pipe), src);
   1.955 -        gst_object_unref (src);
   1.956 -    }
   1.957 +  if ((src != NULL) && (ret == FALSE))
   1.958 +	{
   1.959 +	  gst_bin_remove(GST_BIN(priv->pipe), src);
   1.960 +	  gst_object_unref(src);
   1.961 +	}
   1.962  
   1.963 -    if (ap != NULL)
   1.964 -        gst_object_unref (ap);
   1.965 +  if (ap != NULL)
   1.966 +	gst_object_unref(ap);
   1.967  
   1.968 -    if (vp != NULL)
   1.969 -        gst_object_unref (vp);
   1.970 +  if (vp != NULL)
   1.971 +	gst_object_unref(vp);
   1.972  
   1.973 -    if (pad_src != NULL)
   1.974 -        gst_object_unref (pad_src);
   1.975 +  if (pad_src != NULL)
   1.976 +	gst_object_unref(pad_src);
   1.977  
   1.978 -    if (pad_sink != NULL)
   1.979 -        gst_object_unref (pad_sink);
   1.980 +  if (pad_sink != NULL)
   1.981 +	gst_object_unref(pad_sink);
   1.982  
   1.983 -    return ret;
   1.984 +  return ret;
   1.985  }
   1.986  
   1.987  
   1.988  
   1.989  void
   1.990 -g_mencoder_remove_uri (GMencoder *self,
   1.991 -                       const gchar* uri)
   1.992 +g_mencoder_remove_uri(GMencoder * self, const gchar * uri)
   1.993  {
   1.994 -    // GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
   1.995 -    //TODO: remove src
   1.996 + // GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
   1.997 + //TODO: remove src
   1.998  }
   1.999  
  1.1000  void
  1.1001 -g_mencoder_play_stream (GMencoder *self)
  1.1002 +g_mencoder_play_stream(GMencoder * self)
  1.1003  {
  1.1004 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
  1.1005 -    g_return_if_fail (priv->ready == FALSE);
  1.1006 -    priv->ready = TRUE;
  1.1007 -    gst_element_set_state (priv->pipe, GST_STATE_PLAYING);
  1.1008 -    priv->tick_id = g_timeout_add (500, _tick_cb, self);
  1.1009 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
  1.1010 +  g_return_if_fail(priv->ready == FALSE);
  1.1011 +  priv->ready = TRUE;
  1.1012 +  gst_element_set_state(priv->pipe, GST_STATE_PLAYING);
  1.1013 +  priv->tick_id = g_timeout_add(500, _tick_cb, self);
  1.1014  }
  1.1015  
  1.1016  void
  1.1017 -g_mencoder_pause_stream (GMencoder *self)
  1.1018 +g_mencoder_pause_stream(GMencoder * self)
  1.1019  {
  1.1020 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
  1.1021 -    g_return_if_fail (priv->ready == TRUE);
  1.1022 -    gst_element_set_state (priv->pipe, GST_STATE_PAUSED);
  1.1023 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
  1.1024 +  g_return_if_fail(priv->ready == TRUE);
  1.1025 +  gst_element_set_state(priv->pipe, GST_STATE_PAUSED);
  1.1026  }
  1.1027  
  1.1028  void
  1.1029 -g_mencoder_close_stream (GMencoder *self)
  1.1030 +g_mencoder_close_stream(GMencoder * self)
  1.1031  {
  1.1032  
  1.1033 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
  1.1034 -    if (priv->tick_id != 0) {
  1.1035 -        g_source_remove (priv->tick_id);
  1.1036 -        priv->tick_id = 0;
  1.1037 -    }
  1.1038 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
  1.1039 +  if (priv->tick_id != 0)
  1.1040 +	{
  1.1041 +	  g_source_remove(priv->tick_id);
  1.1042 +	  priv->tick_id = 0;
  1.1043 +	}
  1.1044  
  1.1045 -    if (priv->pipe != NULL) {
  1.1046 -        //TODO: fixe pipeline dispose
  1.1047 -        //gst_element_set_state (priv->pipe, GST_STATE_NULL);
  1.1048 -		//g_debug ("SETING STATE TO NULL: OK");
  1.1049 -        //gst_element_set_state (priv->pipe, GST_STATE_NULL);
  1.1050 -        //gst_object_unref (priv->pipe);
  1.1051 -        gst_object_unref (priv->src);
  1.1052 -        priv->src = NULL;
  1.1053 -        priv->pipe = NULL;
  1.1054 -        priv->abin = NULL;
  1.1055 -        priv->vbin = NULL;
  1.1056 -        priv->sink = NULL;
  1.1057 -    }
  1.1058 -    priv->ready = FALSE;
  1.1059 +  if (priv->pipe != NULL)
  1.1060 +	{
  1.1061 +	 //TODO: fixe pipeline dispose
  1.1062 +	 //gst_element_set_state (priv->pipe, GST_STATE_NULL);
  1.1063 +	 //g_debug ("SETING STATE TO NULL: OK");
  1.1064 +	 //gst_element_set_state (priv->pipe, GST_STATE_NULL);
  1.1065 +	 //gst_object_unref (priv->pipe);
  1.1066 +	  gst_object_unref(priv->src);
  1.1067 +	  priv->src = NULL;
  1.1068 +	  priv->pipe = NULL;
  1.1069 +	  priv->abin = NULL;
  1.1070 +	  priv->vbin = NULL;
  1.1071 +	  priv->sink = NULL;
  1.1072 +	}
  1.1073 +  priv->ready = FALSE;
  1.1074  }
  1.1075  
  1.1076 -static GstElement*
  1.1077 -_create_pipeline (GMencoder *self,
  1.1078 -                  const gchar* video_encode,
  1.1079 -                  const gchar* mux_name,
  1.1080 -                  gchar** video_encode_prop,
  1.1081 -                  gdouble video_fps,
  1.1082 -                  gdouble video_rate,
  1.1083 -                  guint video_width,
  1.1084 -                  guint video_height,
  1.1085 -                  const gchar* audio_encode,
  1.1086 -                  gchar** audio_encode_prop,
  1.1087 -                  guint audio_rate)
  1.1088 +static GstElement *
  1.1089 +_create_pipeline(GMencoder * self,
  1.1090 +				 const gchar * video_encode,
  1.1091 +				 const gchar * mux_name,
  1.1092 +				 gchar ** video_encode_prop,
  1.1093 +				 gdouble video_fps,
  1.1094 +				 gdouble video_rate,
  1.1095 +				 guint video_width,
  1.1096 +				 guint video_height,
  1.1097 +				 const gchar * audio_encode,
  1.1098 +				 gchar ** audio_encode_prop, guint audio_rate)
  1.1099  {
  1.1100 -    GstBus *bus = NULL;
  1.1101 -    GstElement *pipe = NULL;
  1.1102 -    GstElement *sink = NULL;
  1.1103 -    GstElement *mux = NULL;
  1.1104 -    GstElement *abin = NULL;
  1.1105 -    GstElement *vbin = NULL;
  1.1106 -    GstElement *queue= NULL;
  1.1107 -    GstPad *aux_pad = NULL;
  1.1108 -    GstPad *mux_pad = NULL;
  1.1109 +  GstBus *bus = NULL;
  1.1110 +  GstElement *pipe = NULL;
  1.1111 +  GstElement *sink = NULL;
  1.1112 +  GstElement *mux = NULL;
  1.1113 +  GstElement *abin = NULL;
  1.1114 +  GstElement *vbin = NULL;
  1.1115 +  GstElement *queue = NULL;
  1.1116 +  GstPad *aux_pad = NULL;
  1.1117 +  GstPad *mux_pad = NULL;
  1.1118  #ifdef SUPPORT_MULT_INPUT
  1.1119 -    GstElement *ap = NULL;
  1.1120 -    GstElement *vp = NULL;
  1.1121 +  GstElement *ap = NULL;
  1.1122 +  GstElement *vp = NULL;
  1.1123  #endif
  1.1124 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
  1.1125 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
  1.1126  
  1.1127 -    pipe = gst_pipeline_new ("pipe");
  1.1128 +  pipe = gst_pipeline_new("pipe");
  1.1129  
  1.1130  #ifdef SUPPORT_MULT_INPUT
  1.1131 -    ap = gst_element_factory_make ("concatmux", "ap");
  1.1132 -    vp = gst_element_factory_make ("concatmux", "vp");
  1.1133 -    gst_bin_add_many (GST_BIN (pipe), ap, vp, NULL);
  1.1134 +  ap = gst_element_factory_make("concatmux", "ap");
  1.1135 +  vp = gst_element_factory_make("concatmux", "vp");
  1.1136 +  gst_bin_add_many(GST_BIN(pipe), ap, vp, NULL);
  1.1137  #endif
  1.1138  
  1.1139 -    mux = gst_element_factory_make ((mux_name ? mux_name : "ffmux_mpeg"), "mux");
  1.1140 -    if (mux == NULL)
  1.1141 -        goto error;
  1.1142 +  mux = gst_element_factory_make((mux_name ? mux_name : "ffmux_mpeg"), "mux");
  1.1143 +  if (mux == NULL)
  1.1144 +	goto error;
  1.1145  
  1.1146 -    queue = gst_element_factory_make ("queue", "queueu_sink");
  1.1147 +  queue = gst_element_factory_make("queue", "queueu_sink");
  1.1148  
  1.1149  
  1.1150 -    sink = gst_element_factory_make ("fdsink", "sink");
  1.1151 -    if (sink == NULL)
  1.1152 -        goto error;
  1.1153 +  sink = gst_element_factory_make("fdsink", "sink");
  1.1154 +  if (sink == NULL)
  1.1155 +	goto error;
  1.1156  
  1.1157 -    g_object_set (G_OBJECT(sink),
  1.1158 -                  "fd", priv->fd,
  1.1159 -                  "sync", FALSE,
  1.1160 -                  NULL);
  1.1161 +  g_object_set(G_OBJECT(sink), "fd", priv->fd, "sync", FALSE, NULL);
  1.1162  
  1.1163 -    abin = _create_audio_bin (audio_encode, audio_encode_prop, audio_rate);
  1.1164 -    if (abin == NULL)
  1.1165 -        goto error;
  1.1166 +  abin = _create_audio_bin(audio_encode, audio_encode_prop, audio_rate);
  1.1167 +  if (abin == NULL)
  1.1168 +	goto error;
  1.1169  
  1.1170 -    vbin = _create_video_bin (video_encode, video_encode_prop, video_fps, video_rate, video_width, video_height);
  1.1171 -    if (vbin == NULL)
  1.1172 -        goto error;
  1.1173 +  vbin =
  1.1174 +	_create_video_bin(video_encode, video_encode_prop, video_fps, video_rate,
  1.1175 +					  video_width, video_height);
  1.1176 +  if (vbin == NULL)
  1.1177 +	goto error;
  1.1178  
  1.1179 -    // Finish Pipe
  1.1180 -    gst_bin_add_many (GST_BIN (pipe), abin, vbin, mux, queue, sink, NULL);
  1.1181 + // Finish Pipe
  1.1182 +  gst_bin_add_many(GST_BIN(pipe), abin, vbin, mux, queue, sink, NULL);
  1.1183  
  1.1184  
  1.1185  #ifdef SUPPORT_MULT_INPUT
  1.1186 -    if (gst_element_link (ap, abin) == FALSE) {
  1.1187 -        g_warning ("Fail to link concat and abin");
  1.1188 -        goto error;
  1.1189 -    }
  1.1190 +  if (gst_element_link(ap, abin) == FALSE)
  1.1191 +	{
  1.1192 +	  g_warning("Fail to link concat and abin");
  1.1193 +	  goto error;
  1.1194 +	}
  1.1195  
  1.1196 -    if (gst_element_link (vp, vbin) == FALSE) {
  1.1197 -        g_warning ("Fail to link concat and vbin");
  1.1198 -    }
  1.1199 +  if (gst_element_link(vp, vbin) == FALSE)
  1.1200 +	{
  1.1201 +	  g_warning("Fail to link concat and vbin");
  1.1202 +	}
  1.1203  #endif
  1.1204  
  1.1205 -    //Link bins with mux
  1.1206 -    aux_pad = gst_element_get_pad (abin, "src");
  1.1207 -    mux_pad = gst_element_get_compatible_pad (mux, aux_pad, GST_PAD_CAPS (aux_pad));
  1.1208 -    if (mux_pad == NULL) {
  1.1209 -        g_warning ("Mux element no have audio PAD");
  1.1210 -        goto error;
  1.1211 -    }
  1.1212 -    GstPadLinkReturn ret = gst_pad_link (aux_pad, mux_pad);
  1.1213 -    if (ret != GST_PAD_LINK_OK) {
  1.1214 -        g_warning ("Fail link audio and mux: %d", ret);
  1.1215 -        goto error;
  1.1216 + //Link bins with mux
  1.1217 +  aux_pad = gst_element_get_pad(abin, "src");
  1.1218 +  mux_pad =
  1.1219 +	gst_element_get_compatible_pad(mux, aux_pad, GST_PAD_CAPS(aux_pad));
  1.1220 +  if (mux_pad == NULL)
  1.1221 +	{
  1.1222 +	  g_warning("Mux element no have audio PAD");
  1.1223 +	  goto error;
  1.1224 +	}
  1.1225 +  GstPadLinkReturn ret = gst_pad_link(aux_pad, mux_pad);
  1.1226 +  if (ret != GST_PAD_LINK_OK)
  1.1227 +	{
  1.1228 +	  g_warning("Fail link audio and mux: %d", ret);
  1.1229 +	  goto error;
  1.1230  
  1.1231 -    }
  1.1232 -    gst_object_unref (aux_pad);
  1.1233 -    gst_object_unref (mux_pad);
  1.1234 +	}
  1.1235 +  gst_object_unref(aux_pad);
  1.1236 +  gst_object_unref(mux_pad);
  1.1237  
  1.1238 -    aux_pad = gst_element_get_pad (vbin, "src");
  1.1239 -    mux_pad = gst_element_get_compatible_pad (mux, aux_pad, GST_PAD_CAPS (aux_pad));
  1.1240 -    if (mux_pad == NULL) {
  1.1241 -        g_warning ("Mux element no have video PAD");
  1.1242 -        goto error;
  1.1243 -    }
  1.1244 -    ret = gst_pad_link (aux_pad, mux_pad);
  1.1245 -    if (ret != GST_PAD_LINK_OK) {
  1.1246 -        g_warning ("Fail link video and mux: %d", ret);
  1.1247 -        goto error;
  1.1248 -    }
  1.1249 -    gst_object_unref (aux_pad);
  1.1250 -    gst_object_unref (mux_pad);
  1.1251 -    aux_pad = NULL;
  1.1252 -    mux_pad = NULL;
  1.1253 +  aux_pad = gst_element_get_pad(vbin, "src");
  1.1254 +  mux_pad =
  1.1255 +	gst_element_get_compatible_pad(mux, aux_pad, GST_PAD_CAPS(aux_pad));
  1.1256 +  if (mux_pad == NULL)
  1.1257 +	{
  1.1258 +	  g_warning("Mux element no have video PAD");
  1.1259 +	  goto error;
  1.1260 +	}
  1.1261 +  ret = gst_pad_link(aux_pad, mux_pad);
  1.1262 +  if (ret != GST_PAD_LINK_OK)
  1.1263 +	{
  1.1264 +	  g_warning("Fail link video and mux: %d", ret);
  1.1265 +	  goto error;
  1.1266 +	}
  1.1267 +  gst_object_unref(aux_pad);
  1.1268 +  gst_object_unref(mux_pad);
  1.1269 +  aux_pad = NULL;
  1.1270 +  mux_pad = NULL;
  1.1271  
  1.1272 -    //Link mux with sink
  1.1273 -    gst_element_link_many (mux, queue, sink, NULL);
  1.1274 + //Link mux with sink
  1.1275 +  gst_element_link_many(mux, queue, sink, NULL);
  1.1276  
  1.1277 -    bus = gst_pipeline_get_bus (GST_PIPELINE (pipe));
  1.1278 -    gst_bus_add_watch (bus, _pipeline_bus_cb, self);
  1.1279 -    gst_object_unref (bus);
  1.1280 -    return pipe;
  1.1281 +  bus = gst_pipeline_get_bus(GST_PIPELINE(pipe));
  1.1282 +  gst_bus_add_watch(bus, _pipeline_bus_cb, self);
  1.1283 +  gst_object_unref(bus);
  1.1284 +  return pipe;
  1.1285  
  1.1286 -  error:
  1.1287 -    g_warning ("Invalid uri");
  1.1288 +error:
  1.1289 +  g_warning("Invalid uri");
  1.1290  
  1.1291 -    if (pipe != NULL) {
  1.1292 -        gst_object_unref (pipe);
  1.1293 -    }
  1.1294 +  if (pipe != NULL)
  1.1295 +	{
  1.1296 +	  gst_object_unref(pipe);
  1.1297 +	}
  1.1298  
  1.1299  
  1.1300 -    if (mux != NULL) {
  1.1301 -        gst_object_unref (mux);
  1.1302 -    }
  1.1303 +  if (mux != NULL)
  1.1304 +	{
  1.1305 +	  gst_object_unref(mux);
  1.1306 +	}
  1.1307  
  1.1308 -    if (mux_pad != NULL) {
  1.1309 -        gst_object_unref (mux_pad);
  1.1310 -    }
  1.1311 +  if (mux_pad != NULL)
  1.1312 +	{
  1.1313 +	  gst_object_unref(mux_pad);
  1.1314 +	}
  1.1315  
  1.1316 -    if (aux_pad != NULL) {
  1.1317 -        gst_object_unref (mux_pad);
  1.1318 -    }
  1.1319 +  if (aux_pad != NULL)
  1.1320 +	{
  1.1321 +	  gst_object_unref(mux_pad);
  1.1322 +	}
  1.1323  
  1.1324 -    if (sink != NULL) {
  1.1325 -        gst_object_unref (sink);
  1.1326 -    }
  1.1327 +  if (sink != NULL)
  1.1328 +	{
  1.1329 +	  gst_object_unref(sink);
  1.1330 +	}
  1.1331  
  1.1332 -    if (abin != NULL) {
  1.1333 -        gst_object_unref (abin);
  1.1334 -    }
  1.1335 +  if (abin != NULL)
  1.1336 +	{
  1.1337 +	  gst_object_unref(abin);
  1.1338 +	}
  1.1339  
  1.1340 -    if (vbin != NULL) {
  1.1341 -        gst_object_unref (vbin);
  1.1342 -    }
  1.1343 +  if (vbin != NULL)
  1.1344 +	{
  1.1345 +	  gst_object_unref(vbin);
  1.1346 +	}
  1.1347  
  1.1348 -    return FALSE;
  1.1349 +  return FALSE;
  1.1350  }
  1.1351  
  1.1352  
  1.1353  static void
  1.1354 -_close_output (GMencoder *self)
  1.1355 +_close_output(GMencoder * self)
  1.1356  {
  1.1357  }
  1.1358  
  1.1359 -static GstElement*
  1.1360 -_create_source (const gchar* uri)
  1.1361 +static GstElement *
  1.1362 +_create_source(const gchar * uri)
  1.1363  {
  1.1364  
  1.1365 -    GstElement *bsrc = NULL;
  1.1366 -    GstElement *src = NULL;
  1.1367 -    GstElement *queue = NULL;
  1.1368 -    GstElement *aqueue = NULL;
  1.1369 -    GstElement *vqueue = NULL;
  1.1370 -    GstElement *decode = NULL;
  1.1371 -    GstPad *src_pad = NULL;
  1.1372 +  GstElement *bsrc = NULL;
  1.1373 +  GstElement *src = NULL;
  1.1374 +  GstElement *queue = NULL;
  1.1375 +  GstElement *aqueue = NULL;
  1.1376 +  GstElement *vqueue = NULL;
  1.1377 +  GstElement *decode = NULL;
  1.1378 +  GstPad *src_pad = NULL;
  1.1379  
  1.1380  
  1.1381 -    bsrc = gst_bin_new (NULL);
  1.1382 +  bsrc = gst_bin_new(NULL);
  1.1383  
  1.1384 -    //src = gst_element_factory_make ("gnomevfssrc", "src");
  1.1385 -    //g_object_set (G_OBJECT (src), "location", uri, NULL);
  1.1386 -    src = gst_element_make_from_uri (GST_URI_SRC, uri, "src");
  1.1387 -    if (src == NULL)
  1.1388 -        goto error;
  1.1389 + //src = gst_element_factory_make ("gnomevfssrc", "src");
  1.1390 + //g_object_set (G_OBJECT (src), "location", uri, NULL);
  1.1391 +  src = gst_element_make_from_uri(GST_URI_SRC, uri, "src");
  1.1392 +  if (src == NULL)
  1.1393 +	goto error;
  1.1394  
  1.1395 -    decode = gst_element_factory_make ("decodebin", "decode");
  1.1396 -    if (decode == NULL)
  1.1397 -        goto error;
  1.1398 +  decode = gst_element_factory_make("decodebin", "decode");
  1.1399 +  if (decode == NULL)
  1.1400 +	goto error;
  1.1401  
  1.1402 -    queue = gst_element_factory_make ("queue", "queue_src");
  1.1403 -    aqueue = gst_element_factory_make ("queue", "aqueue");
  1.1404 -    if (aqueue == NULL)
  1.1405 -        goto error;
  1.1406 +  queue = gst_element_factory_make("queue", "queue_src");
  1.1407 +  aqueue = gst_element_factory_make("queue", "aqueue");
  1.1408 +  if (aqueue == NULL)
  1.1409 +	goto error;
  1.1410  
  1.1411 -    vqueue = gst_element_factory_make ("queue", "vqueue");
  1.1412 -    if (vqueue == NULL)
  1.1413 -        goto error;
  1.1414 +  vqueue = gst_element_factory_make("queue", "vqueue");
  1.1415 +  if (vqueue == NULL)
  1.1416 +	goto error;
  1.1417  
  1.1418 -    gst_bin_add_many (GST_BIN (bsrc), src, queue, decode, aqueue, vqueue, NULL);
  1.1419 -    gst_element_link_many (src, queue, decode, NULL);
  1.1420 +  gst_bin_add_many(GST_BIN(bsrc), src, queue, decode, aqueue, vqueue, NULL);
  1.1421 +  gst_element_link_many(src, queue, decode, NULL);
  1.1422  
  1.1423 -    g_signal_connect (G_OBJECT (decode),
  1.1424 -                      "new-decoded-pad",
  1.1425 -                      G_CALLBACK (_decodebin_new_pad_cb),
  1.1426 -                      bsrc);
  1.1427 +  g_signal_connect(G_OBJECT(decode),
  1.1428 +				   "new-decoded-pad",
  1.1429 +				   G_CALLBACK(_decodebin_new_pad_cb), bsrc);
  1.1430  
  1.1431 -    g_signal_connect (G_OBJECT (decode),
  1.1432 -                      "unknown-type",
  1.1433 -                      G_CALLBACK (_decodebin_unknown_type_cb),
  1.1434 -                      pipe);
  1.1435 +  g_signal_connect(G_OBJECT(decode),
  1.1436 +				   "unknown-type",
  1.1437 +				   G_CALLBACK(_decodebin_unknown_type_cb), pipe);
  1.1438  
  1.1439 -    src_pad = gst_element_get_pad (aqueue, "src");
  1.1440 -    gst_element_add_pad (bsrc, gst_ghost_pad_new("src_audio", src_pad));
  1.1441 -    gst_object_unref (src_pad);
  1.1442 +  src_pad = gst_element_get_pad(aqueue, "src");
  1.1443 +  gst_element_add_pad(bsrc, gst_ghost_pad_new("src_audio", src_pad));
  1.1444 +  gst_object_unref(src_pad);
  1.1445  
  1.1446 -    src_pad = gst_element_get_pad (vqueue, "src");
  1.1447 -    gst_element_add_pad (bsrc, gst_ghost_pad_new("src_video", src_pad));
  1.1448 -    gst_object_unref (src_pad);
  1.1449 +  src_pad = gst_element_get_pad(vqueue, "src");
  1.1450 +  gst_element_add_pad(bsrc, gst_ghost_pad_new("src_video", src_pad));
  1.1451 +  gst_object_unref(src_pad);
  1.1452  
  1.1453 -    return bsrc;
  1.1454 +  return bsrc;
  1.1455  
  1.1456 -  error:
  1.1457 -    if (src != NULL) {
  1.1458 -        gst_object_unref (src);
  1.1459 -    }
  1.1460 +error:
  1.1461 +  if (src != NULL)
  1.1462 +	{
  1.1463 +	  gst_object_unref(src);
  1.1464 +	}
  1.1465  
  1.1466 -    if (decode != NULL) {
  1.1467 -        gst_object_unref (decode);
  1.1468 -    }
  1.1469 +  if (decode != NULL)
  1.1470 +	{
  1.1471 +	  gst_object_unref(decode);
  1.1472 +	}
  1.1473  
  1.1474 -    if (aqueue != NULL) {
  1.1475 -        gst_object_unref (aqueue);
  1.1476 -    }
  1.1477 +  if (aqueue != NULL)
  1.1478 +	{
  1.1479 +	  gst_object_unref(aqueue);
  1.1480 +	}
  1.1481  
  1.1482 -    if (vqueue != NULL) {
  1.1483 -        gst_object_unref (vqueue);
  1.1484 -    }
  1.1485 +  if (vqueue != NULL)
  1.1486 +	{
  1.1487 +	  gst_object_unref(vqueue);
  1.1488 +	}
  1.1489  
  1.1490 -    return NULL;
  1.1491 +  return NULL;
  1.1492  }
  1.1493  
  1.1494  static void
  1.1495 -_open_output (GMencoder *self,
  1.1496 -              const gchar* uri)
  1.1497 +_open_output(GMencoder * self, const gchar * uri)
  1.1498  {
  1.1499 -    gchar** i;
  1.1500 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (self);
  1.1501 +  gchar **i;
  1.1502 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
  1.1503  
  1.1504 -    i = g_strsplit (uri, "://", 0);
  1.1505 -    if (strcmp (i[0], "fd") == 0) {
  1.1506 -        priv->fd = atoi (i[1]);
  1.1507 -    } else if (strcmp (i[0], "file") == 0) {
  1.1508 -        priv->fd = open (i[1], O_WRONLY | O_CREAT | O_TRUNC,
  1.1509 -						S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
  1.1510 -    } else {
  1.1511 -        g_warning ("Output uri not supported");
  1.1512 -    }
  1.1513 +  i = g_strsplit(uri, "://", 0);
  1.1514 +  if (strcmp(i[0], "fd") == 0)
  1.1515 +	{
  1.1516 +	  priv->fd = atoi(i[1]);
  1.1517 +	}
  1.1518 +  else if (strcmp(i[0], "file") == 0)
  1.1519 +	{
  1.1520 +	  priv->fd = open(i[1], O_WRONLY | O_CREAT | O_TRUNC,
  1.1521 +					  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
  1.1522 +	}
  1.1523 +  else
  1.1524 +	{
  1.1525 +	  g_warning("Output uri not supported");
  1.1526 +	}
  1.1527  
  1.1528 -    g_strfreev (i);
  1.1529 +  g_strfreev(i);
  1.1530  }
  1.1531  
  1.1532  static gboolean
  1.1533 -_pipeline_bus_cb (GstBus     *bus,
  1.1534 -		  GstMessage *msg,
  1.1535 -		  gpointer    user_data)
  1.1536 +_pipeline_bus_cb(GstBus * bus, GstMessage * msg, gpointer user_data)
  1.1537  {
  1.1538 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (user_data);
  1.1539 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(user_data);
  1.1540  
  1.1541 -    switch (GST_MESSAGE_TYPE (msg))
  1.1542 +  switch (GST_MESSAGE_TYPE(msg))
  1.1543  	{
  1.1544  
  1.1545 -        case GST_MESSAGE_STATE_CHANGED:
  1.1546 -        {
  1.1547 -            GstState oldstate;
  1.1548 -            GstState newstate;
  1.1549 -            GstState pendingstate;
  1.1550 +	case GST_MESSAGE_STATE_CHANGED:
  1.1551 +	  {
  1.1552 +		GstState oldstate;
  1.1553 +		GstState newstate;
  1.1554 +		GstState pendingstate;
  1.1555  
  1.1556  
  1.1557 -            gst_message_parse_state_changed (msg, &oldstate,
  1.1558 -                                             &newstate, &pendingstate);
  1.1559 +		gst_message_parse_state_changed(msg, &oldstate,
  1.1560 +										&newstate, &pendingstate);
  1.1561  
  1.1562 -            if (pendingstate != GST_STATE_VOID_PENDING)
  1.1563 -                break;
  1.1564 +		if (pendingstate != GST_STATE_VOID_PENDING)
  1.1565 +		  break;
  1.1566  
  1.1567 -            if ((oldstate == GST_STATE_READY) &&
  1.1568 -                (newstate == GST_STATE_PAUSED)) {
  1.1569 -                if (priv->ready)
  1.1570 -                    g_signal_emit (user_data, g_mencoder_signals[PAUSED], 0);
  1.1571 -            } else if ((oldstate == GST_STATE_PAUSED) &&
  1.1572 -                       (newstate == GST_STATE_PLAYING)) {
  1.1573 -                g_signal_emit (user_data, g_mencoder_signals[PLAYING], 0);
  1.1574 -            } else if ((oldstate == GST_STATE_READY) &&
  1.1575 -                       (newstate == GST_STATE_NULL)) {
  1.1576 -                g_signal_emit (user_data, g_mencoder_signals[STOPED], 0);
  1.1577 -            }
  1.1578 -            break;
  1.1579 -        }
  1.1580 +		if ((oldstate == GST_STATE_READY) && (newstate == GST_STATE_PAUSED))
  1.1581 +		  {
  1.1582 +			if (priv->ready)
  1.1583 +			  g_signal_emit(user_data, g_mencoder_signals[PAUSED], 0);
  1.1584 +		  }
  1.1585 +		else if ((oldstate == GST_STATE_PAUSED) &&
  1.1586 +				 (newstate == GST_STATE_PLAYING))
  1.1587 +		  {
  1.1588 +			g_signal_emit(user_data, g_mencoder_signals[PLAYING], 0);
  1.1589 +		  }
  1.1590 +		else if ((oldstate == GST_STATE_READY) &&
  1.1591 +				 (newstate == GST_STATE_NULL))
  1.1592 +		  {
  1.1593 +			g_signal_emit(user_data, g_mencoder_signals[STOPED], 0);
  1.1594 +		  }
  1.1595 +		break;
  1.1596 +	  }
  1.1597  
  1.1598 -        case GST_MESSAGE_ERROR:
  1.1599 -        {
  1.1600 -            GError *error;
  1.1601 -            gchar *debug;
  1.1602 -            gchar *err_str;
  1.1603 +	case GST_MESSAGE_ERROR:
  1.1604 +	  {
  1.1605 +		GError *error;
  1.1606 +		gchar *debug;
  1.1607 +		gchar *err_str;
  1.1608  
  1.1609 -            if (priv->tick_id != 0) {
  1.1610 -                g_source_remove (priv->tick_id);
  1.1611 -                priv->tick_id = 0;
  1.1612 -            }
  1.1613 +		if (priv->tick_id != 0)
  1.1614 +		  {
  1.1615 +			g_source_remove(priv->tick_id);
  1.1616 +			priv->tick_id = 0;
  1.1617 +		  }
  1.1618  
  1.1619 -            gst_message_parse_error (msg, &error, &debug);
  1.1620 -            err_str = g_strdup_printf ("Error [%d] %s (%s)", error->code,
  1.1621 -                                       error->message,
  1.1622 -                                       debug);
  1.1623 -            priv->ready = FALSE;
  1.1624 -            g_signal_emit (user_data, g_mencoder_signals[ERROR], 0, err_str);
  1.1625 -            g_free (err_str);
  1.1626 -            g_clear_error (&error);
  1.1627 -            g_free (debug);
  1.1628 -            break;
  1.1629 -        }
  1.1630 +		gst_message_parse_error(msg, &error, &debug);
  1.1631 +		err_str = g_strdup_printf("Error [%d] %s (%s)", error->code,
  1.1632 +								  error->message, debug);
  1.1633 +		priv->ready = FALSE;
  1.1634 +		g_signal_emit(user_data, g_mencoder_signals[ERROR], 0, err_str);
  1.1635 +		g_free(err_str);
  1.1636 +		g_clear_error(&error);
  1.1637 +		g_free(debug);
  1.1638 +		break;
  1.1639 +	  }
  1.1640  
  1.1641 -        case GST_MESSAGE_EOS:
  1.1642 -            priv->ready = FALSE;
  1.1643 -            g_signal_emit (user_data, g_mencoder_signals[EOS], 0);
  1.1644 -            break;
  1.1645 +	case GST_MESSAGE_EOS:
  1.1646 +	  priv->ready = FALSE;
  1.1647 +	  g_signal_emit(user_data, g_mencoder_signals[EOS], 0);
  1.1648 +	  break;
  1.1649  
  1.1650 -        case GST_MESSAGE_DURATION:
  1.1651 -        {
  1.1652 -            GstFormat format;
  1.1653 -            gint64 duration;
  1.1654 -            gst_message_parse_duration (msg, &format, &duration);
  1.1655 -            if (format == GST_FORMAT_BYTES)
  1.1656 -                priv->duration = duration;
  1.1657 -            break;
  1.1658 -        }
  1.1659 -        default:
  1.1660 -        {
  1.1661 -            break;
  1.1662 -        }
  1.1663 +	case GST_MESSAGE_DURATION:
  1.1664 +	  {
  1.1665 +		GstFormat format;
  1.1666 +		gint64 duration;
  1.1667 +		gst_message_parse_duration(msg, &format, &duration);
  1.1668 +		if (format == GST_FORMAT_BYTES)
  1.1669 +		  priv->duration = duration;
  1.1670 +		break;
  1.1671 +	  }
  1.1672 +	default:
  1.1673 +	  {
  1.1674 +		break;
  1.1675 +	  }
  1.1676  	}
  1.1677 -    return TRUE;
  1.1678 +  return TRUE;
  1.1679  }
  1.1680  
  1.1681  
  1.1682  
  1.1683  static void
  1.1684 -_decodebin_new_pad_cb (GstElement* object,
  1.1685 -                       GstPad* pad,
  1.1686 -                       gboolean flag,
  1.1687 -                       gpointer user_data)
  1.1688 +_decodebin_new_pad_cb(GstElement * object,
  1.1689 +					  GstPad * pad, gboolean flag, gpointer user_data)
  1.1690  {
  1.1691 -    GstCaps *caps;
  1.1692 -    gchar *str_caps = NULL;
  1.1693 -    GstElement *sink_element;
  1.1694 -    GstPad *sink_pad;
  1.1695 +  GstCaps *caps;
  1.1696 +  gchar *str_caps = NULL;
  1.1697 +  GstElement *sink_element;
  1.1698 +  GstPad *sink_pad;
  1.1699  
  1.1700 -    caps = gst_pad_get_caps (pad);
  1.1701 -    str_caps = gst_caps_to_string (caps);
  1.1702 -    if (strstr (str_caps, "audio") != NULL) {
  1.1703 -        sink_element = gst_bin_get_by_name (GST_BIN (user_data), "aqueue");
  1.1704 -    } else if (strstr (str_caps, "video") != NULL) {
  1.1705 -        sink_element = gst_bin_get_by_name (GST_BIN (user_data), "vqueue");
  1.1706 -    } else {
  1.1707 -        g_warning ("invalid caps %s", str_caps);
  1.1708 -    }
  1.1709 +  caps = gst_pad_get_caps(pad);
  1.1710 +  str_caps = gst_caps_to_string(caps);
  1.1711 +  if (strstr(str_caps, "audio") != NULL)
  1.1712 +	{
  1.1713 +	  sink_element = gst_bin_get_by_name(GST_BIN(user_data), "aqueue");
  1.1714 +	}
  1.1715 +  else if (strstr(str_caps, "video") != NULL)
  1.1716 +	{
  1.1717 +	  sink_element = gst_bin_get_by_name(GST_BIN(user_data), "vqueue");
  1.1718 +	}
  1.1719 +  else
  1.1720 +	{
  1.1721 +	  g_warning("invalid caps %s", str_caps);
  1.1722 +	}
  1.1723  
  1.1724 -    sink_pad = gst_element_get_pad (sink_element, "sink");
  1.1725 -    gst_pad_link (pad, sink_pad);
  1.1726 +  sink_pad = gst_element_get_pad(sink_element, "sink");
  1.1727 +  gst_pad_link(pad, sink_pad);
  1.1728  
  1.1729 -    gst_object_unref (sink_element);
  1.1730 -    gst_object_unref (sink_pad);
  1.1731 -    g_free (str_caps);
  1.1732 -    gst_caps_unref (caps);
  1.1733 +  gst_object_unref(sink_element);
  1.1734 +  gst_object_unref(sink_pad);
  1.1735 +  g_free(str_caps);
  1.1736 +  gst_caps_unref(caps);
  1.1737  }
  1.1738  
  1.1739  static void
  1.1740 -_decodebin_unknown_type_cb (GstElement* object,
  1.1741 -                            GstPad* pad,
  1.1742 -                            GstCaps* caps,
  1.1743 -                            gpointer user_data)
  1.1744 +_decodebin_unknown_type_cb(GstElement * object,
  1.1745 +						   GstPad * pad, GstCaps * caps, gpointer user_data)
  1.1746  {
  1.1747 -    g_warning  ("Unknown Type");
  1.1748 -    //priv->ready = FALSE;
  1.1749 +  g_warning("Unknown Type");
  1.1750 + //priv->ready = FALSE;
  1.1751  }
  1.1752  
  1.1753  static gboolean
  1.1754 -_tick_cb (gpointer user_data)
  1.1755 +_tick_cb(gpointer user_data)
  1.1756  {
  1.1757 -    GstFormat format = GST_FORMAT_BYTES;
  1.1758 -    gint64 cur = 0;
  1.1759 +  GstFormat format = GST_FORMAT_BYTES;
  1.1760 +  gint64 cur = 0;
  1.1761  
  1.1762 -    GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE (user_data);
  1.1763 +  GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(user_data);
  1.1764  
  1.1765 -    if (priv->duration == 0) {
  1.1766 -        gint64 d = 0;
  1.1767 -        if (gst_element_query_duration (priv->src, &format, &d))
  1.1768 -            priv->duration = d;
  1.1769 -    }
  1.1770 +  if (priv->duration == 0)
  1.1771 +	{
  1.1772 +	  gint64 d = 0;
  1.1773 +	  if (gst_element_query_duration(priv->src, &format, &d))
  1.1774 +		priv->duration = d;
  1.1775 +	}
  1.1776  
  1.1777 -    if (priv->duration != 0) {
  1.1778 -        gst_element_query_position (priv->src, &format, &cur);
  1.1779 -        g_print ("PROGRESS:%lli\n", (99 * cur) / priv->duration);
  1.1780 -    }
  1.1781 +  if (priv->duration != 0)
  1.1782 +	{
  1.1783 +	  gst_element_query_position(priv->src, &format, &cur);
  1.1784 +	  g_print("PROGRESS:%lli\n", (99 * cur) / priv->duration);
  1.1785 +	}
  1.1786  
  1.1787 -    return TRUE;
  1.1788 +  return TRUE;
  1.1789  }
     2.1 --- a/gmyth-stream/gmemcoder/src/gmencoder.h	Thu Jun 14 18:21:08 2007 +0100
     2.2 +++ b/gmyth-stream/gmemcoder/src/gmencoder.h	Thu Jun 14 18:21:53 2007 +0100
     2.3 @@ -3,17 +3,17 @@
     2.4  
     2.5  #include <glib-object.h>
     2.6  
     2.7 -G_BEGIN_DECLS
     2.8 -
     2.9 -typedef struct _GMencoder GMencoder;
    2.10 +G_BEGIN_DECLS typedef struct _GMencoder GMencoder;
    2.11  typedef struct _GMencoderClass GMencoderClass;
    2.12  
    2.13 -struct _GMencoderClass {
    2.14 -    GObjectClass parent_class;
    2.15 +struct _GMencoderClass
    2.16 +{
    2.17 +  GObjectClass parent_class;
    2.18  };
    2.19  
    2.20 -struct _GMencoder {
    2.21 -    GObject parent;
    2.22 +struct _GMencoder
    2.23 +{
    2.24 +  GObject parent;
    2.25  };
    2.26  
    2.27  /* TYPE MACROS */
    2.28 @@ -31,32 +31,28 @@
    2.29    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_MENCODER, GMencoderClass))
    2.30  
    2.31  
    2.32 -GType 	    g_mencoder_get_type 	(void);
    2.33 -GMencoder*  g_mencoder_new              (void);
    2.34 +GType g_mencoder_get_type(void);
    2.35 +GMencoder *g_mencoder_new(void);
    2.36  
    2.37 -void        g_mencoder_setup_stream     (GMencoder *self,
    2.38 -                                         const gchar* mux_name,
    2.39 -                                         const gchar* video_encode,
    2.40 -                                         gchar** video_encode_prop,
    2.41 -                                         gdouble video_fps,
    2.42 -                                         gdouble video_rate,
    2.43 -                                         guint video_width,
    2.44 -                                         guint video_height,
    2.45 -                                         const gchar* audio_encode,
    2.46 -                                         gchar** audio_encode_prop,
    2.47 -                                         guint audio_rate,
    2.48 -                                         const gchar* output_uri);
    2.49 +void g_mencoder_setup_stream(GMencoder * self,
    2.50 +							 const gchar * mux_name,
    2.51 +							 const gchar * video_encode,
    2.52 +							 gchar ** video_encode_prop,
    2.53 +							 gdouble video_fps,
    2.54 +							 gdouble video_rate,
    2.55 +							 guint video_width,
    2.56 +							 guint video_height,
    2.57 +							 const gchar * audio_encode,
    2.58 +							 gchar ** audio_encode_prop,
    2.59 +							 guint audio_rate, const gchar * output_uri);
    2.60  
    2.61 -gboolean    g_mencoder_append_uri       (GMencoder *self,
    2.62 -                                         const gchar* uri);
    2.63 +gboolean g_mencoder_append_uri(GMencoder * self, const gchar * uri);
    2.64  
    2.65 -void        g_mencoder_remove_uri       (GMencoder *self,
    2.66 -                                         const gchar* uri);
    2.67 +void g_mencoder_remove_uri(GMencoder * self, const gchar * uri);
    2.68  
    2.69 -void        g_mencoder_play_stream      (GMencoder *self);
    2.70 -void   	    g_mencoder_pause_stream 	(GMencoder *self);
    2.71 -void        g_mencoder_close_stream 	(GMencoder *self);
    2.72 +void g_mencoder_play_stream(GMencoder * self);
    2.73 +void g_mencoder_pause_stream(GMencoder * self);
    2.74 +void g_mencoder_close_stream(GMencoder * self);
    2.75  
    2.76  G_END_DECLS
    2.77 -
    2.78  #endif
     3.1 --- a/gmyth-stream/gmemcoder/src/main.c	Thu Jun 14 18:21:08 2007 +0100
     3.2 +++ b/gmyth-stream/gmemcoder/src/main.c	Thu Jun 14 18:21:53 2007 +0100
     3.3 @@ -12,183 +12,187 @@
     3.4  
     3.5  static GMainLoop *mainloop = NULL;
     3.6  /* Options */
     3.7 -static gchar*   input_file      = NULL;
     3.8 -static gchar*   video_encode    = NULL;
     3.9 -static gchar*   video_opts      = NULL;
    3.10 -static gdouble  video_fps       = 0.0;
    3.11 -static gint     video_rate      = 0;
    3.12 -static gint     video_width     = 0;
    3.13 -static gint     video_height    = 0;
    3.14 -static gchar*   audio_encode    = NULL;
    3.15 -static gchar*   audio_opts      = NULL;
    3.16 -static double   audio_rate      = 0.0;
    3.17 -static gchar*   mux_name        = NULL;
    3.18 -static gchar*   output_uri      = NULL;
    3.19 +static gchar *input_file = NULL;
    3.20 +static gchar *video_encode = NULL;
    3.21 +static gchar *video_opts = NULL;
    3.22 +static gdouble video_fps = 0.0;
    3.23 +static gint video_rate = 0;
    3.24 +static gint video_width = 0;
    3.25 +static gint video_height = 0;
    3.26 +static gchar *audio_encode = NULL;
    3.27 +static gchar *audio_opts = NULL;
    3.28 +static double audio_rate = 0.0;
    3.29 +static gchar *mux_name = NULL;
    3.30 +static gchar *output_uri = NULL;
    3.31  
    3.32  
    3.33  
    3.34  static gboolean
    3.35 -_quit (gpointer data)
    3.36 +_quit(gpointer data)
    3.37  {
    3.38 -    g_object_unref (data);
    3.39 -    g_main_loop_quit (mainloop);
    3.40 -    return FALSE;
    3.41 +  g_object_unref(data);
    3.42 +  g_main_loop_quit(mainloop);
    3.43 +  return FALSE;
    3.44  }
    3.45  
    3.46  static void
    3.47 -_mencoder_eos_cb (GMencoder *mencoder, gpointer data)
    3.48 +_mencoder_eos_cb(GMencoder * mencoder, gpointer data)
    3.49  {
    3.50 -    g_print ("EOS\n");
    3.51 -    g_idle_add (_quit, mencoder);
    3.52 +  g_print("EOS\n");
    3.53 +  g_idle_add(_quit, mencoder);
    3.54  }
    3.55  
    3.56  
    3.57  static void
    3.58 -_mencoder_error_cb (GMencoder *mencoder, const gchar* msg, gpointer data)
    3.59 +_mencoder_error_cb(GMencoder * mencoder, const gchar * msg, gpointer data)
    3.60  {
    3.61 -    g_print ("Error: %s\n", msg);
    3.62 -    g_idle_add (_quit, mencoder);
    3.63 +  g_print("Error: %s\n", msg);
    3.64 +  g_idle_add(_quit, mencoder);
    3.65  }
    3.66  
    3.67  static gboolean
    3.68 -_io_channel_cb (GIOChannel *ch,
    3.69 -                GIOCondition condition,
    3.70 -                gpointer data)
    3.71 +_io_channel_cb(GIOChannel * ch, GIOCondition condition, gpointer data)
    3.72  {
    3.73 -    GString *cmd = g_string_new ("");
    3.74 -    g_io_channel_read_line_string (ch, cmd, NULL, NULL);
    3.75 +  GString *cmd = g_string_new("");
    3.76 +  g_io_channel_read_line_string(ch, cmd, NULL, NULL);
    3.77  
    3.78 -    if (strcmp (cmd->str, "PLAY\n") == 0) {
    3.79 -        g_mencoder_play_stream (G_MENCODER (data));
    3.80 -    } else if (strcmp (cmd->str, "PAUSE\n") == 0) {
    3.81 -        g_mencoder_pause_stream (G_MENCODER (data));
    3.82 -    } else if (strcmp (cmd->str, "STOP\n") == 0) {
    3.83 -        g_mencoder_close_stream (G_MENCODER (data));
    3.84 -    } else if (strcmp (cmd->str, "QUIT\n") == 0) {
    3.85 -        g_mencoder_close_stream (G_MENCODER (data));
    3.86 -        g_main_loop_quit (mainloop);
    3.87 -    }
    3.88 -    g_string_free (cmd, TRUE);
    3.89 -    return TRUE;
    3.90 +  if (strcmp(cmd->str, "PLAY\n") == 0)
    3.91 +	{
    3.92 +	  g_mencoder_play_stream(G_MENCODER(data));
    3.93 +	}
    3.94 +  else if (strcmp(cmd->str, "PAUSE\n") == 0)
    3.95 +	{
    3.96 +	  g_mencoder_pause_stream(G_MENCODER(data));
    3.97 +	}
    3.98 +  else if (strcmp(cmd->str, "STOP\n") == 0)
    3.99 +	{
   3.100 +	  g_mencoder_close_stream(G_MENCODER(data));
   3.101 +	}
   3.102 +  else if (strcmp(cmd->str, "QUIT\n") == 0)
   3.103 +	{
   3.104 +	  g_mencoder_close_stream(G_MENCODER(data));
   3.105 +	  g_main_loop_quit(mainloop);
   3.106 +	}
   3.107 +  g_string_free(cmd, TRUE);
   3.108 +  return TRUE;
   3.109  }
   3.110  
   3.111  int
   3.112 -main (int argc, char** argv)
   3.113 +main(int argc, char **argv)
   3.114  {
   3.115 -    GMencoder *coder = NULL;
   3.116 -    GIOChannel *ch;
   3.117 -    gchar **vopts;
   3.118 -    gchar **aopts;
   3.119 -    gchar **files;
   3.120 -    gint i;
   3.121 +  GMencoder *coder = NULL;
   3.122 +  GIOChannel *ch;
   3.123 +  gchar **vopts;
   3.124 +  gchar **aopts;
   3.125 +  gchar **files;
   3.126 +  gint i;
   3.127  
   3.128 -    GOptionContext *context;
   3.129 -    static const GOptionEntry options []  = {
   3.130 -        {"input-files", 'i', 0, G_OPTION_ARG_STRING, &input_file,
   3.131 -         "Input File", NULL},
   3.132 +  GOptionContext *context;
   3.133 +  static const GOptionEntry options[] = {
   3.134 +	{"input-files", 'i', 0, G_OPTION_ARG_STRING, &input_file,
   3.135 +	 "Input File", NULL},
   3.136  
   3.137 -        {"video-encode", 0, 0, G_OPTION_ARG_STRING, &video_encode,
   3.138 -         "GstElementName for used to video encode", NULL},
   3.139 +	{"video-encode", 0, 0, G_OPTION_ARG_STRING, &video_encode,
   3.140 +	 "GstElementName for used to video encode", NULL},
   3.141  
   3.142 -        {"video-opts", 0, 0, G_OPTION_ARG_STRING, &video_opts,
   3.143 -         "Properties to set on video element", NULL},
   3.144 +	{"video-opts", 0, 0, G_OPTION_ARG_STRING, &video_opts,
   3.145 +	 "Properties to set on video element", NULL},
   3.146  
   3.147 -        {"video-fps", 0, 0, G_OPTION_ARG_DOUBLE, &video_fps,
   3.148 -         "Video FPS", NULL},
   3.149 +	{"video-fps", 0, 0, G_OPTION_ARG_DOUBLE, &video_fps,
   3.150 +	 "Video FPS", NULL},
   3.151  
   3.152 -        {"video-rate", 0, 0, G_OPTION_ARG_INT, &video_rate,
   3.153 -         "Video rate", NULL},
   3.154 +	{"video-rate", 0, 0, G_OPTION_ARG_INT, &video_rate,
   3.155 +	 "Video rate", NULL},
   3.156  
   3.157 -        {"video-width", 0, 0, G_OPTION_ARG_INT, &video_width,
   3.158 -         "Video width", NULL},
   3.159 +	{"video-width", 0, 0, G_OPTION_ARG_INT, &video_width,
   3.160 +	 "Video width", NULL},
   3.161  
   3.162 -        {"video-height", 0, 0, G_OPTION_ARG_INT, &video_height,
   3.163 -         "Video height", NULL},
   3.164 +	{"video-height", 0, 0, G_OPTION_ARG_INT, &video_height,
   3.165 +	 "Video height", NULL},
   3.166  
   3.167 -        {"audio-encode", 0, 0, G_OPTION_ARG_STRING, &audio_encode,
   3.168 -         "GstElementName for use to audio encode", NULL},
   3.169 +	{"audio-encode", 0, 0, G_OPTION_ARG_STRING, &audio_encode,
   3.170 +	 "GstElementName for use to audio encode", NULL},
   3.171  
   3.172 -        {"audio-opts", 0, 0, G_OPTION_ARG_STRING, &audio_opts,
   3.173 -         "Properties to set on audio element", NULL},
   3.174 +	{"audio-opts", 0, 0, G_OPTION_ARG_STRING, &audio_opts,
   3.175 +	 "Properties to set on audio element", NULL},
   3.176  
   3.177 -        {"audio-rate", 0, 0, G_OPTION_ARG_INT, &audio_rate,
   3.178 -         "Audio rate", NULL},
   3.179 +	{"audio-rate", 0, 0, G_OPTION_ARG_INT, &audio_rate,
   3.180 +	 "Audio rate", NULL},
   3.181  
   3.182 -        {"mux-element", 0, 0, G_OPTION_ARG_STRING, &mux_name,
   3.183 -         "GstElementName for use to mux file", NULL},
   3.184 +	{"mux-element", 0, 0, G_OPTION_ARG_STRING, &mux_name,
   3.185 +	 "GstElementName for use to mux file", NULL},
   3.186  
   3.187 -        {"output-uri", 'o', 0, G_OPTION_ARG_STRING, &output_uri,
   3.188 -         "Uri to output", NULL},
   3.189 +	{"output-uri", 'o', 0, G_OPTION_ARG_STRING, &output_uri,
   3.190 +	 "Uri to output", NULL},
   3.191  
   3.192 -        { NULL }
   3.193 -    };
   3.194 +	{NULL}
   3.195 +  };
   3.196  
   3.197 -    g_type_init ();
   3.198 -    g_thread_init (NULL);
   3.199 -    mainloop = g_main_loop_new (NULL, FALSE);
   3.200 +  g_type_init();
   3.201 +  g_thread_init(NULL);
   3.202 +  mainloop = g_main_loop_new(NULL, FALSE);
   3.203  
   3.204 -    g_set_prgname ("gmemcoder");
   3.205 -    context = g_option_context_new (NULL);
   3.206 -    g_option_context_set_help_enabled (context, TRUE);
   3.207 -    g_option_context_add_main_entries (context, options, NULL);
   3.208 -    g_option_context_add_group (context, gst_init_get_option_group ());
   3.209 -    g_option_context_parse (context, &argc, &argv, NULL);
   3.210 +  g_set_prgname("gmemcoder");
   3.211 +  context = g_option_context_new(NULL);
   3.212 +  g_option_context_set_help_enabled(context, TRUE);
   3.213 +  g_option_context_add_main_entries(context, options, NULL);
   3.214 +  g_option_context_add_group(context, gst_init_get_option_group());
   3.215 +  g_option_context_parse(context, &argc, &argv, NULL);
   3.216  
   3.217 -    gst_init (&argc, &argv);
   3.218 +  gst_init(&argc, &argv);
   3.219  
   3.220 -    if (output_uri == NULL) {
   3.221 -        g_print ("You need to specify output-uri.\nTry --help "
   3.222 -                 "for more information.\n");
   3.223 -        return 1;
   3.224 -    }
   3.225 +  if (output_uri == NULL)
   3.226 +	{
   3.227 +	  g_print("You need to specify output-uri.\nTry --help "
   3.228 +			  "for more information.\n");
   3.229 +	  return 1;
   3.230 +	}
   3.231  
   3.232 -    if (input_file == NULL) {
   3.233 -        g_print ("You need to specify input file\nTry --help "
   3.234 -                 "for more information.\n");
   3.235 -    }
   3.236 +  if (input_file == NULL)
   3.237 +	{
   3.238 +	  g_print("You need to specify input file\nTry --help "
   3.239 +			  "for more information.\n");
   3.240 +	}
   3.241  
   3.242 -    coder = g_mencoder_new ();
   3.243 -    ch = g_io_channel_unix_new (0);
   3.244 +  coder = g_mencoder_new();
   3.245 +  ch = g_io_channel_unix_new(0);
   3.246  
   3.247 -    aopts = g_strsplit (audio_opts, ",", 0);
   3.248 -    vopts = g_strsplit (video_opts, ",", 0);
   3.249 +  aopts = g_strsplit(audio_opts, ",", 0);
   3.250 +  vopts = g_strsplit(video_opts, ",", 0);
   3.251  
   3.252 -    g_mencoder_setup_stream (coder, mux_name,
   3.253 -                             video_encode, vopts, video_fps,
   3.254 -                             video_rate, video_width, video_height,
   3.255 -                             audio_encode, aopts, audio_rate,
   3.256 -                             output_uri);
   3.257 +  g_mencoder_setup_stream(coder, mux_name,
   3.258 +						  video_encode, vopts, video_fps,
   3.259 +						  video_rate, video_width, video_height,
   3.260 +						  audio_encode, aopts, audio_rate, output_uri);
   3.261  
   3.262 -    files = g_strsplit (input_file, ",", 0);
   3.263 -    for (i=0; i < g_strv_length (files); i++) {
   3.264 -        if (!g_mencoder_append_uri (coder, files[i])) {
   3.265 -            g_debug ("Invalid uri: %s", files[i]);
   3.266 -        }
   3.267 -    }
   3.268 +  files = g_strsplit(input_file, ",", 0);
   3.269 +  for (i = 0; i < g_strv_length(files); i++)
   3.270 +	{
   3.271 +	  if (!g_mencoder_append_uri(coder, files[i]))
   3.272 +		{
   3.273 +		  g_debug("Invalid uri: %s", files[i]);
   3.274 +		}
   3.275 +	}
   3.276  
   3.277 -    g_strfreev (files);
   3.278 -    g_strfreev (aopts);
   3.279 -    g_strfreev (vopts);
   3.280 +  g_strfreev(files);
   3.281 +  g_strfreev(aopts);
   3.282 +  g_strfreev(vopts);
   3.283  
   3.284  
   3.285 -    g_io_add_watch (ch, G_IO_IN, _io_channel_cb, coder);
   3.286 +  g_io_add_watch(ch, G_IO_IN, _io_channel_cb, coder);
   3.287  
   3.288 -    g_signal_connect (G_OBJECT (coder),
   3.289 -                      "eos",
   3.290 -                      G_CALLBACK (_mencoder_eos_cb),
   3.291 -                      mainloop);
   3.292 +  g_signal_connect(G_OBJECT(coder),
   3.293 +				   "eos", G_CALLBACK(_mencoder_eos_cb), mainloop);
   3.294  
   3.295 -    g_signal_connect (G_OBJECT (coder),
   3.296 -                      "error",
   3.297 -                      G_CALLBACK (_mencoder_error_cb),
   3.298 -                      mainloop);
   3.299 +  g_signal_connect(G_OBJECT(coder),
   3.300 +				   "error", G_CALLBACK(_mencoder_error_cb), mainloop);
   3.301  
   3.302 -    g_mencoder_play_stream (coder);
   3.303 +  g_mencoder_play_stream(coder);
   3.304  
   3.305 -    g_debug ("RUNNING..");
   3.306 -    g_main_loop_run (mainloop);
   3.307 -    g_debug ("DONE");
   3.308 -    g_object_unref (coder);
   3.309 +  g_debug("RUNNING..");
   3.310 +  g_main_loop_run(mainloop);
   3.311 +  g_debug("DONE");
   3.312 +  g_object_unref(coder);
   3.313  
   3.314 -    return 0;
   3.315 +  return 0;
   3.316  }
     4.1 --- a/gmyth-stream/gmemcoder/tests/main.c	Thu Jun 14 18:21:08 2007 +0100
     4.2 +++ b/gmyth-stream/gmemcoder/tests/main.c	Thu Jun 14 18:21:53 2007 +0100
     4.3 @@ -4,234 +4,228 @@
     4.4  #include <string.h>
     4.5  
     4.6  #include <gst/gst.h>
     4.7 -#include <glib.h> 
     4.8 +#include <glib.h>
     4.9  
    4.10  
    4.11  static GMainLoop *mainloop = NULL;
    4.12  static gint64 d = 0;
    4.13  static gint64 gap = 10;
    4.14  
    4.15 -typedef enum {
    4.16 -    MY_STREAM_TYPE_AUDIO = 0,
    4.17 -    MY_STREAM_TYPE_VIDEO = 1
    4.18 +typedef enum
    4.19 +{
    4.20 +  MY_STREAM_TYPE_AUDIO = 0,
    4.21 +  MY_STREAM_TYPE_VIDEO = 1
    4.22  } MyStreamType;
    4.23  
    4.24  typedef struct _StreamData StreamData;
    4.25 -struct _StreamData {
    4.26 -    GstElement *bin;
    4.27 -    MyStreamType type;
    4.28 +struct _StreamData
    4.29 +{
    4.30 +  GstElement *bin;
    4.31 +  MyStreamType type;
    4.32  };
    4.33  
    4.34  static void
    4.35 -_stream_decode_pad_added_cb (GstElement *decode, 
    4.36 -                            GstPad *pad,
    4.37 -                            gboolean arg1,
    4.38 -                            gpointer user_data)
    4.39 +_stream_decode_pad_added_cb(GstElement * decode,
    4.40 +							GstPad * pad, gboolean arg1, gpointer user_data)
    4.41  {
    4.42 -    StreamData *data = (StreamData *) user_data;
    4.43 -    GstElement *queue;
    4.44 -    GstPad* sink_pad;
    4.45 -    GstCaps* caps = gst_pad_get_caps (pad);
    4.46 -    gchar *str_caps = gst_caps_to_string (caps);
    4.47 +  StreamData *data = (StreamData *) user_data;
    4.48 +  GstElement *queue;
    4.49 +  GstPad *sink_pad;
    4.50 +  GstCaps *caps = gst_pad_get_caps(pad);
    4.51 +  gchar *str_caps = gst_caps_to_string(caps);
    4.52  
    4.53 -    g_debug ("decode caps: [%d] [%s]", data->type, str_caps);
    4.54 +  g_debug("decode caps: [%d] [%s]", data->type, str_caps);
    4.55  
    4.56 -    switch (data->type)
    4.57 -    {
    4.58 -        case MY_STREAM_TYPE_AUDIO:
    4.59 -            g_debug ("Audio");
    4.60 -            if (strstr (str_caps, "audio") == NULL) 
    4.61 -                goto done;
    4.62 -            break;
    4.63 -        case MY_STREAM_TYPE_VIDEO:
    4.64 -            g_debug ("Video");
    4.65 -            if (strstr (str_caps, "video") == NULL)
    4.66 -                goto done;
    4.67 -            break;
    4.68 -    }
    4.69 +  switch (data->type)
    4.70 +	{
    4.71 +	case MY_STREAM_TYPE_AUDIO:
    4.72 +	  g_debug("Audio");
    4.73 +	  if (strstr(str_caps, "audio") == NULL)
    4.74 +		goto done;
    4.75 +	  break;
    4.76 +	case MY_STREAM_TYPE_VIDEO:
    4.77 +	  g_debug("Video");
    4.78 +	  if (strstr(str_caps, "video") == NULL)
    4.79 +		goto done;
    4.80 +	  break;
    4.81 +	}
    4.82  
    4.83 -    queue = gst_bin_get_by_name (GST_BIN (data->bin), "queue");
    4.84 -    sink_pad = gst_element_get_pad (queue, "sink");
    4.85 +  queue = gst_bin_get_by_name(GST_BIN(data->bin), "queue");
    4.86 +  sink_pad = gst_element_get_pad(queue, "sink");
    4.87  
    4.88 -    if (gst_pad_link (pad, sink_pad) != GST_PAD_LINK_OK) {
    4.89 -        g_warning ("Failed to link decode");
    4.90 -    }
    4.91 +  if (gst_pad_link(pad, sink_pad) != GST_PAD_LINK_OK)
    4.92 +	{
    4.93 +	  g_warning("Failed to link decode");
    4.94 +	}
    4.95  
    4.96 -    gst_object_unref (queue);
    4.97 -    gst_object_unref (sink_pad);
    4.98 -    //g_free (data);
    4.99 -    g_debug ("Linked");
   4.100 +  gst_object_unref(queue);
   4.101 +  gst_object_unref(sink_pad);
   4.102 + //g_free (data);
   4.103 +  g_debug("Linked");
   4.104  
   4.105  done:
   4.106 -    gst_caps_unref (caps);
   4.107 -    g_free (str_caps);
   4.108 +  gst_caps_unref(caps);
   4.109 +  g_free(str_caps);
   4.110  }
   4.111  
   4.112  
   4.113 -static GstElement*
   4.114 -_create_src_element (const gchar* name,
   4.115 -                     const gchar* uri,                 
   4.116 -                     MyStreamType type,
   4.117 -                     guint priority)
   4.118 +static GstElement *
   4.119 +_create_src_element(const gchar * name,
   4.120 +					const gchar * uri, MyStreamType type, guint priority)
   4.121  {
   4.122 -    StreamData *data;
   4.123 -    GstElement *bin;
   4.124 -    GstElement *src;
   4.125 -    GstElement *decode;
   4.126 -    GstElement *queue;
   4.127 -    GstPad *src_pad;
   4.128 +  StreamData *data;
   4.129 +  GstElement *bin;
   4.130 +  GstElement *src;
   4.131 +  GstElement *decode;
   4.132 +  GstElement *queue;
   4.133 +  GstPad *src_pad;
   4.134  
   4.135 -    GstElement *gnl_src;
   4.136 +  GstElement *gnl_src;
   4.137  
   4.138 -    g_debug ("element from uri: %s", uri);
   4.139 +  g_debug("element from uri: %s", uri);
   4.140  
   4.141 -    bin = gst_bin_new ("bin");
   4.142 -    src = gst_element_make_from_uri (GST_URI_SRC, uri, "src");
   4.143 -    g_return_val_if_fail (src != NULL, NULL);
   4.144 +  bin = gst_bin_new("bin");
   4.145 +  src = gst_element_make_from_uri(GST_URI_SRC, uri, "src");
   4.146 +  g_return_val_if_fail(src != NULL, NULL);
   4.147  
   4.148 -    decode = gst_element_factory_make ("decodebin", NULL);
   4.149 -    g_return_val_if_fail (decode != NULL, NULL);
   4.150 +  decode = gst_element_factory_make("decodebin", NULL);
   4.151 +  g_return_val_if_fail(decode != NULL, NULL);
   4.152  
   4.153 -    queue = gst_element_factory_make ("queue", "queue");
   4.154 -    g_return_val_if_fail (queue != NULL, NULL);
   4.155 +  queue = gst_element_factory_make("queue", "queue");
   4.156 +  g_return_val_if_fail(queue != NULL, NULL);
   4.157  
   4.158 -    gst_bin_add_many (GST_BIN (bin), src, decode, queue, NULL);
   4.159 -    gst_element_link (src, decode);
   4.160 +  gst_bin_add_many(GST_BIN(bin), src, decode, queue, NULL);
   4.161 +  gst_element_link(src, decode);
   4.162  
   4.163 -    data = g_new0 (StreamData, 1);
   4.164 -    data->bin = bin;
   4.165 -    data->type = type;
   4.166 -    g_debug ("Type : %d = %d", type, data->type);
   4.167 +  data = g_new0(StreamData, 1);
   4.168 +  data->bin = bin;
   4.169 +  data->type = type;
   4.170 +  g_debug("Type : %d = %d", type, data->type);
   4.171  
   4.172 -    g_signal_connect (G_OBJECT (decode), "new-decoded-pad",
   4.173 -                      G_CALLBACK (_stream_decode_pad_added_cb), 
   4.174 -                      data);
   4.175 +  g_signal_connect(G_OBJECT(decode), "new-decoded-pad",
   4.176 +				   G_CALLBACK(_stream_decode_pad_added_cb), data);
   4.177  
   4.178 -    
   4.179 -    src_pad = gst_element_get_pad (queue, "src");
   4.180 -    g_return_val_if_fail (src_pad != NULL, NULL);
   4.181  
   4.182 -    gst_element_add_pad (bin,
   4.183 -        gst_ghost_pad_new ("src", src_pad));
   4.184 +  src_pad = gst_element_get_pad(queue, "src");
   4.185 +  g_return_val_if_fail(src_pad != NULL, NULL);
   4.186  
   4.187 -    gst_object_unref (src_pad);
   4.188 +  gst_element_add_pad(bin, gst_ghost_pad_new("src", src_pad));
   4.189  
   4.190 -    gnl_src = gst_element_factory_make ("gnlsource", name);
   4.191 -    g_return_val_if_fail (gnl_src != NULL, NULL);
   4.192 -    gst_bin_add (GST_BIN (gnl_src), bin);
   4.193 +  gst_object_unref(src_pad);
   4.194  
   4.195 -    g_debug ("ADDING WITH: START [%lli] DUR [%lli]", d, gap);
   4.196 -    if (d == 0) {
   4.197 -        g_object_set (G_OBJECT (gnl_src),
   4.198 -                        //"start", 0L,
   4.199 -                        "duration", 10 * GST_SECOND,
   4.200 -                        //"media-start", 0L,
   4.201 -                        //"media-duration", 10 * GST_SECOND,
   4.202 -                        "priority", priority,
   4.203 -                        NULL);
   4.204 +  gnl_src = gst_element_factory_make("gnlsource", name);
   4.205 +  g_return_val_if_fail(gnl_src != NULL, NULL);
   4.206 +  gst_bin_add(GST_BIN(gnl_src), bin);
   4.207  
   4.208 -    } else {
   4.209 -        g_object_set (G_OBJECT (gnl_src),
   4.210 -                        "start", 10 * GST_SECOND,
   4.211 -                        "duration", 10 * GST_SECOND,
   4.212 -                        ///"media-start", 10 * GST_SECOND,
   4.213 -                        //"media-duration", 10 * GST_SECOND,
   4.214 -                        "priority", priority,
   4.215 -                        NULL);
   4.216 +  g_debug("ADDING WITH: START [%lli] DUR [%lli]", d, gap);
   4.217 +  if (d == 0)
   4.218 +	{
   4.219 +	  g_object_set(G_OBJECT(gnl_src),
   4.220 +				  //"start", 0L,
   4.221 +				   "duration", 10 * GST_SECOND,
   4.222 +				  //"media-start", 0L,
   4.223 +				  //"media-duration", 10 * GST_SECOND,
   4.224 +				   "priority", priority, NULL);
   4.225  
   4.226 -    }
   4.227 -    d++;
   4.228 +	}
   4.229 +  else
   4.230 +	{
   4.231 +	  g_object_set(G_OBJECT(gnl_src),
   4.232 +				   "start", 10 * GST_SECOND, "duration", 10 * GST_SECOND,
   4.233 +				  ///"media-start", 10 * GST_SECOND,
   4.234 +				  //"media-duration", 10 * GST_SECOND,
   4.235 +				   "priority", priority, NULL);
   4.236  
   4.237 -    return gnl_src;
   4.238 +	}
   4.239 +  d++;
   4.240 +
   4.241 +  return gnl_src;
   4.242  }
   4.243  
   4.244  static void
   4.245 -_composition_pad_added_cb (GstElement *composition, 
   4.246 -                           GstPad *pad,
   4.247 -                           gpointer data)
   4.248 +_composition_pad_added_cb(GstElement * composition,
   4.249 +						  GstPad * pad, gpointer data)
   4.250  {
   4.251 -    GstPad *sink_pad = gst_element_get_pad (GST_ELEMENT (data), "sink");
   4.252 -    g_debug ("compose pad added");
   4.253 +  GstPad *sink_pad = gst_element_get_pad(GST_ELEMENT(data), "sink");
   4.254 +  g_debug("compose pad added");
   4.255  
   4.256 -    if (gst_pad_link (pad, sink_pad) != GST_PAD_LINK_OK) {
   4.257 -        g_warning ("Failed to link decode");
   4.258 -    }
   4.259 +  if (gst_pad_link(pad, sink_pad) != GST_PAD_LINK_OK)
   4.260 +	{
   4.261 +	  g_warning("Failed to link decode");
   4.262 +	}
   4.263  
   4.264 -    g_debug ("Linked ok");
   4.265 +  g_debug("Linked ok");
   4.266  }
   4.267  
   4.268  static void
   4.269 -_compose_add_file (GstElement *compose,
   4.270 -                   const gchar* e_name,
   4.271 -                   const gchar* uri,
   4.272 -                   MyStreamType type, 
   4.273 -                   guint priority)
   4.274 +_compose_add_file(GstElement * compose,
   4.275 +				  const gchar * e_name,
   4.276 +				  const gchar * uri, MyStreamType type, guint priority)
   4.277  {
   4.278 -    GstElement *src;
   4.279 +  GstElement *src;
   4.280  
   4.281 -    src = _create_src_element (e_name, uri, type, priority);
   4.282 -    gst_bin_add (GST_BIN (compose), src);
   4.283 +  src = _create_src_element(e_name, uri, type, priority);
   4.284 +  gst_bin_add(GST_BIN(compose), src);
   4.285  }
   4.286  
   4.287  
   4.288 -int 
   4.289 -main (int argc, char** argv)
   4.290 +int
   4.291 +main(int argc, char **argv)
   4.292  {
   4.293 -    GstElement* pipe;
   4.294 -    GstElement* gnl_compose_a;
   4.295 -    GstElement* gnl_compose_v;
   4.296 -    GstElement* asink;
   4.297 -    GstElement* vsink;
   4.298 -    GstElement* aqueue;
   4.299 -    GstElement* vqueue;
   4.300 +  GstElement *pipe;
   4.301 +  GstElement *gnl_compose_a;
   4.302 +  GstElement *gnl_compose_v;
   4.303 +  GstElement *asink;
   4.304 +  GstElement *vsink;
   4.305 +  GstElement *aqueue;
   4.306 +  GstElement *vqueue;
   4.307  
   4.308 -    g_type_init ();
   4.309 -    gst_init (&argc, &argv);
   4.310 +  g_type_init();
   4.311 +  gst_init(&argc, &argv);
   4.312  
   4.313 -	mainloop = g_main_loop_new (NULL, FALSE);
   4.314 +  mainloop = g_main_loop_new(NULL, FALSE);
   4.315  
   4.316 -    pipe = gst_pipeline_new ("test_pipeline");
   4.317 +  pipe = gst_pipeline_new("test_pipeline");
   4.318  
   4.319 -    gnl_compose_a = gst_element_factory_make ("gnlcomposition", "acompose");
   4.320 -    g_return_val_if_fail (gnl_compose_a != NULL, 1);
   4.321 +  gnl_compose_a = gst_element_factory_make("gnlcomposition", "acompose");
   4.322 +  g_return_val_if_fail(gnl_compose_a != NULL, 1);
   4.323  
   4.324 -    gnl_compose_v = gst_element_factory_make ("gnlcomposition", "vcompose");
   4.325 -    g_return_val_if_fail (gnl_compose_v != NULL, 1);
   4.326 +  gnl_compose_v = gst_element_factory_make("gnlcomposition", "vcompose");
   4.327 +  g_return_val_if_fail(gnl_compose_v != NULL, 1);
   4.328  
   4.329  
   4.330 -    //_compose_add_file (gnl_compose_a, "src0", argv[1], MY_STREAM_TYPE_AUDIO, 1);
   4.331 -    //_compose_add_file (gnl_compose_a, "src1", argv[2], MY_STREAM_TYPE_AUDIO, 1);
   4.332 + //_compose_add_file (gnl_compose_a, "src0", argv[1], MY_STREAM_TYPE_AUDIO, 1);
   4.333 + //_compose_add_file (gnl_compose_a, "src1", argv[2], MY_STREAM_TYPE_AUDIO, 1);
   4.334  
   4.335 -    d = 0;
   4.336 +  d = 0;
   4.337  
   4.338 -    _compose_add_file (gnl_compose_v, "src2", argv[1], MY_STREAM_TYPE_VIDEO, 1);
   4.339 -    _compose_add_file (gnl_compose_v, "src3", argv[2], MY_STREAM_TYPE_VIDEO, 1);
   4.340 +  _compose_add_file(gnl_compose_v, "src2", argv[1], MY_STREAM_TYPE_VIDEO, 1);
   4.341 +  _compose_add_file(gnl_compose_v, "src3", argv[2], MY_STREAM_TYPE_VIDEO, 1);
   4.342  
   4.343  
   4.344 -    //aqueue = gst_element_factory_make ("queue", "aqueue");
   4.345 -    //asink = gst_element_factory_make ("alsasink", "asink");
   4.346 + //aqueue = gst_element_factory_make ("queue", "aqueue");
   4.347 + //asink = gst_element_factory_make ("alsasink", "asink");
   4.348  
   4.349 -    vqueue = gst_element_factory_make ("queue", "vqueue");
   4.350 -    vsink = gst_element_factory_make ("xvimagesink", "vsink");
   4.351 +  vqueue = gst_element_factory_make("queue", "vqueue");
   4.352 +  vsink = gst_element_factory_make("xvimagesink", "vsink");
   4.353  
   4.354 -    gst_bin_add_many (GST_BIN (pipe), gnl_compose_a, gnl_compose_v, 
   4.355 -            vqueue, vsink, 
   4.356 -            //aqueue, asink, 
   4.357 -            NULL);
   4.358 +  gst_bin_add_many(GST_BIN(pipe), gnl_compose_a, gnl_compose_v, vqueue, vsink,
   4.359 +				  //aqueue, asink, 
   4.360 +				   NULL);
   4.361  
   4.362 -    gst_element_link (vqueue, vsink);
   4.363 -    //gst_element_link (aqueue, asink);
   4.364 +  gst_element_link(vqueue, vsink);
   4.365 + //gst_element_link (aqueue, asink);
   4.366  
   4.367 -    //g_signal_connect (G_OBJECT (gnl_compose_a), "pad-added",
   4.368 -    //                  G_CALLBACK (_composition_pad_added_cb), aqueue);
   4.369 + //g_signal_connect (G_OBJECT (gnl_compose_a), "pad-added",
   4.370 + //                  G_CALLBACK (_composition_pad_added_cb), aqueue);
   4.371  
   4.372 -    g_signal_connect (G_OBJECT (gnl_compose_v), "pad-added",
   4.373 -                      G_CALLBACK (_composition_pad_added_cb), vqueue);
   4.374 +  g_signal_connect(G_OBJECT(gnl_compose_v), "pad-added",
   4.375 +				   G_CALLBACK(_composition_pad_added_cb), vqueue);
   4.376  
   4.377  
   4.378 -    //g_idle_add (_play, pipe);
   4.379 -    gst_element_set_state (GST_ELEMENT (pipe), GST_STATE_PLAYING);
   4.380 -	g_main_loop_run (mainloop);
   4.381 + //g_idle_add (_play, pipe);
   4.382 +  gst_element_set_state(GST_ELEMENT(pipe), GST_STATE_PLAYING);
   4.383 +  g_main_loop_run(mainloop);
   4.384  
   4.385 -	return 0;
   4.386 +  return 0;
   4.387  }