mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
glimagesink: Replace GstGLRotateMethod with GstVideoOrientationMethod
It's the same enum, just drop the renamed copy. But keep the registered GEnum as it is part of the API. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1088>
This commit is contained in:
parent
ad495089cb
commit
a51509c6e7
2 changed files with 38 additions and 52 deletions
|
@ -180,23 +180,23 @@ _on_client_draw (GstGLImageSink * sink, GstGLContext * context,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define DEFAULT_ROTATE_METHOD GST_GL_ROTATE_METHOD_IDENTITY
|
||||
#define DEFAULT_ROTATE_METHOD GST_VIDEO_ORIENTATION_IDENTITY
|
||||
|
||||
#define GST_TYPE_GL_ROTATE_METHOD (gst_gl_rotate_method_get_type())
|
||||
|
||||
static const GEnumValue rotate_methods[] = {
|
||||
{GST_GL_ROTATE_METHOD_IDENTITY, "Identity (no rotation)", "none"},
|
||||
{GST_GL_ROTATE_METHOD_90R, "Rotate clockwise 90 degrees", "clockwise"},
|
||||
{GST_GL_ROTATE_METHOD_180, "Rotate 180 degrees", "rotate-180"},
|
||||
{GST_GL_ROTATE_METHOD_90L, "Rotate counter-clockwise 90 degrees",
|
||||
{GST_VIDEO_ORIENTATION_IDENTITY, "Identity (no rotation)", "none"},
|
||||
{GST_VIDEO_ORIENTATION_90R, "Rotate clockwise 90 degrees", "clockwise"},
|
||||
{GST_VIDEO_ORIENTATION_180, "Rotate 180 degrees", "rotate-180"},
|
||||
{GST_VIDEO_ORIENTATION_90L, "Rotate counter-clockwise 90 degrees",
|
||||
"counterclockwise"},
|
||||
{GST_GL_ROTATE_METHOD_FLIP_HORIZ, "Flip horizontally", "horizontal-flip"},
|
||||
{GST_GL_ROTATE_METHOD_FLIP_VERT, "Flip vertically", "vertical-flip"},
|
||||
{GST_GL_ROTATE_METHOD_FLIP_UL_LR,
|
||||
{GST_VIDEO_ORIENTATION_HORIZ, "Flip horizontally", "horizontal-flip"},
|
||||
{GST_VIDEO_ORIENTATION_VERT, "Flip vertically", "vertical-flip"},
|
||||
{GST_VIDEO_ORIENTATION_UL_LR,
|
||||
"Flip across upper left/lower right diagonal", "upper-left-diagonal"},
|
||||
{GST_GL_ROTATE_METHOD_FLIP_UR_LL,
|
||||
{GST_VIDEO_ORIENTATION_UR_LL,
|
||||
"Flip across upper right/lower left diagonal", "upper-right-diagonal"},
|
||||
{GST_GL_ROTATE_METHOD_AUTO,
|
||||
{GST_VIDEO_ORIENTATION_AUTO,
|
||||
"Select rotate method based on image-orientation tag", "automatic"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
@ -532,16 +532,16 @@ static const gfloat upper_right_matrix[] = {
|
|||
|
||||
static void
|
||||
gst_glimage_sink_set_rotate_method (GstGLImageSink * gl_sink,
|
||||
GstGLRotateMethod method, gboolean from_tag)
|
||||
GstVideoOrientationMethod method, gboolean from_tag)
|
||||
{
|
||||
GstGLRotateMethod tag_method = DEFAULT_ROTATE_METHOD;
|
||||
GstVideoOrientationMethod tag_method = DEFAULT_ROTATE_METHOD;
|
||||
GST_GLIMAGE_SINK_LOCK (gl_sink);
|
||||
if (from_tag)
|
||||
tag_method = method;
|
||||
else
|
||||
gl_sink->rotate_method = method;
|
||||
|
||||
if (gl_sink->rotate_method == GST_GL_ROTATE_METHOD_AUTO)
|
||||
if (gl_sink->rotate_method == GST_VIDEO_ORIENTATION_AUTO)
|
||||
method = tag_method;
|
||||
else
|
||||
method = gl_sink->rotate_method;
|
||||
|
@ -552,35 +552,35 @@ gst_glimage_sink_set_rotate_method (GstGLImageSink * gl_sink,
|
|||
rotate_methods[method].value_nick);
|
||||
|
||||
switch (method) {
|
||||
case GST_GL_ROTATE_METHOD_IDENTITY:
|
||||
case GST_VIDEO_ORIENTATION_IDENTITY:
|
||||
gl_sink->transform_matrix = NULL;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_90R:
|
||||
case GST_VIDEO_ORIENTATION_90R:
|
||||
gl_sink->transform_matrix = clockwise_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_180:
|
||||
case GST_VIDEO_ORIENTATION_180:
|
||||
gl_sink->transform_matrix = clockwise_180_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_90L:
|
||||
case GST_VIDEO_ORIENTATION_90L:
|
||||
gl_sink->transform_matrix = counterclockwise_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_FLIP_HORIZ:
|
||||
case GST_VIDEO_ORIENTATION_HORIZ:
|
||||
gl_sink->transform_matrix = horizontal_flip_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_FLIP_VERT:
|
||||
case GST_VIDEO_ORIENTATION_VERT:
|
||||
gl_sink->transform_matrix = vertical_flip_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_FLIP_UL_LR:
|
||||
case GST_VIDEO_ORIENTATION_UL_LR:
|
||||
gl_sink->transform_matrix = upper_left_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
case GST_GL_ROTATE_METHOD_FLIP_UR_LL:
|
||||
case GST_VIDEO_ORIENTATION_UR_LL:
|
||||
gl_sink->transform_matrix = upper_right_matrix;
|
||||
gl_sink->output_mode_changed = TRUE;
|
||||
break;
|
||||
|
@ -1126,28 +1126,28 @@ gst_glimage_sink_event (GstBaseSink * sink, GstEvent * event)
|
|||
if (gst_tag_list_get_string (taglist, "image-orientation", &orientation)) {
|
||||
if (!g_strcmp0 ("rotate-0", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_GL_ROTATE_METHOD_IDENTITY, TRUE);
|
||||
GST_VIDEO_ORIENTATION_IDENTITY, TRUE);
|
||||
else if (!g_strcmp0 ("rotate-90", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_90R,
|
||||
TRUE);
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_VIDEO_ORIENTATION_90R, TRUE);
|
||||
else if (!g_strcmp0 ("rotate-180", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_180,
|
||||
TRUE);
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_VIDEO_ORIENTATION_180, TRUE);
|
||||
else if (!g_strcmp0 ("rotate-270", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_90L,
|
||||
TRUE);
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_VIDEO_ORIENTATION_90L, TRUE);
|
||||
else if (!g_strcmp0 ("flip-rotate-0", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_GL_ROTATE_METHOD_FLIP_HORIZ, TRUE);
|
||||
GST_VIDEO_ORIENTATION_HORIZ, TRUE);
|
||||
else if (!g_strcmp0 ("flip-rotate-90", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_GL_ROTATE_METHOD_FLIP_UR_LL, TRUE);
|
||||
GST_VIDEO_ORIENTATION_UR_LL, TRUE);
|
||||
else if (!g_strcmp0 ("flip-rotate-180", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_GL_ROTATE_METHOD_FLIP_VERT, TRUE);
|
||||
GST_VIDEO_ORIENTATION_VERT, TRUE);
|
||||
else if (!g_strcmp0 ("flip-rotate-270", orientation))
|
||||
gst_glimage_sink_set_rotate_method (gl_sink,
|
||||
GST_GL_ROTATE_METHOD_FLIP_UL_LR, TRUE);
|
||||
GST_VIDEO_ORIENTATION_UL_LR, TRUE);
|
||||
|
||||
g_free (orientation);
|
||||
}
|
||||
|
@ -2280,11 +2280,10 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
|
|||
|
||||
src.x = 0;
|
||||
src.y = 0;
|
||||
if (gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_90R
|
||||
|| gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_90L
|
||||
|| gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_FLIP_UL_LR
|
||||
|| gl_sink->current_rotate_method ==
|
||||
GST_GL_ROTATE_METHOD_FLIP_UR_LL) {
|
||||
if (gl_sink->current_rotate_method == GST_VIDEO_ORIENTATION_90R
|
||||
|| gl_sink->current_rotate_method == GST_VIDEO_ORIENTATION_90L
|
||||
|| gl_sink->current_rotate_method == GST_VIDEO_ORIENTATION_UL_LR
|
||||
|| gl_sink->current_rotate_method == GST_VIDEO_ORIENTATION_UR_LL) {
|
||||
src.h = GST_VIDEO_SINK_WIDTH (gl_sink);
|
||||
src.w = GST_VIDEO_SINK_HEIGHT (gl_sink);
|
||||
} else {
|
||||
|
|
|
@ -45,19 +45,6 @@ GST_DEBUG_CATEGORY_EXTERN (gst_debug_glimage_sink);
|
|||
#define GST_IS_GLIMAGE_SINK_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GLIMAGE_SINK))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GST_GL_ROTATE_METHOD_IDENTITY,
|
||||
GST_GL_ROTATE_METHOD_90R,
|
||||
GST_GL_ROTATE_METHOD_180,
|
||||
GST_GL_ROTATE_METHOD_90L,
|
||||
GST_GL_ROTATE_METHOD_FLIP_HORIZ,
|
||||
GST_GL_ROTATE_METHOD_FLIP_VERT,
|
||||
GST_GL_ROTATE_METHOD_FLIP_UL_LR,
|
||||
GST_GL_ROTATE_METHOD_FLIP_UR_LL,
|
||||
GST_GL_ROTATE_METHOD_AUTO,
|
||||
}GstGLRotateMethod;
|
||||
|
||||
typedef struct _GstGLImageSink GstGLImageSink;
|
||||
typedef struct _GstGLImageSinkClass GstGLImageSinkClass;
|
||||
|
||||
|
@ -139,8 +126,8 @@ struct _GstGLImageSink
|
|||
GstGLOverlayCompositor *overlay_compositor;
|
||||
|
||||
/* current video flip method */
|
||||
GstGLRotateMethod current_rotate_method;
|
||||
GstGLRotateMethod rotate_method;
|
||||
GstVideoOrientationMethod current_rotate_method;
|
||||
GstVideoOrientationMethod rotate_method;
|
||||
const gfloat *transform_matrix;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue