All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.co.caprica.vlcj.player.embedded.videosurface.videoengine.VideoEngineWindowCallbackHandler Maven / Gradle / Ivy

/*
 * This file is part of VLCJ.
 *
 * VLCJ is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VLCJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VLCJ.  If not, see .
 *
 * Copyright 2009-2024 Caprica Software Limited.
 */

package uk.co.caprica.vlcj.player.embedded.videosurface.videoengine;

import com.sun.jna.Pointer;
import uk.co.caprica.vlcj.binding.internal.libvlc_video_output_resize_cb;
import uk.co.caprica.vlcj.binding.internal.libvlc_video_output_mouse_move_cb;
import uk.co.caprica.vlcj.binding.internal.libvlc_video_output_mouse_press_cb;
import uk.co.caprica.vlcj.binding.internal.libvlc_video_output_mouse_release_cb;
import uk.co.caprica.vlcj.player.base.MouseButton;

/**
 * Handler component that bridges a vlcj application with the native video engine window callback.
 * 

* The various callback method invocations must not be made concurrently. */ public final class VideoEngineWindowCallbackHandler implements VideoEngineWindowCallback { /** * Opaque pointer associated with the callbacks. */ private final Pointer opaque; /** * Opaque pointer for the native report size changed callback. *

* This pointer must be passed with the native callback method. */ private final Pointer reportOpaque; /** * Native callback. */ private final libvlc_video_output_resize_cb resize; private final libvlc_video_output_mouse_move_cb mouseMove; private final libvlc_video_output_mouse_press_cb mousePress; private final libvlc_video_output_mouse_release_cb mouseRelease; /** * Create a window callback handler. * * @param opaque opaque pointer associated with the callbacks * @param reportOpaque opaque pointer for the native report callbacks * @param resize native callback for window resizes * @param mouseMove native callback for mouse moves * @param mousePress native callback for mouse presses * @param mouseRelease native callback for mouse releases */ public VideoEngineWindowCallbackHandler(Pointer opaque, Pointer reportOpaque, libvlc_video_output_resize_cb resize, libvlc_video_output_mouse_move_cb mouseMove, libvlc_video_output_mouse_press_cb mousePress, libvlc_video_output_mouse_release_cb mouseRelease) { this.opaque = opaque; this.reportOpaque = reportOpaque; this.resize = resize; this.mouseMove = mouseMove; this.mousePress = mousePress; this.mouseRelease = mouseRelease; } @Override public void setSize(int width, int height) { if (resize != null) { resize.reportSizeChanged(reportOpaque, width, height); } } @Override public void mouseMoved(int x, int y) { if (mouseMove != null) { mouseMove.mouseMove(reportOpaque, x, y); } } @Override public void mousePressed(MouseButton mouseButton) { if (mousePress != null) { mousePress.mousePress(reportOpaque, mouseButton.intValue()); } } @Override public void mouseReleased(MouseButton mouseButton) { if (mouseRelease != null) { mouseRelease.mouseRelease(reportOpaque, mouseButton.intValue()); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy