[MOVED FROM BAD 101/134] port some more to new memory API

Fixes #668677.
This commit is contained in:
Mark Nauwelaerts 2012-01-25 18:49:58 +01:00 committed by Sebastian Dröge
parent ec7f8034af
commit 85c73e93f3
2 changed files with 13 additions and 11 deletions

View file

@ -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,

View file

@ -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);