@@ -762,16 +762,20 @@ static int fmt_mp_to_sp(const struct v4l2_format *f_mp,
static int buf_sp_to_mp(const struct v4l2_buffer *b_sp,
struct v4l2_buffer *b_mp)
{
+ struct v4l2_plane *planes;
int ret;
+ planes = b_mp->m.planes;
memcpy(b_mp, b_sp, sizeof *b_mp);
+ b_mp->m.planes = planes;
+
ret = type_sp_to_mp(b_sp->type, &b_mp->type);
if (ret)
return ret;
b_mp->m.planes[0].length = b_sp->length;
b_mp->m.planes[0].bytesused = b_mp->bytesused;
b_mp->length = 1;
- memcpy(&b_mp->m.planes[0].m, &b_sp->m, sizeof(struct v4l2_plane));
+ memcpy(&b_mp->m.planes[0].m, &b_sp->m, sizeof(b_mp->m.planes[0].m));
return 0;
}
@@ -785,9 +789,10 @@ static int buf_mp_to_sp(const struct v4l2_buffer *b_mp,
ret = type_mp_to_sp(b_mp->type, &b_sp->type);
if (ret)
return ret;
+
b_sp->length = b_mp->m.planes[0].length;
b_sp->bytesused = b_mp->m.planes[0].bytesused;
- memcpy(&b_sp->m, &b_mp->m.planes[0].m, sizeof(struct v4l2_plane));
+ memcpy(&b_sp->m, &b_mp->m.planes[0].m, sizeof(b_sp->m));
return 0;
}