1.1 --- a/maemo-ui/src/mmyth_tvplayer.c Thu Sep 28 22:05:21 2006 +0100
1.2 +++ b/maemo-ui/src/mmyth_tvplayer.c Thu Nov 09 19:12:55 2006 +0000
1.3 @@ -89,9 +89,9 @@
1.4 s = gst_caps_to_string (pad->caps);
1.5
1.6 if ( s[0] == 'a') {
1.7 - ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue, "sink"));
1.8 + ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue1, "sink"));
1.9 } else {
1.10 - ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue, "sink"));
1.11 + ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue1, "sink"));
1.12 }
1.13
1.14 g_free(s);
1.15 @@ -100,38 +100,41 @@
1.16 static gboolean
1.17 expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
1.18 {
1.19 - MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data);
1.20 + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data);
1.21
1.22 if (tvplayer && tvplayer->videow) {
1.23 - gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink),
1.24 - GDK_WINDOW_XWINDOW (widget->window));
1.25 + gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink),
1.26 + GDK_WINDOW_XWINDOW (widget->window));
1.27 return TRUE;
1.28 }
1.29 -
1.30 +
1.31 g_warning ("MMythTVPlayer expose called before setting video window\n");
1.32 -
1.33 - return FALSE;
1.34 +
1.35 + return FALSE;
1.36 }
1.37
1.38 static void
1.39 mmyth_tvplayer_init (MMythTVPlayer *tvplayer)
1.40 {
1.41 - tvplayer->gst_pipeline = NULL;
1.42 - tvplayer->gst_source = NULL;
1.43 - tvplayer->gst_videodec = NULL;
1.44 - tvplayer->gst_videosink = NULL;
1.45 - tvplayer->videoqueue = NULL;
1.46 - tvplayer->audioqueue = NULL;
1.47 -
1.48 - /* GTKWidget for rendering the video */
1.49 - tvplayer->videow = NULL;
1.50 + tvplayer->gst_pipeline = NULL;
1.51 + tvplayer->gst_source = NULL;
1.52 + tvplayer->gst_videodec = NULL;
1.53 + tvplayer->gst_videosink = NULL;
1.54 + tvplayer->gst_videocolortrs = NULL;
1.55 + tvplayer->videoqueue1 = NULL;
1.56 + tvplayer->videoqueue2 = NULL;
1.57 + tvplayer->audioqueue1 = NULL;
1.58 + tvplayer->audioqueue2 = NULL;
1.59 +
1.60 + /* GTKWidget for rendering the video */
1.61 + tvplayer->videow = NULL;
1.62 tvplayer->expose_handler = 0;
1.63 -
1.64 +
1.65 tvplayer->backend_hostname = NULL;
1.66 tvplayer->backend_port = 0;
1.67 tvplayer->local_hostname = NULL;
1.68
1.69 - tvplayer->remote_encoder = NULL;
1.70 + tvplayer->recorder = NULL;
1.71 tvplayer->tvchain = NULL;
1.72 tvplayer->proginfo = NULL;
1.73 }
1.74 @@ -161,8 +164,8 @@
1.75 g_object_unref (tvplayer->videow);
1.76 }
1.77
1.78 - if ( tvplayer->remote_encoder != NULL )
1.79 - g_object_unref (tvplayer->remote_encoder);
1.80 + if ( tvplayer->recorder != NULL )
1.81 + g_object_unref (tvplayer->recorder);
1.82 if ( tvplayer->tvchain != NULL )
1.83 g_object_unref (tvplayer->tvchain);
1.84 if ( tvplayer->proginfo != NULL )
1.85 @@ -175,12 +178,18 @@
1.86 g_object_unref (tvplayer->gst_source);
1.87 if ( tvplayer->gst_videodec != NULL )
1.88 g_object_unref (tvplayer->gst_videodec);
1.89 + if ( tvplayer->gst_videocolortrs != NULL )
1.90 + g_object_unref (tvplayer->gst_videocolortrs);
1.91 if ( tvplayer->gst_videosink != NULL )
1.92 g_object_unref (tvplayer->gst_videosink);
1.93 - if ( tvplayer->videoqueue != NULL )
1.94 - g_object_unref (tvplayer->videoqueue);
1.95 - if ( tvplayer->audioqueue != NULL )
1.96 - g_object_unref (tvplayer->audioqueue);
1.97 + if ( tvplayer->videoqueue1 != NULL )
1.98 + g_object_unref (tvplayer->videoqueue1);
1.99 + if ( tvplayer->videoqueue2 != NULL )
1.100 + g_object_unref (tvplayer->videoqueue2);
1.101 + if ( tvplayer->audioqueue1 != NULL )
1.102 + g_object_unref (tvplayer->audioqueue1);
1.103 + if ( tvplayer->audioqueue2 != NULL )
1.104 + g_object_unref (tvplayer->audioqueue2);
1.105
1.106 G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->finalize (object);
1.107 }
1.108 @@ -230,21 +239,25 @@
1.109 GstElement *pipeline;
1.110 GstElement *source, *parser;
1.111 GstElement *videodec, *videosink;
1.112 + GstElement *videocolortrs;
1.113 #ifndef MAEMO_PLATFORM
1.114 GstElement *audiodec, *audioconv;
1.115 #endif
1.116 GstElement *audiosink;
1.117 - GstElement *videoqueue, *audioqueue;
1.118 + GstElement *videoqueue1, *videoqueue2, *audioqueue1, *audioqueue2;
1.119
1.120 g_debug ("MMythTVPlayer: Setting the Gstreamer pipeline\n");
1.121
1.122 pipeline = gst_pipeline_new ("video-player");
1.123 source = gst_element_factory_make ("mythtvsrc", "myth-source");
1.124 - parser = gst_element_factory_make ("ffdemux_nuv", "nuv-demux");
1.125 + parser = gst_element_factory_make ("nuvdemux", "nuv-demux");
1.126
1.127 /* Gstreamer Video elements */
1.128 - videoqueue = gst_element_factory_make ("queue", "video-queue");
1.129 - videodec = gst_element_factory_make ("ffdec_mpeg4", "video-decoder");
1.130 + videoqueue1 = gst_element_factory_make ("queue", "video-queue1");
1.131 + videodec = gst_element_factory_make ("divxdec", "video-decoder");
1.132 + videoqueue2 = gst_element_factory_make ("queue", "video-queue2");
1.133 + videocolortrs = gst_element_factory_make ("ffmpegcolorspace", "image-color-transforms");
1.134 +
1.135 #ifdef MAEMO_PLATFORM
1.136 videosink = gst_element_factory_make ("sdlvideosink", "image-output");
1.137 #else
1.138 @@ -252,17 +265,18 @@
1.139 #endif
1.140
1.141 /* Gstreamer Audio elements */
1.142 - audioqueue = gst_element_factory_make ("queue", "audio-queue");
1.143 + audioqueue1 = gst_element_factory_make ("queue", "audio-queue1");
1.144 + audioqueue2 = gst_element_factory_make ("queue", "audio-queue2");
1.145 #ifdef MAEMO_PLATFORM
1.146 audiosink = gst_element_factory_make ("dspmp3sink", "audio-output");
1.147 #else
1.148 - audiodec = gst_element_factory_make ("ffdec_mp3", "audio-decoder");
1.149 + audiodec = gst_element_factory_make ("mad", "audio-decoder");
1.150 audioconv = gst_element_factory_make ("audioconvert", "audio-converter");
1.151 audiosink = gst_element_factory_make ("alsasink", "audio-output");
1.152 #endif
1.153
1.154 if (!(pipeline && source && parser && videodec && videosink) ||
1.155 - !(videoqueue && audioqueue && audiosink)) {
1.156 + !(videoqueue1 && videoqueue2 && audioqueue1 && audioqueue2 && audiosink)) {
1.157 /* FIXME: hanlde the error correctly */
1.158 /* video_alignment is not being created (below)
1.159 and is causing problems to the ui */
1.160 @@ -270,6 +284,7 @@
1.161 tvplayer->gst_pipeline = NULL;
1.162 tvplayer->gst_videodec = NULL;
1.163 tvplayer->gst_videosink = NULL;
1.164 + tvplayer->gst_videocolortrs = NULL;
1.165
1.166 g_warning ("GstElement creation error!\n");
1.167 return FALSE;
1.168 @@ -282,29 +297,35 @@
1.169 }
1.170 #endif
1.171
1.172 -
1.173 tvplayer->gst_pipeline = pipeline;
1.174 tvplayer->gst_source = source;
1.175 tvplayer->gst_videodec = videodec;
1.176 tvplayer->gst_videosink = videosink;
1.177 + tvplayer->gst_videocolortrs = videocolortrs;
1.178 g_object_ref (tvplayer->gst_pipeline);
1.179 g_object_ref (tvplayer->gst_source);
1.180 g_object_ref (tvplayer->gst_videodec);
1.181 g_object_ref (tvplayer->gst_videosink);
1.182 + g_object_ref (tvplayer->gst_videocolortrs);
1.183
1.184 - tvplayer->videoqueue = videoqueue;
1.185 - tvplayer->audioqueue = audioqueue;
1.186 - g_object_ref (tvplayer->videoqueue);
1.187 - g_object_ref (tvplayer->audioqueue);
1.188 -
1.189 + tvplayer->videoqueue1 = videoqueue1;
1.190 + tvplayer->videoqueue2 = videoqueue2;
1.191 + tvplayer->audioqueue1 = audioqueue1;
1.192 + tvplayer->audioqueue2 = audioqueue2;
1.193 + g_object_ref (tvplayer->videoqueue1);
1.194 + g_object_ref (tvplayer->videoqueue2);
1.195 + g_object_ref (tvplayer->audioqueue1);
1.196 + g_object_ref (tvplayer->audioqueue2);
1.197 +
1.198 g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
1.199 g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
1.200
1.201 gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)),
1.202 bus_call, tvplayer);
1.203
1.204 - gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue,
1.205 - videodec, videosink, audioqueue, audiodec, audioconv, audiosink, NULL);
1.206 + gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue1,
1.207 + videodec, videoqueue2, videocolortrs, videosink, audioqueue1,
1.208 + audiodec, audioconv, audioqueue2, audiosink, NULL);
1.209
1.210 {
1.211 // GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL);
1.212 @@ -312,8 +333,8 @@
1.213 }
1.214
1.215 gst_element_link (source, parser);
1.216 - gst_element_link_many (videoqueue, videodec, videosink, NULL);
1.217 - gst_element_link_many (audioqueue, audiodec, audioconv, audiosink, NULL);
1.218 + gst_element_link_many (videoqueue1, videodec, videoqueue2, videocolortrs, videosink, NULL);
1.219 + gst_element_link_many (audioqueue1, audiodec, audioconv, audioqueue2, audiosink, NULL);
1.220
1.221 g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad_cb), tvplayer);
1.222
1.223 @@ -382,9 +403,9 @@
1.224 }
1.225
1.226 // Gets the remote encoder num
1.227 - tvplayer->remote_encoder = remote_request_next_free_recorder (-1);
1.228 + tvplayer->recorder = remote_request_next_free_recorder (-1);
1.229
1.230 - if ( tvplayer->remote_encoder == NULL ) {
1.231 + if ( tvplayer->recorder == NULL ) {
1.232 g_warning ("[%s] None remote encoder available", __FUNCTION__);
1.233 res = FALSE;
1.234 goto error;
1.235 @@ -400,14 +421,14 @@
1.236 }
1.237
1.238 // Init remote encoder. Opens its control socket.
1.239 - res = gmyth_remote_encoder_setup(tvplayer->remote_encoder);
1.240 + res = gmyth_recorder_setup(tvplayer->recorder);
1.241 if ( !res ) {
1.242 g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__);
1.243 res = FALSE;
1.244 goto error;
1.245 }
1.246 // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly)
1.247 - res = gmyth_remote_encoder_spawntv ( tvplayer->remote_encoder,
1.248 + res = gmyth_recorder_spawntv ( tvplayer->recorder,
1.249 gmyth_tvchain_get_id(tvplayer->tvchain) );
1.250 if (!res) {
1.251 g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__);
1.252 @@ -446,9 +467,9 @@
1.253 res = FALSE;
1.254 }
1.255
1.256 - if ( tvplayer->remote_encoder != NULL ) {
1.257 - g_object_unref (tvplayer->remote_encoder);
1.258 - tvplayer->remote_encoder = NULL;
1.259 + if ( tvplayer->recorder != NULL ) {
1.260 + g_object_unref (tvplayer->recorder);
1.261 + tvplayer->recorder = NULL;
1.262 }
1.263
1.264 if ( tvplayer->tvchain != NULL ) {
1.265 @@ -589,7 +610,7 @@
1.266 gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL);
1.267
1.268 if (tvplayer->is_livetv) {
1.269 - if (!gmyth_remote_encoder_stop_livetv (tvplayer->remote_encoder)) {
1.270 + if (!gmyth_recorder_stop_livetv (tvplayer->recorder)) {
1.271 g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__);
1.272 }
1.273 }
1.274 @@ -660,9 +681,9 @@
1.275 g_string_free( str_chainid, FALSE );
1.276 }
1.277
1.278 - if ( tvplayer->remote_encoder != NULL )
1.279 + if ( tvplayer->recorder != NULL )
1.280 g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id",
1.281 - tvplayer->remote_encoder->recorder_num, NULL );
1.282 + tvplayer->recorder->recorder_num, NULL );
1.283 g_debug ("[%s] Setting location to %s", __FUNCTION__,
1.284 tvplayer->proginfo->pathname->str);
1.285