[totem] Remove built-in DVB support



commit cb844acc76ccf9cd5a7c6fe808b1c330222a993c
Author: Sebastian Pölsterl <sebp k-d-w org>
Date:   Tue Dec 22 15:13:49 2009 +0000

    Remove built-in DVB support
    
    This will now be handled through gnome-dvb-daemon's Totem plugin.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=515759

 src/Makefile.am                           |    2 -
 src/backend/bacon-video-widget-gst-0.10.c |  195 +----------------------------
 src/totem-dvb-setup.c                     |  134 --------------------
 src/totem-dvb-setup.h                     |   47 -------
 src/totem-menu.c                          |   58 ---------
 src/totem-object.c                        |   46 -------
 6 files changed, 1 insertions(+), 481 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 37b954c..cb4a8a3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,8 +84,6 @@ libtotem_main_la_SOURCES = \
 	ev-sidebar.h			\
 	totem-subtitle-encoding.c	\
 	totem-subtitle-encoding.h	\
-	totem-dvb-setup.c		\
-	totem-dvb-setup.h		\
 	totem-profile.h
 
 libtotem_main_la_CPPFLAGS = \
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 6076298..13bdc4c 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -5388,146 +5388,6 @@ done:
   return res;
 }
 
-static char *
-bacon_video_widget_get_channels_file (void)
-{
-  gchar *filename;
-
-  filename = g_strdup(g_getenv("GST_DVB_CHANNELS_CONF"));
-  if (filename == NULL || g_file_test (filename, G_FILE_TEST_IS_REGULAR) == FALSE) {
-    gchar *directory;
-    guint major, minor, micro, nano;
-
-    g_free (filename);
-    gst_version(&major, &minor, &micro, &nano);
-    directory = g_strdup_printf (".gstreamer-%d.%d", major, minor);
-    filename = g_build_filename (g_get_home_dir (), directory, "dvb-channels.conf", NULL);
-    g_free (directory);
-
-    if (g_file_test (filename, G_FILE_TEST_IS_REGULAR) == FALSE) {
-      g_free (filename);
-      filename = g_build_filename (g_get_home_dir (), ".xine", "channels.conf", NULL);
-    }
-  }
-
-  return filename;
-}
-
-static char
-bacon_video_widget_dvb_get_adapter_type (const char *device)
-{
-  GstElement *dvbelement;
-  GstBus *dvbbus;
-  GstPipeline * pipeline;
-  char adapter_type;
-
-  adapter_type = 'U'; /* unknown */
-  /* let gstreamer know what adapter to use */
-  g_setenv("GST_DVB_ADAPTER", device, TRUE);
-
-  /* HACK: find out type of adapter so it filters out the channels
-   * based on the type of adapter. */
-  dvbelement = gst_element_factory_make ("dvbsrc", "test_dvbsrc");
-  g_object_set (G_OBJECT (dvbelement), "adapter", atoi (device), NULL);
-
-  pipeline = GST_PIPELINE (gst_pipeline_new (""));
-  gst_bin_add (GST_BIN (pipeline), dvbelement);
-  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
-  gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, GST_CLOCK_TIME_NONE);
-  dvbbus = gst_pipeline_get_bus (pipeline);
-
-  while (gst_bus_have_pending (dvbbus)) {
-    GstMessage* msg;
-
-    msg = gst_bus_pop (dvbbus);
-    if (msg->type == GST_MESSAGE_ELEMENT && msg->src == GST_OBJECT(dvbelement)) {
-      GstStructure *structure;
-
-      structure = msg->structure;
-
-      if (g_str_equal (gst_structure_get_name (structure), "dvb-adapter") != FALSE) {
-        const GValue* val;
-
-	val = gst_structure_get_value (structure, "type");
-	if (val) {
-	  if (g_str_equal (g_value_get_string (val), "DVB-T") != FALSE) {
-	    adapter_type = 'T';
-	  } else if (g_str_equal (g_value_get_string (val), "DVB-S") != FALSE) {
-	    adapter_type = 'S';
-	  } else if (g_str_equal (g_value_get_string (val), "DVB-C") != FALSE) {
-	    adapter_type = 'C';
-	  } else if (g_str_equal (g_value_get_string (val), "ATSC") != FALSE) {
-	    adapter_type = 'A';
-	  }
-	}
-	gst_message_unref (msg);
-	break;
-      }
-    }
-    gst_message_unref (msg);
-  }
-  g_object_unref (dvbbus);
-  gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_NULL);
-  g_object_unref (G_OBJECT(pipeline));
-
-  return adapter_type;
-}
-
-static gchar **
-bacon_video_widget_get_dvb_mrls (const char *device)
-{
-  gchar* filename;
-  gchar* contents;
-  GPtrArray *array;
-  gchar adapter_type;
-
-  adapter_type = bacon_video_widget_dvb_get_adapter_type (device);
-  filename = bacon_video_widget_get_channels_file ();
-
-  if (g_file_get_contents (filename, &contents, NULL, NULL) != FALSE) {
-    gchar **lines, *line;
-    guint i;
-
-    lines = g_strsplit (contents, "\n", 0);
-    array = g_ptr_array_new ();
-
-    for (i = 0; lines[i] != NULL; i++) {
-      line = lines[i];
-
-      if (line[0] != '#') {
-	gchar** fields = g_strsplit(line, ":", 0);
-	if ((g_strv_length (fields) == 13 && adapter_type == 'T') ||
-	    (g_strv_length (fields) == 8 && adapter_type == 'S') ||
-	    (g_strv_length (fields) == 9 && adapter_type == 'C') ||
-	    (g_strv_length (fields) == 6 && adapter_type == 'A')) {
-	  g_ptr_array_add (array, g_strdup_printf("dvb://%s", fields[0]));
-	} else if (g_strv_length (fields) == 0) {
-	  /* Empty line */
-	  g_strfreev (fields);
-	  continue;
-	} else {
-	  /* Exit if the channels.conf is in a format we don't understand */
-	  GST_DEBUG ("'%s' file has line %d with the wrong number of fields (%d) for adapter type %c",
-		     filename, i + 1, g_strv_length (fields), adapter_type);
-	  g_free (filename);
-	  g_ptr_array_free (array, TRUE);
-	  return (char **) NULL;
-	}
-	g_strfreev(fields);
-      }
-    }
-    g_free (filename);
-    g_strfreev(lines);
-  } else {
-    GST_DEBUG ("Couldn't get contents of file: '%s'", filename);
-    g_free (filename);
-    return NULL;
-  }
-  if (array->len >= 1)
-    g_ptr_array_add (array, NULL);
-  return (char **) g_ptr_array_free (array, FALSE);
-}
-
 /**
  * bacon_video_widget_get_mrls:
  * @bvw: a #BaconVideoWidget
@@ -5538,7 +5398,7 @@ bacon_video_widget_get_dvb_mrls (const char *device)
  * Returns an array of MRLs available for the given @device and media @type.
  *
  * @device should typically be the number of the device (e.g. %0 for the first
- * DVD drive, or the number of the DVB adapter).
+ * DVD drive.
  *
  * @type can be any value from #TotemDiscMediaType, but a %BVW_ERROR_INVALID_LOCATION error
  * will be returned if @type is %MEDIA_TYPE_CDDA, as CDDA support has been removed from
@@ -5548,10 +5408,6 @@ bacon_video_widget_get_dvb_mrls (const char *device)
  * not exist for the given @type (for the GStreamer backend). *
  * If @device does not exist, a %BVW_ERROR_INVALID_DEVICE error will be returned.
  *
- * If @type is %MEDIA_TYPE_DVB and the DVB channels file (as given by
- * bacon_video_widget_get_channels_file() for the GStreamer backend)
- * does not exist, a %BVW_ERROR_FILE_NOT_FOUND error will be returned.
- *
  * Return value: a %NULL-terminated array of MRLs, or %NULL; free with g_strfreev()
  **/
 gchar **
