[svn r18] Configure the GStreamer bus call.
1.1 --- a/gmyth/src/libgmyth/gmyth_tvplayer.c Tue Sep 26 16:16:28 2006 +0100
1.2 +++ b/gmyth/src/libgmyth/gmyth_tvplayer.c Wed Sep 27 00:08:03 2006 +0100
1.3 @@ -49,8 +49,8 @@
1.4
1.5 /*
1.6 static gboolean idle_state (gpointer data);
1.7 +*/
1.8 static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data);
1.9 -*/
1.10
1.11 static void gmyth_tvplayer_class_init (GMythTVPlayerClass *klass);
1.12 static void gmyth_tvplayer_init (GMythTVPlayer *object);
1.13 @@ -300,8 +300,8 @@
1.14 g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
1.15 g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
1.16
1.17 -// gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)),
1.18 -// bus_call, tvplayer);
1.19 + gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)),
1.20 + bus_call, tvplayer);
1.21
1.22 gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue,
1.23 videodec, videosink, audioqueue, audiodec, audioconv, audiosink, NULL);
1.24 @@ -487,24 +487,18 @@
1.25 return TRUE;
1.26 }
1.27
1.28 -#if 0
1.29 static gboolean
1.30 bus_call (GstBus * bus, GstMessage * msg, gpointer data)
1.31 {
1.32 - GMythTVPlayer *tvplayer = GMYTH_TVPLAYER ( data );
1.33 - GMainLoop *loop = tvplayer->loop;
1.34 + //GMythTVPlayer *tvplayer = GMYTH_TVPLAYER ( data );
1.35 + //GMainLoop *loop = tvplayer->loop;
1.36
1.37 switch (GST_MESSAGE_TYPE (msg)) {
1.38 case GST_MESSAGE_EOS:
1.39 printf ("End of stream\n");
1.40 -/* if (miptv_ui->idle_id != 0) {
1.41 - g_source_remove (miptv_ui->idle_id);
1.42 - miptv_ui->idle_id = 0;
1.43 - }*/
1.44 -
1.45 //g_idle_add ((GSourceFunc) idle_eos, data);
1.46 - gst_element_set_state (GST_ELEMENT (GST_MESSAGE_SRC (msg)),
1.47 - GST_STATE_READY);
1.48 + gst_element_set_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), GST_STATE_NULL );
1.49 + gst_element_set_locked_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), FALSE );
1.50 break;
1.51 case GST_MESSAGE_ERROR:
1.52 {
1.53 @@ -517,37 +511,9 @@
1.54 printf ("Error: %s\n", err->message);
1.55 g_error_free (err);
1.56
1.57 - g_main_loop_quit (loop);
1.58 + //g_main_loop_quit (loop);
1.59 }
1.60 break;
1.61 - case GST_MESSAGE_STATE_CHANGED:{
1.62 - GstState oldstate;
1.63 - GstState newstate;
1.64 - GstState pending;
1.65 - GstPlayerWindowStateChange *st =
1.66 - g_new (GstPlayerWindowStateChange, 1);
1.67 -
1.68 - gst_message_parse_state_changed (msg,
1.69 - &oldstate,
1.70 - &newstate, &pending);
1.71 -
1.72 - st->play = tvplayer->gst_pipeline;
1.73 - gst_object_ref (GST_OBJECT (tvplayer->gst_pipeline));
1.74 - st->old_state = oldstate;
1.75 - st->new_state = newstate;
1.76 -
1.77 - st->tvplayer = tvplayer;
1.78 -
1.79 - /* State debug messages */
1.80 - printf ("oldstate = %s, newstate = %s, pendingstate = %s\n",
1.81 - gst_element_state_get_name (oldstate),
1.82 - gst_element_state_get_name (newstate),
1.83 - gst_element_state_get_name (pending));
1.84 -
1.85 - //g_idle_add ((GSourceFunc) idle_state, st);
1.86 -
1.87 - }
1.88 - break;
1.89 default:
1.90 printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg)));
1.91 printf ("\n");
1.92 @@ -556,7 +522,6 @@
1.93
1.94 return TRUE;
1.95 }
1.96 -#endif
1.97
1.98
1.99 #if 0