导航菜单

页面标题

页面副标题

FanCode v7.24.0 - MirroringSinkCapability.java 源代码

正在查看: FanCode v7.24.0 应用的 MirroringSinkCapability.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.connectsdk.service.webos.lgcast.screenmirroring.capability;

import com.connectsdk.service.config.ServiceDescription;
import com.connectsdk.service.webos.lgcast.common.utils.Logger;
import com.connectsdk.service.webos.lgcast.common.utils.StringUtil;
import com.connectsdk.service.webos.lgcast.remotecamera.service.CameraProperty;
import com.connectsdk.service.webos.lgcast.screenmirroring.ScreenMirroringConfig;
import com.connectsdk.service.webos.lgcast.screenmirroring.ScreenMirroringConst;
import org.json.JSONObject;

public class MirroringSinkCapability {
    public String audioCodec;
    public int audioUdpPort;
    public String devicePlatform;
    public String deviceSoC;
    public String deviceType;
    public String deviceVersion;
    public String displayOrientation;
    public String ipAddress;
    public int keepAliveTimeout;
    public String publicKey;
    public String supportedOrientation;
    public String videoCodec;
    public int videoLandscapeMaxHeight;
    public int videoLandscapeMaxWidth;
    public int videoPortraitMaxHeight;
    public int videoPortraitMaxWidth;
    public int videoUdpPort;

    public MirroringSinkCapability() {
    }

    public void debug() {
        Logger.error("##### MIRRORING SINK CAPABILITY #####", new Object[0]);
        Logger.error("ipAddress=" + this.ipAddress, new Object[0]);
        Logger.error("videoPortraitMaxWidth=" + this.videoPortraitMaxWidth, new Object[0]);
        Logger.error("videoPortraitMaxHeight=" + this.videoPortraitMaxHeight, new Object[0]);
        Logger.error("videoLandscapeMaxWidth=" + this.videoLandscapeMaxWidth, new Object[0]);
        Logger.error("videoLandscapeMaxHeight=" + this.videoLandscapeMaxHeight, new Object[0]);
        Logger.error("supportedOrientation=" + this.supportedOrientation, new Object[0]);
        Logger.error("displayOrientation=" + this.displayOrientation, new Object[0]);
        Logger.error(StringUtil.EMPTY, new Object[0]);
    }

    public boolean isDisplayLandscape() {
        return ScreenMirroringConst.LANDSCAPE.equals(this.displayOrientation);
    }

    public boolean isDisplayPortrait() {
        return ScreenMirroringConst.PORTRAIT.equals(this.displayOrientation);
    }

    public boolean isSupportLandscapeMode() {
        String str = this.supportedOrientation;
        return str != null && str.contains(ScreenMirroringConst.LANDSCAPE);
    }

    public boolean isSupportPortraitMode() {
        String str = this.supportedOrientation;
        return str != null && str.contains(ScreenMirroringConst.PORTRAIT);
    }

    public MirroringSinkCapability(JSONObject jSONObject) {
        if (jSONObject == null) {
            throw new IllegalArgumentException();
        }
        this.ipAddress = jSONObject.optString(ServiceDescription.KEY_IP_ADDRESS, "127.0.0.1");
        this.keepAliveTimeout = jSONObject.optInt("keepAliveTimeout", 60) * 1000;
        this.publicKey = jSONObject.optString("publicKey");
        JSONObject optJSONObject = jSONObject.optJSONObject("deviceInfo");
        if (optJSONObject != null) {
            this.deviceType = optJSONObject.optString("type");
            this.deviceVersion = optJSONObject.optString("version");
            this.devicePlatform = optJSONObject.optString("platform");
            this.deviceSoC = optJSONObject.optString("SoC");
        }
        JSONObject optJSONObject2 = jSONObject.optJSONObject("mirroring");
        if (optJSONObject2 != null) {
            JSONObject optJSONObject3 = optJSONObject2.optJSONObject(ScreenMirroringConst.VIDEO);
            if (optJSONObject3 != null) {
                this.videoCodec = optJSONObject3.optString("codec");
                this.videoUdpPort = optJSONObject3.optInt("udpPort");
                JSONObject optJSONObject4 = optJSONObject3.optJSONObject(ScreenMirroringConst.PORTRAIT);
                if (optJSONObject4 != null) {
                    this.videoPortraitMaxWidth = optJSONObject4.optInt("maxWidth", ScreenMirroringConfig.Video.DEFAULT_HEIGHT);
                    this.videoPortraitMaxHeight = optJSONObject4.optInt("maxHeight", ScreenMirroringConfig.Video.DEFAULT_WIDTH);
                }
                JSONObject optJSONObject5 = optJSONObject3.optJSONObject(ScreenMirroringConst.LANDSCAPE);
                if (optJSONObject5 != null) {
                    this.videoLandscapeMaxWidth = optJSONObject5.optInt("maxWidth", ScreenMirroringConfig.Video.DEFAULT_WIDTH);
                    this.videoLandscapeMaxHeight = optJSONObject5.optInt("maxHeight", ScreenMirroringConfig.Video.DEFAULT_HEIGHT);
                } else {
                    this.videoLandscapeMaxWidth = ScreenMirroringConfig.Video.DEFAULT_WIDTH;
                    this.videoLandscapeMaxHeight = ScreenMirroringConfig.Video.DEFAULT_HEIGHT;
                }
            }
            JSONObject optJSONObject6 = optJSONObject2.optJSONObject(CameraProperty.AUDIO);
            if (optJSONObject6 != null) {
                this.audioCodec = optJSONObject6.optString("codec", "none");
                this.audioUdpPort = optJSONObject6.optInt("udpPort");
            }
            JSONObject optJSONObject7 = optJSONObject2.optJSONObject("supportedFeatures");
            if (optJSONObject7 != null) {
                this.supportedOrientation = optJSONObject7.optString("screenOrientation", ScreenMirroringConst.LANDSCAPE);
            }
            this.displayOrientation = optJSONObject2.optString("displayOrientation", ScreenMirroringConst.LANDSCAPE);
        }
    }
}