# HG changeset patch # User rosfran # Date 1162839506 0 # Node ID f926338c6952e514b466b66bd15b111bf90d8599 # Parent 957b55b3f630c4019c122609d2fbb68e74f69c6a [svn r65] Fixes in some recorder functions, refactoring. diff -r 957b55b3f630 -r f926338c6952 maemo-ui/src/mmyth_main.c --- a/maemo-ui/src/mmyth_main.c Mon Oct 30 22:55:19 2006 +0000 +++ b/maemo-ui/src/mmyth_main.c Mon Nov 06 18:58:26 2006 +0000 @@ -8,8 +8,7 @@ #include "hildon-widgets/hildon-window.h" #endif - -#include "gmyth_remote_encoder.h" +#include "gmyth_recorder.h" #include "gmyth_settings.h" #include "gmyth_context.h" #include "gmyth_tvchain.h" diff -r 957b55b3f630 -r f926338c6952 maemo-ui/src/mmyth_tvplayer.c --- a/maemo-ui/src/mmyth_tvplayer.c Mon Oct 30 22:55:19 2006 +0000 +++ b/maemo-ui/src/mmyth_tvplayer.c Mon Nov 06 18:58:26 2006 +0000 @@ -89,9 +89,9 @@ s = gst_caps_to_string (pad->caps); if ( s[0] == 'a') { - ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue, "sink")); + ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue1, "sink")); } else { - ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue, "sink")); + ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue1, "sink")); } g_free(s); @@ -100,38 +100,41 @@ static gboolean expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { - MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data); + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data); if (tvplayer && tvplayer->videow) { - gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink), - GDK_WINDOW_XWINDOW (widget->window)); + gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink), + GDK_WINDOW_XWINDOW (widget->window)); return TRUE; } - + g_warning ("MMythTVPlayer expose called before setting video window\n"); - - return FALSE; + + return FALSE; } static void mmyth_tvplayer_init (MMythTVPlayer *tvplayer) { - tvplayer->gst_pipeline = NULL; - tvplayer->gst_source = NULL; - tvplayer->gst_videodec = NULL; - tvplayer->gst_videosink = NULL; - tvplayer->videoqueue = NULL; - tvplayer->audioqueue = NULL; - - /* GTKWidget for rendering the video */ - tvplayer->videow = NULL; + tvplayer->gst_pipeline = NULL; + tvplayer->gst_source = NULL; + tvplayer->gst_videodec = NULL; + tvplayer->gst_videosink = NULL; + tvplayer->gst_videocolortrs = NULL; + tvplayer->videoqueue1 = NULL; + tvplayer->videoqueue2 = NULL; + tvplayer->audioqueue1 = NULL; + tvplayer->audioqueue2 = NULL; + + /* GTKWidget for rendering the video */ + tvplayer->videow = NULL; tvplayer->expose_handler = 0; - + tvplayer->backend_hostname = NULL; tvplayer->backend_port = 0; tvplayer->local_hostname = NULL; - tvplayer->remote_encoder = NULL; + tvplayer->recorder = NULL; tvplayer->tvchain = NULL; tvplayer->proginfo = NULL; } @@ -161,8 +164,8 @@ g_object_unref (tvplayer->videow); } - if ( tvplayer->remote_encoder != NULL ) - g_object_unref (tvplayer->remote_encoder); + if ( tvplayer->recorder != NULL ) + g_object_unref (tvplayer->recorder); if ( tvplayer->tvchain != NULL ) g_object_unref (tvplayer->tvchain); if ( tvplayer->proginfo != NULL ) @@ -175,12 +178,18 @@ g_object_unref (tvplayer->gst_source); if ( tvplayer->gst_videodec != NULL ) g_object_unref (tvplayer->gst_videodec); + if ( tvplayer->gst_videocolortrs != NULL ) + g_object_unref (tvplayer->gst_videocolortrs); if ( tvplayer->gst_videosink != NULL ) g_object_unref (tvplayer->gst_videosink); - if ( tvplayer->videoqueue != NULL ) - g_object_unref (tvplayer->videoqueue); - if ( tvplayer->audioqueue != NULL ) - g_object_unref (tvplayer->audioqueue); + if ( tvplayer->videoqueue1 != NULL ) + g_object_unref (tvplayer->videoqueue1); + if ( tvplayer->videoqueue2 != NULL ) + g_object_unref (tvplayer->videoqueue2); + if ( tvplayer->audioqueue1 != NULL ) + g_object_unref (tvplayer->audioqueue1); + if ( tvplayer->audioqueue2 != NULL ) + g_object_unref (tvplayer->audioqueue2); G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->finalize (object); } @@ -230,21 +239,25 @@ GstElement *pipeline; GstElement *source, *parser; GstElement *videodec, *videosink; + GstElement *videocolortrs; #ifndef MAEMO_PLATFORM GstElement *audiodec, *audioconv; #endif GstElement *audiosink; - GstElement *videoqueue, *audioqueue; + GstElement *videoqueue1, *videoqueue2, *audioqueue1, *audioqueue2; g_debug ("MMythTVPlayer: Setting the Gstreamer pipeline\n"); pipeline = gst_pipeline_new ("video-player"); source = gst_element_factory_make ("mythtvsrc", "myth-source"); - parser = gst_element_factory_make ("ffdemux_nuv", "nuv-demux"); + parser = gst_element_factory_make ("nuvdemux", "nuv-demux"); /* Gstreamer Video elements */ - videoqueue = gst_element_factory_make ("queue", "video-queue"); - videodec = gst_element_factory_make ("ffdec_mpeg4", "video-decoder"); + videoqueue1 = gst_element_factory_make ("queue", "video-queue1"); + videodec = gst_element_factory_make ("divxdec", "video-decoder"); + videoqueue2 = gst_element_factory_make ("queue", "video-queue2"); + videocolortrs = gst_element_factory_make ("ffmpegcolorspace", "image-color-transforms"); + #ifdef MAEMO_PLATFORM videosink = gst_element_factory_make ("sdlvideosink", "image-output"); #else @@ -252,17 +265,18 @@ #endif /* Gstreamer Audio elements */ - audioqueue = gst_element_factory_make ("queue", "audio-queue"); + audioqueue1 = gst_element_factory_make ("queue", "audio-queue1"); + audioqueue2 = gst_element_factory_make ("queue", "audio-queue2"); #ifdef MAEMO_PLATFORM audiosink = gst_element_factory_make ("dspmp3sink", "audio-output"); #else - audiodec = gst_element_factory_make ("ffdec_mp3", "audio-decoder"); + audiodec = gst_element_factory_make ("mad", "audio-decoder"); audioconv = gst_element_factory_make ("audioconvert", "audio-converter"); audiosink = gst_element_factory_make ("alsasink", "audio-output"); #endif if (!(pipeline && source && parser && videodec && videosink) || - !(videoqueue && audioqueue && audiosink)) { + !(videoqueue1 && videoqueue2 && audioqueue1 && audioqueue2 && audiosink)) { /* FIXME: hanlde the error correctly */ /* video_alignment is not being created (below) and is causing problems to the ui */ @@ -270,6 +284,7 @@ tvplayer->gst_pipeline = NULL; tvplayer->gst_videodec = NULL; tvplayer->gst_videosink = NULL; + tvplayer->gst_videocolortrs = NULL; g_warning ("GstElement creation error!\n"); return FALSE; @@ -282,29 +297,35 @@ } #endif - tvplayer->gst_pipeline = pipeline; tvplayer->gst_source = source; tvplayer->gst_videodec = videodec; tvplayer->gst_videosink = videosink; + tvplayer->gst_videocolortrs = videocolortrs; g_object_ref (tvplayer->gst_pipeline); g_object_ref (tvplayer->gst_source); g_object_ref (tvplayer->gst_videodec); g_object_ref (tvplayer->gst_videosink); + g_object_ref (tvplayer->gst_videocolortrs); - tvplayer->videoqueue = videoqueue; - tvplayer->audioqueue = audioqueue; - g_object_ref (tvplayer->videoqueue); - g_object_ref (tvplayer->audioqueue); - + tvplayer->videoqueue1 = videoqueue1; + tvplayer->videoqueue2 = videoqueue2; + tvplayer->audioqueue1 = audioqueue1; + tvplayer->audioqueue2 = audioqueue2; + g_object_ref (tvplayer->videoqueue1); + g_object_ref (tvplayer->videoqueue2); + g_object_ref (tvplayer->audioqueue1); + g_object_ref (tvplayer->audioqueue2); + g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL); g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL); gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)), bus_call, tvplayer); - gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue, - videodec, videosink, audioqueue, audiodec, audioconv, audiosink, NULL); + gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue1, + videodec, videoqueue2, videocolortrs, videosink, audioqueue1, + audiodec, audioconv, audioqueue2, audiosink, NULL); { // GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL); @@ -312,8 +333,8 @@ } gst_element_link (source, parser); - gst_element_link_many (videoqueue, videodec, videosink, NULL); - gst_element_link_many (audioqueue, audiodec, audioconv, audiosink, NULL); + gst_element_link_many (videoqueue1, videodec, videoqueue2, videocolortrs, videosink, NULL); + gst_element_link_many (audioqueue1, audiodec, audioconv, audioqueue2, audiosink, NULL); g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad_cb), tvplayer); @@ -382,9 +403,9 @@ } // Gets the remote encoder num - tvplayer->remote_encoder = remote_request_next_free_recorder (-1); + tvplayer->recorder = remote_request_next_free_recorder (-1); - if ( tvplayer->remote_encoder == NULL ) { + if ( tvplayer->recorder == NULL ) { g_warning ("[%s] None remote encoder available", __FUNCTION__); res = FALSE; goto error; @@ -400,14 +421,14 @@ } // Init remote encoder. Opens its control socket. - res = gmyth_remote_encoder_setup(tvplayer->remote_encoder); + res = gmyth_recorder_setup(tvplayer->recorder); if ( !res ) { g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__); res = FALSE; goto error; } // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly) - res = gmyth_remote_encoder_spawntv ( tvplayer->remote_encoder, + res = gmyth_recorder_spawntv ( tvplayer->recorder, gmyth_tvchain_get_id(tvplayer->tvchain) ); if (!res) { g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__); @@ -446,9 +467,9 @@ res = FALSE; } - if ( tvplayer->remote_encoder != NULL ) { - g_object_unref (tvplayer->remote_encoder); - tvplayer->remote_encoder = NULL; + if ( tvplayer->recorder != NULL ) { + g_object_unref (tvplayer->recorder); + tvplayer->recorder = NULL; } if ( tvplayer->tvchain != NULL ) { @@ -589,7 +610,7 @@ gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL); if (tvplayer->is_livetv) { - if (!gmyth_remote_encoder_stop_livetv (tvplayer->remote_encoder)) { + if (!gmyth_recorder_stop_livetv (tvplayer->recorder)) { g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__); } } @@ -660,9 +681,9 @@ g_string_free( str_chainid, FALSE ); } - if ( tvplayer->remote_encoder != NULL ) + if ( tvplayer->recorder != NULL ) g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id", - tvplayer->remote_encoder->recorder_num, NULL ); + tvplayer->recorder->recorder_num, NULL ); g_debug ("[%s] Setting location to %s", __FUNCTION__, tvplayer->proginfo->pathname->str); diff -r 957b55b3f630 -r f926338c6952 maemo-ui/src/mmyth_tvplayer.h --- a/maemo-ui/src/mmyth_tvplayer.h Mon Oct 30 22:55:19 2006 +0000 +++ b/maemo-ui/src/mmyth_tvplayer.h Mon Nov 06 18:58:26 2006 +0000 @@ -36,7 +36,7 @@ #include #include -#include "gmyth_remote_encoder.h" +#include "gmyth_recorder.h" #include "gmyth_tvchain.h" #include "gmyth_common.h" @@ -69,9 +69,12 @@ GstElement *gst_source; GstElement *gst_videodec; GstElement *gst_videosink; - GstElement *videoqueue; - GstElement *audioqueue; - + GstElement *gst_videocolortrs; + GstElement *videoqueue1; + GstElement *videoqueue2; + GstElement *audioqueue1; + GstElement *audioqueue2; + gulong expose_handler; // GMainLoop *loop; @@ -82,7 +85,7 @@ gint backend_port; GString *local_hostname; - GMythRemoteEncoder *remote_encoder; + GMythRecorder *recorder; GMythTVChain *tvchain; GMythProgramInfo *proginfo;