@@ -5598,55 +5454,6 @@ bacon_video_widget_get_mrls (BaconVideoWidget * bvw,
       }
       break;
     }
-    case MEDIA_TYPE_DVB: {
-      gchar *filename;
-
-      if (!gst_default_registry_check_feature_version ("dvbbasebin", 0, 10, 6) ||
-          !gst_default_registry_check_feature_version ("mpegtsparse", 0, 10, 6) ||
-          !gst_default_registry_check_feature_version ("dvbsrc", 0, 10, 6)) {
-        GST_DEBUG ("Missing one or all of: dvbsrc, dvbbasebin, mpegtsparse");
-	g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
-                             "XXX Do not use XXX");
-        return NULL;
-      }
-      if (!gst_default_registry_check_feature_version ("mpegpsdemux", 0, 10, 0) &&
-	  gst_default_registry_check_feature_version ("flupsdemux", 0, 10, 0) &&
-      	  !gst_default_registry_check_feature_version ("flupsdemux", 0, 10, 15)) {
-        GST_DEBUG ("flupsdemux not new enough for DVB playback");
-	g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
-                             "XXX Do not use XXX");
-	return NULL;
-      }
-
-      filename = g_strdup_printf ("/dev/dvb/adapter%s/frontend0", device);
-      if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
-	g_free (filename);
-	g_set_error_literal (error, BVW_ERROR, BVW_ERROR_INVALID_DEVICE,
-                             "XXX Do not use XXX");
-	return NULL;
-      }
-      g_free (filename);
-
-      filename = bacon_video_widget_get_channels_file ();
-      if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
-        mrls = bacon_video_widget_get_dvb_mrls (device);
-	if (mrls == NULL) {
-	  GST_DEBUG ("broken channels file '%s'", filename);
-	  g_free (filename);
-	  g_set_error_literal (error, BVW_ERROR, BVW_ERROR_FILE_NOT_FOUND,
-			       "XXX Do not use XXX");
-	  return NULL;
-	}
-      } else {
-        GST_DEBUG ("no channels file '%s'", filename);
-	g_free (filename);
-	g_set_error_literal (error, BVW_ERROR, BVW_ERROR_FILE_NOT_FOUND,
-                             "XXX Do not use XXX");
-	return NULL;
-      }
-      g_free (filename);
-      break;
-    }
     case MEDIA_TYPE_CDDA:
       g_set_error_literal (error, BVW_ERROR, BVW_ERROR_INVALID_LOCATION,
                            "XXX Do not use XXX");
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 16d8f01..6692c3c 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -760,19 +760,6 @@ on_play_disc_activate (GtkAction *action, Totem *totem)
 	totem_action_play_media_device (totem, device_path);
 }
 
