diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2012-01-25 18:49:58 +0100 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2012-01-25 18:50:40 +0100 |
commit | 12ee41829c4e1d350adeb898c721724550620260 (patch) | |
tree | fa2f03da024198b1207562f09e82c96f2858ac8b /sys/dvb/gstdvbsrc.c | |
parent | 7aead77649ed8c1531d4e969651452dcb40f8c70 (diff) |
port some more to new memory API
Fixes #668677.
Diffstat (limited to 'sys/dvb/gstdvbsrc.c')
-rw-r--r-- | sys/dvb/gstdvbsrc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c index 01fac8926..6096f6ca3 100644 --- a/sys/dvb/gstdvbsrc.c +++ b/sys/dvb/gstdvbsrc.c @@ -901,14 +901,14 @@ gst_dvbsrc_read_device (GstDvbSrc * object, int size) gint ret_val = 0; GstBuffer *buf = gst_buffer_new_and_alloc (size); GstClockTime timeout = object->timeout * GST_USECOND; - guint8 *data; + GstMapInfo map; g_return_val_if_fail (GST_IS_BUFFER (buf), NULL); if (object->fd_dvr < 0) return NULL; - data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + gst_buffer_map (buf, &map, GST_MAP_WRITE); while (count < size) { ret_val = gst_poll_wait (object->poll, timeout); GST_LOG_OBJECT (object, "select returned %d", ret_val); @@ -923,7 +923,7 @@ gst_dvbsrc_read_device (GstDvbSrc * object, int size) gst_message_new_element (GST_OBJECT (object), gst_structure_new_empty ("dvb-read-failure"))); } else { - int nread = read (object->fd_dvr, data + count, size - count); + int nread = read (object->fd_dvr, map.data + count, size - count); if (G_UNLIKELY (nread < 0)) { GST_WARNING_OBJECT @@ -937,20 +937,21 @@ gst_dvbsrc_read_device (GstDvbSrc * object, int size) count = count + nread; } } - gst_buffer_unmap (buf, data, count); + gst_buffer_unmap (buf, &map); + gst_buffer_resize (buf, 0, count); GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; return buf; stopped: GST_DEBUG_OBJECT (object, "stop called"); - gst_buffer_unmap (buf, data, 0); + gst_buffer_unmap (buf, &map); gst_buffer_unref (buf); return NULL; select_error: GST_ELEMENT_ERROR (object, RESOURCE, READ, (NULL), ("select error %d: %s (%d)", ret_val, g_strerror (errno), errno)); - gst_buffer_unmap (buf, data, 0); + gst_buffer_unmap (buf, &map); gst_buffer_unref (buf); return NULL; } |