[svn r9] Fixed a bug when trying to mount the LDFLAGS.
1 /* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2 -*- */
2 /* GStreamer MythTV Plug-in
3 * Copyright (C) <2006> Rosfran Borges <rosfran.borges@indt.org.br>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more
20 #include "gstmythtvsrc.h"
21 #include "myth_file_transfer.h"
22 #include "myth_livetv.h"
24 #include <gmyth/gmyth_socket.h>
25 #include <gmyth/gmyth_tvchain.h>
30 GST_DEBUG_CATEGORY_STATIC (mythtvsrc_debug);
31 #define GST_CAT_DEFAULT mythtvsrc_debug
33 #define GST_MYTHTV_ID_NUM 1
35 #define MYTHTV_VERSION_DEFAULT 30
37 #define MYTHTV_TRANSFER_MAX_WAITS 100
39 #define MYTHTV_TRANSFER_MAX_BUFFER ( 32*1024 )
42 #define MAX_READ_SIZE ( 16*1024 )
44 #define ENABLE_TIMING_POSITION 1
46 /* stablish a maximum iteration value to the IS_RECORDING message */
47 static guint wait_to_transfer = 0;
49 static const GstElementDetails gst_mythtv_src_details =
50 GST_ELEMENT_DETAILS ("MythTV client source",
52 "Control and receive data as a client over the network via raw socket connections using the MythTV protocol",
53 "Rosfran Borges <rosfran.borges@indt.org.br>");
55 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
65 #ifndef GST_DISABLE_GST_DEBUG
71 PROP_MYTHTV_LIVE_CHAINID
74 static void gst_mythtv_src_finalize (GObject * gobject);
76 static GstFlowReturn gst_mythtv_src_create (GstBaseSrc * psrc,
77 guint64 offset, guint size, GstBuffer ** outbuf);
78 static gboolean gst_mythtv_src_start (GstBaseSrc * bsrc);
79 static gboolean gst_mythtv_src_stop (GstBaseSrc * bsrc);
80 static gboolean gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size);
81 static gboolean gst_mythtv_src_is_seekable( GstBaseSrc *base_src );
83 static void gst_mythtv_src_set_property (GObject * object, guint prop_id,
84 const GValue * value, GParamSpec * pspec);
85 static void gst_mythtv_src_get_property (GObject * object, guint prop_id,
86 GValue * value, GParamSpec * pspec);
89 gst_mythtv_src_uri_handler_init (gpointer g_iface, gpointer iface_data);
92 gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event);
95 _urihandler_init (GType type)
97 static const GInterfaceInfo urihandler_info = {
98 gst_mythtv_src_uri_handler_init,
103 g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
105 GST_DEBUG_CATEGORY_INIT (mythtvsrc_debug, "mythtvsrc", 0,
109 GST_BOILERPLATE_FULL (GstMythtvSrc, gst_mythtv_src, GstBaseSrc,
110 GST_TYPE_BASE_SRC, _urihandler_init);
113 gst_mythtv_src_base_init (gpointer g_class)
115 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
117 gst_element_class_add_pad_template (element_class,
118 gst_static_pad_template_get (&srctemplate));
120 gst_element_class_set_details (element_class, &gst_mythtv_src_details);
124 gst_mythtv_src_class_init (GstMythtvSrcClass * klass)
126 GObjectClass *gobject_class;
127 GstBaseSrcClass *gstbasesrc_class;
129 gobject_class = (GObjectClass *) klass;
130 gstbasesrc_class = (GstBaseSrcClass *) klass;
132 gobject_class->set_property = gst_mythtv_src_set_property;
133 gobject_class->get_property = gst_mythtv_src_get_property;
134 gobject_class->finalize = gst_mythtv_src_finalize;
136 g_object_class_install_property
137 (gobject_class, PROP_LOCATION,
138 g_param_spec_string ("location", "Location",
139 "The location. In the form:"
140 "\n\t\t\tmyth://a.com/file.nuv"
141 "\n\t\t\tmyth://a.com:23223/file.nuv "
142 "\n\t\t\ta.com/file.nuv - default scheme 'myth'",
143 "", G_PARAM_READWRITE));
145 g_object_class_install_property
146 (gobject_class, PROP_URI,
147 g_param_spec_string ("uri", "Uri",
148 "The location in form of a URI (deprecated; use location)",
149 "", G_PARAM_READWRITE));
151 g_object_class_install_property
152 (gobject_class, PROP_MYTHTV_VERSION,
153 g_param_spec_int ("mythtv-version", "mythtv-version",
154 "Change Myth TV version",
155 26, 30, 26, G_PARAM_READWRITE));
157 g_object_class_install_property
158 (gobject_class, PROP_MYTHTV_LIVEID,
159 g_param_spec_int ("mythtv-live-id", "mythtv-live-id",
160 "Change Myth TV version",
161 0, 200, GST_MYTHTV_ID_NUM, G_PARAM_READWRITE));
163 g_object_class_install_property
164 (gobject_class, PROP_MYTHTV_LIVE_CHAINID,
165 g_param_spec_string ("mythtv-live-chainid", "mythtv-live-chainid",
166 "Sets the Myth TV chain ID (from TV Chain)",
167 "", G_PARAM_READWRITE));
169 g_object_class_install_property
170 (gobject_class, PROP_MYTHTV_LIVE,
171 g_param_spec_boolean ("mythtv-live", "mythtv-live",
172 "Enable MythTV Live TV content streaming",
173 FALSE, G_PARAM_READWRITE));
175 #ifndef GST_DISABLE_GST_DEBUG
176 g_object_class_install_property
177 (gobject_class, PROP_MYTHTV_DBG,
178 g_param_spec_boolean ("mythtv-debug", "mythtv-debug",
179 "Enable MythTV debug messages",
180 FALSE, G_PARAM_READWRITE));
183 gstbasesrc_class->start = gst_mythtv_src_start;
184 gstbasesrc_class->stop = gst_mythtv_src_stop;
185 gstbasesrc_class->get_size = gst_mythtv_src_get_size;
186 gstbasesrc_class->is_seekable = gst_mythtv_src_is_seekable;
188 gstbasesrc_class->create = gst_mythtv_src_create;
191 GST_DEBUG_CATEGORY_INIT (mythtvsrc_debug, "mythtvsrc", 0,
192 "MythTV Client Source");
196 gst_mythtv_src_init (GstMythtvSrc * this, GstMythtvSrcClass * g_class)
198 this->file_transfer = NULL;
200 this->unique_setup = FALSE;
202 this->mythtv_version = MYTHTV_VERSION_DEFAULT;
204 this->bytes_read = 0;
206 this->content_size = -1;
207 this->read_offset = 0;
209 this->live_tv = FALSE;
211 this->user_agent = g_strdup ("mythtvsrc");
212 this->mythtv_caps = NULL;
214 gst_pad_set_event_function (GST_BASE_SRC_PAD(GST_BASE_SRC(this)),
215 GST_DEBUG_FUNCPTR (gst_mythtv_src_handle_event));
220 gst_mythtv_src_finalize (GObject * gobject)
222 GstMythtvSrc *this = GST_MYTHTV_SRC (gobject);
224 g_free (this->user_agent);
226 if (this->mythtv_caps) {
227 gst_caps_unref (this->mythtv_caps);
228 this->mythtv_caps = NULL;
231 if (this->file_transfer) {
232 g_object_unref (this->file_transfer);
233 this->file_transfer = NULL;
236 if (this->uri_name) {
237 g_free (this->uri_name);
240 if (this->user_agent) {
241 g_free (this->user_agent);
244 G_OBJECT_CLASS (parent_class)->finalize (gobject);
249 do_seek( GstMythtvSrc *src, guint64 offset, guint size, GstBuffer *outbuf )
251 guint64 off_uint64 = myth_file_transfer_seek(src->file_transfer, offset, 1);
253 g_print( "[%s] Call MythTV SEEK with offset %llu, got a new one %llu...\n", __FUNCTION__,
254 offset, off_uint64 );
262 do_read_request_response (GstMythtvSrc * src, guint64 offset, guint size, GstBuffer * outbuf)
265 guint sizetoread = size; //GST_BUFFER_SIZE (outbuf);
267 g_print( "[%s] Reading %d bytes...\n", __FUNCTION__, sizetoread );
269 /* Loop sending the request:
270 * Retry whilst authentication fails and we supply it. */
274 GST_OBJECT_LOCK(src);
276 while ( sizetoread > 0 ) {
278 len = myth_file_transfer_read( src->file_transfer,
279 GST_BUFFER_DATA (outbuf) + read, sizetoread, TRUE );
283 src->read_offset += read;
285 } else if ( len < 0 ) {
288 /*else if ( len == 0 ) {
292 if ( len == sizetoread )
298 src->bytes_read += read;
300 GST_BUFFER_SIZE (outbuf) = read;
301 } else if ( read <= 0 || len <= 0 ) {
302 if ( src->live_tv == FALSE )
307 //GST_BUFFER_OFFSET (outbuf) = src->read_offset;
309 g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\
310 "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read,
311 src->read_offset, src->content_size );
313 GST_OBJECT_UNLOCK(src);
317 if ( src->live_tv == FALSE )
323 if ( src->bytes_read < src->content_size )
327 GST_OBJECT_UNLOCK(src);
331 GST_OBJECT_UNLOCK(src);
337 gst_mythtv_src_create ( GstBaseSrc * psrc, guint64 offset,
338 guint size, GstBuffer **outbuf )
341 GstFlowReturn ret = GST_FLOW_OK;
343 guint64 size_tmp = 0;
345 src = GST_MYTHTV_SRC (psrc);
347 g_print( "[%s]\tBUFFER OFFSET = %llu, BUFFER SIZE = %d.\n", __FUNCTION__, offset,
351 /* The caller should know the number of bytes and not read beyond EOS. */
352 if (G_UNLIKELY (src->eos))
355 /* Create the buffer. */
356 ret = gst_pad_alloc_buffer ( GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)),
357 // GST_BUFFER_OFFSET_NONE, GST_BASE_SRC (psrc)->blocksize,
359 src->mythtv_caps ? src->mythtv_caps :
360 GST_PAD_CAPS (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc))), outbuf );
362 if (G_UNLIKELY (ret == GST_FLOW_UNEXPECTED))
365 if (G_UNLIKELY (ret != GST_FLOW_OK))
368 read = do_read_request_response ( src, offset, size, *outbuf );
370 #if ENABLE_TIMING_POSITION == 1
371 if (src->live_tv == TRUE) {
375 size_tmp = myth_file_transfer_get_file_position( src->file_transfer );
376 if ( size_tmp > ( src->content_size + MYTHTV_TRANSFER_MAX_BUFFER ) )
377 src->content_size = size_tmp;
380 g_print( "\t[%s]\tGET_POSITION: file_position = %llu\n",
381 __FUNCTION__, size_tmp);
386 if (G_UNLIKELY (read < 0))
389 if (G_UNLIKELY(src->eos))
395 #if ENABLE_TIMING_POSITION == 1
396 if ( src->live_tv == TRUE ) {
398 guint64 size_tmp = 0;
401 size_tmp = myth_file_transfer_get_file_position( src->file_transfer );
402 if ( size_tmp > ( src->content_size + MYTHTV_TRANSFER_MAX_BUFFER ) )
403 src->content_size = size_tmp;
405 goto get_file_pos_eos;
406 g_print( "\t[%s]\tGET_POSITION: file_position = %llu\n",
407 __FUNCTION__, size_tmp);
412 GST_DEBUG_OBJECT (src, "EOS reached");
413 return GST_FLOW_UNEXPECTED;
418 GST_ELEMENT_ERROR (src, RESOURCE, READ,
419 (NULL), ("Could not read any bytes (%i, %s)", read,
421 return GST_FLOW_ERROR;
426 /* The following two charset mangling functions were copied from gnomevfssrc.
427 * Preserve them under the unverified assumption that they do something vaguely
431 unicodify (const char *str, int len, ...)
433 char *ret = NULL, *cset;
435 gsize bytes_read, bytes_written;
437 if (g_utf8_validate (str, len, NULL))
438 return g_strndup (str, len >= 0 ? len : strlen (str));
440 va_start (args, len);
441 while ((cset = va_arg (args, char *)) != NULL)
443 if (!strcmp (cset, "locale"))
444 ret = g_locale_to_utf8 (str, len, &bytes_read, &bytes_written, NULL);
446 ret = g_convert (str, len, "UTF-8", cset,
447 &bytes_read, &bytes_written, NULL);
457 gst_mythtv_src_unicodify (const char *str)
459 return unicodify (str, -1, "locale", "ISO-8859-1", NULL);
463 /* create a socket for connecting to remote server */
465 gst_mythtv_src_start ( GstBaseSrc * bsrc )
467 GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
469 GString *chain_id_local = NULL;
473 if (src->live_tv == TRUE && src->file_transfer != NULL) {
474 guint64 size_tmp = myth_file_transfer_get_file_position( src->file_transfer );
475 if (size_tmp > src->content_size)
476 src->content_size = size_tmp;
477 g_print( "\t[%s]\tGET_POSITION: file_position = %llu\n",
478 __FUNCTION__, size_tmp);
481 if (src->unique_setup == FALSE) {
482 src->unique_setup = TRUE;
487 GST_OBJECT_LOCK(src);
489 if ( src->live_tv ) {
490 src->spawn_livetv = myth_livetv_new( );
491 if ( myth_livetv_setup( src->spawn_livetv ) == FALSE ) {
495 /* set up the uri variable */
496 src->uri_name = g_strdup( src->spawn_livetv->proginfo->pathname->str );
497 chain_id_local = gmyth_tvchain_get_id( src->spawn_livetv->tvchain );
498 if ( chain_id_local != NULL ) {
499 src->live_chain_id = g_strdup( chain_id_local->str );
500 g_print( "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id );
502 src->live_tv_id = src->spawn_livetv->remote_encoder->recorder_num;
503 g_print ( "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name );
506 src->file_transfer = myth_file_transfer_new( src->live_tv_id,
507 g_string_new( src->uri_name ), -1, src->mythtv_version );
509 if ( src->file_transfer == NULL ) {
510 GST_OBJECT_UNLOCK(src);
515 if ( src->live_tv ) {
516 g_print ( "[%s] GST MYTHTVSRC: live_chain_id = %s\n", __FUNCTION__, src->live_chain_id );
517 /* sets the MythSocket to the FileTransfer */
518 //ret = myth_file_transfer_livetv_setup( &(src->file_transfer), src->spawn_livetv->remote_encoder->myth_socket );
520 /* sets the Playback monitor connection */
521 ret = myth_file_transfer_playback_setup( &(src->file_transfer), src->live_tv );
523 if ( src->live_tv == TRUE && ret == TRUE ) {
524 /* loop finished, set the max tries variable to zero again... */
525 wait_to_transfer = 0;
527 while ( wait_to_transfer++ < MYTHTV_TRANSFER_MAX_WAITS && ( myth_file_transfer_is_recording( src->file_transfer ) == FALSE
528 /*|| ( myth_file_transfer_get_file_position( src->file_transfer ) < ( src->content_size + 327680 ) )*/ ) )
532 /* sets the FileTransfer instance connection (video/audio download) */
533 ret = myth_file_transfer_setup( &(src->file_transfer), src->live_tv );
535 if ( ret == FALSE ) {
536 GST_OBJECT_UNLOCK(src);
537 #ifndef GST_DISABLE_GST_DEBUG
538 if ( src->mythtv_msgs_dbg )
539 g_printerr( "MythTV FileTransfer request failed when setting up socket connection!\n" );
541 goto begin_req_failed;
544 src->content_size = src->file_transfer->filesize;
546 GST_OBJECT_UNLOCK(src);
549 const char *str_value;
552 str_value = ne_get_response_header (src->request, "myth-metaint");
554 if ( sscanf (str_value, "%d", &gint_value) == 1 ) {
555 if (src->myth_caps) {
556 gst_caps_unref (src->myth_caps);
557 src->myth_caps = NULL;
559 src->myth_metaint = gint_value;
561 //src->mythtv_caps = gst_caps_new_simple ("application/x-gst_ff-nuv", NULL);
570 if (src->spawn_livetv != NULL )
571 g_object_unref( src->spawn_livetv );
573 GST_ELEMENT_ERROR (src, LIBRARY, INIT,
574 (NULL), ("Could not initialize MythTV library (%i, %s)", ret, src->uri_name));
579 GST_ELEMENT_ERROR (src, LIBRARY, INIT,
580 (NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret, src->uri_name));
586 gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size)
590 src = GST_MYTHTV_SRC (bsrc);
591 #if ENABLE_TIMING_POSITION == 1
592 guint64 size_tmp = 0;
593 if (src->live_tv == TRUE) {
596 size_tmp = myth_file_transfer_get_file_position( src->file_transfer );
597 if ( size_tmp > ( src->content_size + MYTHTV_TRANSFER_MAX_BUFFER ) )
598 src->content_size = size_tmp;
601 g_print( "\t[%s]\tGET_POSITION: file_position = %llu\n",
602 __FUNCTION__, size_tmp);
605 if (src->content_size <= 0)
608 *size = src->content_size;
613 /* close the socket and associated resources
614 * used both to recover from errors and go to NULL state */
616 gst_mythtv_src_stop (GstBaseSrc * bsrc)
620 src = GST_MYTHTV_SRC (bsrc);
623 g_free (src->uri_name);
624 src->uri_name = NULL;
627 if (src->mythtv_caps) {
628 gst_caps_unref (src->mythtv_caps);
629 src->mythtv_caps = NULL;
638 gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event)
640 GstMythtvSrc *src = GST_MYTHTV_SRC (GST_PAD_PARENT (pad));
642 switch (GST_EVENT_TYPE (event)) {
643 case GST_EVENT_FLUSH_START:
647 case GST_EVENT_FLUSH_STOP:
648 src->do_start = TRUE;
650 gst_element_set_state (GST_ELEMENT(src), GST_STATE_NULL);
651 gst_element_set_locked_state (GST_ELEMENT(src), TRUE);
656 //gboolean update = TRUE;
658 GstSeekType cur_type, stop_type;
660 gint64 cur = 0, stop = 0;
661 gst_event_parse_seek ( event, &rate, &format,
662 &flags, &cur_type, &cur,
665 g_print( "[%s] Got EVENT_SEEK.\n", __FUNCTION__ );
666 if ( !( flags & GST_SEEK_FLAG_FLUSH ) ) {
667 g_print( "[%s] Could get the FLAG_FLUSH message.\n", __FUNCTION__ );
669 //gboolean ret = gst_event_parse_new_segment ( event,
670 // &update, &rate, &format, &start, &stop,
672 //GstFlowReturn flow_ret = gst_mythtv_src_create (GST_BASE_SRC( GST_PAD_PARENT( psrc ) ),
673 // cur, stop - cur + 1, GstBuffer)
677 return gst_pad_event_default (pad, event);
680 return gst_pad_event_default (pad, event);
684 gst_mythtv_src_is_seekable( GstBaseSrc *base_src )
690 gst_mythtv_src_set_property (GObject * object, guint prop_id,
691 const GValue * value, GParamSpec * pspec)
693 GstMythtvSrc *mythtvsrc = GST_MYTHTV_SRC (object);
695 GST_OBJECT_LOCK (mythtvsrc);
700 if (!g_value_get_string (value)) {
701 GST_WARNING ("location property cannot be NULL");
705 if (mythtvsrc->uri_name != NULL) {
706 g_free (mythtvsrc->uri_name);
707 mythtvsrc->uri_name = NULL;
709 mythtvsrc->uri_name = g_value_dup_string (value);
713 #ifndef GST_DISABLE_GST_DEBUG
714 case PROP_MYTHTV_DBG:
716 mythtvsrc->mythtv_msgs_dbg = g_value_get_boolean (value);
720 case PROP_MYTHTV_VERSION:
722 mythtvsrc->mythtv_version = g_value_get_int (value);
725 case PROP_MYTHTV_LIVEID:
727 mythtvsrc->live_tv_id = g_value_get_int (value);
730 case PROP_MYTHTV_LIVE:
732 mythtvsrc->live_tv = g_value_get_boolean (value);
735 case PROP_MYTHTV_LIVE_CHAINID:
737 if (!g_value_get_string (value)) {
738 GST_WARNING ("MythTV Live chainid property cannot be NULL");
742 if (mythtvsrc->live_chain_id != NULL) {
743 g_free (mythtvsrc->live_chain_id);
744 mythtvsrc->live_chain_id = NULL;
746 mythtvsrc->live_chain_id = g_value_dup_string (value);
752 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
755 GST_OBJECT_UNLOCK (mythtvsrc);
761 gst_mythtv_src_get_property (GObject * object, guint prop_id,
762 GValue * value, GParamSpec * pspec)
764 GstMythtvSrc *mythtvsrc = GST_MYTHTV_SRC (object);
766 GST_OBJECT_LOCK (mythtvsrc);
771 gchar *str = g_strdup( "" );
773 if ( mythtvsrc->uri_name == NULL ) {
774 g_free (mythtvsrc->uri_name);
775 mythtvsrc->uri_name = NULL;
777 str = g_strdup( mythtvsrc->uri_name );
779 g_value_set_string ( value, str );
782 #ifndef GST_DISABLE_GST_DEBUG
783 case PROP_MYTHTV_DBG:
784 g_value_set_boolean ( value, mythtvsrc->mythtv_msgs_dbg );
787 case PROP_MYTHTV_VERSION:
789 g_value_set_int ( value, mythtvsrc->mythtv_version );
792 case PROP_MYTHTV_LIVEID:
794 g_value_set_int ( value, mythtvsrc->live_tv_id );
797 case PROP_MYTHTV_LIVE:
798 g_value_set_boolean ( value, mythtvsrc->live_tv );
800 case PROP_MYTHTV_LIVE_CHAINID:
802 gchar *str = g_strdup( "" );
804 if ( mythtvsrc->live_chain_id == NULL ) {
805 g_free (mythtvsrc->live_chain_id);
806 mythtvsrc->live_chain_id = NULL;
808 str = g_strdup( mythtvsrc->live_chain_id );
810 g_value_set_string ( value, str );
814 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
817 GST_OBJECT_UNLOCK (mythtvsrc);
820 /* entry point to initialize the plug-in
821 * initialize the plug-in itself
822 * register the element factories and pad templates
823 * register the features
826 plugin_init (GstPlugin * plugin)
828 return gst_element_register (plugin, "mythtvsrc", GST_RANK_NONE,
829 GST_TYPE_MYTHTV_SRC);
832 /* this is the structure that gst-register looks for
833 * so keep the name plugin_desc, or you cannot get your plug-in registered */
834 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
838 plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
841 /*** GSTURIHANDLER INTERFACE *************************************************/
843 gst_mythtv_src_uri_get_type (void)
849 gst_mythtv_src_uri_get_protocols (void)
851 static gchar *protocols[] = { "myth", "myths", NULL };
857 gst_mythtv_src_uri_get_uri (GstURIHandler * handler)
859 GstMythtvSrc *src = GST_MYTHTV_SRC (handler);
861 return src->uri_name;
865 gst_mythtv_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
867 GstMythtvSrc *src = GST_MYTHTV_SRC (handler);
871 protocol = gst_uri_get_protocol (uri);
872 if ((strcmp (protocol, "myth") != 0) && (strcmp (protocol, "myths") != 0)) {
877 g_object_set (src, "location", uri, NULL);
883 gst_mythtv_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
885 GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
887 iface->get_type = gst_mythtv_src_uri_get_type;
888 iface->get_protocols = gst_mythtv_src_uri_get_protocols;
889 iface->get_uri = gst_mythtv_src_uri_get_uri;
890 iface->set_uri = gst_mythtv_src_uri_set_uri;
894 size_header_handler (void *userdata, const char *value)
896 GstMythtvSrc *src = GST_MYTHTV_SRC (userdata);
898 //src->content_size = g_ascii_strtoull (value, NULL, 10);
900 GST_DEBUG_OBJECT (src, "content size = %lld bytes", src->content_size);