# HG changeset patch # User rosfran # Date 1171579494 0 # Node ID ea8b127de178cda77e763ca05cee97570095d902 # Parent 01297079047372e86fb0c0bc1b716b9fcf1c5948 [svn r376] Added more documentation aboute LiveTV, removed program chain cahngin from plug-in. diff -r 012970790473 -r ea8b127de178 gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Thu Feb 15 22:24:47 2007 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Thu Feb 15 22:44:54 2007 +0000 @@ -17,10 +17,30 @@ * Boston, MA 02111-1307, USA. */ /** - * When using the LiveTV content, put the location URI in the following - * format: + * If you want to get the LiveTV content (set channel, TV tuner, RemoteEncoder, + * Recorder), + * put the following URI: * - * myth://mythtv:mythtv@xxx.xxx.xxx.xxx:6543/?mythconverg + * myth://xxx.xxx.xxx.xxx:6543/livetv?channel=BBC + * + * This URI will say to the gmyth library to configure the Recorder instance (used to + * change the channel, start the TV multimedia content transmition, etc.), using + * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend + * server, and setting the channel name to "BBC". + * + * To get a already recorded the MythTV NUV file, put the following URI: + * + * myth://xxx.xxx.xxx.xxx:6543/filename.nuv + * + * This URI will say to the gmyth library to configure the Recorder instance (used to + * change the channel, start the TV multimedia content transmition, etc.), using + * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend + * server, and setting the channel name to "BBC". + * + * Another possible way to use the LiveTV content, and just in the case you want to + * use the mysql database, put the location URI in the following format: + * + * myth://mythtv:mythtv@xxx.xxx.xxx.xxx:port/?mythconverg * * Where the first field is the protocol (myth), the second and third are user * name (mythtv) and password (mythtv), then backend host name and port number, @@ -104,8 +124,6 @@ static gboolean gst_mythtv_src_do_seek (GstBaseSrc * base, GstSegment * segment); -static gboolean gst_mythtv_src_next_program_chain (GstMythtvSrc * src); - static GstStateChangeReturn gst_mythtv_src_change_state (GstElement * element, GstStateChange transition); @@ -257,7 +275,6 @@ this->update_prog_chain = FALSE; this->user_agent = g_strdup ("mythtvsrc"); - this->mythtv_caps = NULL; this->update_prog_chain = FALSE; this->channel_name = NULL; @@ -282,21 +299,16 @@ { GstMythtvSrc *this = GST_MYTHTV_SRC (gobject); - if (this->mythtv_caps) { - gst_caps_unref (this->mythtv_caps); - this->mythtv_caps = NULL; + if (this->spawn_livetv) { + g_object_unref (this->spawn_livetv); + this->spawn_livetv = NULL; } - +/* if (this->file_transfer) { g_object_unref (this->file_transfer); this->file_transfer = NULL; } - - if (this->spawn_livetv) { - g_object_unref (this->spawn_livetv); - this->spawn_livetv = NULL; - } - +*/ if (this->backend_info) { g_object_unref (this->backend_info); this->backend_info = NULL; @@ -539,12 +551,6 @@ gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)), gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0)); - /* go to the next program chain */ - //src->unique_setup = FALSE; - //src->update_prog_chain = TRUE; - - //gst_mythtv_src_next_program_chain (src); - goto program_chain_changed; } @@ -603,9 +609,7 @@ segment->start, src->read_offset, new_offset); if (G_UNLIKELY (new_offset < 0)) { ret = FALSE; - if (src->live_tv) - goto change_progchain; - else + if (!src->live_tv) goto eos; } @@ -626,22 +630,6 @@ GST_DEBUG_OBJECT (src, "EOS found on seeking!!!"); return FALSE; } -change_progchain: - { - GST_ELEMENT_ERROR (src, RESOURCE, READ, - (NULL), ("Seek failed, go to the next program info... (%i, %s)", read, - src->uri_name)); - - gst_pad_push_event (GST_BASE_SRC_PAD (base), - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0)); - /* go to the next program chain */ - src->unique_setup = FALSE; - src->update_prog_chain = TRUE; - - gst_mythtv_src_next_program_chain (src); - - return TRUE; - } } @@ -655,9 +643,6 @@ GMythURI *gmyth_uri = NULL; gboolean ret = TRUE; - if (G_UNLIKELY (src->update_prog_chain)) - goto change_progchain; - if (src->unique_setup == FALSE) { src->unique_setup = TRUE; } else { @@ -783,128 +768,6 @@ src->uri_name)); return FALSE; } -change_progchain: - { - GST_ELEMENT_ERROR (src, RESOURCE, READ, - (NULL), ("Seek failed, go to the next program info... (%s)", - src->uri_name)); - - gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (src)), - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0)); - - /* go to the next program chain */ - src->unique_setup = FALSE; - src->update_prog_chain = TRUE; - - gst_mythtv_src_next_program_chain (src); - - return TRUE; - } -} - -/* create a new socket for connecting to the next program chain */ -static gboolean -gst_mythtv_src_next_program_chain (GstMythtvSrc * src) -{ - gboolean ret = TRUE; - - if (!src->live_tv) - goto init_failed; - - if (src->unique_setup == FALSE) { - src->unique_setup = TRUE; - } else { - goto done; - } - - GST_PAD_STREAM_LOCK (GST_BASE_SRC_PAD (GST_BASE_SRC (src))); - - if (src->file_transfer) { - g_object_unref (src->file_transfer); - src->file_transfer = NULL; - } - - if (src->uri_name) { - g_free (src->uri_name); - } - - if (src->backend_info == NULL) - src->backend_info = gmyth_backend_info_new_with_uri (src->uri_name); - - if (src->live_tv) { - if (gmyth_livetv_next_program_chain (src->spawn_livetv) == FALSE) { - GST_INFO_OBJECT (src, "Failed to go to the next program chain!"); - ret = FALSE; - goto init_failed; - } - /* set up the uri variable */ - src->uri_name = g_strdup (src->spawn_livetv->proginfo->pathname->str); - - src->file_transfer = gmyth_livetv_create_file_transfer (src->spawn_livetv); - } else { - - src->file_transfer = gmyth_file_transfer_new (src->backend_info); - - if (src->file_transfer == NULL) { - goto init_failed; - } - - ret = gmyth_file_transfer_open (src->file_transfer, src->uri_name); - } - - if (ret == FALSE) { -#ifndef GST_DISABLE_GST_DEBUG - if (src->mythtv_msgs_dbg) - GST_ERROR_OBJECT (src, - "MythTV FileTransfer request failed when setting up socket connection!"); -#endif - goto begin_req_failed; - } - src->content_size_last = src->content_size; - - src->content_size = src->file_transfer->filesize; - if (src->live_tv) { - /* - src->wait_to_transfer = 0; - while (src->wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS && - src->content_size < GMYTHTV_TRANSFER_MAX_BUFFER) - src->content_size = gst_mythtv_src_get_position (src); - */ - } - - src->read_offset = 0; - - if (src->bytes_queue != NULL) { - g_byte_array_free (src->bytes_queue, TRUE); - } - - src->bytes_queue = g_byte_array_sized_new (INTERNAL_BUFFER_SIZE); - -done: - src->update_prog_chain = FALSE; - - GST_PAD_STREAM_UNLOCK (GST_BASE_SRC_PAD (GST_BASE_SRC (src))); - - return TRUE; - - /* ERRORS */ -init_failed: - { - if (src->spawn_livetv != NULL) - g_object_unref (src->spawn_livetv); - - GST_ELEMENT_ERROR (src, LIBRARY, INIT, - (NULL), ("Could not initialize MythTV library (%i, %s)", ret, - src->uri_name)); - return FALSE; - } -begin_req_failed: - { - GST_ELEMENT_ERROR (src, LIBRARY, INIT, - (NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret, - src->uri_name)); - return FALSE; - } } @@ -955,11 +818,6 @@ src->uri_name = NULL; } - if (src->mythtv_caps) { - gst_caps_unref (src->mythtv_caps); - src->mythtv_caps = NULL; - } - src->eos = FALSE; return TRUE; diff -r 012970790473 -r ea8b127de178 gst-plugins-mythtv/src/gstmythtvsrc.h --- a/gst-plugins-mythtv/src/gstmythtvsrc.h Thu Feb 15 22:24:47 2007 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.h Thu Feb 15 22:44:54 2007 +0000 @@ -102,10 +102,6 @@ /* MythTV capabilities */ GstCaps *mythtv_caps; - GstPad *sinkpad; - - GStaticRecMutex *th_mutex; - GByteArray *bytes_queue; #ifndef GST_DISABLE_GST_DEBUG