mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
video: Add API to parse the image orientation from a GstTagList
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1088>
This commit is contained in:
parent
a51509c6e7
commit
c898ffceeb
2 changed files with 54 additions and 0 deletions
|
@ -237,3 +237,52 @@ gst_video_orientation_method_get_type (void)
|
||||||
|
|
||||||
return (GType) video_orientation_method_type;
|
return (GType) video_orientation_method_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_video_orientation_from_tag:
|
||||||
|
* @taglist: A #GstTagList
|
||||||
|
* @method: The location where to return the orientation.
|
||||||
|
*
|
||||||
|
* Parses the "image-orientation" tag and transforms it into the
|
||||||
|
* #GstVideoOrientationMethod enum.
|
||||||
|
*
|
||||||
|
* Returns: TRUE if there was a valid "image-orientation" tag in the taglist.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_video_orientation_from_tag (GstTagList * taglist,
|
||||||
|
GstVideoOrientationMethod * method)
|
||||||
|
{
|
||||||
|
gchar *orientation;
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_TAG_LIST (taglist), FALSE);
|
||||||
|
g_return_val_if_fail (method != NULL, FALSE);
|
||||||
|
|
||||||
|
if (!gst_tag_list_get_string (taglist, "image-orientation", &orientation))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!g_strcmp0 ("rotate-0", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_IDENTITY;
|
||||||
|
else if (!g_strcmp0 ("rotate-90", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_90R;
|
||||||
|
else if (!g_strcmp0 ("rotate-180", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_180;
|
||||||
|
else if (!g_strcmp0 ("rotate-270", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_90L;
|
||||||
|
else if (!g_strcmp0 ("flip-rotate-0", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_HORIZ;
|
||||||
|
else if (!g_strcmp0 ("flip-rotate-90", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_UR_LL;
|
||||||
|
else if (!g_strcmp0 ("flip-rotate-180", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_VERT;
|
||||||
|
else if (!g_strcmp0 ("flip-rotate-270", orientation))
|
||||||
|
*method = GST_VIDEO_ORIENTATION_UL_LR;
|
||||||
|
else
|
||||||
|
ret = FALSE;
|
||||||
|
|
||||||
|
g_free (orientation);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -172,6 +172,11 @@ GstSample * gst_video_convert_sample (GstSample * sample,
|
||||||
GstClockTime timeout,
|
GstClockTime timeout,
|
||||||
GError ** error);
|
GError ** error);
|
||||||
|
|
||||||
|
|
||||||
|
GST_VIDEO_API
|
||||||
|
gboolean gst_video_orientation_from_tag (GstTagList * taglist,
|
||||||
|
GstVideoOrientationMethod * method);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#include <gst/video/colorbalancechannel.h>
|
#include <gst/video/colorbalancechannel.h>
|
||||||
|
|
Loading…
Reference in a new issue