gst-plugins-mythtv/src/gstmythtvsrc.c
branchtrunk
changeset 361 7140b2c2e63c
parent 325 b6b5f2dc831d
child 364 9b20a9775516
     1.1 --- a/gst-plugins-mythtv/src/gstmythtvsrc.c	Fri Feb 02 22:46:13 2007 +0000
     1.2 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c	Wed Feb 14 21:35:23 2007 +0000
     1.3 @@ -398,6 +398,8 @@
     1.4  
     1.5    /* just get from the byte array, no network effort... */
     1.6    if ((src->buffer_remain = src->bytes_queue->len) < MAX_READ_SIZE) {
     1.7 +  	
     1.8 +program_chain_changed:
     1.9      GByteArray *buffer = NULL;
    1.10      guint buffer_size_inter = (INTERNAL_BUFFER_SIZE - src->buffer_remain);
    1.11  
    1.12 @@ -409,11 +411,23 @@
    1.13      read = do_read_request_response (src, buffer_size_inter, buffer);
    1.14  
    1.15      if (G_UNLIKELY (read < 0)) {
    1.16 +    	
    1.17 +    	if (buffer != NULL) {
    1.18 +	      g_byte_array_free (buffer, TRUE);
    1.19 +	      buffer = NULL;
    1.20 +	    }
    1.21 +	    
    1.22        if (src->live_tv)
    1.23          goto change_progchain;
    1.24        else
    1.25          goto read_error;
    1.26      } else if (G_UNLIKELY (read == 0)) {
    1.27 +    	
    1.28 +    	if (buffer != NULL) {
    1.29 +	      g_byte_array_free (buffer, TRUE);
    1.30 +	      buffer = NULL;
    1.31 +	    }
    1.32 +	    
    1.33        if (!src->live_tv)
    1.34          goto done;
    1.35        else
    1.36 @@ -421,7 +435,13 @@
    1.37      }
    1.38  
    1.39      if (G_UNLIKELY (src->update_prog_chain))
    1.40 -      goto change_progchain;
    1.41 +    {
    1.42 +    	if (buffer != NULL) {
    1.43 +	      g_byte_array_free (buffer, TRUE);
    1.44 +	      buffer = NULL;
    1.45 +	    }
    1.46 +      goto change_progchain;      
    1.47 +    }
    1.48  
    1.49      src->bytes_queue =
    1.50          g_byte_array_append (src->bytes_queue, buffer->data, read);
    1.51 @@ -477,15 +497,15 @@
    1.52    src->bytes_queue =
    1.53        g_byte_array_remove_range (src->bytes_queue, 0, buffer_size);
    1.54  
    1.55 -  GST_DEBUG_OBJECT (src, "Got buffer: BUFFER --->SIZE = %d, OFFSET = %llu, "
    1.56 +  GST_DEBUG_OBJECT ( src, "Got buffer: BUFFER --->SIZE = %d, OFFSET = %llu, "
    1.57        "OFFSET_END = %llu.", GST_BUFFER_SIZE (*outbuf),
    1.58 -      GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
    1.59 +      GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) );
    1.60  
    1.61    GST_DEBUG_OBJECT (src, "CONTENT_SIZE = %llu, BYTES_READ = %llu.",
    1.62        src->content_size, src->bytes_read);
    1.63  
    1.64 -  if (G_UNLIKELY (src->eos) || (!src->live_tv
    1.65 -          && (src->bytes_read >= src->content_size)))
    1.66 +  if ( G_UNLIKELY (src->eos) || ( !src->live_tv
    1.67 +          && ( src->bytes_read >= src->content_size ) ) )
    1.68      goto eos;
    1.69  
    1.70  done:
    1.71 @@ -519,12 +539,12 @@
    1.72          gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
    1.73  
    1.74      /* go to the next program chain */
    1.75 -    src->unique_setup = FALSE;
    1.76 -    src->update_prog_chain = TRUE;
    1.77 +    //src->unique_setup = FALSE;
    1.78 +    //src->update_prog_chain = TRUE;
    1.79  
    1.80 -    gst_mythtv_src_next_program_chain (src);
    1.81 +    //gst_mythtv_src_next_program_chain (src);
    1.82  
    1.83 -    return GST_FLOW_ERROR_NO_DATA;
    1.84 +    goto program_chain_changed;
    1.85    }
    1.86  
    1.87  }