mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 23:58:17 +00:00
videometa: make video metatransform
Make more generic video meta transform data that can be used for many video transformations later.
This commit is contained in:
parent
6885b9d397
commit
4da57f08a1
2 changed files with 29 additions and 14 deletions
|
@ -323,8 +323,26 @@ gst_video_crop_meta_transform (GstBuffer * dest, GstMeta * meta,
|
|||
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");
|
||||
GstVideoMetaTransform *trans = data;
|
||||
gint ow, oh, nw, nh;
|
||||
|
||||
smeta = (GstVideoCropMeta *) meta;
|
||||
dmeta = gst_buffer_add_video_crop_meta (dest);
|
||||
|
||||
ow = GST_VIDEO_INFO_WIDTH (trans->in_info);
|
||||
nw = GST_VIDEO_INFO_WIDTH (trans->out_info);
|
||||
oh = GST_VIDEO_INFO_HEIGHT (trans->in_info);
|
||||
nh = GST_VIDEO_INFO_HEIGHT (trans->out_info);
|
||||
|
||||
GST_DEBUG ("scaling crop metadata %dx%d -> %dx%d", ow, oh, nw, nh);
|
||||
dmeta->x = (smeta->x * nw) / ow;
|
||||
dmeta->y = (smeta->y * nh) / oh;
|
||||
dmeta->width = (smeta->width * nw) / ow;
|
||||
dmeta->height = (smeta->height * nh) / oh;
|
||||
GST_DEBUG ("crop offset %dx%d -> %dx%d", smeta->x, smeta->y, dmeta->x,
|
||||
dmeta->y);
|
||||
GST_DEBUG ("crop size %dx%d -> %dx%d", smeta->width, smeta->height,
|
||||
dmeta->width, dmeta->height);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ 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 */
|
||||
/* video metadata transforms */
|
||||
|
||||
GQuark gst_video_meta_transform_scale_get_quark (void);
|
||||
/**
|
||||
|
@ -126,20 +126,17 @@ GQuark gst_video_meta_transform_scale_get_quark (void);
|
|||
#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
|
||||
* GstVideoMetaTransform:
|
||||
* @old_info: the old #GstVideoInfo
|
||||
* @new_info: the new #GstVideoInfo
|
||||
*
|
||||
* Extra data passed to a video "scale" transform #GstMetaTransformFunction.
|
||||
* Extra data passed to a video transform #GstMetaTransformFunction such as:
|
||||
* "gst-video-scale".
|
||||
*/
|
||||
typedef struct {
|
||||
gint old_width;
|
||||
gint old_height;
|
||||
gint new_width;
|
||||
gint new_height;
|
||||
} GstVideoMetaTransformScale;
|
||||
GstVideoInfo *in_info;
|
||||
GstVideoInfo *out_info;
|
||||
} GstVideoMetaTransform;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue