mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 14:11:15 +00:00
video: use metadata to set up strides
Use the GstMetaVideo when we can to map the buffers and set up the strides.
This commit is contained in:
parent
6b60a27aba
commit
20d8d3050c
1 changed files with 17 additions and 4 deletions
|
@ -887,9 +887,9 @@ gst_video_frame_map (GstVideoFrame * frame, GstVideoInfo * info,
|
||||||
GstBuffer * buffer, GstMapFlags flags)
|
GstBuffer * buffer, GstMapFlags flags)
|
||||||
{
|
{
|
||||||
GstMetaVideo *meta;
|
GstMetaVideo *meta;
|
||||||
gint i;
|
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
|
gint i;
|
||||||
|
|
||||||
g_return_val_if_fail (frame != NULL, FALSE);
|
g_return_val_if_fail (frame != NULL, FALSE);
|
||||||
g_return_val_if_fail (info != NULL, FALSE);
|
g_return_val_if_fail (info != NULL, FALSE);
|
||||||
|
@ -900,7 +900,16 @@ gst_video_frame_map (GstVideoFrame * frame, GstVideoInfo * info,
|
||||||
frame->meta = meta;
|
frame->meta = meta;
|
||||||
|
|
||||||
if (meta) {
|
if (meta) {
|
||||||
/* FIXME use metadata */
|
frame->info.flags = meta->flags;
|
||||||
|
frame->info.format = meta->format;
|
||||||
|
frame->info.width = meta->width;
|
||||||
|
frame->info.height = meta->height;
|
||||||
|
frame->info.n_planes = meta->n_planes;
|
||||||
|
|
||||||
|
for (i = 0; i < info->n_planes; i++) {
|
||||||
|
frame->data[i] =
|
||||||
|
gst_meta_video_map (meta, i, &frame->info.plane[i].stride, flags);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* copy the info */
|
/* copy the info */
|
||||||
frame->info = *info;
|
frame->info = *info;
|
||||||
|
@ -937,7 +946,7 @@ gst_video_frame_unmap (GstVideoFrame * frame)
|
||||||
{
|
{
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
GstMetaVideo *meta;
|
GstMetaVideo *meta;
|
||||||
guint8 *data;
|
gint i;
|
||||||
|
|
||||||
g_return_if_fail (frame != NULL);
|
g_return_if_fail (frame != NULL);
|
||||||
|
|
||||||
|
@ -945,8 +954,12 @@ gst_video_frame_unmap (GstVideoFrame * frame)
|
||||||
meta = frame->meta;
|
meta = frame->meta;
|
||||||
|
|
||||||
if (meta) {
|
if (meta) {
|
||||||
/* FIXME use metadata */
|
for (i = 0; i < frame->info.n_planes; i++) {
|
||||||
|
gst_meta_video_unmap (meta, i, frame->data[i]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
guint8 *data;
|
||||||
|
|
||||||
data = frame->data[0];
|
data = frame->data[0];
|
||||||
data -= frame->info.plane[0].offset;
|
data -= frame->info.plane[0].offset;
|
||||||
gst_buffer_unmap (buffer, data, -1);
|
gst_buffer_unmap (buffer, data, -1);
|
||||||
|
|
Loading…
Reference in a new issue