package com.mstar.android.tvapi.impl;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import com.mstar.android.tvapi.atv.AtvPlayer;
import com.mstar.android.tvapi.atv.listener.OnAtvPlayerEventListener;
import com.mstar.android.tvapi.common.TvManager;
import com.mstar.android.tvapi.common.exception.TvCommonException;
import com.mstar.android.tvapi.common.exception.TvNativeCallFailException;
import com.mstar.android.tvapi.common.listener.OnEventListener;
import com.mstar.android.tvapi.common.listener.OnTvPlayerEventListener;
import com.mstar.android.tvapi.common.vo.CaptionOptionSetting;
import com.mstar.android.tvapi.common.vo.DtvProgramSignalInfo;
import com.mstar.android.tvapi.common.vo.EnumAntennaType;
import com.mstar.android.tvapi.common.vo.EnumAvdVideoStandardType;
import com.mstar.android.tvapi.common.vo.EnumStdDetectionState;
import com.mstar.android.tvapi.common.vo.EnumTeletextCommand;
import com.mstar.android.tvapi.common.vo.EnumTeletextMode;
import com.mstar.android.tvapi.common.vo.TvOsType;
import com.mstar.android.tvapi.common.vo.VChipRatingInfo;
import com.mstar.android.tvapi.common.vo.VideoArcInfo;
import com.mstar.android.tvapi.common.vo.VideoInfo;
import com.mstar.android.tvapi.dtv.atsc.AtscPlayer;
import com.mstar.android.tvapi.dtv.atsc.vo.AtscScanChannelNotify;
import com.mstar.android.tvapi.dtv.atsc.vo.AudioMuteType;
import com.mstar.android.tvapi.dtv.atsc.vo.EnumCanadaEngRatingType;
import com.mstar.android.tvapi.dtv.atsc.vo.EnumCanadaFreRatingType;
import com.mstar.android.tvapi.dtv.atsc.vo.EnumUsaTvRatingType;
import com.mstar.android.tvapi.dtv.atsc.vo.EnumVChipRatingType;
import com.mstar.android.tvapi.dtv.atsc.vo.Region5RatingInformation;
import com.mstar.android.tvapi.dtv.atsc.vo.UsaMpaaRatingType;
import com.mstar.android.tvapi.dtv.dvb.DvbPlayer;
import com.mstar.android.tvapi.dtv.dvb.dvbc.DtvDemodDvbcInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbc.vo.EnumChinaDvbcRegion;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.BissProgramInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.DvbsTransponderInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.LocationInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.SatelliteInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbt.DtvDemodDvbtInfo;
import com.mstar.android.tvapi.dtv.dvb.isdb.vo.EwbsInfo;
import com.mstar.android.tvapi.dtv.dvb.isdb.vo.EwbsOpInfo;
import com.mstar.android.tvapi.dtv.dvb.vo.DvbMuxInfo;
import com.mstar.android.tvapi.dtv.dvb.vo.EwsInfo;
import com.mstar.android.tvapi.dtv.listener.OnDtvPlayerEventListener;
import com.mstar.android.tvapi.dtv.vo.DtvAudioInfo;
import com.mstar.android.tvapi.dtv.vo.DtvDemodType;
import com.mstar.android.tvapi.dtv.vo.DtvDemodVersion;
import com.mstar.android.tvapi.dtv.vo.EnumParentalRating;
import com.mstar.android.tvapi.dtv.vo.MwAtscEasInfo;
import com.mstar.android.tvapi.dtv.vo.RfInfo;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes.dex */
public class PlayerImpl implements AtvPlayer, DvbPlayer, AtscPlayer {
    private static final String TAG = "PlayerImpl";
    public static final int TVPLAYER_4K_UHD_EVENT_END = 17999;
    public static final int TVPLAYER_4K_UHD_EVENT_START = 17000;
    public static final int TVPLAYER_4K_UHD_HDMI_DISABLE_DUAL_VIEW = 17003;
    public static final int TVPLAYER_4K_UHD_HDMI_DISABLE_PIP = 17001;
    public static final int TVPLAYER_4K_UHD_HDMI_DISABLE_POP = 17002;
    public static final int TVPLAYER_4K_UHD_HDMI_DISABLE_TRAVELING_MODE = 17004;
    public static final int TVPLAYER_ATV_AUTO_TUNING_SCAN_INFO = 1002;
    public static final int TVPLAYER_ATV_MANUAL_TUNING_SCAN_INFO = 1001;
    public static final int TVPLAYER_ATV_SCAN_EVENT_END = 1999;
    public static final int TVPLAYER_ATV_SCAN_EVENT_START = 1000;
    public static final int TVPLAYER_AUDIO_MODE_CHANGE = 8001;
    public static final int TVPLAYER_AUDIO_MODE_CHANGE_EVENT_END = 8999;
    public static final int TVPLAYER_AUDIO_MODE_CHANGE_EVENT_START = 8000;
    public static final int TVPLAYER_CHANGE_TTX_STATUS = 7001;
    public static final int TVPLAYER_CHANNEL_INFO_EVENT_END = 2999;
    public static final int TVPLAYER_CHANNEL_INFO_EVENT_START = 2000;
    public static final int TVPLAYER_CI_EVENT_END = 12999;
    public static final int TVPLAYER_CI_EVENT_START = 12000;
    public static final int TVPLAYER_CI_LOAD_CREDENTIAL_FAIL = 12001;
    public static final int TVPLAYER_CI_UI_OP_EXIT_SERVICE_LIST = 12004;
    public static final int TVPLAYER_CI_UI_OP_REFRESH_QUERY = 12002;
    public static final int TVPLAYER_CI_UI_OP_SERVICE_LIST = 12003;
    public static final int TVPLAYER_CLOSE_EMERGENCY_SYSTEM = 19002;
    public static final int TVPLAYER_DISPLAY_EMERGENCY_SYSTEM = 19001;
    public static final int TVPLAYER_DTV_AUTO_TUNING_SCAN_INFO = 1;
    public static final int TVPLAYER_DTV_AUTO_UPDATE_SCAN = 6001;
    public static final int TVPLAYER_DTV_CHANNEL_INFO_UPDATE = 2003;
    public static final int TVPLAYER_DTV_CHANNEL_NAME_READY = 2001;
    public static final int TVPLAYER_DTV_PRI_COMPONENT_MISSING = 2006;
    public static final int TVPLAYER_DTV_PSIP_TS_UPDATE = 2005;
    public static final int TVPLAYER_DTV_SCAN_EVENT_END = 999;
    public static final int TVPLAYER_DTV_SCAN_EVENT_START = 0;
    public static final int TVPLAYER_DTV_VIDEO_INFO_READY = 2007;
    public static final int TVPLAYER_EMERGENCY_ALERT = 16001;
    public static final int TVPLAYER_EMERGENCY_ALERT_EVENT_END = 16999;
    public static final int TVPLAYER_EMERGENCY_ALERT_EVENT_START = 16000;
    public static final int TVPLAYER_EMERGENCY_SYSTEM_END = 19999;
    public static final int TVPLAYER_EMERGENCY_SYSTEM_START = 19000;
    public static final int TVPLAYER_EPG_EVENT_END = 3999;
    public static final int TVPLAYER_EPG_EVENT_START = 3000;
    public static final int TVPLAYER_EPG_TIMER_SIMULCAST = 3001;
    public static final int TVPLAYER_EPG_UPDATE = 3003;
    public static final int TVPLAYER_EPG_UPDATE_LIST = 3002;
    public static final int TVPLAYER_EVENT_CODEC_END = 20999;
    public static final int TVPLAYER_EVENT_CODEC_START = 20000;
    public static final int TVPLAYER_EVENT_EXCEED_CODEC_CAPABILITY = 20001;
    public static final int TVPLAYER_GINGA_EVENT_END = 10999;
    public static final int TVPLAYER_GINGA_EVENT_START = 10000;
    public static final int TVPLAYER_GINGA_STATUS_MODE = 10001;
    public static final int TVPLAYER_HBBTV_EVENT_END = 4999;
    public static final int TVPLAYER_HBBTV_EVENT_START = 4000;
    public static final int TVPLAYER_HBBTV_STATUS_MODE = 4001;
    public static final int TVPLAYER_HBBTV_UI_EVENT = 4002;
    public static final int TVPLAYER_INPUT_SOURCE_END = 18999;
    public static final int TVPLAYER_INPUT_SOURCE_EVENT_START = 18000;
    public static final int TVPLAYER_INPUT_SOURCE_LOCK = 18001;
    public static final int TVPLAYER_MHEG5_EVENT_END = 5999;
    public static final int TVPLAYER_MHEG5_EVENT_HANDLER = 5003;
    public static final int TVPLAYER_MHEG5_EVENT_START = 5000;
    public static final int TVPLAYER_MHEG5_RETURN_KEY = 5002;
    public static final int TVPLAYER_MHEG5_STATUS_MODE = 5001;
    public static final int TVPLAYER_OAD_DOWNLOAD = 9003;
    public static final int TVPLAYER_OAD_EVENT_END = 9999;
    public static final int TVPLAYER_OAD_EVENT_START = 9000;
    public static final int TVPLAYER_OAD_HANDLER = 9002;
    public static final int TVPLAYER_OAD_TIMEOUT = 9001;
    public static final int TVPLAYER_POPUP_DIALOG = 14001;
    public static final int TVPLAYER_POPUP_SCAN_DIALOG_FREQ_CHANGE = 6004;
    public static final int TVPLAYER_POPUP_SCAN_DIALOG_LOSS_SIGNAL = 6002;
    public static final int TVPLAYER_POPUP_SCAN_DIALOG_NEW_MULTIPLEX = 6003;
    public static final int TVPLAYER_PROGRAM_BLOCK_DIALOG_EVENT_END = 14999;
    public static final int TVPLAYER_PROGRAM_BLOCK_DIALOG_EVENT_START = 14000;
    public static final int TVPLAYER_PROGRAM_INFO_READY = 2002;
    public static final int TVPLAYER_PVR_ALWAYS_TIMESHIFT_PROGRAM_NOT_READY = 15016;
    public static final int TVPLAYER_PVR_ALWAYS_TIMESHIFT_PROGRAM_READY = 15015;
    public static final int TVPLAYER_PVR_CI_PLUS_PROTECTION = 15012;
    public static final int TVPLAYER_PVR_CI_PLUS_RETENTION_LIMIT_UPDATE = 15013;
    public static final int TVPLAYER_PVR_EVENT_END = 15999;
    public static final int TVPLAYER_PVR_EVENT_START = 15000;
    public static final int TVPLAYER_PVR_OVERRUN = 15010;
    public static final int TVPLAYER_PVR_PARENTAL_CONTROL = 15014;
    public static final int TVPLAYER_PVR_PLAYBACK_BEGIN = 15004;
    public static final int TVPLAYER_PVR_PLAYBACK_SPEED_CHANGE = 15002;
    public static final int TVPLAYER_PVR_PLAYBACK_STOP = 15003;
    public static final int TVPLAYER_PVR_PLAYBACK_TIME = 15001;
    public static final int TVPLAYER_PVR_RECORD_SIZE = 15006;
    public static final int TVPLAYER_PVR_RECORD_STOP = 15007;
    public static final int TVPLAYER_PVR_RECORD_TIME = 15005;
    public static final int TVPLAYER_PVR_TIMESHIFT_OVERWRITE_AFTER = 15009;
    public static final int TVPLAYER_PVR_TIMESHIFT_OVERWRITE_BEFORE = 15008;
    public static final int TVPLAYER_PVR_USB_REMOVED = 15011;
    public static final int TVPLAYER_RCT_PRESENCE = 15017;
    public static final int TVPLAYER_RESCAN_EVENT_END = 6999;
    public static final int TVPLAYER_RESCAN_EVENT_START = 6000;
    public static final int TVPLAYER_SCREEN_SAVER_EVENT_END = 13999;
    public static final int TVPLAYER_SCREEN_SAVER_EVENT_START = 13000;
    public static final int TVPLAYER_SCREEN_SAVER_MODE = 13001;
    public static final int TVPLAYER_SIGNAL_EVENT_END = 11999;
    public static final int TVPLAYER_SIGNAL_EVENT_START = 11000;
    public static final int TVPLAYER_SIGNAL_LOCK = 11001;
    public static final int TVPLAYER_SIGNAL_UNLOCK = 11002;
    public static final int TVPLAYER_SIGNAL_UNSTABLE = 11003;
    public static final int TVPLAYER_TELETEXT_EVENT_END = 7999;
    public static final int TVPLAYER_TELETEXT_EVENT_START = 7000;
    public static final int TVPLAYER_TS_CHANGE = 2004;
    private static PlayerImpl _playerImpl;
    private final String IPLEARIMPL_MANAGER = "mstar.IPlayerImpl";
    private EventHandler mEventHandler;
    private long mNativeContext;
    private long mNativeSurfaceTexture;
    private OnAtvPlayerEventListener mOnAtvPlayerEventListener;
    private OnDtvPlayerEventListener mOnDtvPlayerEventListener;
    private OnEventListener mOnEventListener;
    private OnTvPlayerEventListener mOnTvPlayerEventListener;
    private int mPlayerContext;
    private Surface mSurface;
    private SurfaceHolder mSurfaceHolder;

