Commit 337eed6e authored by Wim Taymans's avatar Wim Taymans

videometa: add videoscale metadata transform

parent df004b58
......@@ -29,20 +29,27 @@ gst_video_meta_transform (GstBuffer * dest, GstMeta * meta,
smeta = (GstVideoMeta *) meta;
if (GST_META_TRANSFORM_IS_COPY (type)) {
dmeta =
(GstVideoMeta *) gst_buffer_add_meta (dest, GST_VIDEO_META_INFO, NULL);
dmeta->buffer = dest;
dmeta->flags = smeta->flags;
dmeta->id = smeta->id;
dmeta->format = smeta->format;
dmeta->width = smeta->width;
dmeta->height = smeta->height;
dmeta->n_planes = smeta->n_planes;
for (i = 0; i < dmeta->n_planes; i++) {
dmeta->offset[i] = smeta->offset[i];
dmeta->stride[i] = smeta->stride[i];
GstMetaTransformCopy *copy = data;
if (!copy->region) {
/* only copy if the complete data is copied as well */
dmeta =
(GstVideoMeta *) gst_buffer_add_meta (dest, GST_VIDEO_META_INFO,
NULL);
dmeta->buffer = dest;
GST_DEBUG ("copy video metadata");
dmeta->flags = smeta->flags;
dmeta->id = smeta->id;
dmeta->format = smeta->format;
dmeta->width = smeta->width;
dmeta->height = smeta->height;
dmeta->n_planes = smeta->n_planes;
for (i = 0; i < dmeta->n_planes; i++) {
dmeta->offset[i] = smeta->offset[i];
dmeta->stride[i] = smeta->stride[i];
}
}
}
return TRUE;
......@@ -310,10 +317,14 @@ gst_video_crop_meta_transform (GstBuffer * dest, GstMeta * meta,
smeta = (GstVideoCropMeta *) meta;
dmeta = gst_buffer_add_video_crop_meta (dest);
GST_DEBUG ("copy crop metadata");
dmeta->x = smeta->x;
dmeta->y = smeta->y;
dmeta->width = smeta->width;
dmeta->height = smeta->height;
} else if (GST_VIDEO_META_TRANSFORM_IS_SCALE (type)) {
/* FIXME, do something */
GST_DEBUG ("scaling crop metadata");
}
return TRUE;
}
......@@ -344,3 +355,21 @@ gst_video_crop_meta_get_info (void)
}
return video_crop_meta_info;
}
/**
* gst_video_meta_transform_scale_get_quark:
*
* Get the #GQuark for the "gst-video-scale" metadata transform operation.
*
* Returns: a #GQuark
*/
GQuark
gst_video_meta_transform_scale_get_quark (void)
{
static GQuark _value = 0;
if (_value == 0) {
_value = g_quark_from_static_string ("gst-video-scale");
}
return _value;
}
......@@ -115,6 +115,32 @@ const GstMetaInfo * gst_video_crop_meta_get_info (void);
#define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_API_TYPE))
#define gst_buffer_add_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_add_meta((b),GST_VIDEO_CROP_META_INFO, NULL))
/* metadata transforms */
GQuark gst_video_meta_transform_scale_get_quark (void);
/**
* gst_video_meta_transform_scale:
*
* GQuark for the video "gst-video-scale" transform.
*/
#define GST_VIDEO_META_TRANSFORM_IS_SCALE(type) ((type) == gst_video_meta_transform_scale_get_quark())
/**
* GstVideoMetaTransformScale:
* @old_width: the old width
* @old_height: the old height
* @new_width: the new width
* @new_height: the new height
*
* Extra data passed to a video "scale" transform #GstMetaTransformFunction.
*/
typedef struct {
gint old_width;
gint old_height;
gint new_width;
gint new_height;
} GstVideoMetaTransformScale;
G_END_DECLS
#endif /* __GST_VIDEO_META_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment