[svn r508] updated to new gmyth_file_transfer_read trunk
authorrenatofilho
Wed Apr 04 22:11:50 2007 +0100 (2007-04-04)
branchtrunk
changeset 503b0e8a532e882
parent 502 aa932d8bf85b
child 504 2b5355061b66
[svn r508] updated to new gmyth_file_transfer_read
gst-plugins-mythtv/configure.ac
gst-plugins-mythtv/src/gstmythtvsrc.c
     1.1 --- a/gst-plugins-mythtv/configure.ac	Wed Apr 04 21:53:33 2007 +0100
     1.2 +++ b/gst-plugins-mythtv/configure.ac	Wed Apr 04 22:11:50 2007 +0100
     1.3 @@ -98,32 +98,14 @@
     1.4  AC_SUBST(GOBJECT_CFLAGS)
     1.5  AC_SUBST(GOBJECT_LIBS)
     1.6  
     1.7 -dnl ========== Check for Hildon Libraries
     1.8 -PKG_CHECK_MODULES(HILDON,
     1.9 -  hildon-lgpl libosso hildon-status-bar-lib libhildonmenu hildon-base-lib hildon-control-panel hildon-libs,
    1.10 -  HAVE_HILDON=yes, HAVE_HILDON=no)
    1.11 -
    1.12 -if test "x$HAVE_HILDON" = "xyes"; then
    1.13 -  AC_DEFINE(MAEMO_PLATFORM, 1, [build with hildon libs])
    1.14 -  HILDON_CFLAGS="$HILDON_CFLAGS -DMAEMO_PLATFORM=1"
    1.15 -else
    1.16 -  AC_MSG_RESULT(no)
    1.17 -fi
    1.18 -
    1.19 -AM_CONDITIONAL(MAEMO_PLATFORM, test "x$HAVE_HILDON" = "xyes")
    1.20 -
    1.21 -dnl make HILDON_CFLAGS and HILDON_LIBS available
    1.22 -AC_SUBST(HILDON_CFLAGS)
    1.23 -AC_SUBST(HILDON_LIBS)
    1.24 -
    1.25  dnl *** MythTV ***
    1.26  PKG_CHECK_MODULES(GMYTH,
    1.27 -  gmyth-0.1,
    1.28 +  gmyth,
    1.29    HAVE_GMYTH=yes, HAVE_GMYTH=no)
    1.30  
    1.31  # Give error and exit if we don't have gobject
    1.32  if test "x$HAVE_GMYTH" = "xno"; then
    1.33 -  AC_MSG_ERROR(you need gmyth-0.1 must to be installed)
    1.34 +  AC_MSG_ERROR(you need gmyth must to be installed)
    1.35  fi
    1.36  
    1.37  # make GMYTH_CFLAGS and GMYTH_LIBS available
     2.1 --- a/gst-plugins-mythtv/src/gstmythtvsrc.c	Wed Apr 04 21:53:33 2007 +0100
     2.2 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c	Wed Apr 04 22:11:50 2007 +0100
     2.3 @@ -336,6 +336,7 @@
     2.4    gint read = 0;
     2.5    guint sizetoread = size;
     2.6    gint max_iters = GMYTHTV_TRANSFER_MAX_RESENDS;
     2.7 +  GMythFileTransferReadResult result;
     2.8  
     2.9    GST_LOG_OBJECT (src, "Starting: Reading %d bytes...", sizetoread);
    2.10  
    2.11 @@ -345,22 +346,22 @@
    2.12  
    2.13    while (sizetoread == size && --max_iters > 0) {
    2.14  
    2.15 -    len = gmyth_file_transfer_read (src->file_transfer,
    2.16 +    result = gmyth_file_transfer_read (src->file_transfer,
    2.17          data_ptr, sizetoread, src->live_tv);
    2.18  
    2.19      if (len > 0) {
    2.20 -      read += len;
    2.21 -      sizetoread -= len;
    2.22 +      read += data_ptr->len;
    2.23 +      sizetoread -= data_ptr->len;
    2.24      } else if (len < 0) {
    2.25  
    2.26        if (src->live_tv == FALSE) {
    2.27          read = -1;
    2.28          goto eos;
    2.29        } else {
    2.30 -        if (len == GMYTHTV_FILE_TRANSFER_READ_ERROR) {  /* -314 */
    2.31 +        if (result == GMYTH_FILE_TRANSFER_READ_ERROR) {  /* -314 */
    2.32            GST_INFO_OBJECT (src, "[LiveTV] FileTransfer READ_ERROR!");
    2.33            goto done;
    2.34 -        } else if (len == GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN) {      /* -315 */
    2.35 +        } else if (result == GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN) {      /* -315 */
    2.36            GST_INFO_OBJECT (src,
    2.37                "[LiveTV] FileTransfer - Go to the next program chain!");
    2.38            continue;
    2.39 @@ -368,7 +369,7 @@
    2.40          goto done;
    2.41        }
    2.42  
    2.43 -    } else if (len == 0)
    2.44 +    } else if (data_ptr->len == 0)
    2.45        goto done;
    2.46  
    2.47      if (read == sizetoread)
    2.48 @@ -392,7 +393,6 @@
    2.49  {
    2.50    GstMythtvSrc *src;
    2.51    GstFlowReturn ret = GST_FLOW_OK;
    2.52 -  gint read = -1;
    2.53  
    2.54    src = GST_MYTHTV_SRC (psrc);
    2.55  
    2.56 @@ -412,6 +412,7 @@
    2.57    /* just get from the byte array, no network effort... */
    2.58    if ((src->buffer_remain = src->bytes_queue->len) < MAX_READ_SIZE) {
    2.59    	GByteArray *buffer;
    2.60 +    GMythFileTransferReadResult result = GMYTH_FILE_TRANSFER_READ_OK;
    2.61    	
    2.62      buffer = NULL;
    2.63      guint buffer_size_inter = (INTERNAL_BUFFER_SIZE - src->buffer_remain);
    2.64 @@ -421,16 +422,16 @@
    2.65  
    2.66      buffer = g_byte_array_new ();
    2.67  
    2.68 -    read = do_read_request_response (src, buffer_size_inter, buffer);
    2.69 +    result = do_read_request_response (src, buffer_size_inter, buffer);
    2.70  
    2.71 -    if (G_UNLIKELY (read < 0)) {
    2.72 +    if (G_UNLIKELY (buffer->len < 0)) {
    2.73      	
    2.74      	if (buffer != NULL) {
    2.75  	      g_byte_array_free (buffer, TRUE);
    2.76  	      buffer = NULL;
    2.77  	    }
    2.78  	    
    2.79 -      if (src->live_tv || ( read == GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN ))
    2.80 +      if (src->live_tv || ( result == GMYTH_FILE_TRANSFER_READ_NEXT_PROG_CHAIN ))
    2.81          goto change_progchain;
    2.82        else
    2.83          goto read_error;
    2.84 @@ -457,13 +458,13 @@
    2.85      }
    2.86  
    2.87      src->bytes_queue =
    2.88 -        g_byte_array_append (src->bytes_queue, buffer->data, read);
    2.89 -    if (read > buffer_size_inter)
    2.90 +        g_byte_array_append (src->bytes_queue, buffer->data, buffer->len);
    2.91 +    if (buffer->len > buffer_size_inter)
    2.92        GST_WARNING_OBJECT (src,
    2.93            "INCREASED buffer size! Backend sent more than we ask him... (%d)",
    2.94            abs (read - buffer_size_inter));
    2.95  
    2.96 -    src->buffer_remain += read;
    2.97 +    src->buffer_remain += buffer->len;
    2.98  
    2.99      if (buffer != NULL) {
   2.100        g_byte_array_free (buffer, TRUE);
   2.101 @@ -726,7 +727,7 @@
   2.102        "MythTV FileTransfer filesize = %lld, content_size = %lld!",
   2.103        src->file_transfer->filesize, src->content_size);
   2.104  
   2.105 -  src->content_size = src->file_transfer->filesize;
   2.106 +  src->content_size = gmyth_file_transfer_get_filesize (src->file_transfer);
   2.107  
   2.108    src->do_start = FALSE;
   2.109