Skip to content

Commit

Permalink
avoid multiple java casting
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Mar 26, 2024
1 parent d89598e commit de705f6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions library/src/main/java/com/pedro/library/base/Camera1Base.java
Expand Up @@ -707,9 +707,9 @@ private void prepareGlView(int width, int height, int rotation) {
isPortrait = true;
}
glInterface.setEncoderSize(w, h);
if (glInterface instanceof GlStreamInterface) {
((GlStreamInterface) glInterface).setPreviewResolution(w, h);
((GlStreamInterface) glInterface).setIsPortrait(isPortrait);
if (glInterface instanceof GlStreamInterface glStreamInterface) {
glStreamInterface.setPreviewResolution(w, h);
glStreamInterface.setIsPortrait(isPortrait);
}
glInterface.setRotation(0);
if (!glInterface.isRunning()) glInterface.start();
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/java/com/pedro/library/base/Camera2Base.java
Expand Up @@ -651,9 +651,9 @@ private void prepareGlView(int width, int height, int rotation) {
isPortrait = true;
}
glInterface.setEncoderSize(w, h);
if (glInterface instanceof GlStreamInterface) {
((GlStreamInterface) glInterface).setPreviewResolution(w, h);
((GlStreamInterface) glInterface).setIsPortrait(isPortrait);
if (glInterface instanceof GlStreamInterface glStreamInterface) {
glStreamInterface.setPreviewResolution(w, h);
glStreamInterface.setIsPortrait(isPortrait);
}
glInterface.setRotation(rotation == 0 ? 270 : rotation - 90);
if (!glInterface.isRunning()) glInterface.start();
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/java/com/pedro/library/base/DisplayBase.java
Expand Up @@ -183,9 +183,9 @@ public boolean prepareVideo(int width, int height, int fps, int bitrate, int rot
isPortrait = true;
}
glInterface.setEncoderSize(w, h);
if (glInterface instanceof GlStreamInterface) {
((GlStreamInterface) glInterface).setPreviewResolution(w, h);
((GlStreamInterface) glInterface).setIsPortrait(isPortrait);
if (glInterface instanceof GlStreamInterface glStreamInterface) {
glStreamInterface.setPreviewResolution(w, h);
glStreamInterface.setIsPortrait(isPortrait);
}
}
return videoInitialized;
Expand Down
Expand Up @@ -418,9 +418,9 @@ private void prepareGlView() {
isPortrait = true;
}
glInterface.setEncoderSize(w, h);
if (glInterface instanceof GlStreamInterface) {
((GlStreamInterface) glInterface).setPreviewResolution(w, h);
((GlStreamInterface) glInterface).setIsPortrait(isPortrait);
if (glInterface instanceof GlStreamInterface glStreamInterface) {
glStreamInterface.setPreviewResolution(w, h);
glStreamInterface.setIsPortrait(isPortrait);
}
glInterface.setRotation(0);
glInterface.start();
Expand Down

0 comments on commit de705f6

Please sign in to comment.