    /* JADX INFO: renamed from: com.mstar.android.tvapi.impl.PlayerImpl$1, reason: invalid class name */
    static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] $SwitchMap$com$mstar$android$tvapi$common$vo$TvOsType$EnumInputSource;

        static {
            int[] iArr = new int[TvOsType.EnumInputSource.values().length];
            $SwitchMap$com$mstar$android$tvapi$common$vo$TvOsType$EnumInputSource = iArr;
            try {
                iArr[TvOsType.EnumInputSource.E_INPUT_SOURCE_ATV.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$mstar$android$tvapi$common$vo$TvOsType$EnumInputSource[TvOsType.EnumInputSource.E_INPUT_SOURCE_DTV.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    private class EventHandler extends Handler {
        private PlayerImpl mMSrv;

        public EventHandler(PlayerImpl playerImpl, Looper looper) {
            super(looper);
            this.mMSrv = playerImpl;
        }

        @Override // android.os.Handler
        public void handleMessage(Message message) {
            if (this.mMSrv.mNativeContext == 0) {
            }
            TvOsType.EnumInputSource currentInputSource = null;
            if (PlayerImpl.this.mOnEventListener != null) {
                Bundle bundle = new Bundle();
                bundle.putParcelable("messageObj", (Parcelable) message.obj);
                int i2 = message.what;
                if (i2 == 1 || i2 == 4002 || i2 == 1001 || i2 == 1002) {
                    message.setData(bundle);
                }
                message.obj = null;
                PlayerImpl.this.mOnEventListener.onEvent(message);
                message.obj = bundle.getParcelable("messageObj");
            }
            int i3 = message.what;
            if (i3 == 1001) {
                if (PlayerImpl.this.mOnAtvPlayerEventListener != null) {
                    Bundle bundle2 = new Bundle();
                    bundle2.putParcelable("messageObj", (Parcelable) message.obj);
                    message.setData(bundle2);
                    PlayerImpl.this.mOnAtvPlayerEventListener.onAtvManualTuningScanInfo(message.what, null);
                    return;
                }
                return;
            }
            if (i3 == 1002) {
                if (PlayerImpl.this.mOnAtvPlayerEventListener != null) {
                    Bundle bundle3 = new Bundle();
                    bundle3.putParcelable("messageObj", (Parcelable) message.obj);
                    message.setData(bundle3);
                    PlayerImpl.this.mOnAtvPlayerEventListener.onAtvAutoTuningScanInfo(message.what, null);
                    return;
                }
                return;
            }
            if (i3 == 3001) {
                if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                    PlayerImpl.this.mOnDtvPlayerEventListener.onEpgTimerSimulcast(message.what, message.arg1);
                    return;
                }
                return;
            }
            if (i3 == 3002) {
                if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                    PlayerImpl.this.mOnTvPlayerEventListener.onEpgUpdateList(message.what, message.arg1);
                    return;
                }
                return;
            }
            if (i3 == 4001) {
                if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                    if (message.arg1 != 0) {
                        PlayerImpl.this.mOnDtvPlayerEventListener.onHbbtvStatusMode(message.what, true);
                        return;
                    } else {
                        PlayerImpl.this.mOnDtvPlayerEventListener.onHbbtvStatusMode(message.what, false);
                        return;
                    }
                }
                return;
            }
            if (i3 == 4002) {
                if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                    Bundle bundle4 = new Bundle();
                    bundle4.putParcelable("messageObj", (Parcelable) message.obj);
                    message.setData(bundle4);
                    PlayerImpl.this.mOnTvPlayerEventListener.onHbbtvUiEvent(message.what, null);
                    return;
                }
                return;
            }
            if (i3 == 11001) {
                try {
                    currentInputSource = TvManager.getInstance().getCurrentInputSource();
                } catch (TvCommonException e2) {
                    e2.printStackTrace();
                }
                int i4 = AnonymousClass1.$SwitchMap$com$mstar$android$tvapi$common$vo$TvOsType$EnumInputSource[currentInputSource.ordinal()];
                if (i4 == 1) {
                    if (PlayerImpl.this.mOnAtvPlayerEventListener != null) {
                        PlayerImpl.this.mOnAtvPlayerEventListener.onSignalLock(message.what);
                        return;
                    }
                    return;
                } else if (i4 != 2) {
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onSignalLock(message.what);
                        return;
                    }
                    return;
                } else {
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        PlayerImpl.this.mOnDtvPlayerEventListener.onSignalLock(message.what);
                        return;
                    }
                    return;
                }
            }
            if (i3 == 11002) {
                try {
                    currentInputSource = TvManager.getInstance().getCurrentInputSource();
                } catch (TvCommonException e3) {
                    e3.printStackTrace();
                }
                int i5 = AnonymousClass1.$SwitchMap$com$mstar$android$tvapi$common$vo$TvOsType$EnumInputSource[currentInputSource.ordinal()];
                if (i5 == 1) {
                    if (PlayerImpl.this.mOnAtvPlayerEventListener != null) {
                        PlayerImpl.this.mOnAtvPlayerEventListener.onSignalUnLock(message.what);
                        return;
                    }
                    return;
                } else if (i5 != 2) {
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onSignalUnLock(message.what);
                        return;
                    }
                    return;
                } else {
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        PlayerImpl.this.mOnDtvPlayerEventListener.onSignalUnLock(message.what);
                        return;
                    }
                    return;
                }
            }
            switch (i3) {
                case 1:
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        Bundle bundle5 = new Bundle();
                        bundle5.putParcelable("messageObj", (Parcelable) message.obj);
                        message.setData(bundle5);
                        PlayerImpl.this.mOnDtvPlayerEventListener.onDtvAutoTuningScanInfo(message.what, null);
                    }
                    break;
                case 7001:
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        if (message.arg1 == 0) {
                            PlayerImpl.this.mOnDtvPlayerEventListener.onChangeTtxStatus(message.what, false);
                        } else {
                            PlayerImpl.this.mOnDtvPlayerEventListener.onChangeTtxStatus(message.what, true);
                        }
                    }
                    break;
                case 8001:
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        if (message.arg1 == 0) {
                            PlayerImpl.this.mOnDtvPlayerEventListener.onAudioModeChange(message.what, false);
                        } else {
                            PlayerImpl.this.mOnDtvPlayerEventListener.onAudioModeChange(message.what, true);
                        }
                    }
                    break;
                case 10001:
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        if (message.arg1 == 0) {
                            PlayerImpl.this.mOnDtvPlayerEventListener.onGingaStatusMode(message.what, false);
                        } else {
                            PlayerImpl.this.mOnDtvPlayerEventListener.onGingaStatusMode(message.what, true);
                        }
                    }
                    break;
                case 13001:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onScreenSaverMode(message.what, message.arg1);
                    }
                    break;
                case 14001:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPopupDialog(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 15001:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyPlaybackTime(message.what, message.arg1);
                    }
                    break;
                case 15002:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyPlaybackSpeedChange(message.what);
                    }
                    break;
                case 15003:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyPlaybackStop(message.what);
                    }
                    break;
                case 15004:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyPlaybackBegin(message.what);
                    }
                    break;
                case 15005:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyRecordTime(message.what, message.arg1);
                    }
                    break;
                case 15006:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyRecordSize(message.what, message.arg1);
                    }
                    break;
                case 15007:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyRecordStop(message.what);
                    }
                    break;
                case 15008:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyTimeShiftOverwritesBefore(message.what, message.arg1);
                    }
                    break;
                case 15009:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyTimeShiftOverwritesAfter(message.what, message.arg1);
                    }
                    break;
                case 15010:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyOverRun(message.what);
                    }
                    break;
                case 15011:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyUsbRemoved(message.what, message.arg1);
                    }
                    break;
                case 15012:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyCiPlusProtection(message.what);
                    }
                    break;
                case 15013:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyCiPlusRetentionLimitUpdate(message.what, message.arg1);
                    }
                    break;
                case 15014:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyParentalControl(message.what, message.arg1);
                    }
                    break;
                case 15015:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyAlwaysTimeShiftProgramReady(message.what);
                    }
                    break;
                case 15016:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onPvrNotifyAlwaysTimeShiftProgramNotReady(message.what);
                    }
                    break;
                case 15017:
                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                        PlayerImpl.this.mOnDtvPlayerEventListener.onRctPresence(message.what);
                    }
                    break;
                case 16001:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.onEmerencyAlert(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 17001:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.on4k2kHDMIDisablePip(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 17002:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.on4k2kHDMIDisablePop(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 17003:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.on4k2kHDMIDisableDualView(message.what, message.arg1, message.arg2);
                    }
                    break;
                case 17004:
                    if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                        PlayerImpl.this.mOnTvPlayerEventListener.on4k2kHDMIDisableTravelingMode(message.what, message.arg1, message.arg2);
                    }
                    break;
                default:
                    switch (i3) {
                        case 2001:
                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                PlayerImpl.this.mOnDtvPlayerEventListener.onDtvChannelNameReady(message.what);
                            }
                            break;
                        case 2002:
                            try {
                                currentInputSource = TvManager.getInstance().getCurrentInputSource();
                            } catch (TvCommonException e4) {
                                e4.printStackTrace();
                            }
                            int i6 = AnonymousClass1.$SwitchMap$com$mstar$android$tvapi$common$vo$TvOsType$EnumInputSource[currentInputSource.ordinal()];
                            if (i6 == 1) {
                                if (PlayerImpl.this.mOnAtvPlayerEventListener != null) {
                                    PlayerImpl.this.mOnAtvPlayerEventListener.onAtvProgramInfoReady(message.what);
                                }
                            } else if (i6 == 2) {
                                if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                    PlayerImpl.this.mOnDtvPlayerEventListener.onDtvProgramInfoReady(message.what);
                                }
                            } else if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                                PlayerImpl.this.mOnTvPlayerEventListener.onTvProgramInfoReady(message.what);
                            }
                            break;
                        case 2003:
                            if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                                PlayerImpl.this.mOnTvPlayerEventListener.onDtvChannelInfoUpdate(message.what, message.arg1, message.arg2);
                            }
                            break;
                        case 2004:
                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                PlayerImpl.this.mOnDtvPlayerEventListener.onTsChange(message.what);
                            }
                            break;
                        case 2005:
                            if (PlayerImpl.this.mOnTvPlayerEventListener != null) {
                                PlayerImpl.this.mOnTvPlayerEventListener.onDtvPsipTsUpdate(message.what, message.arg1, message.arg2);
                            }
                            break;
                        case 2006:
                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                PlayerImpl.this.mOnDtvPlayerEventListener.onDtvPriComponentMissing(message.what);
                            }
                            break;
                        default:
                            switch (i3) {
                                case 5001:
                                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                        PlayerImpl.this.mOnDtvPlayerEventListener.onMheg5StatusMode(message.what, message.arg1);
                                    }
                                    break;
                                case 5002:
                                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                        PlayerImpl.this.mOnDtvPlayerEventListener.onMheg5ReturnKey(message.what, message.arg1);
                                    }
                                    break;
                                case 5003:
                                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                        PlayerImpl.this.mOnDtvPlayerEventListener.onMheg5EventHandler(message.what, message.arg1);
                                    }
                                    break;
                                default:
                                    switch (i3) {
                                        case 6001:
                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                PlayerImpl.this.mOnDtvPlayerEventListener.onDtvAutoUpdateScan(message.what);
                                            }
                                            break;
                                        case 6002:
                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                PlayerImpl.this.mOnDtvPlayerEventListener.onPopupScanDialogLossSignal(message.what);
                                            }
                                            break;
                                        case 6003:
                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                PlayerImpl.this.mOnDtvPlayerEventListener.onPopupScanDialogNewMultiplex(message.what);
                                            }
                                            break;
                                        case 6004:
                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                PlayerImpl.this.mOnDtvPlayerEventListener.onPopupScanDialogFrequencyChange(message.what);
                                            }
                                            break;
                                        default:
                                            switch (i3) {
                                                case 9001:
                                                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                        PlayerImpl.this.mOnDtvPlayerEventListener.onOadTimeout(message.what, message.arg1);
                                                    }
                                                    break;
                                                case 9002:
                                                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                        PlayerImpl.this.mOnDtvPlayerEventListener.onOadHandler(message.what, message.arg1, message.arg2);
                                                    }
                                                    break;
                                                case 9003:
                                                    if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                        PlayerImpl.this.mOnDtvPlayerEventListener.onOadDownload(message.what, message.arg1);
                                                    }
                                                    break;
                                                default:
                                                    switch (i3) {
                                                        case 12001:
                                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                                PlayerImpl.this.mOnDtvPlayerEventListener.onCiLoadCredentialFail(message.what);
                                                            }
                                                            break;
                                                        case 12002:
                                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                                PlayerImpl.this.mOnDtvPlayerEventListener.onUiOPRefreshQuery(message.what);
                                                            }
                                                            break;
                                                        case 12003:
                                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                                PlayerImpl.this.mOnDtvPlayerEventListener.onUiOPServiceList(message.what);
                                                            }
                                                            break;
                                                        case 12004:
                                                            if (PlayerImpl.this.mOnDtvPlayerEventListener != null) {
                                                                PlayerImpl.this.mOnDtvPlayerEventListener.onUiOPExitServiceList(message.what);
                                                            }
                                                            break;
                                                    }
                                                    break;
                                            }
                                            break;
                                    }
                                    break;
                            }
                            break;
                    }
                    break;
            }
        }
    }

    static {
        try {
            System.loadLibrary("playerimpl_jni");
            native_init();
        } catch (UnsatisfiedLinkError e2) {
            System.err.println("Cannot load playerimpl_jni library:\n" + e2.toString());
        }
    }

    protected PlayerImpl() {
        Looper looperMyLooper = Looper.myLooper();
        if (looperMyLooper != null) {
            this.mEventHandler = new EventHandler(this, looperMyLooper);
        } else {
            Looper mainLooper = Looper.getMainLooper();
            if (mainLooper != null) {
                this.mEventHandler = new EventHandler(this, mainLooper);
            } else {
                this.mEventHandler = null;
            }
        }
        native_setup(new WeakReference(this));
    }

    private native boolean _destoryVideoSurface(Surface surface);

    private native int _getCurrentEventStatus(int i2) throws TvCommonException;

    private native void _setCurrentEventStatus(int i2, int i3) throws TvCommonException;

    private native void _setVideoSurface(Surface surface, int i2);

    private native void getAllBISSProgramInfo(Parcel parcel) throws TvCommonException;

    private final native boolean getEWSInfo(Parcel parcel, Parcel parcel2) throws TvCommonException;

    protected static PlayerImpl getInstance(Object obj) {
        String name = obj.getClass().getName();
        if ((name.equals("com.mstar.android.tvapi.atv.AtvPlayerImplProxy") || name.equals("com.mstar.android.tvapi.dtv.common.DtvPlayerImplProxy") || name.equals("com.mstar.android.tvapi.common.TvPlayerImplProxy")) && _playerImpl == null) {
            synchronized (PlayerImpl.class) {
                try {
                    if (_playerImpl == null) {
                        _playerImpl = new PlayerImpl();
                    }
                } finally {
                }
            }
        }
        return _playerImpl;
    }

    private final native boolean native_atsc_setAntennaType(int i2) throws TvCommonException;

    private final native boolean native_detectInputSource(int i2) throws TvCommonException;

    private final native void native_finalize();

    private native void native_forceVideoStandard(int i2) throws TvCommonException;

    private final native VideoArcInfo native_getAspectRatio() throws TvCommonException;

    private final native int native_getChinaDvbcRegion() throws TvCommonException;

    private final native int[] native_getNitFrequencyByDtvRegion(int i2) throws TvCommonException;

    private native void native_getRRTInformation(Parcel parcel) throws TvCommonException;

    private final native RfInfo native_getRfInfo(int i2, int i3) throws TvCommonException;

    private native boolean native_getVChipRatingInfo(Parcel parcel, Parcel parcel2) throws TvCommonException;

    private final native int native_getVideoStandard() throws TvCommonException;

    private final native int native_getVideoStandardDetectionState() throws TvCommonException;

    private static final native void native_init();

    private final native boolean native_openPAT(int i2) throws TvCommonException;

    private final native boolean native_openTeletext(int i2) throws TvCommonException;

    private final native boolean native_sendTeletextCommand(int i2) throws TvCommonException;

    private native boolean native_setAudioMute(int i2, int i3) throws TvCommonException;

    private final native void native_setChannelChangeFreezeMode(boolean z2) throws TvCommonException;

    private final native void native_setChinaDvbcRegion(int i2) throws TvCommonException;

    private final native boolean native_setCountry(int i2) throws TvCommonException;

    private final native void native_setParental(int i2) throws TvCommonException;

    private final native void native_setTimeZone(int i2) throws TvCommonException;

    private final native void native_setup(Object obj);

    private static void postEventFromNative(Object obj, int i2, int i3, int i4, Object obj2) {
        EventHandler eventHandler;
        PlayerImpl playerImpl = (PlayerImpl) ((WeakReference) obj).get();
        if (playerImpl == null || (eventHandler = playerImpl.mEventHandler) == null) {
            return;
        }
        playerImpl.mEventHandler.sendMessage(eventHandler.obtainMessage(i2, i3, i4, obj2));
    }

    private void updateSurfaceScreenOn() {
        SurfaceHolder surfaceHolder = this.mSurfaceHolder;
        if (surfaceHolder != null) {
            surfaceHolder.setKeepScreenOn(true);
        }
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean addSatelliteInfo(SatelliteInfo satelliteInfo) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean addTransponderInfo(int i2, DvbsTransponderInfo dvbsTransponderInfo) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean autostartApplication() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean changeManualScanRF(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native void changeSetting(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public native void clearProgramBISSKeyByNumber(int i2, int i3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean closeTeletext() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native boolean createPreviewCCWin() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean deleteSatelliteInfo(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean deleteTransponderInfo(int i2, int i3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public boolean destoryDisplay(SurfaceHolder surfaceHolder) {
        if (surfaceHolder != null) {
            return _destoryVideoSurface(surfaceHolder.getSurface());
        }
        return false;
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public boolean detectInputSource(TvOsType.EnumInputSource enumInputSource) throws TvCommonException {
        return native_detectInputSource(enumInputSource.ordinal());
    }

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public final native boolean disableAft() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native void disableAutoClock() throws TvCommonException;

    public final native boolean disableAutoScartOut() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean disableGigna() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean doesCcExist() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native boolean drawPreviewCCWin(CaptionOptionSetting captionOptionSetting) throws TvCommonException;

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public final native boolean enableAft() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native void enableAutoClock() throws TvCommonException;

    public final native boolean enableAutoScartOut() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean enableGinga() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native boolean enterPassToUnlockByUser(boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native boolean enterPassToUnlockUnratedByUser(boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native boolean exitPreviewCCWin() throws TvCommonException;

    public void finalize() throws Throwable {
        super.finalize();
        native_finalize();
        _playerImpl = null;
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public void forceVideoStandard(EnumAvdVideoStandardType enumAvdVideoStandardType) throws TvCommonException {
        native_forceVideoStandard(enumAvdVideoStandardType.ordinal());
    }

    public final native int getAirChannelType() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final ArrayList<BissProgramInfo> getAllBISSProgramInfo() throws TvCommonException {
        Parcel parcelObtain = Parcel.obtain();
        getAllBISSProgramInfo(parcelObtain);
        ArrayList<BissProgramInfo> arrayList = new ArrayList<>();
        int i2 = parcelObtain.readInt();
        for (int i3 = 0; i3 < i2; i3++) {
            BissProgramInfo bissProgramInfo = new BissProgramInfo();
            bissProgramInfo.number = parcelObtain.readInt();
            bissProgramInfo.serviceType = (short) parcelObtain.readInt();
            bissProgramInfo.serviceName = parcelObtain.readString();
            bissProgramInfo.bisskey = parcelObtain.readString();
            arrayList.add(bissProgramInfo);
        }
        parcelObtain.recycle();
        return arrayList;
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer, com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final native int getAntennaType() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final VideoArcInfo getAspectRatio() throws TvCommonException {
        return native_getAspectRatio();
    }

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native DtvAudioInfo getAudioInfo() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native DtvAudioInfo getAudioInfo_ex() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native int getCcMode() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native int[] getChannelLogoARGB() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public EnumChinaDvbcRegion getChinaDvbcRegion() throws TvCommonException {
        int iNative_getChinaDvbcRegion = native_getChinaDvbcRegion();
        if (iNative_getChinaDvbcRegion < EnumChinaDvbcRegion.E_CN_OTHERS.ordinal() || iNative_getChinaDvbcRegion > EnumChinaDvbcRegion.E_CN_NUM.ordinal()) {
            throw new TvCommonException("getChinaDvbcRegion failed");
        }
        return EnumChinaDvbcRegion.values()[iNative_getChinaDvbcRegion];
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public native String getCountryCode() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public int getCurrentEventStatus(int i2) throws TvCommonException {
        return _getCurrentEventStatus(i2);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native DvbMuxInfo getCurrentMuxInfo() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native String getCurrentRatingInformation() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getCurrentSatelliteCount() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getCurrentSatelliteNumber() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native DtvProgramSignalInfo getCurrentSignalInformation() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getCurrentTransponderNumber() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native boolean getCurrentVChipBlockStatus() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    @Deprecated
    public DtvDemodVersion getDTVDemodVersion(DtvDemodType dtvDemodType) throws TvCommonException {
        return getDtvDemodVersion(dtvDemodType.ordinal());
    }

    public native DtvDemodDvbcInfo getDemodDVBCInfo() throws TvCommonException;

    public native DtvDemodDvbtInfo getDemodDVBTInfo() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public DtvDemodVersion getDtvDemodVersion(int i2) throws TvCommonException {
        return native_getDTVDemodVersion(i2);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getDtvRouteCount() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native MwAtscEasInfo getEASInProgress() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native EwbsInfo getEWBSInfo(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native EwbsOpInfo getEWBSOpInfo(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final EwsInfo getEWSInfo() throws TvCommonException {
        Parcel parcelObtain = Parcel.obtain();
        Parcel parcelObtain2 = Parcel.obtain();
        parcelObtain.writeInterfaceToken("mstar.IPlayerImpl");
        getEWSInfo(parcelObtain, parcelObtain2);
        if (parcelObtain2.readInt() == 0) {
            parcelObtain.recycle();
            parcelObtain2.recycle();
            throw new TvNativeCallFailException("funtion failed at tvservice ");
        }
        EwsInfo ewsInfo = new EwsInfo();
        ewsInfo.type = parcelObtain2.readInt();
        ewsInfo.authority = parcelObtain2.readInt();
        ewsInfo.level = parcelObtain2.readInt();
        ewsInfo.location = parcelObtain2.readString();
        ewsInfo.code = parcelObtain2.readString();
        ewsInfo.eventData = parcelObtain2.readString();
        ewsInfo.position = parcelObtain2.readString();
        ewsInfo.characteristic = parcelObtain2.readString();
        ewsInfo.information = parcelObtain2.readString();
        parcelObtain.recycle();
        parcelObtain2.recycle();
        return ewsInfo;
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native boolean getEasProgressSatus() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native int getHdmiEdidVersionBySource(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native String getLanguageCode() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int[] getLogoData() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native String getMheg5PfgContent() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native DvbMuxInfo getMuxInfoByProgramNumber(int i2, short s2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final int[] getNitFrequencyByDtvRegion(EnumChinaDvbcRegion enumChinaDvbcRegion) throws TvCommonException {
        return native_getNitFrequencyByDtvRegion(enumChinaDvbcRegion.ordinal());
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native int getPhaseRange() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public Region5RatingInformation getRRTInformation() throws TvCommonException {
        Parcel parcelObtain = Parcel.obtain();
        native_getRRTInformation(parcelObtain);
        Log.i(TAG, "getRRTInformation(), ret:" + parcelObtain.readInt());
        return Region5RatingInformation.CREATOR.createFromParcel(parcelObtain);
    }

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public RfInfo getRfInfo(RfInfo.EnumInfoType enumInfoType, int i2) throws TvCommonException {
        return native_getRfInfo(enumInfoType.ordinal(), i2);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native SatelliteInfo getSatelliteInfo(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final native AtscScanChannelNotify getTSUpdateInfo(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getTransponderCount(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native DvbsTransponderInfo getTransponderInfo(int i2, int i3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getUserLocationCode() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int getUserLocationCount() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native LocationInfo getUserLocationInfo(int i2) throws TvCommonException;

    public VChipRatingInfo getVChipRatingInfo() throws TvCommonException {
        VChipRatingInfo vChipRatingInfo = new VChipRatingInfo();
        Parcel parcelObtain = Parcel.obtain();
        Parcel parcelObtain2 = Parcel.obtain();
        native_getVChipRatingInfo(parcelObtain, parcelObtain2);
        if (parcelObtain2.readInt() == 1) {
            vChipRatingInfo.eia608Data1 = parcelObtain2.readInt();
            vChipRatingInfo.eia608Data2 = parcelObtain2.readInt();
            vChipRatingInfo.ratingType = parcelObtain2.readInt();
            vChipRatingInfo.ratingLevel = parcelObtain2.readInt();
            vChipRatingInfo.tv_FVSLD = parcelObtain2.readInt();
            vChipRatingInfo.mpaaLevel = parcelObtain2.readInt();
            vChipRatingInfo.canEngLevel = parcelObtain2.readInt();
            vChipRatingInfo.canFreLevel = parcelObtain2.readInt();
            for (int i2 = 0; i2 < 256; i2++) {
                vChipRatingInfo.dimVal[i2] = parcelObtain2.readInt();
            }
            parcelObtain.recycle();
            parcelObtain2.recycle();
        }
        return vChipRatingInfo;
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native VideoInfo getVideoInfo() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public EnumAvdVideoStandardType getVideoStandard() throws TvCommonException {
        int iNative_getVideoStandard = native_getVideoStandard();
        if (iNative_getVideoStandard < EnumAvdVideoStandardType.PAL_BGHI.ordinal() || iNative_getVideoStandard > EnumAvdVideoStandardType.MAX.ordinal()) {
            throw new TvCommonException("native_getVideoStandard failed");
        }
        return EnumAvdVideoStandardType.values()[iNative_getVideoStandard];
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public EnumStdDetectionState getVideoStandardDetectionState() throws TvCommonException {
        int iNative_getVideoStandardDetectionState = native_getVideoStandardDetectionState();
        if (iNative_getVideoStandardDetectionState < EnumStdDetectionState.VERIFY.ordinal() || iNative_getVideoStandardDetectionState > EnumStdDetectionState.DUMP.ordinal()) {
            throw new TvCommonException("native_getVideoStandardDetectionState failed");
        }
        return EnumStdDetectionState.values()[iNative_getVideoStandardDetectionState];
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean hasTeletextClockSignal() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean hasTeletextSignal() throws TvCommonException;

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public final native void initAtvVif() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native void initOfflineDetection() throws TvCommonException;

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public final native boolean isAftEnabled() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean isGingaEnabled() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean isGingaRunning() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean isHdmiMode();

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean isMheg5Running() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean isSignalStable() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean isTeletextDisplayed() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean isTeletextSubtitleChannel() throws TvCommonException;

    public native DtvDemodVersion native_getDTVDemodVersion(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final boolean openPAT(EnumTeletextCommand enumTeletextCommand) throws TvCommonException {
        return native_openPAT(enumTeletextCommand.ordinal());
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public boolean openTeletext(EnumTeletextMode enumTeletextMode) throws TvCommonException {
        return native_openTeletext(enumTeletextMode.ordinal());
    }

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean playCurrentProgram() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean processKey(int i2, boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public void release() throws Throwable {
        _playerImpl = null;
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native boolean resetRrtInformation() throws TvCommonException;

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public final native boolean saveAtvProgram(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean sendDiSEqCMotorCommand(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    @Deprecated
    public final native boolean sendMheg5Command(short s2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean sendMheg5IcsCommand(int i2, short s2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean sendMheg5Key(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final boolean sendTeletextCommand(EnumTeletextCommand enumTeletextCommand) throws TvCommonException {
        return native_sendTeletextCommand(enumTeletextCommand.ordinal());
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public void setAntennaType(EnumAntennaType enumAntennaType) throws TvCommonException {
        native_atsc_setAntennaType(enumAntennaType.ordinal());
    }

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean setAudioMode(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public boolean setAudioMute(AudioMuteType.EnumAudioMuteType enumAudioMuteType, TvOsType.EnumInputSource enumInputSource) throws TvCommonException {
        return native_setAudioMute(enumAudioMuteType.getValue(), enumInputSource.ordinal());
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native boolean setAutoSync(boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final boolean setCanadaEngGuideline(EnumCanadaEngRatingType enumCanadaEngRatingType) throws TvCommonException {
        return setVChipGuideline((short) EnumVChipRatingType.E_CANADA_ENG.ordinal(), (short) enumCanadaEngRatingType.ordinal(), (short) 0, (short) 0);
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final boolean setCanadaFreGuideline(EnumCanadaFreRatingType enumCanadaFreRatingType) throws TvCommonException {
        return setVChipGuideline((short) EnumVChipRatingType.E_CANADA_FRE.ordinal(), (short) enumCanadaFreRatingType.ordinal(), (short) 0, (short) 0);
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native void setCcMode(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public void setChannelChangeFreezeMode(boolean z2) throws TvCommonException {
        native_setChannelChangeFreezeMode(z2);
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final void setChinaDvbcRegion(EnumChinaDvbcRegion enumChinaDvbcRegion) throws TvCommonException {
        native_setChinaDvbcRegion(enumChinaDvbcRegion.ordinal());
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public boolean setCountry(int i2) throws TvCommonException {
        return native_setCountry(i2);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public void setCurrentEventStatus(int i2, boolean z2) throws TvCommonException {
        _setCurrentEventStatus(i2, z2 ? 1 : 0);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setCurrentSatelliteNumber(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setCurrentTransponderNumber(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native void setDebugMode(boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setDiSEqCSwitchPort(int i2, int i3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setDish22KMode(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setDishLNBPowerMode(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setDishToneburstMode(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public void setDisplay(SurfaceHolder surfaceHolder) {
        setDisplay(surfaceHolder, 0);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native void setDtvRoute(short s2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final boolean setDynamicGuideline(short s2, short s3, short s4) throws TvCommonException {
        return setVChipGuideline((short) EnumVChipRatingType.E_DYNAMIC.ordinal(), s2, s3, s4);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native int setEWBSOpInfo(int i2, int i3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native void setEasAudioDesired(boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native void setEasProgressDone() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native void setFavoriteRegion(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setHPosition(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native boolean setHdmiEdidVersionBySource(int i2, int i3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setHdmiGpio(int[] iArr) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean setManualTuneByFreq(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean setManualTuneByRf(short s2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setMirror(boolean z2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.atv.AtvPlayer
    public void setOnAtvPlayerEventListener(OnAtvPlayerEventListener onAtvPlayerEventListener) {
        this.mOnAtvPlayerEventListener = onAtvPlayerEventListener;
    }

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public void setOnDtvPlayerEventListener(OnDtvPlayerEventListener onDtvPlayerEventListener) {
        this.mOnDtvPlayerEventListener = onDtvPlayerEventListener;
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public void setOnEventListener(OnEventListener onEventListener) {
        this.mOnEventListener = onEventListener;
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public void setOnTvPlayerEventListener(OnTvPlayerEventListener onTvPlayerEventListener) {
        this.mOnTvPlayerEventListener = onTvPlayerEventListener;
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public void setParental(EnumParentalRating enumParentalRating) throws TvCommonException {
        native_setParental(enumParentalRating.ordinal());
    }

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setPhase(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public native boolean setProgramBISSKeyByNumber(int i2, int i3, String str, int i4) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean setProgramSortByType(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setSize(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setTeletextLanguageGroup(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public void setTimeZone(TvOsType.EnumTimeZone enumTimeZone) throws TvCommonException {
        native_setTimeZone(enumTimeZone.getValue());
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final boolean setUsaMpaaGuideline(UsaMpaaRatingType.EnumUsaMpaaRatingType enumUsaMpaaRatingType, boolean z2) throws TvCommonException {
        return setVChipGuideline((short) EnumVChipRatingType.E_US_MPAA.ordinal(), (short) enumUsaMpaaRatingType.ordinal(), z2 ? (short) 1 : (short) 0, (short) 0);
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    @Deprecated
    public final boolean setUsaTvGuideline(EnumUsaTvRatingType enumUsaTvRatingType, short s2) throws TvCommonException {
        return setUsaTvGuideline((short) enumUsaTvRatingType.ordinal(), s2);
    }

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native void setUserLocationCode(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public native boolean setVChipGuideline(short s2, short s3, short s4, short s5) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean setVPosition(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean startApplication(long j2, long j3) throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public native void startAutoStandardDetection() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean startCc() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean startPcModeAtuoTune() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native boolean stopApplication() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public final native boolean stopCc() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.common.DtvPlayer
    public final native void switchAudioTrack(int i2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean switchDtvRoute(short s2) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean unlockChannel() throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean updateSatelliteInfo(int i2, SatelliteInfo satelliteInfo) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean updateTransponderInfo(int i2, int i3, DvbsTransponderInfo dvbsTransponderInfo) throws TvCommonException;

    @Override // com.mstar.android.tvapi.dtv.dvb.DvbPlayer
    public final native boolean verifySlotFrequency() throws TvCommonException;

    @Override // com.mstar.android.tvapi.common.TvPlayer
    public void setDisplay(SurfaceHolder surfaceHolder, int i2) {
        this.mSurfaceHolder = surfaceHolder;
        if (surfaceHolder != null) {
            this.mSurface = surfaceHolder.getSurface();
        } else {
            this.mSurface = null;
        }
        _setVideoSurface(this.mSurface, i2);
        updateSurfaceScreenOn();
    }

    @Override // com.mstar.android.tvapi.dtv.atsc.AtscPlayer
    public final boolean setUsaTvGuideline(short s2, short s3) throws TvCommonException {
        return setVChipGuideline((short) EnumVChipRatingType.E_US_TV.ordinal(), s2, s3, (short) 0);
    }
}
