1.1 --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Wed Feb 14 22:26:33 2007 +0000
1.2 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Feb 16 18:38:59 2007 +0000
1.3 @@ -17,10 +17,30 @@
1.4 * Boston, MA 02111-1307, USA.
1.5 */
1.6 /**
1.7 - * When using the LiveTV content, put the location URI in the following
1.8 - * format:
1.9 + * If you want to get the LiveTV content (set channel, TV tuner, RemoteEncoder,
1.10 + * Recorder),
1.11 + * put the following URI:
1.12 *
1.13 - * myth://mythtv:mythtv@xxx.xxx.xxx.xxx:6543/?mythconverg
1.14 + * myth://xxx.xxx.xxx.xxx:6543/livetv?channel=BBC
1.15 + *
1.16 + * This URI will say to the gmyth library to configure the Recorder instance (used to
1.17 + * change the channel, start the TV multimedia content transmition, etc.), using
1.18 + * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend
1.19 + * server, and setting the channel name to "BBC".
1.20 + *
1.21 + * To get a already recorded the MythTV NUV file, put the following URI:
1.22 + *
1.23 + * myth://xxx.xxx.xxx.xxx:6543/filename.nuv
1.24 + *
1.25 + * This URI will say to the gmyth library to configure the Recorder instance (used to
1.26 + * change the channel, start the TV multimedia content transmition, etc.), using
1.27 + * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend
1.28 + * server, and setting the channel name to "BBC".
1.29 + *
1.30 + * Another possible way to use the LiveTV content, and just in the case you want to
1.31 + * use the mysql database, put the location URI in the following format:
1.32 + *
1.33 + * myth://mythtv:mythtv@xxx.xxx.xxx.xxx:port/?mythconverg
1.34 *
1.35 * Where the first field is the protocol (myth), the second and third are user
1.36 * name (mythtv) and password (mythtv), then backend host name and port number,
1.37 @@ -104,8 +124,6 @@
1.38 static gboolean gst_mythtv_src_do_seek (GstBaseSrc * base,
1.39 GstSegment * segment);
1.40
1.41 -static gboolean gst_mythtv_src_next_program_chain (GstMythtvSrc * src);
1.42 -
1.43 static GstStateChangeReturn
1.44 gst_mythtv_src_change_state (GstElement * element, GstStateChange transition);
1.45
1.46 @@ -257,7 +275,6 @@
1.47 this->update_prog_chain = FALSE;
1.48
1.49 this->user_agent = g_strdup ("mythtvsrc");
1.50 - this->mythtv_caps = NULL;
1.51 this->update_prog_chain = FALSE;
1.52
1.53 this->channel_name = NULL;
1.54 @@ -282,21 +299,16 @@
1.55 {
1.56 GstMythtvSrc *this = GST_MYTHTV_SRC (gobject);
1.57
1.58 - if (this->mythtv_caps) {
1.59 - gst_caps_unref (this->mythtv_caps);
1.60 - this->mythtv_caps = NULL;
1.61 + if (this->spawn_livetv) {
1.62 + g_object_unref (this->spawn_livetv);
1.63 + this->spawn_livetv = NULL;
1.64 }
1.65 -
1.66 +/*
1.67 if (this->file_transfer) {
1.68 g_object_unref (this->file_transfer);
1.69 this->file_transfer = NULL;
1.70 }
1.71 -
1.72 - if (this->spawn_livetv) {
1.73 - g_object_unref (this->spawn_livetv);
1.74 - this->spawn_livetv = NULL;
1.75 - }
1.76 -
1.77 +*/
1.78 if (this->backend_info) {
1.79 g_object_unref (this->backend_info);
1.80 this->backend_info = NULL;
1.81 @@ -539,12 +551,6 @@
1.82 gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)),
1.83 gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
1.84
1.85 - /* go to the next program chain */
1.86 - //src->unique_setup = FALSE;
1.87 - //src->update_prog_chain = TRUE;
1.88 -
1.89 - //gst_mythtv_src_next_program_chain (src);
1.90 -
1.91 goto program_chain_changed;
1.92 }
1.93
1.94 @@ -603,9 +609,7 @@
1.95 segment->start, src->read_offset, new_offset);
1.96 if (G_UNLIKELY (new_offset < 0)) {
1.97 ret = FALSE;
1.98 - if (src->live_tv)
1.99 - goto change_progchain;
1.100 - else
1.101 + if (!src->live_tv)
1.102 goto eos;
1.103 }
1.104
1.105 @@ -626,22 +630,6 @@
1.106 GST_DEBUG_OBJECT (src, "EOS found on seeking!!!");
1.107 return FALSE;
1.108 }
1.109 -change_progchain:
1.110 - {
1.111 - GST_ELEMENT_ERROR (src, RESOURCE, READ,
1.112 - (NULL), ("Seek failed, go to the next program info... (%i, %s)", read,
1.113 - src->uri_name));
1.114 -
1.115 - gst_pad_push_event (GST_BASE_SRC_PAD (base),
1.116 - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
1.117 - /* go to the next program chain */
1.118 - src->unique_setup = FALSE;
1.119 - src->update_prog_chain = TRUE;
1.120 -
1.121 - gst_mythtv_src_next_program_chain (src);
1.122 -
1.123 - return TRUE;
1.124 - }
1.125
1.126 }
1.127
1.128 @@ -655,9 +643,6 @@
1.129 GMythURI *gmyth_uri = NULL;
1.130 gboolean ret = TRUE;
1.131
1.132 - if (G_UNLIKELY (src->update_prog_chain))
1.133 - goto change_progchain;
1.134 -
1.135 if (src->unique_setup == FALSE) {
1.136 src->unique_setup = TRUE;
1.137 } else {
1.138 @@ -783,128 +768,6 @@
1.139 src->uri_name));
1.140 return FALSE;
1.141 }
1.142 -change_progchain:
1.143 - {
1.144 - GST_ELEMENT_ERROR (src, RESOURCE, READ,
1.145 - (NULL), ("Seek failed, go to the next program info... (%s)",
1.146 - src->uri_name));
1.147 -
1.148 - gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
1.149 - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
1.150 -
1.151 - /* go to the next program chain */
1.152 - src->unique_setup = FALSE;
1.153 - src->update_prog_chain = TRUE;
1.154 -
1.155 - gst_mythtv_src_next_program_chain (src);
1.156 -
1.157 - return TRUE;
1.158 - }
1.159 -}
1.160 -
1.161 -/* create a new socket for connecting to the next program chain */
1.162 -static gboolean
1.163 -gst_mythtv_src_next_program_chain (GstMythtvSrc * src)
1.164 -{
1.165 - gboolean ret = TRUE;
1.166 -
1.167 - if (!src->live_tv)
1.168 - goto init_failed;
1.169 -
1.170 - if (src->unique_setup == FALSE) {
1.171 - src->unique_setup = TRUE;
1.172 - } else {
1.173 - goto done;
1.174 - }
1.175 -
1.176 - GST_PAD_STREAM_LOCK (GST_BASE_SRC_PAD (GST_BASE_SRC (src)));
1.177 -
1.178 - if (src->file_transfer) {
1.179 - g_object_unref (src->file_transfer);
1.180 - src->file_transfer = NULL;
1.181 - }
1.182 -
1.183 - if (src->uri_name) {
1.184 - g_free (src->uri_name);
1.185 - }
1.186 -
1.187 - if (src->backend_info == NULL)
1.188 - src->backend_info = gmyth_backend_info_new_with_uri (src->uri_name);
1.189 -
1.190 - if (src->live_tv) {
1.191 - if (gmyth_livetv_next_program_chain (src->spawn_livetv) == FALSE) {
1.192 - GST_INFO_OBJECT (src, "Failed to go to the next program chain!");
1.193 - ret = FALSE;
1.194 - goto init_failed;
1.195 - }
1.196 - /* set up the uri variable */
1.197 - src->uri_name = g_strdup (src->spawn_livetv->proginfo->pathname->str);
1.198 -
1.199 - src->file_transfer = gmyth_livetv_create_file_transfer (src->spawn_livetv);
1.200 - } else {
1.201 -
1.202 - src->file_transfer = gmyth_file_transfer_new (src->backend_info);
1.203 -
1.204 - if (src->file_transfer == NULL) {
1.205 - goto init_failed;
1.206 - }
1.207 -
1.208 - ret = gmyth_file_transfer_open (src->file_transfer, src->uri_name);
1.209 - }
1.210 -
1.211 - if (ret == FALSE) {
1.212 -#ifndef GST_DISABLE_GST_DEBUG
1.213 - if (src->mythtv_msgs_dbg)
1.214 - GST_ERROR_OBJECT (src,
1.215 - "MythTV FileTransfer request failed when setting up socket connection!");
1.216 -#endif
1.217 - goto begin_req_failed;
1.218 - }
1.219 - src->content_size_last = src->content_size;
1.220 -
1.221 - src->content_size = src->file_transfer->filesize;
1.222 - if (src->live_tv) {
1.223 - /*
1.224 - src->wait_to_transfer = 0;
1.225 - while (src->wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
1.226 - src->content_size < GMYTHTV_TRANSFER_MAX_BUFFER)
1.227 - src->content_size = gst_mythtv_src_get_position (src);
1.228 - */
1.229 - }
1.230 -
1.231 - src->read_offset = 0;
1.232 -
1.233 - if (src->bytes_queue != NULL) {
1.234 - g_byte_array_free (src->bytes_queue, TRUE);
1.235 - }
1.236 -
1.237 - src->bytes_queue = g_byte_array_sized_new (INTERNAL_BUFFER_SIZE);
1.238 -
1.239 -done:
1.240 - src->update_prog_chain = FALSE;
1.241 -
1.242 - GST_PAD_STREAM_UNLOCK (GST_BASE_SRC_PAD (GST_BASE_SRC (src)));
1.243 -
1.244 - return TRUE;
1.245 -
1.246 - /* ERRORS */
1.247 -init_failed:
1.248 - {
1.249 - if (src->spawn_livetv != NULL)
1.250 - g_object_unref (src->spawn_livetv);
1.251 -
1.252 - GST_ELEMENT_ERROR (src, LIBRARY, INIT,
1.253 - (NULL), ("Could not initialize MythTV library (%i, %s)", ret,
1.254 - src->uri_name));
1.255 - return FALSE;
1.256 - }
1.257 -begin_req_failed:
1.258 - {
1.259 - GST_ELEMENT_ERROR (src, LIBRARY, INIT,
1.260 - (NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret,
1.261 - src->uri_name));
1.262 - return FALSE;
1.263 - }
1.264
1.265 }
1.266
1.267 @@ -955,11 +818,6 @@
1.268 src->uri_name = NULL;
1.269 }
1.270
1.271 - if (src->mythtv_caps) {
1.272 - gst_caps_unref (src->mythtv_caps);
1.273 - src->mythtv_caps = NULL;
1.274 - }
1.275 -
1.276 src->eos = FALSE;
1.277
1.278 return TRUE;