mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
vaapipostproc: element warning if video direction is unsupported
If the video direction is unsupported by the driver, an element warning is posted in the bus to notify the application. gst_vaapi_enum_type_get_nick() was added in the library thus it can be used elsewhere. It retrives the nick from an enum gtype.
This commit is contained in:
parent
47ff72a6d4
commit
c06b587819
4 changed files with 39 additions and 26 deletions
|
@ -118,17 +118,6 @@ gst_vaapi_scale_method_get_type (void)
|
||||||
return g_type;
|
return g_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
|
||||||
gst_vaapi_get_video_direction_nick (GstVideoOrientationMethod method)
|
|
||||||
{
|
|
||||||
gpointer const klass = g_type_class_peek (GST_TYPE_VIDEO_ORIENTATION_METHOD);
|
|
||||||
GEnumValue *const e = g_enum_get_value (klass, method);
|
|
||||||
|
|
||||||
if (e)
|
|
||||||
return e->value_nick;
|
|
||||||
return "<unknown>";
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gst_vaapi_deinterlace_method_get_type (void)
|
gst_vaapi_deinterlace_method_get_type (void)
|
||||||
{
|
{
|
||||||
|
@ -1996,23 +1985,15 @@ gst_vaapi_filter_set_video_direction (GstVaapiFilter * filter,
|
||||||
|
|
||||||
from_GstVideoOrientationMethod (method, &va_mirror, &va_rotation);
|
from_GstVideoOrientationMethod (method, &va_mirror, &va_rotation);
|
||||||
|
|
||||||
if (va_mirror != VA_MIRROR_NONE && !(filter->mirror_flags & va_mirror)) {
|
if (va_mirror != VA_MIRROR_NONE && !(filter->mirror_flags & va_mirror))
|
||||||
GST_WARNING ("%s video-direction unsupported",
|
return FALSE;
|
||||||
gst_vaapi_get_video_direction_nick (method));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (va_rotation != VA_ROTATION_NONE
|
if (va_rotation != VA_ROTATION_NONE
|
||||||
&& !(filter->rotation_flags & (1 << va_rotation))) {
|
&& !(filter->rotation_flags & (1 << va_rotation)))
|
||||||
GST_WARNING ("%s video-direction unsupported",
|
return FALSE;
|
||||||
gst_vaapi_get_video_direction_nick (method));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GST_WARNING ("%s video-direction unsupported",
|
return FALSE;
|
||||||
gst_vaapi_get_video_direction_nick (method));
|
|
||||||
return TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
filter->video_direction = method;
|
filter->video_direction = method;
|
||||||
|
|
|
@ -215,3 +215,22 @@ gst_vaapi_type_define_enum_subset_from_mask (GstVaapiEnumSubset * subset,
|
||||||
}
|
}
|
||||||
return subset->type;
|
return subset->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vaapi_enum_type_get_nick:
|
||||||
|
* @type: an enum #GType
|
||||||
|
* @value: the value to get its nick
|
||||||
|
*
|
||||||
|
* Returns: (tranfer none); the string associated with
|
||||||
|
* @value. Otherwise "<unknown>"
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
gst_vaapi_enum_type_get_nick (GType type, gint value)
|
||||||
|
{
|
||||||
|
gpointer const klass = g_type_class_peek (type);
|
||||||
|
GEnumValue *const e = g_enum_get_value (klass, value);
|
||||||
|
|
||||||
|
if (e)
|
||||||
|
return e->value_nick;
|
||||||
|
return "<unknown>";
|
||||||
|
}
|
||||||
|
|
|
@ -157,6 +157,10 @@ G_PASTE(name,_get_type)(void) \
|
||||||
return gst_vaapi_type_define_enum_subset_from_mask(&subset, MASK); \
|
return gst_vaapi_type_define_enum_subset_from_mask(&subset, MASK); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
const gchar *
|
||||||
|
gst_vaapi_enum_type_get_nick (GType type, gint value);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* GST_VAAPI_VALUE_H */
|
#endif /* GST_VAAPI_VALUE_H */
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#include "gstcompat.h"
|
#include "gstcompat.h"
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
|
||||||
|
#include <gst/vaapi/gstvaapivalue.h>
|
||||||
|
|
||||||
#include "gstvaapipostproc.h"
|
#include "gstvaapipostproc.h"
|
||||||
#include "gstvaapipostprocutil.h"
|
#include "gstvaapipostprocutil.h"
|
||||||
#include "gstvaapipluginutil.h"
|
#include "gstvaapipluginutil.h"
|
||||||
|
@ -595,8 +597,15 @@ update_filter (GstVaapiPostproc * postproc)
|
||||||
|
|
||||||
if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION) {
|
if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION) {
|
||||||
if (!gst_vaapi_filter_set_video_direction (postproc->filter,
|
if (!gst_vaapi_filter_set_video_direction (postproc->filter,
|
||||||
postproc->video_direction))
|
postproc->video_direction)) {
|
||||||
return FALSE;
|
GST_ELEMENT_WARNING (postproc, LIBRARY, SETTINGS,
|
||||||
|
("Unsupported video direction '%s' by driver.",
|
||||||
|
gst_vaapi_enum_type_get_nick
|
||||||
|
(GST_TYPE_VIDEO_ORIENTATION_METHOD, postproc->video_direction)),
|
||||||
|
("video direction transformation ignored"));
|
||||||
|
|
||||||
|
/* Don't return FALSE because other filters might be set */
|
||||||
|
}
|
||||||
|
|
||||||
if (gst_vaapi_filter_get_video_direction_default (postproc->filter) ==
|
if (gst_vaapi_filter_get_video_direction_default (postproc->filter) ==
|
||||||
postproc->video_direction)
|
postproc->video_direction)
|
||||||
|
|
Loading…
Reference in a new issue