gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
branchtrunk
changeset 164 81e9da9ad7db
parent 156 4b24a328c655
child 165 9726f9ebd4cb
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Thu Nov 30 21:05:13 2006 +0000
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Dec 01 14:52:05 2006 +0000
     1.3 @@ -469,9 +469,11 @@
     1.4        res = GST_FLOW_ERROR;
     1.5      }
     1.6    }
     1.7 +
     1.8    if (file_header != NULL) {
     1.9      gst_buffer_unref (file_header);
    1.10    }
    1.11 +  
    1.12    return res;
    1.13  }
    1.14  
    1.15 @@ -732,7 +734,7 @@
    1.16  
    1.17        timestamp = h->i_timecode * GST_MSECOND;
    1.18  
    1.19 -      GST_BUFFER_SIZE (buf) = h->i_length;
    1.20 +      //GST_BUFFER_SIZE (buf) = h->i_length;
    1.21        GST_BUFFER_TIMESTAMP (buf) = timestamp;
    1.22    }
    1.23    else {
    1.24 @@ -796,15 +798,18 @@
    1.25          default:
    1.26            break;
    1.27        }
    1.28 -      if (buf != NULL)
    1.29 +      if (buf != NULL) {
    1.30          gst_buffer_unref (buf);
    1.31 +        buf = NULL;
    1.32 +      }
    1.33  
    1.34        goto done;
    1.35      }
    1.36      default:
    1.37 -      if (buf != NULL)
    1.38 +      if (buf != NULL) {
    1.39          gst_buffer_unref (buf);
    1.40 -
    1.41 +        buf = NULL;
    1.42 +      }
    1.43        break;
    1.44    }
    1.45  
    1.46 @@ -835,6 +840,9 @@
    1.47  
    1.48          //GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad));
    1.49        }
    1.50 +  } else if (buf != NULL) {
    1.51 +      gst_buffer_unref (buf);
    1.52 +      buf = NULL;
    1.53    }
    1.54  
    1.55  done:
    1.56 @@ -1081,12 +1089,17 @@
    1.57        guint8 *data = NULL;
    1.58        data = (guint8 *) gst_adapter_take (nuv->priv->adapter, size);
    1.59        *buffer = gst_buffer_new ();
    1.60 -      gst_buffer_set_data (*buffer, data, size);
    1.61 +      GST_BUFFER_SIZE (buffer) = size;
    1.62 +      GST_BUFFER_MALLOCDATA (buffer) = g_malloc (size);
    1.63 +      GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
    1.64 +      g_free (data);
    1.65      } else {
    1.66        guint8 *data = NULL;
    1.67        data = (guint8 *) gst_adapter_peek (nuv->priv->adapter, size);
    1.68        *buffer = gst_buffer_new ();
    1.69 -      gst_buffer_set_data (*buffer, data, size);
    1.70 +      GST_BUFFER_SIZE (buffer) = size;
    1.71 +      GST_BUFFER_MALLOCDATA (buffer) = g_malloc (size);
    1.72 +      GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
    1.73      }
    1.74    }
    1.75    return ret;
    1.76 @@ -1208,6 +1221,7 @@
    1.77      }
    1.78  
    1.79      case GST_EVENT_EOS:
    1.80 +        g_debug ("EEEEEEEEEEEEEEEEEOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSS");
    1.81      default:
    1.82        res = gst_pad_event_default (pad, event);
    1.83        break;
    1.84 @@ -1403,4 +1417,5 @@
    1.85      GST_VERSION_MINOR,
    1.86      "nuvdemux",
    1.87      "Demuxes and muxes audio and video",
    1.88 -    plugin_init, VERSION, "LGPL", "NuvDemux", "")
    1.89 +     plugin_init, VERSION, "LGPL", "NuvDemux", "")
    1.90 +