-/* Play DVB menu items */
-static void
-on_play_dvb_activate (GtkAction *action, Totem *totem)
-{
-	int adapter;
-	char *str;
-
-	adapter = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (action), "adapter"));
-	str = g_strdup_printf ("%d", adapter);
-	totem_action_play_media (totem, MEDIA_TYPE_DVB, str);
-	g_free (str);
-}
-
 static const char *
 get_icon_name_for_gicon (GtkIconTheme *theme,
 			 GIcon *icon)
@@ -1090,47 +1077,6 @@ update_drive_menu_items (GtkMenuItem *movie_menuitem, Totem *totem)
 }
 
 static void
-update_dvb_menu_items (GtkMenuItem *movie_menuitem, Totem *totem)
-{
-	guint i;
-
-	for (i = 0 ; i < 8 ; i++) {
-		char *devicenode;
-
-		devicenode = g_strdup_printf("/dev/dvb/adapter%d/frontend0", i);
-
-		if (g_file_test (devicenode, G_FILE_TEST_EXISTS) != FALSE) {
-			char* label, *name, *adapter_name;
-			GtkAction* action;
-
-			/* translators: the index of the adapter
-			 * DVB Adapter 1 */
-			adapter_name = g_strdup_printf (_("DVB Adapter %u"), i);
-			/* translators:
-			 * Watch TV on 'DVB Adapter 1'
-			 * or
-			 * Watch TV on 'Hauppauge Nova-T Stick' */
-			label = g_strdup_printf (_("Watch TV on \'%s\'"), adapter_name);
-			g_free (adapter_name);
-			name = g_strdup_printf ("dvbdevice%d", i);
-			action = gtk_action_new (name, label, NULL, NULL);
-
-			g_object_set (G_OBJECT(action), "icon-name", "totem-tv", "sensitive", TRUE, NULL);
-			gtk_action_group_add_action (totem->devices_action_group, action);
-			g_object_unref (action);
-			gtk_ui_manager_add_ui (totem->ui_manager, totem->devices_ui_id,
-					       "/tmw-menubar/movie/devices-placeholder", name, name,
-					       GTK_UI_MANAGER_MENUITEM, FALSE);
-			g_object_set_data_full (G_OBJECT (action),
-						"adapter", GINT_TO_POINTER (i), NULL);
-			g_signal_connect (G_OBJECT (action), "activate",
-					  G_CALLBACK (on_play_dvb_activate), totem);
-		}
-		g_free (devicenode);
-	}
-}
-
-static void
 on_movie_menu_select (GtkMenuItem *movie_menuitem, Totem *totem)
 {
 	//FIXME we should check whether there's new DVB items
@@ -1153,10 +1099,6 @@ on_movie_menu_select (GtkMenuItem *movie_menuitem, Totem *totem)
 
 	update_drive_menu_items (movie_menuitem, totem);
 
-	/* Check for DVB */
-	/* FIXME we should only update if we have an updated as per HAL */
-	update_dvb_menu_items (movie_menuitem, totem);
-
 	gtk_ui_manager_ensure_update (totem->ui_manager);
 }
 
diff --git a/src/totem-object.c b/src/totem-object.c
index 799de8b..703669b 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -61,7 +61,6 @@
 #include "ev-sidebar.h"
 #include "totem-playlist.h"
 #include "bacon-video-widget.h"
-#include "totem-dvb-setup.h"
 #include "totem-statusbar.h"
 #include "totem-time-label.h"
 #include "totem-sidebar.h"
@@ -1182,14 +1181,6 @@ totem_action_open_dialog (Totem *totem, const char *path, gboolean play)
 	return TRUE;
 }
 
