-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change video engine resize callback API to encapsulate JNA
- Loading branch information
Showing
5 changed files
with
111 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...k/co/caprica/vlcj/player/embedded/videosurface/videoengine/VideoEngineResizeCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright 2009-2022 Caprica Software Limited. | ||
*/ | ||
|
||
package uk.co.caprica.vlcj.player.embedded.videosurface.videoengine; | ||
|
||
/** | ||
* Specification for a component that informs the video engine when the size of the hosted video window changes. | ||
*/ | ||
public interface VideoEngineResizeCallback { | ||
|
||
/** | ||
* Set the new window size. | ||
* | ||
* @param width new width | ||
* @param height new height | ||
*/ | ||
void setSize(int width, int height); | ||
} |
66 changes: 66 additions & 0 deletions
66
...prica/vlcj/player/embedded/videosurface/videoengine/VideoEngineResizeCallbackHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright 2009-2022 Caprica Software Limited. | ||
*/ | ||
|
||
package uk.co.caprica.vlcj.player.embedded.videosurface.videoengine; | ||
|
||
import com.sun.jna.Pointer; | ||
import uk.co.caprica.vlcj.binding.internal.ReportSizeChanged; | ||
|
||
/** | ||
* Handler component that bridges a vlcj application with the native video engine resize callback. | ||
*/ | ||
public final class VideoEngineResizeCallbackHandler implements VideoEngineResizeCallback { | ||
|
||
/** | ||
* Opaque pointer associated with the callbacks. | ||
*/ | ||
private final Pointer opaque; | ||
|
||
/** | ||
* Opaque pointer for the native report size changed callback. | ||
* <p> | ||
* This pointer <strong>must</strong> be passed with the native callback method. | ||
*/ | ||
private final Pointer reportOpaque; | ||
|
||
/** | ||
* Native callback. | ||
*/ | ||
private final ReportSizeChanged reportSizeChanged; | ||
|
||
/** | ||
* Create a resize callback handler. | ||
* | ||
* @param opaque opaque pointer associated with the callbacks | ||
* @param reportOpaque opaque pointer for the native report size changed callback | ||
* @param reportSizeChanged native callback | ||
*/ | ||
public VideoEngineResizeCallbackHandler(Pointer opaque, Pointer reportOpaque, ReportSizeChanged reportSizeChanged) { | ||
this.opaque = opaque; | ||
this.reportOpaque = reportOpaque; | ||
this.reportSizeChanged = reportSizeChanged; | ||
} | ||
|
||
@Override | ||
public void setSize(int width, int height) { | ||
if (reportSizeChanged != null) { | ||
reportSizeChanged.reportSizeChanged(reportOpaque, width, height); | ||
} | ||
} | ||
} |