|| gst_va_filter_get_orientation (btrans->filter) !=
GST_VIDEO_ORIENTATION_IDENTITY) {
- event = gst_event_make_writable (event);
-
if (!gst_navigation_event_get_coordinates (event, &x, &y))
break;
+ event = gst_event_make_writable (event);
+
/* video-direction compensation */
switch (gst_va_filter_get_orientation (btrans->filter)) {
case GST_VIDEO_ORIENTATION_90R:
gst_video_box_src_event (GstBaseTransform * trans, GstEvent * event)
{
GstVideoBox *video_box = GST_VIDEO_BOX (trans);
- GstNavigationEventType type;
- gdouble pointer_x;
- gdouble pointer_y;
+ gdouble x, y, new_x, new_y;
GST_OBJECT_LOCK (video_box);
- type = gst_navigation_event_get_type (event);
- if (GST_EVENT_TYPE (event) == GST_EVENT_NAVIGATION &&
- (video_box->box_left != 0 || video_box->box_top != 0) &&
- (type == GST_NAVIGATION_EVENT_MOUSE_MOVE
- || type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS
- || type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE)) {
- if (gst_navigation_event_get_coordinates (event, &pointer_x, &pointer_y)) {
- gdouble new_pointer_x, new_pointer_y;
-
- event = gst_event_make_writable (event);
- new_pointer_x = pointer_x + video_box->box_left;
- new_pointer_y = pointer_y + video_box->box_top;
-
- gst_navigation_event_set_coordinates (event, new_pointer_x,
- new_pointer_y);
- } else {
- GST_WARNING_OBJECT (video_box, "Failed to read navigation event");
- }
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NAVIGATION:
+ if ((video_box->box_left != 0 || video_box->box_top != 0)
+ && gst_navigation_event_get_coordinates (event, &x, &y)) {
+
+ event = gst_event_make_writable (event);
+ new_x = x + video_box->box_left;
+ new_y = y + video_box->box_top;
+
+ GST_TRACE_OBJECT (video_box, "from %fx%f to %fx%f", x, y, new_x, new_y);
+ gst_navigation_event_set_coordinates (event, new_x, new_y);
+ }
+ break;
+ default:
+ break;
}
GST_OBJECT_UNLOCK (video_box);
static gboolean
gst_video_crop_src_event (GstBaseTransform * trans, GstEvent * event)
{
- GstNavigationEventType type;
- double pointer_x;
- double pointer_y;
+ double x, y, new_x, new_y;
GstVideoCrop *vcrop = GST_VIDEO_CROP (trans);
GST_OBJECT_LOCK (vcrop);
- type = gst_navigation_event_get_type (event);
- if (GST_EVENT_TYPE (event) == GST_EVENT_NAVIGATION &&
- (vcrop->crop_left != 0 || vcrop->crop_top != 0) &&
- (type == GST_NAVIGATION_EVENT_MOUSE_MOVE
- || type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS
- || type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE)) {
- if (gst_navigation_event_get_coordinates (event, &pointer_x, &pointer_y)) {
- event = gst_event_make_writable (event);
- gst_navigation_event_set_coordinates (event, pointer_x + vcrop->crop_left,
- pointer_y + vcrop->crop_top);
- } else {
- GST_WARNING_OBJECT (vcrop, "Failed to read navigation event");
- }
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NAVIGATION:
+ if ((vcrop->crop_left != 0 || vcrop->crop_top != 0)
+ && gst_navigation_event_get_coordinates (event, &x, &y)) {
+
+ new_x = x + vcrop->crop_left;
+ new_y = y + vcrop->crop_top;
+
+ event = gst_event_make_writable (event);
+
+ GST_TRACE_OBJECT (vcrop, "from %fx%f to %fx%f", x, y, new_x, new_y);
+ gst_navigation_event_set_coordinates (event, new_x, new_y);
+ }
+ break;
+ default:
+ break;
}
GST_OBJECT_UNLOCK (vcrop);