rem: g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN, _("Failed to open video output. It may not be available. " "Please select another video output in the Multimedia Systems Selector."));
add: if (video_sink) { g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN, _("Failed to open video output. It may not be available. " "Please select another video output in the Multimedia Systems Selector.")); } else { g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN, _("Could not find the video output. " "You may need to install additional GStreamer plugins, or select another video output in the Multimedia Systems Selector.")); }
context: bacon_video_widget_new (int width, int height,			BvwUseType type, GError ** err){  GConfValue *confvalue;  BaconVideoWidget *bvw;  GstElement *audio_sink = NULL, *video_sink = NULL;  gulong sig1, sig2;  gint i;  GError *local_err = NULL;  bvw = BACON_VIDEO_WIDGET (g_object_new                            (bacon_video_widget_get_type (), NULL));    bvw->priv->play = gst_element_factory_make ("playbin", "play");  if (!bvw->priv->play) {    g_set_error (err, BVW_ERROR, BVW_ERROR_PLUGIN_LOAD,		 _("Failed to create a GStreamer play object. "		   "Please check your GStreamer installation."));    g_object_unref (G_OBJECT (bvw));    return NULL;  }    bvw->priv->speakersetup = BVW_AUDIO_SOUND_STEREO;  bvw->priv->media_device = g_strdup ("/dev/dvd");  bvw->priv->init_width = 240;  bvw->priv->init_height = 180;  bvw->priv->visq = VISUAL_SMALL;  bvw->priv->show_vfx = FALSE;  bvw->priv->vis_element = NULL;  bvw->priv->tv_out_type = TV_OUT_NONE;  bvw->priv->connection_speed = 0;  bvw->priv->ratio_type = BVW_RATIO_AUTO;  bvw->priv->cursor_shown = TRUE;  bvw->priv->logo_mode = TRUE;  bvw->priv->auto_resize = TRUE;  /* gconf setting in backend */  bvw->priv->gc = gconf_client_get_default ();  gconf_client_notify_add (bvw->priv->gc, "/apps/totem",      cb_gconf, bvw, NULL, NULL);  if (type == BVW_USE_TYPE_VIDEO || type == BVW_USE_TYPE_AUDIO) {    audio_sink = gst_gconf_get_default_audio_sink ();    if (!GST_IS_ELEMENT (audio_sink))      {        g_message ("failed to render default audio sink from gconf");        return NULL;      }  }  if (type == BVW_USE_TYPE_VIDEO) {    video_sink = gst_gconf_get_default_video_sink ();    if (!GST_IS_ELEMENT (video_sink)) {        g_message ("failed to render default video sink from gconf");        return NULL;    } else {      GDate d;      g_date_clear (&d, 1);      g_date_set_time (&d, time (NULL));      if (g_date_day (&d) == 1 && g_date_month (&d) == G_DATE_APRIL) {        confvalue = gconf_client_get_without_default (bvw->priv->gc,            GCONF_PREFIX"/puzzle_year", NULL);        if (!confvalue ||            gconf_value_get_int (confvalue) != g_date_year (&d)) {          GstElement *puzzle;          gconf_client_set_int (bvw->priv->gc, GCONF_PREFIX"/puzzle_year",              g_date_year (&d), NULL);          puzzle = gst_element_factory_make ("puzzle", NULL);          if (puzzle) {            GstElement *bin = gst_bin_new ("videosinkbin");            gst_bin_add_many (GST_BIN (bin), puzzle, video_sink, NULL);            gst_element_link (puzzle, video_sink);            gst_element_add_ghost_pad (bin,                gst_element_get_pad (puzzle, "sink"), "sink");            video_sink = bin;          }        }        if (confvalue)          gconf_value_free (confvalue);      }    }  }  if (video_sink == NULL) {    video_sink = gst_element_factory_make ("fakesink", "fakevideosink");  }  if (audio_sink == NULL) {    audio_sink = gst_element_factory_make ("fakesink", "fakeaudiosink");  }  /* check video */  sig1 = g_signal_connect (video_sink, "error", G_CALLBACK (out_error),      			   &local_err);  if (gst_element_set_state (video_sink,			     GST_STATE_READY) != GST_STATE_SUCCESS) {    /* Videosink not available; give user feedback on what to do now */    if (err) {      if (local_err && local_err->domain == GST_RESOURCE_ERROR) {	switch (local_err->code) {	  case GST_RESOURCE_ERROR_NOT_FOUND:	  case GST_RESOURCE_ERROR_OPEN_WRITE:	    /* can use the default below... */	    break;	  case GST_RESOURCE_ERROR_BUSY:	    g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN,		_("The video output is in use by another application. "		  "Please close other video applications, or select another video output in the Multimedia Systems Selector."));	    break;	  default:	    break;	}      }      if (!*err) {	/* "default" */	g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN,	    _("Failed to open video output. It may not be available. "	      "Please select another video output in the Multimedia Systems Selector."));      }      if (local_err)	g_error_free (local_err);    }    gst_object_unref (GST_OBJECT (video_sink));    gst_object_unref (GST_OBJECT (audio_sink));    g_free (bvw);    return NULL;  }  g_signal_handler_disconnect (video_sink, sig1);  /* check audio */  sig2 = g_signal_connect (audio_sink, "error", G_CALLBACK (out_error),			   &local_err);  if (gst_element_set_state (audio_sink,			     GST_STATE_READY) != GST_STATE_SUCCESS) {    if (err) {      if (local_err && local_err->domain == GST_RESOURCE_ERROR) {	switch (local_err->code) {	  case GST_RESOURCE_ERROR_OPEN_WRITE:	  case GST_RESOURCE_ERROR_OPEN_READ_WRITE:	    /* use default below */	    break;	  case GST_RESOURCE_ERROR_BUSY:	    g_set_error (err, BVW_ERROR, BVW_ERROR_AUDIO_BUSY,		_("The audio output is in use by another application. "		  "Please select another audio output in the Multimedia Systems Selector. "		  "You may want to consider using a sound server."));	    break;	  case GST_RESOURCE_ERROR_NOT_FOUND:	    g_set_error (err, BVW_ERROR, BVW_ERROR_AUDIO_PLUGIN,		_("The requested audio output was not found. "		  "Please select another audio output in the Multimedia Systems Selector"));	    break;	  default:	    break;	}      }      if (!*err) {	/* "default" */        g_set_error (err, BVW_ERROR, BVW_ERROR_AUDIO_PLUGIN,	    _("Failed to open audio output. You may not have permission to open the sound device, or the sound server may not be running. "	      "Please select another audio output in the Multimedia Systems Selector."));      }      if (local_err)	g_error_free (local_err);    }    gst_object_unref (GST_OBJECT (video_sink));    gst_object_unref (GST_OBJECT (audio_sink));    g_free (bvw);    return NULL;  }  /* somehow, alsa hangs? */  gst_element_set_state (audio_sink, GST_STATE_NULL);  g_signal_handler_disconnect (audio_sink, sig2);  /* now tell playbin */  g_object_set (G_OBJECT (bvw->priv->play), "video-sink",		video_sink, NULL);  g_object_set (G_OBJECT (bvw->priv->play), "audio-sink",		audio_sink, NULL);  g_signal_connect (GST_PAD_REALIZE (gst_element_get_pad (audio_sink, "sink")),		    "fixate", G_CALLBACK (cb_audio_fixate), (gpointer) bvw);  bvw->priv->vis_plugins_list = NULL;  g_signal_connect (G_OBJECT (bvw->priv->play), "eos",		    (GtkSignalFunc) got_eos, (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "state-change",		    G_CALLBACK (state_change), (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "found_tag",		    G_CALLBACK (got_found_tag), (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "error",		    G_CALLBACK (got_error), (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "buffering",		    G_CALLBACK (got_buffering), (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "notify::source",		    G_CALLBACK (got_source), (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "notify::stream-info",		    G_CALLBACK (stream_info_set), (gpointer) bvw);  g_signal_connect (G_OBJECT (bvw->priv->play), "group-switch",		    G_CALLBACK (group_switch), (gpointer) bvw);  if (TOTEM_OBJECT_HAS_SIGNAL (bvw->priv->play, "got-redirect") != FALSE) {    g_signal_connect (G_OBJECT (bvw->priv->play), "got-redirect",		      G_CALLBACK (got_redirect), (gpointer) bvw);  }  /* We try to get an element supporting XOverlay interface */  if (type == BVW_USE_TYPE_VIDEO && GST_IS_BIN (bvw->priv->play)) {    GstElement *element = NULL;    GList *elements = NULL, *l_elements = NULL;        element = gst_bin_get_by_interface (GST_BIN (video_sink),                                        GST_TYPE_X_OVERLAY);    if (GST_IS_X_OVERLAY (element))      bvw->priv->xoverlay = GST_X_OVERLAY (element);        /* Get them all and prefer hardware one */    elements = gst_bin_get_all_by_interface (GST_BIN (bvw->priv->play),                                             GST_TYPE_COLOR_BALANCE);    l_elements = elements;        /* We take the first one */    if (elements && GST_IS_COLOR_BALANCE (elements->data))      element = GST_ELEMENT (elements->data);        while (elements)      {        GstElement *local_element = NULL;        GstColorBalanceClass *cb_class = NULL;                if (elements->data && GST_IS_COLOR_BALANCE (elements->data))          {            local_element = GST_ELEMENT (elements->data);            cb_class = GST_COLOR_BALANCE_GET_CLASS (elements->data);                    /* If one of them is hardware type we use that one then */            if (GST_COLOR_BALANCE_TYPE (cb_class) == GST_COLOR_BALANCE_HARDWARE)              {                element = local_element;              }          }                  elements = g_list_next (elements);      }        if (l_elements)      g_list_free (l_elements);        elements = l_elements = NULL;        if (GST_IS_COLOR_BALANCE (element))      {        bvw->priv->balance = GST_COLOR_BALANCE (element);      }  }  /* Setup brightness and contrast */  for (i = 0; i < 4; i++) {    confvalue = gconf_client_get_without_default (bvw->priv->gc,        video_props_str[i], NULL);    if (confvalue != NULL) {      bacon_video_widget_set_video_property (bvw, i,        gconf_value_get_int (confvalue));      gconf_value_free (confvalue);    }  }  /* audio out, if any */  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/audio_output_type", NULL);  if (confvalue != NULL &&      (type != BVW_USE_TYPE_METADATA && type != BVW_USE_TYPE_CAPTURE)) {    bvw->priv->speakersetup = gconf_value_get_int (confvalue);    gconf_value_free (confvalue);  }  /* visualization */  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/show_vfx", NULL);  if (confvalue != NULL) {    bvw->priv->show_vfx = gconf_value_get_bool (confvalue);    gconf_value_free (confvalue);  }  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/visual_quality", NULL);  if (confvalue != NULL) {    bvw->priv->visq = gconf_value_get_int (confvalue);    gconf_value_free (confvalue);  }#if 0  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/visual", NULL);  if (confvalue != NULL) {    bvw->priv->vis_element =         gst_element_factory_make (gconf_value_get_string (confvalue), NULL);    gconf_value_free (confvalue);  }#endif  setup_vis (bvw);  /* tv/conn (not used yet) */  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/tv_out_type", NULL);  if (confvalue != NULL) {    bvw->priv->tv_out_type = gconf_value_get_int (confvalue);    gconf_value_free (confvalue);  }  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/connection_speed", NULL);  if (confvalue != NULL) {    bvw->priv->connection_speed = gconf_value_get_int (confvalue);    gconf_value_free (confvalue);  }  /* those are private to us, i.e. not Xine-compatible */  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/buffer-size", NULL);  if (confvalue != NULL) {    g_object_set (G_OBJECT (bvw->priv->play), "queue-size",        (guint64) GST_SECOND * gconf_value_get_float (confvalue), NULL);    gconf_value_free (confvalue);  }  confvalue = gconf_client_get_without_default (bvw->priv->gc,      GCONF_PREFIX"/network-buffer-threshold", NULL);  if (confvalue != NULL) {    g_object_set (G_OBJECT (bvw->priv->play), "queue-threshold",        (guint64) GST_SECOND * gconf_value_get_float (confvalue), NULL);    gconf_value_free (confvalue);  }  return GTK_WIDGET (bvw);}