From 85c73e93f32c593c320a36bd50bccb3254c1df33 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 25 Jan 2012 18:49:58 +0100 Subject: [PATCH] [MOVED FROM BAD 101/134] port some more to new memory API Fixes #668677. --- ext/vp8/gstvp8dec.c | 17 +++++++++-------- ext/vp8/gstvp8enc.c | 7 ++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c index a88ff1c..8aa515b 100644 --- a/ext/vp8/gstvp8dec.c +++ b/ext/vp8/gstvp8dec.c @@ -366,8 +366,7 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, vpx_image_t *img; long decoder_deadline = 0; GstClockTimeDiff deadline; - gsize size; - gpointer data; + GstMapInfo map; GST_DEBUG_OBJECT (decoder, "handle_frame"); @@ -383,13 +382,13 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, memset (&stream_info, 0, sizeof (stream_info)); stream_info.sz = sizeof (stream_info); - data = gst_buffer_map (frame->sink_buffer, &size, NULL, GST_MAP_READ); + gst_buffer_map (frame->sink_buffer, &map, GST_MAP_READ); status = - vpx_codec_peek_stream_info (&vpx_codec_vp8_dx_algo, data, size, + vpx_codec_peek_stream_info (&vpx_codec_vp8_dx_algo, map.data, map.size, &stream_info); - gst_buffer_unmap (frame->sink_buffer, data, size); + gst_buffer_unmap (frame->sink_buffer, &map); if (status != VPX_CODEC_OK || !stream_info.is_kf) { GST_WARNING_OBJECT (decoder, "No keyframe, skipping"); @@ -456,11 +455,13 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, decoder_deadline = MAX (1, deadline / GST_MSECOND); } - data = gst_buffer_map (frame->sink_buffer, &size, NULL, GST_MAP_READ); + gst_buffer_map (frame->sink_buffer, &map, GST_MAP_READ); - status = vpx_codec_decode (&dec->decoder, data, size, NULL, decoder_deadline); + status = + vpx_codec_decode (&dec->decoder, map.data, map.size, NULL, + decoder_deadline); - gst_buffer_unmap (frame->sink_buffer, data, size); + gst_buffer_unmap (frame->sink_buffer, &map); if (status) { GST_ELEMENT_ERROR (decoder, LIBRARY, ENCODE, diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c index b4f1f66..afdf90f 100644 --- a/ext/vp8/gstvp8enc.c +++ b/ext/vp8/gstvp8enc.c @@ -854,7 +854,7 @@ gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder, const GstTagList *iface_tags; GValue array = { 0, }; GValue value = { 0, }; - gsize size; + GstMapInfo map; s = gst_caps_get_structure (caps, 0); /* put buffers in a fixed list */ @@ -863,7 +863,8 @@ gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder, /* Create Ogg stream-info */ stream_hdr = gst_buffer_new_and_alloc (26); - data = gst_buffer_map (stream_hdr, &size, NULL, GST_MAP_WRITE); + gst_buffer_map (stream_hdr, &map, GST_MAP_WRITE); + data = map.data; GST_WRITE_UINT8 (data, 0x4F); GST_WRITE_UINT32_BE (data + 1, 0x56503830); /* "VP80" */ @@ -877,7 +878,7 @@ gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder, GST_WRITE_UINT32_BE (data + 18, info->fps_n); GST_WRITE_UINT32_BE (data + 22, info->fps_d); - gst_buffer_unmap (stream_hdr, data, size); + gst_buffer_unmap (stream_hdr, &map); GST_BUFFER_FLAG_SET (stream_hdr, GST_BUFFER_FLAG_IN_CAPS); gst_value_set_buffer (&value, stream_hdr); -- 2.7.4