mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
port to new memory API
This commit is contained in:
parent
bc44628831
commit
aa0a531c23
3 changed files with 12 additions and 9 deletions
|
@ -161,17 +161,16 @@ gst_dtmf_detect_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
|||
gint dtmf_count;
|
||||
gchar dtmfbuf[MAX_DTMF_DIGITS] = "";
|
||||
gint i;
|
||||
gpointer data;
|
||||
gsize size;
|
||||
GstMapInfo map;
|
||||
|
||||
if (GST_BUFFER_IS_DISCONT (buf))
|
||||
zap_dtmf_detect_init (&self->dtmf_state);
|
||||
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP))
|
||||
return GST_FLOW_OK;
|
||||
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||
|
||||
zap_dtmf_detect (&self->dtmf_state, (gint16 *) data, size / 2, FALSE);
|
||||
zap_dtmf_detect (&self->dtmf_state, (gint16 *) map.data, map.size / 2, FALSE);
|
||||
|
||||
dtmf_count = zap_dtmf_get (&self->dtmf_state, dtmfbuf, MAX_DTMF_DIGITS);
|
||||
|
||||
|
@ -180,7 +179,7 @@ gst_dtmf_detect_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
|||
else
|
||||
GST_LOG_OBJECT (self, "Got no DTMF events");
|
||||
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
gst_buffer_unmap (buf, &map);
|
||||
|
||||
for (i = 0; i < dtmf_count; i++) {
|
||||
GstMessage *dtmf_message = NULL;
|
||||
|
|
|
@ -541,6 +541,7 @@ gst_dtmf_src_generate_tone (GstDTMFSrcEvent * event, DTMF_KEY key,
|
|||
float duration, gint sample_rate)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
GstMapInfo map;
|
||||
gint16 *p;
|
||||
gint tone_size;
|
||||
double i = 0;
|
||||
|
@ -552,7 +553,8 @@ gst_dtmf_src_generate_tone (GstDTMFSrcEvent * event, DTMF_KEY key,
|
|||
|
||||
buffer = gst_buffer_new_allocate (NULL, tone_size, 1);
|
||||
|
||||
p = (gint16 *) gst_buffer_map (buffer, NULL, NULL, GST_MAP_READWRITE);
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READWRITE);
|
||||
p = (gint16 *) map.data;
|
||||
|
||||
volume_factor = pow (10, (-event->volume) / 20);
|
||||
|
||||
|
@ -581,7 +583,7 @@ gst_dtmf_src_generate_tone (GstDTMFSrcEvent * event, DTMF_KEY key,
|
|||
(event->sample)++;
|
||||
}
|
||||
|
||||
gst_buffer_unmap (buffer, p, tone_size);
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -333,6 +333,7 @@ gst_dtmf_src_generate_tone (GstRtpDTMFDepay * rtpdtmfdepay,
|
|||
GstRTPDTMFPayload payload)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
GstMapInfo map;
|
||||
gint16 *p;
|
||||
gint tone_size;
|
||||
double i = 0;
|
||||
|
@ -351,7 +352,8 @@ gst_dtmf_src_generate_tone (GstRtpDTMFDepay * rtpdtmfdepay,
|
|||
GST_BUFFER_DURATION (buf) = payload.duration * GST_SECOND / clock_rate;
|
||||
volume = payload.volume;
|
||||
|
||||
p = (gint16 *) gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||
p = (gint16 *) map.data;
|
||||
|
||||
volume_factor = pow (10, (-volume) / 20);
|
||||
|
||||
|
@ -382,7 +384,7 @@ gst_dtmf_src_generate_tone (GstRtpDTMFDepay * rtpdtmfdepay,
|
|||
(rtpdtmfdepay->sample)++;
|
||||
}
|
||||
|
||||
gst_buffer_unmap (buf, p, tone_size);
|
||||
gst_buffer_unmap (buf, &map);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue