# HG changeset patch # User rosfran # Date 1162854741 0 # Node ID 4ba74b706853ed867d24f11f64d37e2a75be0cc3 # Parent f7c91518d8f459ffd0fc5553ef1fd460e994622e [svn r71] Added some new functions: set channel, change program info improvements, faster live TV content rendering. diff -r f7c91518d8f4 -r 4ba74b706853 gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Mon Nov 06 22:59:51 2006 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Mon Nov 06 23:12:21 2006 +0000 @@ -30,19 +30,23 @@ GST_DEBUG_CATEGORY_STATIC (mythtvsrc_debug); #define GST_CAT_DEFAULT mythtvsrc_debug -#define GST_GMYTHTV_ID_NUM 1 +#define GST_GMYTHTV_ID_NUM 1 + +#define GST_GMYTHTV_CHANNEL_NUM 1000 #define GMYTHTV_VERSION_DEFAULT 30 #define GMYTHTV_TRANSFER_MAX_WAITS 100 -#define GMYTHTV_TRANSFER_MAX_BUFFER 80*1024 +#define GMYTHTV_TRANSFER_MAX_BUFFER 64*1024 //( 32*1024 ) /* 4*1024 ??? */ -#define MAX_READ_SIZE 12*1024 +#define MAX_READ_SIZE 4*1024 //( 32*1024 ) +#define GST_FLOW_ERROR_NO_DATA -101 + /* stablish a maximum iteration value to the IS_RECORDING message */ static guint wait_to_transfer = 0; @@ -57,7 +61,10 @@ GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-nuv") ); -static GStaticMutex update_size_mutex = G_STATIC_MUTEX_INIT; +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/x-nuv") ); enum { @@ -71,7 +78,8 @@ PROP_GMYTHTV_LIVE, PROP_GMYTHTV_LIVEID, PROP_GMYTHTV_LIVE_CHAINID, - PROP_GMYTHTV_ENABLE_TIMING_POSITION + PROP_GMYTHTV_ENABLE_TIMING_POSITION, + PROP_GMYTHTV_CHANNEL_NUM }; static void gst_mythtv_src_finalize (GObject * gobject); @@ -101,7 +109,6 @@ static gint do_read_request_response (GstMythtvSrc *src, guint64 offset, guint size, GstBuffer **outbuf); -//static gboolean gst_mythtv_src_sink_activate_pull (GstPad * srcpad, gboolean active); static void _urihandler_init (GType type) @@ -169,19 +176,19 @@ g_object_class_install_property (gobject_class, PROP_GMYTHTV_VERSION, g_param_spec_int ("mythtv-version", "mythtv-version", - "Change Myth TV version", + "Change MythTV version", 26, 30, 26, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_GMYTHTV_LIVEID, g_param_spec_int ("mythtv-live-id", "mythtv-live-id", - "Change Myth TV version", + "Change MythTV version", 0, 200, GST_GMYTHTV_ID_NUM, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_GMYTHTV_LIVE_CHAINID, g_param_spec_string ("mythtv-live-chainid", "mythtv-live-chainid", - "Sets the Myth TV chain ID (from TV Chain)", + "Sets the MythTV chain ID (from TV Chain)", "", G_PARAM_READWRITE)); g_object_class_install_property @@ -195,6 +202,12 @@ g_param_spec_boolean ("mythtv-enable-timing-position", "mythtv-enable-timing-position", "Enable MythTV Live TV content size continuous updating", FALSE, G_PARAM_READWRITE)); + + g_object_class_install_property + (gobject_class, PROP_GMYTHTV_CHANNEL_NUM, + g_param_spec_int ("mythtv-channel", "mythtv-channel", + "Change MythTV channel number", + 0, 200, GST_GMYTHTV_CHANNEL_NUM, G_PARAM_READWRITE)); #ifndef GST_DISABLE_GST_DEBUG g_object_class_install_property @@ -223,6 +236,8 @@ this->unique_setup = FALSE; this->mythtv_version = GMYTHTV_VERSION_DEFAULT; + + this->state = GST_MYTHTV_SRC_FILE_TRANSFER; this->bytes_read = 0; @@ -242,8 +257,20 @@ this->mythtv_caps = NULL; this->update_prog_chain = FALSE; + this->channel_num = 0; + this->eos = FALSE; + this->adapter = NULL; + + this->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); + gst_element_add_pad (GST_ELEMENT (this), this->sinkpad); + + /* + this->srcpad = gst_pad_new_from_static_template (&srctemplate, "src"); + gst_element_add_pad (GST_ELEMENT (this), this->srcpad); + */ + gst_base_src_set_format( GST_BASE_SRC( this ), GST_FORMAT_BYTES ); gst_base_src_set_live ( GST_BASE_SRC( this ), TRUE ); @@ -273,7 +300,7 @@ } if (this->spawn_livetv) { - //g_object_unref (this->spawn_livetv); + g_object_unref (this->spawn_livetv); this->spawn_livetv = NULL; } @@ -299,13 +326,16 @@ /* Loop sending the Myth File Transfer request: * Retry whilst authentication fails and we supply it. */ gint len = 0; + + /* max number of buffer resend interactions */ + //guint max_tries = 3; GST_OBJECT_LOCK(src); while ( sizetoread > 0 ) { len = gmyth_file_transfer_read( src->file_transfer, - GST_BUFFER_DATA( *outbuf ) + read, sizetoread, TRUE ); + GST_BUFFER_DATA( *outbuf ) + read, sizetoread, TRUE ); if ( len > 0 ) { read += len; @@ -313,49 +343,43 @@ } else if ( len <= 0 ) { + read = -1; if ( src->live_tv == FALSE ) { - goto eos; + goto eos; } else { - if ( len == GMYTHTV_FILE_TRANSFER_READ_ERROR ) { /* -314 */ - src->update_prog_chain = TRUE; - if ( gst_mythtv_src_next_program_chain ( src ) ) - continue; - else - goto eos; - } else - if ( abs( src->content_size - src->prev_content_size ) < GMYTHTV_TRANSFER_MAX_BUFFER ) { - src->update_prog_chain = TRUE; - if ( src->enable_timing_position ) { - gint64 size_tmp = 0; - if (src->live_tv == TRUE) { -get_file_pos: - size_tmp = gmyth_file_transfer_get_file_position( src->file_transfer ); - if ( size_tmp > ( src->content_size + GMYTHTV_TRANSFER_MAX_BUFFER ) ) - src->content_size = size_tmp; - else if ( size_tmp > 0 ) - goto get_file_pos; - g_print( "\t[%s]\tGET_POSITION: file_position = %lld\n", - __FUNCTION__, size_tmp ); - } - } else if ( abs( src->content_size - src->prev_content_size ) < GMYTHTV_TRANSFER_MAX_BUFFER ) { - src->prev_content_size = src->content_size; - gint64 new_offset = gmyth_file_transfer_get_file_position( src->file_transfer ); - if ( new_offset > 0 ) { - if ( src->content_size < new_offset ) { - src->content_size = new_offset; - } - } else { - src->update_prog_chain = TRUE; - } - } - goto done; - } - goto done; - } + if ( len == GMYTHTV_FILE_TRANSFER_READ_ERROR ) { /* -314 */ + src->update_prog_chain = TRUE; + goto done; + } else + if ( abs( src->content_size - src->bytes_read ) < GMYTHTV_TRANSFER_MAX_BUFFER ) { + src->update_prog_chain = TRUE; + if ( src->enable_timing_position ) { + gint64 size_tmp = 0; + get_file_pos: + size_tmp = gmyth_file_transfer_get_file_position( src->file_transfer ); + if ( size_tmp > ( src->content_size + GMYTHTV_TRANSFER_MAX_BUFFER ) ) + src->content_size = size_tmp; + else if ( size_tmp > 0 ) + goto get_file_pos; + g_print( "\t[%s]\tGET_POSITION: file_position = %lld\n", + __FUNCTION__, size_tmp ); + } else if ( abs( src->content_size - src->bytes_read ) < GMYTHTV_TRANSFER_MAX_BUFFER ) { + src->prev_content_size = src->content_size; + gint64 new_offset = gmyth_file_transfer_get_file_position( src->file_transfer ); + if ( new_offset > 0 && src->content_size <= new_offset ) { + src->content_size = new_offset; + } else { + src->update_prog_chain = TRUE; + } + } + goto done; + } + goto done; + } } @@ -366,6 +390,7 @@ if ( read > 0 ) { src->read_offset += read; src->bytes_read += read; + //src->content_size += src->bytes_read; g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read, @@ -432,8 +457,12 @@ //src->icy_caps ? src->icy_caps : GST_PAD_CAPS (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc))), outbuf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) - goto done; + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + if ( src->live_tv ) + goto change_progchain; + else + goto done; + } read = do_read_request_response ( src, src->read_offset, size, outbuf ); @@ -477,43 +506,16 @@ // go to the next program chain src->unique_setup = FALSE; src->update_prog_chain = TRUE; - //gst_mythtv_src_next_program_chain( src ); - return -101; + + //GST_OBJECT_LOCK(src); + gst_mythtv_src_next_program_chain( src ); + //GST_OBJECT_UNLOCK(src); + + return GST_FLOW_ERROR_NO_DATA; } } -void -update_size_func( void *mythtv_data ) -{ - GstMythtvSrc *src; - - g_return_if_fail( mythtv_data != NULL ); - - src = GST_MYTHTV_SRC ( mythtv_data ); - - g_static_mutex_lock( &update_size_mutex ); - - if ( src->do_start ) { - if ( src->enable_timing_position ) { - gint64 size_tmp = 0; - if (src->live_tv == TRUE) { -get_file_pos: - g_usleep( 50 ); - size_tmp = gmyth_file_transfer_get_file_position( src->file_transfer ); - if ( size_tmp > ( src->content_size + GMYTHTV_TRANSFER_MAX_BUFFER ) ) - src->content_size = size_tmp; - else if ( size_tmp > 0 ) - goto get_file_pos; - g_print( "\t[%s]\tGET_POSITION: file_position = %lld\n", - __FUNCTION__, size_tmp ); - } - } - } - g_static_mutex_unlock( &update_size_mutex ); - -} - gint64 gst_mythtv_src_get_position ( GstMythtvSrc* src ) { @@ -566,7 +568,7 @@ ret = FALSE; GST_OBJECT_UNLOCK( src ); goto init_failed; - } + } /* set up the uri variable */ src->uri_name = g_strdup( src->spawn_livetv->proginfo->pathname->str ); @@ -575,8 +577,8 @@ src->live_chain_id = g_strdup( chain_id_local->str ); g_print( "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); } - src->live_tv_id = src->spawn_livetv->remote_encoder->recorder_num; - g_print ( "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); + src->live_tv_id = src->spawn_livetv->recorder->recorder_num; + g_print ( "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); } src->file_transfer = gmyth_file_transfer_new( src->live_tv_id, @@ -595,7 +597,8 @@ /* loop finished, set the max tries variable to zero again... */ wait_to_transfer = 0; - while ( wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS && ( gmyth_file_transfer_is_recording( src->file_transfer ) == FALSE + while ( wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS && + ( gmyth_file_transfer_is_recording( src->file_transfer ) == FALSE /*|| ( gmyth_file_transfer_get_file_position( src->file_transfer ) < ( src->content_size + 327680 ) )*/ ) ) g_usleep( 100 ); } @@ -649,8 +652,12 @@ if ( !src->live_tv ) goto init_failed; - - src->update_prog_chain = FALSE; + + if (src->unique_setup == FALSE) { + src->unique_setup = TRUE; + } else { + goto done; + } if (src->file_transfer) { g_object_unref (src->file_transfer); @@ -663,6 +670,7 @@ if ( src->live_tv ) { if ( gmyth_livetv_next_program_chain( src->spawn_livetv ) == FALSE ) { + g_print( "\n\n[%s]\t\tFailed to go to the next program chain!!!\n\n", __FUNCTION__ ); ret = FALSE; goto init_failed; } @@ -673,7 +681,7 @@ src->live_chain_id = g_strdup( chain_id_local->str ); g_print( "\t[%s]\tLocal chain ID = %s.\n", __FUNCTION__, src->live_chain_id ); } - src->live_tv_id = src->spawn_livetv->remote_encoder->recorder_num; + src->live_tv_id = src->spawn_livetv->recorder->recorder_num; g_print ( "[%s] LiveTV id = %d, URI path = %s.\n", __FUNCTION__, src->live_tv_id, src->uri_name ); } @@ -694,7 +702,7 @@ g_usleep( 200 ); while ( wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS && - ( gmyth_file_transfer_is_recording( src->file_transfer ) == FALSE ) ) + ( gmyth_file_transfer_is_recording( src->file_transfer ) == FALSE ) ) g_usleep( 1000 ); } @@ -722,13 +730,17 @@ #endif src->content_size = src->file_transfer->filesize; - while ( src->content_size < GMYTHTV_TRANSFER_MAX_BUFFER ) + while ( src->content_size < GMYTHTV_TRANSFER_MAX_BUFFER*4 ) src->content_size = gst_mythtv_src_get_position( src ); - //src->read_offset = 0; + src->read_offset = 0; - //src->update_prog_chain = FALSE; + src->update_prog_chain = FALSE; + + gst_pad_push_event ( src->sinkpad, + gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 0, src->content_size, 0 ) ); +done: return TRUE; /* ERRORS */ @@ -823,25 +835,22 @@ { GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc); gboolean ret = TRUE; - g_print( "[%s] Difference from previous content size: %d (max.: %d)\n", __FUNCTION__, + g_print( "[%s] Differs from previous content size: %d (max.: %d)\n", __FUNCTION__, abs( src->content_size - src->prev_content_size ), GMYTHTV_TRANSFER_MAX_BUFFER ); if (src->content_size <= 0) { ret= FALSE; } else if ( src->live_tv && ( abs( src->content_size - src->bytes_read ) < - GMYTHTV_TRANSFER_MAX_BUFFER ) ) { + GMYTHTV_TRANSFER_MAX_BUFFER ) ) { //g_static_mutex_lock( &update_size_mutex ); //GST_OBJECT_LOCK(src); - src->prev_content_size = src->content_size; + gint64 new_offset = gmyth_file_transfer_get_file_position( src->file_transfer ); - if ( new_offset > 0 ) { - if ( src->content_size < new_offset ) { - src->content_size = new_offset; - } - } else { - if ( src->live_tv ) - src->update_prog_chain = TRUE; - } + if ( new_offset > 0 && new_offset > src->content_size ) { + src->content_size = new_offset; + } else if ( new_offset < src->content_size ) { + src->update_prog_chain = TRUE; + } if ( src->enable_timing_position ) { gint64 size_tmp = 0; @@ -857,6 +866,9 @@ __FUNCTION__, size_tmp ); } } + + src->prev_content_size = src->content_size; + //GST_OBJECT_UNLOCK(src); //g_static_mutex_unlock( &update_size_mutex ); } @@ -988,68 +1000,142 @@ } #if 0 -static gboolean -gst_nuv_demux_sink_activate (GstPad * sinkpad) +static GstFlowReturn +gst_mythtv_src_file_transfer( GstMythtvSrc *src ) { - gboolean res = TRUE; - GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad)); + GstFlowReturn ret = GST_FLOW_OK; + GstBuffer *buf = NULL; + gint read = -1; + + /* The caller should know the number of bytes and not read beyond EOS. */ + if ( G_UNLIKELY (src->eos) ) + goto eos; + if ( G_UNLIKELY (src->update_prog_chain) ) + goto change_progchain; - if (gst_pad_check_pull_range (sinkpad)) { - nuv->mode = 0; - nuv->adapter = NULL; - res = gst_pad_activate_pull (sinkpad, TRUE); - } else { - nuv->mode = 1; - nuv->adapter = gst_adapter_new (); - res = gst_pad_activate_push (sinkpad, TRUE); + do { + + /* Create the buffer. */ + buf = gst_buffer_new_and_alloc (4096); + + ret = gst_mythtv_src_read_bytes( src, GST_BUFFER_SIZE(buf), TRUE, &buf ); + if ( ret != GST_FLOW_OK ) + return ret; + + read = do_read_request_response ( src, src->read_offset, GST_BUFFER_SIZE(buf), &buf ); + + if (G_UNLIKELY (src->update_prog_chain) ) + goto change_progchain; + + if (G_UNLIKELY (read <= 0) || buf == NULL) { + if ( src->live_tv ) + goto change_progchain; + else + goto read_error; + } + + if ( GST_FLOW_OK != ( ret = gst_pad_push ( src->sinkpad, buf ) ) ) { + goto done; + } + + } while(TRUE); + +done: + { + const gchar *reason = gst_flow_get_name (ret); + + GST_DEBUG_OBJECT (src, "DONE task, reason %s", reason); + return ret; + } +eos: + { + const gchar *reason = gst_flow_get_name (ret); + + GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason); + return GST_FLOW_UNEXPECTED; } - - g_object_unref (nuv); - return res; -} - -static gboolean -gst_nuv_demux_sink_activate_pull (GstPad * sinkpad, gboolean active) -{ - GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad)); - - if (active) { - gst_pad_start_task (sinkpad, (GstTaskFunction) gst_nuv_demux_loop, sinkpad); - } else { - gst_pad_stop_task (sinkpad); + /* ERRORS */ +read_error: + { + GST_ELEMENT_ERROR (src, RESOURCE, READ, + (NULL), ("Could not read any bytes (%i, %s)", read, + src->uri_name)); + return GST_FLOW_ERROR; } - gst_object_unref (nuv); - - return TRUE; +change_progchain: + { + GST_ELEMENT_ERROR (src, RESOURCE, READ, + (NULL), ("Seek failed, go to the next program info... (%i, %s)", read, + src->uri_name)); + // go to the next program chain + src->unique_setup = FALSE; + src->update_prog_chain = TRUE; + src->mode = GST_MYTHTV_SRC_NEXT_PROGRAM_CHAIN; + + //GST_OBJECT_LOCK(src); + //gst_mythtv_src_next_program_chain( src ); + //GST_OBJECT_UNLOCK(src); + return GST_FLOW_OK;//GST_FLOW_ERROR_NO_DATA; + } } static GstFlowReturn -gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf) +gst_mythtv_src_play (GstPad * pad) { - GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad)); + GstFlowReturn res = GST_FLOW_OK; + GstMythtvSrc *src = GST_MYTHTV_SRC (GST_PAD_PARENT (pad)); + + switch ( src->state ) { + case GST_MYTHTV_SRC_FILE_TRANSFER: + res = gst_mythtv_src_file_transfer( src ); + if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { + goto pause; + } + break; + case GST_MYTHTV_SRC_NEXT_PROGRAM_CHAIN: + src->read_offset = 0; + src->bytes_read = 0; + src->unique_setup = FALSE; + if ( !gst_mythtv_src_next_program_chain( src ) ) { + goto pause; + } + src->state = GST_MYTHTV_SRC_FILE_TRANSFER; + break; + case GST_MYTHTV_SRC_INVALID_DATA: + goto pause; + break; + default: + g_assert_not_reached (); + } - gst_adapter_push (nuv->adapter, buf); + GST_DEBUG_OBJECT (src, "state: %d res:%s", src->state, + gst_flow_get_name (res)); - return gst_nuv_demux_play (pad); -} + return GST_FLOW_OK; -static void -gst_nuv_demux_loop (GstPad * pad) -{ - gst_nuv_demux_play (pad); +pause: + GST_LOG_OBJECT (src, "pausing task, reason %s", gst_flow_get_name (res)); + gst_pad_pause_task (src->srcpad); + if (GST_FLOW_IS_FATAL (res)) { + GST_ELEMENT_ERROR (src, STREAM, FAILED, + ("Internal data stream error."), + ("streaming stopped, reason %s", gst_flow_get_name (res))); + gst_pad_send_event( src->sinkpad, gst_event_new_eos() ); + } + return res; } #endif static GstStateChangeReturn gst_mythtv_src_change_state (GstElement * element, GstStateChange transition) { - GstStateChangeReturn ret = GST_STATE_CHANGE_NO_PREROLL; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; //GST_STATE_CHANGE_NO_PREROLL; GstMythtvSrc *src = GST_MYTHTV_SRC (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: src->do_start = TRUE; - src->unique_setup = FALSE; + src->unique_setup = FALSE; break; case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_PAUSED_TO_PLAYING: @@ -1066,16 +1152,23 @@ switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: g_print( "[%s] READY to NULL called!\n", __FUNCTION__ ); + if ( src->live_tv && src->update_prog_chain ) { + gst_pad_push_event ( src->sinkpad, + gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 0, src->content_size, 0 ) ); + gst_element_set_state ( GST_ELEMENT (src), GST_STATE_READY ); + } break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: g_print( "[%s] PLAYING to PAUSED called!\n", __FUNCTION__ ); - break; case GST_STATE_CHANGE_PAUSED_TO_READY: g_print( "[%s] PAUSED to READY called!\n", __FUNCTION__ ); if ( src->live_tv && src->update_prog_chain ) { - src->read_offset = 0; - src->bytes_read = 0; - gst_mythtv_src_next_program_chain( src ); + src->read_offset = 0; + src->bytes_read = 0; + src->unique_setup = FALSE; + //GST_OBJECT_LOCK( src ); + gst_mythtv_src_next_program_chain( src ); + //GST_OBJECT_UNLOCK( src ); } break; default: @@ -1150,7 +1243,11 @@ mythtvsrc->live_chain_id = g_value_dup_string (value); break; } - + case PROP_GMYTHTV_CHANNEL_NUM: + { + mythtvsrc->channel_num = g_value_get_int (value); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1216,6 +1313,11 @@ g_value_set_string ( value, str ); break; } + case PROP_GMYTHTV_CHANNEL_NUM: + { + g_value_set_int ( value, mythtvsrc->channel_num ); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff -r f7c91518d8f4 -r 4ba74b706853 gst-plugins-mythtv/src/gstmythtvsrc.h --- a/gst-plugins-mythtv/src/gstmythtvsrc.h Mon Nov 06 22:59:51 2006 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.h Mon Nov 06 23:12:21 2006 +0000 @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -40,6 +41,13 @@ typedef struct _GstMythtvSrc GstMythtvSrc; typedef struct _GstMythtvSrcClass GstMythtvSrcClass; + +typedef enum { + GST_MYTHTV_SRC_FILE_TRANSFER, + GST_MYTHTV_SRC_NEXT_PROGRAM_CHAIN, + GST_MYTHTV_SRC_INVALID_DATA +} GstMythtvState; + struct _GstMythtvSrc { GstBaseSrc element; @@ -47,6 +55,8 @@ GMythFileTransfer *file_transfer; GMythLiveTV *spawn_livetv; + + GstMythtvState state; gchar *uri_name; gchar *user_agent; @@ -64,6 +74,7 @@ guint64 bytes_read; gint64 read_offset; + gint64 old_offset; gboolean eos; @@ -76,9 +87,18 @@ gboolean enable_timing_position; gint live_tv_id; + + gint channel_num; + + guint mode; /* MythTV capabilities */ GstCaps *mythtv_caps; + + GstPad *sinkpad; + GstPad *srcpad; + + GstAdapter *adapter; /* enable Myth TV debug messages */ gboolean mythtv_msgs_dbg;