-static void
-totem_dvb_setup_result (int result, const char *device, gpointer user_data)
-{
-	Totem *totem = (Totem *) user_data;
-
-	totem_action_play_media (totem, MEDIA_TYPE_DVB, device);
-}
-
 static gboolean
 totem_action_load_media (Totem *totem, TotemDiscMediaType type, const char *device)
 {
@@ -1219,29 +1210,6 @@ totem_action_load_media (Totem *totem, TotemDiscMediaType type, const char *devi
 				msg = g_strdup_printf (_("Totem cannot play this type of media (%s) because it does not have the appropriate plugins to be able to read from the disc."), _(totem_cd_get_human_readable_name (type)));
 			else
 				msg = g_strdup_printf (_("Totem cannot play this type of media (%s) because you do not have the appropriate plugins to handle it."), _(totem_cd_get_human_readable_name (type)));
-		/* Device doesn't exist */
-		} else if (g_error_matches (error, BVW_ERROR, BVW_ERROR_INVALID_DEVICE) != FALSE) {
-			g_assert (type == MEDIA_TYPE_DVB);
-			totem_action_error (_("Totem cannot play TV, because no TV adapters are present or they are not supported."),
-					    _("Please insert a supported TV adapter."), totem);
-			return FALSE;
-		/* No channels.conf file */
-		} else if (g_error_matches (error, BVW_ERROR, BVW_ERROR_FILE_NOT_FOUND) != FALSE) {
-			g_assert (type == MEDIA_TYPE_DVB);
-
-			if (totem_dvb_setup_device (device, GTK_WINDOW (totem->win), totem_dvb_setup_result, totem) == TOTEM_DVB_SETUP_STARTED_OK)
-				return FALSE;
-
-			link = "http://www.gnome.org/projects/totem/#dvb";;
-			link_text = _("More information about watching TV");
-			msg = g_strdup (_("Totem is missing a channels listing to be able to tune the receiver."));
-			secondary = _("Please follow the instructions provided in the link to create a channels listing.");
-		} else if (g_error_matches (error, BVW_ERROR, BVW_ERROR_DEVICE_BUSY) != FALSE) {
-			g_assert (type == MEDIA_TYPE_DVB);
-			msg = g_strdup_printf(_("Totem cannot play this type of media (%s) because the TV device is busy."), _(totem_cd_get_human_readable_name (type)));
-			totem_action_error (msg, _("Please try again later."), totem);
-			g_free (msg);
-			return FALSE;
 		/* Unsupported type (ie. CDDA) */
 		} else if (g_error_matches (error, BVW_ERROR, BVW_ERROR_INVALID_LOCATION) != FALSE) {
 			msg = g_strdup_printf(_("Totem cannot play this type of media (%s) because it is not supported."), _(totem_cd_get_human_readable_name (type)));
@@ -2805,9 +2773,6 @@ totem_action_open_files_list (Totem *totem, GSList *list)
 			} else if (g_str_has_prefix (filename, "dvb:/") != FALSE) {
 				totem_playlist_add_mrl (totem->playlist, data, NULL);
 				changed = TRUE;
-			} else if (g_str_equal (filename, "dvb:") != FALSE) {
-				totem_action_load_media (totem, MEDIA_TYPE_DVB, "0");
-				changed = TRUE;
 			} else if (totem_playlist_add_mrl (totem->playlist, filename, NULL) != FALSE) {
 				changed = TRUE;
 			}
@@ -3094,8 +3059,6 @@ totem_action_remote (Totem *totem, TotemRemoteCommand cmd, const char *url)
 		} else if (strcmp (url, "vcd:") == 0) {
 			/* FIXME b0rked */
 			totem_action_play_media (totem, MEDIA_TYPE_VCD, NULL);
-		} else if (g_str_has_prefix (url, "dvb:") != FALSE) {
-			totem_action_load_media (totem, MEDIA_TYPE_DVB, "0");
 		} else {
 			totem_playlist_add_mrl_with_cursor (totem->playlist, url, NULL);
 		}
@@ -3439,15 +3402,6 @@ on_eos_event (GtkWidget *widget, Totem *totem)
 	if (bacon_video_widget_get_logo_mode (totem->bvw) != FALSE)
 		return FALSE;
 
-	/* EOS on DVB means that we lost the signal */
-	if (totem->mrl != NULL && g_str_has_prefix (totem->mrl, "dvb://") != FALSE) {
-		totem_action_stop (totem);
-		totem_action_error_and_exit (_("TV signal lost"),
-					     _("Please verify your hardware setup."),
-					     totem);
-		return FALSE;
-	}
-
 	if (totem_playlist_has_next_mrl (totem->playlist) == FALSE &&
 	    totem_playlist_get_repeat (totem->playlist) == FALSE &&
 	    (totem_playlist_get_last (totem->playlist) != 0 ||



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]