schro: Map raw video buffers with the correct read/write flags

This commit is contained in:
Sebastian Dröge 2012-07-23 10:54:17 +02:00
parent b60da6223e
commit 47546ab2df
4 changed files with 8 additions and 6 deletions

View file

@ -458,8 +458,9 @@ gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos)
gst_video_decoder_allocate_output_buffer (GST_VIDEO_DECODER
(schro_dec));
schro_frame =
gst_schro_buffer_wrap (outbuf, GST_VIDEO_INFO_FORMAT (&state->info),
state->info.width, state->info.height);
gst_schro_buffer_wrap (outbuf, TRUE,
GST_VIDEO_INFO_FORMAT (&state->info), state->info.width,
state->info.height);
schro_decoder_add_output_picture (schro_dec->decoder, schro_frame);
gst_video_codec_state_unref (state);
break;

View file

@ -525,6 +525,7 @@ gst_schro_enc_handle_frame (GstVideoEncoder * base_video_encoder,
/* FIXME : We could make that method just take GstVideoInfo ... */
schro_frame = gst_schro_buffer_wrap (gst_buffer_ref (frame->input_buffer),
FALSE,
GST_VIDEO_INFO_FORMAT (info),
GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info));

View file

@ -64,14 +64,14 @@ gst_schro_frame_get_buffer (SchroFrame * frame)
}
SchroFrame *
gst_schro_buffer_wrap (GstBuffer * buf, GstVideoFormat format, int width,
int height)
gst_schro_buffer_wrap (GstBuffer * buf, gboolean write, GstVideoFormat format,
int width, int height)
{
SchroFrame *frame;
GstMapInfo info;
FrameData *data;
if (!gst_buffer_map (buf, &info, GST_MAP_READ))
if (!gst_buffer_map (buf, &info, (write ? GST_MAP_READWRITE : GST_MAP_READ)))
return NULL;
switch (format) {

View file

@ -35,7 +35,7 @@
#endif
SchroFrame *
gst_schro_buffer_wrap (GstBuffer *buf, GstVideoFormat format, int width,
gst_schro_buffer_wrap (GstBuffer *buf, gboolean write, GstVideoFormat format, int width,
int height);
GstBuffer * gst_schro_frame_get_buffer (SchroFrame * frame);