HiPlayOSSDualSDK.java 源代码
package com.hichip.sdk;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.ServiceException;
import com.hichip.AesCode.DoAes;
import com.hichip.base.HiLog;
import com.hichip.base.HiThread;
import com.hichip.callback.PlayOSSFileCallback;
import com.hichip.coder.EncMp4;
import com.hichip.coder.H264Decoder;
import com.hichip.coder.HiCoderBitmap;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCloud;
import com.hichip.control.HiGLMonitor;
import com.hichip.data.FrameData;
import com.hichip.data.FrameQueue;
import com.hichip.data.HiAudioPlay;
import com.hichip.data.HiDeviceInfo;
import com.hichip.data.Oss2File;
import com.hichip.data.Oss2FileQueue;
import com.hichip.system.HiSystemValue;
import com.hichip.tools.HiCloudSDK;
import com.hichip.tools.HiConfig;
import com.hichip.tools.Packet;
import com.hichip.tools.PlayLocalFile;
import com.xiaomi.mipush.sdk.Constants;
import common.HiDataValue;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.Timer;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.litepal.util.Const;
public class HiPlayOSSDualSDK implements Serializable {
private static final int HANDLE_MESSAGE_cloud_RESULT = 268435458;
private static final int HANDLE_MESSAGE_manage_RESULT = 268435457;
private String filepath;
private int filetime;
private String localfilepathoss;
private Context mContext;
int mCut2h;
int mCut2w;
int mCuth;
int mCutw;
private String mSaveFilepath;
private HiCloud mhiCloud;
private String mhiCloudname;
private String mhiCloudpwd;
private HiCloudSDK mhiCloudsdk;
private HiConfig mhiConfig;
private int videoheight;
private int videowidth;
private ThreadPlayLocal threadPlayLocal = null;
private ThreadDecodeVideo threadDecodeVideo = null;
private ThreadDecodeAudio threadDecodeAudio = null;
private ThreadOSSDown mthreadOSSDowndata = null;
private ThreadOSSDownFileList mthreadOSSDownFileList = null;
private ThreadOSSDownFileTime mthreadOSSDownFileTime = null;
private ThreadOSSDownCustom mthreadOSSDownCustomFile = null;
private ThreadOSSdoesobj mthreadossdoesobj = null;
private ThreadOSSFileList mthreadossfilelist = null;
private ThreadManageOSS mthreadmanageoss = null;
private FrameQueue mossVideoFrameQueue = null;
private FrameQueue mossVideo2FrameQueue = null;
private FrameQueue mossAudioFrameQueue = null;
private HiGLMonitor mMonitorview = null;
private HiGLMonitor mMonitor2view = null;
private HiGLMonitor mMonitor3view = null;
private int mShownum = 0;
private int msaveDualvalue = 0;
private int audiotype = -1;
private int videotype = -1;
private long saveFirstTime = 0;
int video_type = -1;
int savespeed = 0;
int saveInterval = 50;
private boolean isPlaying = true;
private boolean isPlayEnd = false;
private int saveflag = 0;
private boolean isSeek = false;
private boolean isSeekend = false;
private boolean isSpeed = false;
private int s32SecPerFrame = 0;
private boolean SaveisSeek = false;
private int SaveSeekTime = 0;
private int VIDEO_TYPE_MP4 = 0;
private int VIDEO_TYPE_AVI = 1;
private int VIDEO_TYPE_H264 = 2;
private boolean isPlayStop = false;
private boolean is2Mp4 = false;
private long[] mp4_handle = new long[1];
private long[] mp4_2handle = new long[1];
private boolean isOpenFile = false;
private int DecodeVideoType = 0;
private int DecodeViVoVideoType = 1;
private Lock writemp4lock = new ReentrantLock();
private int maxlen = 0;
private int subtime = 0;
private int mFirstTime = 0;
private boolean isLoading_FLAG = false;
private boolean isDisplayFrist = false;
private int Loading_IFrameNum = 0;
private int Loading_IFrameNum_tal = 3;
private int Loading_FrameNum = 100;
private int Loading_FramePts = 5;
private ThreadDecodeAudioCloud mThreadDecodeAudioCloud = null;
private ThreadDecodeVideoCloud mThreadDecodeVideoCloud = null;
private ThreadDecode2VideoCloud mThreadDecode2VideoCloud = null;
private Oss2FileQueue mOssFrameQueue = null;
private HiChipDefines.HI_Oss_DownLoad2File mOssDLFile = null;
private String mhiCloudSer = "120.24.156.39";
private int mhiCloudport = 33201;
private String mhiCloudKey = "701-jpzh";
private boolean isOSSFile = false;
private int SaveOssLoad = 0;
private int saveOssLoadLen = 0;
private boolean OSSLoadFin = false;
private boolean isPlayossEnd = false;
private boolean isOssreadHead_end = false;
private String Savedownload_file = "";
private int mOssLoadSt = 0;
private int mOssLoadEn = 0;
private int mOssFilesize = 0;
private boolean isExitOSSLoad = false;
private int saveframeseekpos = 0;
private long mSaveOssGetTime = 0;
private long mSetOsstime = 300000;
private int mosstokentime = 60;
private int mOssOperation = 0;
private boolean mOSSSaveisSeek = false;
private int u32AVFramePTS1 = 0;
private boolean isDeviceDecode5 = true;
private byte[] yuvBuffer = null;
private byte[] yuv2Buffer = null;
private int cumtimeout = 10000;
private int mcumCount = 3;
private int mcumCounttry = 0;
private int mstartrecvdata = 0;
private boolean mOssDownEnd = false;
private boolean mOssThreadExit = false;
private HiDeviceInfo mDeciveInfo = new HiDeviceInfo();
private boolean isqueueenpty = false;
private PlayOSSFileCallback mplayOSSfilecallback = null;
private Timer mUidEXIPREtimer = null;
private boolean mIsOCloud = false;
private String mOCloudDate = "";
private String mOCloudUid = "";
long[] osswrite_readhandle = new long[1];
long[] ossread_readhandle = new long[1];
long[] mp4_readhandle = new long[1];
long[] avi_readhandle = new long[1];
long[] h264_readhandle = new long[1];
private boolean isH265DevDec = false;
private boolean isDualThrid = false;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message message) {
int i = message.what;
switch (i) {
case 24831:
long[] jArr = (long[]) message.obj;
HiPlayOSSDualSDK.this.setOSSDownLoadProgres(message.what, jArr[0], jArr[1]);
HiPlayOSSDualSDK.this.mstartrecvdata = message.what;
return;
case 24832:
HiPlayOSSDualSDK.this.mOssThreadExit = false;
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq(((ClientException) message.obj).toString(), message.what, -1, -1);
return;
case HiChipDefines.HI_P2P_GET_SNAP_AUTO_PARAM:
HiPlayOSSDualSDK.this.mOssThreadExit = false;
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq(((ServiceException) message.obj).toString(), message.what, -1, -1);
return;
case HiChipDefines.HI_P2P_SET_SNAP_AUTO_PARAM:
HiPlayOSSDualSDK.this.mOssThreadExit = false;
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq(((IOException) message.obj).toString(), message.what, -1, -1);
return;
case HiChipDefines.HI_P2P_GET_SNAP_AUTO_SCHEDULE:
HiPlayOSSDualSDK.this.mOssThreadExit = false;
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq("", message.what, -1, -1);
return;
case HiChipDefines.HI_P2P_SET_SNAP_AUTO_SCHEDULE:
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq("", message.what, -1, -1);
return;
default:
switch (i) {
case 25087:
break;
case 25088:
break;
case 25089:
break;
case 25090:
break;
case 25091:
break;
case 25092:
break;
default:
switch (i) {
case 25343:
break;
case 25344:
break;
case 25345:
break;
case 25346:
break;
case 25347:
break;
case 25348:
break;
default:
switch (i) {
case 25599:
break;
case 25600:
break;
case 25601:
break;
case 25602:
break;
case 25603:
break;
case 25604:
break;
default:
switch (i) {
case 25855:
break;
case 25856:
break;
case 25857:
break;
case 25858:
break;
case 25859:
break;
case 25860:
break;
default:
switch (i) {
case 26111:
break;
case 26112:
break;
case 26113:
break;
case 26114:
break;
case 26115:
break;
case 26116:
break;
default:
return;
}
}
}
}
}
}
}
};
private byte[] yuvBuffer2 = null;
private byte[] yuvBuffer3 = null;
private Handler cumhandler = new Handler() {
@Override
public void handleMessage(Message message) {
HiLog.e("" + message.what, 1, 0);
int i = message.what;
if (i != 28672 && i != 28673) {
switch (i) {
case 28928:
case HiChipDefines.HI_P2P_GET_FTP_PARAM:
break;
case HiChipDefines.HI_P2P_SET_FTP_PARAM:
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq("", message.what, 1, 1);
return;
case HiChipDefines.HI_P2P_GET_EMAIL_PARAM:
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq("", message.what, 1, 1);
return;
default:
return;
}
}
HiLog.e("" + message.what, 1, 0);
HiPlayOSSDualSDK.this.setOSSReq("", message.what, -1, -1);
}
};
public void DoRead264File(HiThread hiThread) {
}
public void DoReadAVIFile(HiThread hiThread) {
}
public void DoReadMp4File(HiThread hiThread) {
}
private int Playlocal_OpenAVI(String str) {
return 1;
}
public void registerPlayOSSStateListener(PlayOSSFileCallback playOSSFileCallback) {
this.mplayOSSfilecallback = playOSSFileCallback;
HiLog.e("" + playOSSFileCallback, 1, 0);
}
public void unregisterPlayOSSStateListener(PlayOSSFileCallback playOSSFileCallback) {
this.mplayOSSfilecallback = null;
HiLog.e("" + playOSSFileCallback, 1, 0);
}
public void SetOSSverdueTime(long j) {
HiLog.e("" + this.mSetOsstime, 1, 0);
this.mSetOsstime = j;
HiLog.e("" + this.mSetOsstime, 1, 0);
}
public void SetDotryCount(int i) {
this.mcumCount = i;
}
public void OSSOperation() {
switch (this.mOssOperation) {
case 1:
GetOSSFileTime(0, 0);
break;
case 2:
GetOSSFileList("", 0, 0);
break;
case 3:
OSSPlayDown("", "", "", 0, 0);
break;
case 4:
StartOSSDownCustomFile("", 0, 0);
break;
case 5:
GetOSSFilelistExt("", 0);
break;
case 6:
GetOSSdoesObjectExt("", 0);
break;
}
this.mOssOperation = 0;
}
private void SetCallResult(final Context context) {
this.mhiCloudsdk.SetCallResult(new HiCloudSDK.ICloudResult() {
@Override
public void onReceiveiCloudResult(String str, int i, int i2, int i3, String str2) {
HiLog.e(str + ":::" + i + ":::" + i2 + "::" + i3, 1, 0);
if (i == 1) {
if (i2 == 0 && i3 >= 0) {
HiPlayOSSDualSDK.this.mhiCloudSer = str;
HiPlayOSSDualSDK.this.mhiCloudport = i3;
HiPlayOSSDualSDK.this.mhiCloudKey = str2;
if (HiPlayOSSDualSDK.this.mhiConfig != null) {
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_UUID() + "::" + HiPlayOSSDualSDK.this.mhiConfig.getOSSServer() + ":::" + HiPlayOSSDualSDK.this.mhiConfig.getOssport() + "::::" + HiPlayOSSDualSDK.this.mhiConfig.getAeskey(), 1, 0);
HiCloudSDK hiCloudSDK = HiPlayOSSDualSDK.this.mhiCloudsdk;
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiCloudSDK.HiCloudSDKgetCloudinfo(hiPlayOSSDualSDK, 1, hiPlayOSSDualSDK.mhiConfig.getOSS_UUID(), HiPlayOSSDualSDK.this.mhiCloudname, HiPlayOSSDualSDK.this.mhiCloudpwd, HiPlayOSSDualSDK.this.mhiCloudKey, HiPlayOSSDualSDK.this.mhiCloudSer, HiPlayOSSDualSDK.this.mhiCloudport, (short) 5);
}
}
HiPlayOSSDualSDK.this.setOSSReq(str, i, i2, i3);
return;
}
if (i == 2) {
if (i2 == 0) {
if (HiPlayOSSDualSDK.this.mhiConfig == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME() == null || HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT().length() <= 0) {
HiPlayOSSDualSDK.this.setOSSReq(str, i, -1, -1);
HiLog.e("", 1, 1);
return;
}
HiPlayOSSDualSDK.this.mhiCloud.initOSS(context, HiPlayOSSDualSDK.this.mhiConfig);
HiPlayOSSDualSDK.this.mSaveOssGetTime = System.currentTimeMillis();
HiLog.e("" + HiPlayOSSDualSDK.this.mOssOperation, 1, 0);
if (HiPlayOSSDualSDK.this.mOssOperation != 0) {
HiPlayOSSDualSDK.this.OSSOperation();
return;
} else {
HiPlayOSSDualSDK.this.setOSSReq(str, i, i2, i3);
return;
}
}
HiPlayOSSDualSDK.this.setOSSReq(str, i, i2, i3);
}
}
@Override
public void onReceiveiOCloudResult(String str, int i, int i2, int i3, String str2, int i4) {
if (i == 4) {
if (i2 == 0) {
if (HiPlayOSSDualSDK.this.mhiConfig == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME() == null || HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME().length() <= 0 || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT() == null || HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT().length() <= 0) {
HiPlayOSSDualSDK.this.setOSSOCloudReq(str, i, -1, -1, i4);
HiLog.e("", 1, 1);
return;
}
HiPlayOSSDualSDK.this.mhiCloud.initOSS(context, HiPlayOSSDualSDK.this.mhiConfig);
HiPlayOSSDualSDK.this.mSaveOssGetTime = System.currentTimeMillis();
HiLog.e("" + HiPlayOSSDualSDK.this.mOssOperation, 1, 0);
HiLog.e("" + HiPlayOSSDualSDK.this.mOssOperation + "u32GmtTime:" + i4 + "szGmtTime" + str2 + "EndTime:" + i3, 1, 0);
if (i3 - i4 < 3600) {
HiPlayOSSDualSDK.this.mSetOsstime = 3000000L;
}
if (HiPlayOSSDualSDK.this.mOssOperation != 0) {
HiPlayOSSDualSDK.this.OSSOperation();
HiLog.e("" + HiPlayOSSDualSDK.this.mOssOperation + "u32GmtTime:" + i4 + "szGmtTime" + str2, 1, 0);
HiPlayOSSDualSDK.this.setOSSOCloudReq(str, 41, i2, i3, i4);
return;
}
HiLog.e("" + HiPlayOSSDualSDK.this.mOssOperation + "u32GmtTime:" + i4 + "szGmtTime" + str2, 1, 0);
HiPlayOSSDualSDK.this.setOSSOCloudReq(str, i, i2, i3, i4);
return;
}
HiLog.e("" + HiPlayOSSDualSDK.this.mOssOperation + "ret:" + i2 + "status:" + i3 + "u32GmtTime:" + i4, 1, 0);
HiPlayOSSDualSDK.this.setOSSOCloudReq(str, i, i2, i3, i4);
}
}
});
}
public long dateToStamp(String str) throws ParseException {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", Locale.getDefault()).parse(str + " +0000"));
return calendar.getTimeInMillis();
}
public void SetContext(Context context, String str) {
this.mContext = context;
if (this.mOssFrameQueue == null) {
this.mOssFrameQueue = new Oss2FileQueue();
}
if (this.mOssDLFile == null) {
this.mOssDLFile = new HiChipDefines.HI_Oss_DownLoad2File();
}
if (this.mhiConfig == null) {
this.mhiConfig = new HiConfig();
}
if (str != null) {
this.mhiConfig.setOSS_UUID(str);
} else {
this.mhiConfig.setOSS_UUID("BBBB-000000-CDEFG");
}
if (this.mhiCloudsdk == null) {
this.mhiCloudsdk = new HiCloudSDK();
}
if (this.mhiCloud == null) {
this.mhiCloud = new HiCloud();
}
HiLog.e("", 1, 0);
SetCallResult(context);
}
public boolean GetOSSisInfo() {
HiCloud hiCloud = this.mhiCloud;
return (hiCloud == null || hiCloud.mOSS == null) ? false : true;
}
public void GetOSSInfo(String str, String str2, int i) {
this.isOSSFile = true;
this.SaveOssLoad = 0;
this.OSSLoadFin = false;
this.isPlayossEnd = false;
this.isOssreadHead_end = false;
this.saveOssLoadLen = 0;
this.mOssLoadEn = 0;
this.mOssLoadSt = 0;
this.mOssFilesize = 0;
this.isPlayStop = false;
this.mhiCloudname = str;
this.mhiCloudpwd = str2;
this.mIsOCloud = false;
HiCloud hiCloud = this.mhiCloud;
if (hiCloud != null && hiCloud.mOSS != null) {
HiLog.e("", 1, 1);
return;
}
if (1 == i) {
this.mhiCloudSer = "39.98.69.40";
this.mhiCloudport = 33201;
this.mhiCloudKey = "701-jpzh";
HiLog.e(this.mhiConfig.getOSS_UUID() + "::" + this.mhiConfig.getOSSServer() + ":::" + this.mhiConfig.getOssport() + "::::" + this.mhiConfig.getAeskey(), 1, 0);
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
return;
}
this.mhiCloudsdk.HiCloudSDKgetmanageinfo(this, 1, this.mhiConfig.getOSS_UUID());
}
public void GetOSSInfoOCloud(String str, String str2, String str3, int i, int i2, int i3) {
this.isOSSFile = true;
this.SaveOssLoad = 0;
this.OSSLoadFin = false;
this.isPlayossEnd = false;
this.isOssreadHead_end = false;
this.saveOssLoadLen = 0;
this.mOssLoadEn = 0;
this.mOssLoadSt = 0;
this.mOssFilesize = 0;
this.isPlayStop = false;
this.mhiCloudname = str;
this.mhiCloudpwd = str2;
Timer timer = this.mUidEXIPREtimer;
if (timer != null) {
timer.cancel();
}
this.mUidEXIPREtimer = null;
HiCloud hiCloud = this.mhiCloud;
if (hiCloud != null && hiCloud.mOSS != null) {
HiLog.e("", 1, 1);
return;
}
if (1 != i2) {
this.mhiCloudsdk.HiCloudSDKgetmanageinfo(this, 1, this.mhiConfig.getOSS_UUID());
return;
}
if (i3 > 0) {
this.mIsOCloud = true;
if (str3 != null && !TextUtils.isEmpty(str3)) {
this.mhiCloudSer = str3;
} else {
this.mhiCloudSer = "8.209.77.99";
}
if (i > 0) {
this.mhiCloudport = i;
} else {
this.mhiCloudport = 33375;
}
this.mhiCloudKey = "";
HiLog.e(this.mhiConfig.getOSS_UUID() + "::" + this.mhiConfig.getOSSServer() + ":::" + this.mhiConfig.getOssport() + "::::" + this.mhiConfig.getAeskey(), 1, 0);
this.mhiCloudsdk.HiCloudSDKgetOCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
return;
}
this.mIsOCloud = false;
if (str3 != null && !TextUtils.isEmpty(str3)) {
this.mhiCloudSer = str3;
} else {
this.mhiCloudSer = "39.98.69.40";
}
if (i > 0) {
this.mhiCloudport = i;
} else {
this.mhiCloudport = 33201;
}
this.mhiCloudKey = "701-jpzh";
HiLog.e(this.mhiConfig.getOSS_UUID() + "::" + this.mhiConfig.getOSSServer() + ":::" + this.mhiConfig.getOssport() + "::::" + this.mhiConfig.getAeskey(), 1, 0);
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
}
public void SetOSSOCloudDate(String str, String str2, boolean z) {
this.mIsOCloud = z;
this.mOCloudDate = str2;
this.mOCloudUid = str;
}
private void ParseTimeList(byte[] bArr, int i, int i2) {
if (i <= 0) {
setOSSData(3, new byte[0], 0, 0, 0, 0, 0, -1);
}
int i3 = i / 12;
HiLog.e("" + i + ":::::" + i3, 1, 0);
byte[] bArr2 = new byte[12];
byte[] bArr3 = new byte[8];
byte b = -1;
if (i3 > 0) {
int i4 = 0;
while (i4 < i3) {
System.arraycopy(bArr, i4 * 12, bArr2, 0, 12);
System.arraycopy(bArr2, 0, bArr3, 0, 8);
byte b2 = bArr2[9];
HiLog.e("" + i4 + ":::::::" + new String(bArr2) + "::::" + ((int) b2), 1, 0);
setOSSData(3, bArr3, 0, b2, 0, 0, 0, 1);
i4++;
bArr3 = bArr3;
b = b2;
}
}
byte[] bArr4 = bArr3;
byte b3 = b;
if (2 == i2) {
setOSSData(3, bArr4, 0, b3, 0, 0, 0, 2);
}
}
public void parserecdata(byte[] bArr, int i) {
HiLog.e(";;;;;" + i + "::" + new String(bArr), 1, 0);
if (i == 1) {
byte[] bArr2 = new byte[128];
System.arraycopy(bArr, 0, bArr2, 0, 128);
this.mOssFilesize = Packet.byteArrayToInt_Little(bArr, 128);
int byteArrayToInt_Little = Packet.byteArrayToInt_Little(bArr, 132);
int byteArrayToInt_Little2 = Packet.byteArrayToInt_Little(bArr, 136);
int byteArrayToInt_Little3 = Packet.byteArrayToInt_Little(bArr, 140);
int byteArrayToInt_Little4 = Packet.byteArrayToInt_Little(bArr, 144);
HiLog.e("u32FileSize:" + this.mOssFilesize + "RecType" + byteArrayToInt_Little + "u32StartTime" + byteArrayToInt_Little2 + "u32EndTime" + byteArrayToInt_Little3 + "u32Resv" + byteArrayToInt_Little4, 1, 0);
setOSSData(1, bArr2, this.mOssFilesize, byteArrayToInt_Little, byteArrayToInt_Little2, byteArrayToInt_Little3, byteArrayToInt_Little4, 0);
return;
}
if (i != 2) {
return;
}
int i2 = 4;
int byteArrayToInt_Little5 = Packet.byteArrayToInt_Little(bArr, 4);
int byteArrayToInt_Little6 = Packet.byteArrayToInt_Little(bArr, 8);
int byteArrayToInt_Little7 = Packet.byteArrayToInt_Little(bArr, 12);
int byteArrayToInt_Little8 = Packet.byteArrayToInt_Little(bArr, 0);
int byteArrayToInt_Little9 = Packet.byteArrayToInt_Little(bArr, 16);
if (byteArrayToInt_Little8 == 1414944840) {
i2 = 5;
}
int i3 = i2;
setOSSData(2, new byte[1], byteArrayToInt_Little5, byteArrayToInt_Little6, i3, byteArrayToInt_Little7, byteArrayToInt_Little9, 0);
HiLog.e("" + i3 + ":::" + byteArrayToInt_Little5 + ":::" + byteArrayToInt_Little6 + ":::" + byteArrayToInt_Little7 + ":::" + byteArrayToInt_Little9, 1, 0);
PlayLocalFile.HiH264WriteOSS(this.osswrite_readhandle[0], bArr, 20, 0);
}
public void GetOSSFileTime(int i, int i2) {
String replaceAll;
this.mstartrecvdata = 0;
if (i != 0) {
this.mcumCounttry = 0;
}
HiLog.e(i + "::::" + System.currentTimeMillis() + ":::::" + System.nanoTime(), 1, 0);
if (System.currentTimeMillis() - this.mSaveOssGetTime > ((this.mosstokentime * 60) * 1000) - this.mSetOsstime) {
if (this.mIsOCloud) {
Timer timer = this.mUidEXIPREtimer;
if (timer != null) {
timer.cancel();
}
this.mUidEXIPREtimer = null;
this.mhiCloudsdk.HiCloudSDKgetOCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
} else {
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
}
this.mOssOperation = 1;
return;
}
HiConfig hiConfig = this.mhiConfig;
if (hiConfig != null) {
hiConfig.setOSS_objectKey(this.mhiConfig.getOSS_UUID() + "/recdate.db");
if (this.mIsOCloud) {
int indexOf = this.mhiConfig.getOSS_objectKey().indexOf(Const.Config.DB_NAME_SUFFIX);
String bucket_name = this.mhiConfig.getBUCKET_NAME();
HiLog.e(indexOf + ":::" + bucket_name, 1, 0);
if (indexOf > 0) {
replaceAll = bucket_name.replaceAll("-rec", "-db");
} else {
replaceAll = bucket_name.replaceAll("-db", "-rec");
}
this.mhiConfig.setBUCKET_NAME(replaceAll);
}
HiLog.e(this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
ThreadOSSDownFileTime threadOSSDownFileTime = this.mthreadOSSDownFileTime;
if (threadOSSDownFileTime != null) {
threadOSSDownFileTime.weakup();
this.mthreadOSSDownFileTime.stopThread();
this.mthreadOSSDownFileTime = null;
}
if (this.mthreadOSSDownFileTime == null) {
ThreadOSSDownFileTime threadOSSDownFileTime2 = new ThreadOSSDownFileTime();
this.mthreadOSSDownFileTime = threadOSSDownFileTime2;
if (i != 0 && i2 != 0) {
threadOSSDownFileTime2.SetNeedLen(i2);
}
this.mthreadOSSDownFileTime.startThread();
}
}
}
public void GetOSSFileList(String str, int i, int i2) {
String replaceAll;
HiLog.e("" + i, 1, 0);
this.mstartrecvdata = 0;
if (i != 0) {
this.mcumCounttry = 0;
}
if (this.mhiConfig != null) {
HiLog.e("" + str + "::::" + this.isPlayStop, 1, 0);
if (i != 0) {
if (str != null) {
this.mhiConfig.setOSS_objectKey(this.mhiConfig.getOSS_UUID() + "/" + str + "/recdata.db");
} else {
this.mhiConfig.setOSS_objectKey("BBBB-000000-CDEFG/20190729/recdata.db");
}
}
if (this.mIsOCloud) {
int indexOf = this.mhiConfig.getOSS_objectKey().indexOf(Const.Config.DB_NAME_SUFFIX);
String bucket_name = this.mhiConfig.getBUCKET_NAME();
HiLog.e(indexOf + ":::" + bucket_name, 1, 0);
if (indexOf > 0) {
replaceAll = bucket_name.replaceAll("-rec", "-db");
} else {
replaceAll = bucket_name.replaceAll("-db", "-rec");
}
this.mhiConfig.setBUCKET_NAME(replaceAll);
}
HiLog.e(this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_objectKey(), 1, 0);
if (System.currentTimeMillis() - this.mSaveOssGetTime > ((this.mosstokentime * 60) * 1000) - this.mSetOsstime) {
if (this.mIsOCloud) {
Timer timer = this.mUidEXIPREtimer;
if (timer != null) {
timer.cancel();
}
this.mUidEXIPREtimer = null;
this.mhiCloudsdk.HiCloudSDKgetOCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
} else {
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
}
this.mOssOperation = 2;
return;
}
ThreadOSSDownFileList threadOSSDownFileList = this.mthreadOSSDownFileList;
if (threadOSSDownFileList != null) {
threadOSSDownFileList.weakup();
this.mthreadOSSDownFileList.stopThread();
this.mthreadOSSDownFileList = null;
}
if (this.mthreadOSSDownFileList == null) {
ThreadOSSDownFileList threadOSSDownFileList2 = new ThreadOSSDownFileList();
this.mthreadOSSDownFileList = threadOSSDownFileList2;
if (i != 0 && i2 != 0) {
threadOSSDownFileList2.SetNeedLen(i2);
}
this.mthreadOSSDownFileList.startThread();
}
}
}
public void OSSPlayDown(String str, String str2, String str3, int i, int i2) {
String replaceAll;
HiLog.e("" + i2 + "dddd" + str + "dddd" + str2 + "dddd" + str3 + "dddd" + i + "::::" + this.mOssThreadExit, 1, 0);
if (i2 != 0) {
this.mcumCounttry = 0;
}
if (this.mhiConfig != null) {
if (i2 != 0) {
if (!this.Savedownload_file.equals(str)) {
this.mOssFrameQueue.removeAll();
this.Savedownload_file = str;
}
this.mOssFilesize = i;
this.localfilepathoss = str2 + str3;
this.mhiConfig.setOSS_objectKey(str);
}
if (this.mIsOCloud) {
int indexOf = this.mhiConfig.getOSS_objectKey().indexOf(Const.Config.DB_NAME_SUFFIX);
String bucket_name = this.mhiConfig.getBUCKET_NAME();
HiLog.e(indexOf + ":::" + bucket_name, 1, 0);
if (indexOf > 0) {
replaceAll = bucket_name.replaceAll("-rec", "-db");
} else {
replaceAll = bucket_name.replaceAll("-db", "-rec");
}
this.mhiConfig.setBUCKET_NAME(replaceAll);
}
ThreadManageOSS threadManageOSS = this.mthreadmanageoss;
if (threadManageOSS != null) {
this.mOssThreadExit = false;
threadManageOSS.weakup();
this.mthreadmanageoss.stopThread();
this.mthreadmanageoss = null;
}
if (this.mthreadmanageoss == null) {
ThreadManageOSS threadManageOSS2 = new ThreadManageOSS();
this.mthreadmanageoss = threadManageOSS2;
threadManageOSS2.startThread();
}
}
}
public int StartOSSDownCustomFile(String str, int i, int i2) {
String replaceAll;
HiLog.e("" + i2, 1, 0);
if (i2 != 0) {
this.mcumCounttry = 0;
}
if (str == null) {
HiLog.e("", 1, 1);
return -1;
}
if (this.mhiConfig != null) {
HiLog.e("" + str + "::::" + this.isPlayStop, 1, 0);
if (i2 != 0) {
this.mhiConfig.setOSS_objectKey(str);
}
if (this.mIsOCloud) {
int indexOf = this.mhiConfig.getOSS_objectKey().indexOf(Const.Config.DB_NAME_SUFFIX);
String bucket_name = this.mhiConfig.getBUCKET_NAME();
HiLog.e(indexOf + ":::" + bucket_name, 1, 0);
if (indexOf > 0) {
replaceAll = bucket_name.replaceAll("-rec", "-db");
} else {
replaceAll = bucket_name.replaceAll("-db", "-rec");
}
this.mhiConfig.setBUCKET_NAME(replaceAll);
}
HiLog.e(this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
if (System.currentTimeMillis() - this.mSaveOssGetTime > ((this.mosstokentime * 60) * 1000) - this.mSetOsstime) {
if (this.mIsOCloud) {
Timer timer = this.mUidEXIPREtimer;
if (timer != null) {
timer.cancel();
}
this.mUidEXIPREtimer = null;
this.mhiCloudsdk.HiCloudSDKgetOCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
} else {
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
}
this.mOssOperation = 4;
} else {
ThreadOSSDownCustom threadOSSDownCustom = this.mthreadOSSDownCustomFile;
if (threadOSSDownCustom != null) {
threadOSSDownCustom.weakup();
this.mthreadOSSDownCustomFile.stopThread();
this.mthreadOSSDownCustomFile = null;
}
if (this.mthreadOSSDownCustomFile == null) {
ThreadOSSDownCustom threadOSSDownCustom2 = new ThreadOSSDownCustom();
this.mthreadOSSDownCustomFile = threadOSSDownCustom2;
if (i2 != 0 && i != 0) {
threadOSSDownCustom2.SetNeedLen(i);
}
this.mthreadOSSDownCustomFile.startThread();
}
}
return 0;
}
HiLog.e("", 1, 1);
return -2;
}
public void StopOSSDownCustomFile() {
this.isPlayStop = true;
ThreadOSSDownCustom threadOSSDownCustom = this.mthreadOSSDownCustomFile;
if (threadOSSDownCustom != null) {
threadOSSDownCustom.weakup();
this.mthreadOSSDownCustomFile.stopThread();
this.mthreadOSSDownCustomFile = null;
}
}
public void setOSSData(int i, byte[] bArr, int i2, int i3, int i4, int i5, int i6, int i7) {
PlayOSSFileCallback playOSSFileCallback = this.mplayOSSfilecallback;
if (playOSSFileCallback != null) {
playOSSFileCallback.callbackOSSData(i, bArr, i2, i3, i4, i5, i6, i7, this.mhiConfig.getOSS_objectKey());
}
}
public void setOSSReq(String str, int i, int i2, int i3) {
PlayOSSFileCallback playOSSFileCallback = this.mplayOSSfilecallback;
if (playOSSFileCallback != null) {
playOSSFileCallback.callbackOSSReq(str, i, i2, i3, this.mhiConfig.getOSS_objectKey());
}
}
public void setOSSOCloudReq(String str, int i, int i2, int i3, int i4) {
PlayOSSFileCallback playOSSFileCallback = this.mplayOSSfilecallback;
if (playOSSFileCallback != null) {
playOSSFileCallback.callbackOSSOCloudReq(str, i, i2, i3, i4, this.mhiConfig.getOSS_objectKey());
}
}
public void setOSSDownLoad(int i, int i2, int i3) {
PlayOSSFileCallback playOSSFileCallback = this.mplayOSSfilecallback;
if (playOSSFileCallback != null) {
playOSSFileCallback.CallBackOSSDownLoad(i, i2, i3, this.mhiConfig.getOSS_objectKey());
}
}
public void setOSSDownLoadProgres(int i, long j, long j2) {
PlayOSSFileCallback playOSSFileCallback = this.mplayOSSfilecallback;
if (playOSSFileCallback != null) {
playOSSFileCallback.CallBackOSSDownLoadExt(i, j, j2, this.mhiConfig.getOSS_objectKey());
}
}
private void setplaylocal(int i, int i2, int i3, int i4, long j, int i5, int i6) {
PlayOSSFileCallback playOSSFileCallback = this.mplayOSSfilecallback;
if (playOSSFileCallback != null) {
playOSSFileCallback.callbackplayDuallocalExt(i, i2, i3, i4, this.saveFirstTime, j, i5, i6, this.mSaveFilepath);
}
}
public void setLiveShowMonitor(HiGLMonitor hiGLMonitor, HiGLMonitor hiGLMonitor2) {
byte[] bArr;
HiGLMonitor hiGLMonitor3;
byte[] bArr2;
if (hiGLMonitor == null || hiGLMonitor2 == null) {
HiLog.e("", 1, 1);
return;
}
this.mMonitorview = hiGLMonitor;
this.mMonitor2view = hiGLMonitor2;
if (this.mThreadDecodeVideoCloud != null && (bArr2 = this.yuvBuffer) != null && hiGLMonitor != null) {
hiGLMonitor.setYuvFrameData(bArr2, this.videowidth, this.videoheight);
}
if (this.mThreadDecode2VideoCloud != null && (bArr = this.yuv2Buffer) != null && (hiGLMonitor3 = this.mMonitor2view) != null) {
hiGLMonitor3.setYuvFrameData(bArr, this.videowidth, this.videoheight);
}
HiLog.e("setLiveShowMonitor" + hiGLMonitor.getWidth() + Constants.COLON_SEPARATOR + hiGLMonitor.getHeight() + hiGLMonitor2.getWidth() + Constants.COLON_SEPARATOR + hiGLMonitor2.getHeight(), 1, 0);
}
public void setLiveShowMonitor(HiGLMonitor hiGLMonitor, HiGLMonitor hiGLMonitor2, HiGLMonitor hiGLMonitor3) {
byte[] bArr;
HiGLMonitor hiGLMonitor4;
HiGLMonitor hiGLMonitor5;
if (hiGLMonitor == null || hiGLMonitor2 == null || hiGLMonitor3 == null) {
HiLog.e("", 1, 1);
return;
}
this.isDualThrid = true;
this.mMonitorview = hiGLMonitor;
this.mMonitor2view = hiGLMonitor2;
this.mMonitor3view = hiGLMonitor3;
HiLog.e("setLiveShowMonitor" + this.isPlayEnd + Constants.COLON_SEPARATOR + this.mThreadDecodeVideoCloud + "::" + this.mThreadDecode2VideoCloud + "::" + this.mMonitorview + "::" + this.mMonitor2view);
if (this.mThreadDecodeVideoCloud != null && this.yuvBuffer != null && (hiGLMonitor5 = this.mMonitorview) != null) {
byte[] bArr2 = this.yuvBuffer2;
if (bArr2 != null) {
hiGLMonitor5.setYuvFrameData(bArr2, this.mCutw, this.mCuth);
}
byte[] bArr3 = this.yuvBuffer3;
if (bArr3 != null) {
this.mMonitor3view.setYuvFrameData(bArr3, this.mCutw, this.mCuth);
}
}
if (this.mThreadDecode2VideoCloud != null && (bArr = this.yuv2Buffer) != null && (hiGLMonitor4 = this.mMonitor2view) != null) {
hiGLMonitor4.setYuvFrameData(bArr, this.videowidth, this.videoheight);
}
HiLog.e("setLiveShowMonitor" + hiGLMonitor.getWidth() + Constants.COLON_SEPARATOR + hiGLMonitor.getHeight() + hiGLMonitor2.getWidth() + Constants.COLON_SEPARATOR + hiGLMonitor2.getHeight(), 1, 0);
}
public void setMonitorNull() {
if (this.mMonitorview != null) {
this.mMonitorview = null;
}
if (this.mMonitor2view != null) {
this.mMonitor2view = null;
}
if (this.mMonitor3view != null) {
this.mMonitor3view = null;
}
}
public void setLiveShowNum(int i) {
if (this.mShownum != i) {
this.mShownum = i;
}
}
public void setSwtichDualCH(int i) {
int i2;
ThreadPlayLocal threadPlayLocal = this.threadPlayLocal;
if (threadPlayLocal == null || (i2 = this.msaveDualvalue) == i) {
return;
}
if (i == 0) {
if (1 == i2) {
threadPlayLocal.miswaitIFCh2 = true;
FrameQueue frameQueue = this.mossVideo2FrameQueue;
if (frameQueue != null) {
frameQueue.removeAll_New();
}
} else if (2 == i2) {
threadPlayLocal.miswaitIFCh1 = true;
FrameQueue frameQueue2 = this.mossVideoFrameQueue;
if (frameQueue2 != null) {
frameQueue2.removeAll_New();
}
}
} else if (1 == i) {
if (2 == i2) {
threadPlayLocal.miswaitIFCh1 = true;
FrameQueue frameQueue3 = this.mossVideoFrameQueue;
if (frameQueue3 != null) {
frameQueue3.removeAll_New();
}
}
} else if (2 == i && 1 == i2) {
threadPlayLocal.miswaitIFCh2 = true;
FrameQueue frameQueue4 = this.mossVideo2FrameQueue;
if (frameQueue4 != null) {
frameQueue4.removeAll_New();
}
}
this.msaveDualvalue = i;
}
public int Start2Mp4(String str, String str2, String str3) {
HiLog.e("" + str, 1, 0);
if (this.isOpenFile) {
HiLog.e("", 1, 1);
return -1;
}
this.mOssDownEnd = false;
this.isOpenFile = true;
this.savespeed = 0;
this.saveInterval = 50;
this.isPlaying = true;
this.saveflag = 0;
this.isSeek = false;
this.isSpeed = false;
this.isPlayEnd = false;
this.SaveisSeek = false;
this.SaveSeekTime = 0;
this.is2Mp4 = true;
this.isSeekend = false;
this.isPlayStop = false;
this.isLoading_FLAG = false;
this.mSaveFilepath = str;
this.isqueueenpty = false;
String substring = str.substring(str.length() - 4, str.length());
HiLog.e("" + str, 1, 0);
if (substring.equals(".avi")) {
this.video_type = this.VIDEO_TYPE_AVI;
int Playlocal_OpenAVI = Playlocal_OpenAVI(str);
if (Playlocal_OpenAVI != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenAVI;
}
} else {
if (substring.equals(".mp4")) {
this.video_type = this.VIDEO_TYPE_MP4;
return -1;
}
if (str.contains(".ch26x")) {
this.OSSLoadFin = true;
this.isOSSFile = true;
}
if (this.OSSLoadFin) {
this.mOssDownEnd = true;
}
this.video_type = this.VIDEO_TYPE_H264;
int Playlocal_OpenH264 = Playlocal_OpenH264(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
}
long[] jArr = this.mp4_handle;
jArr[0] = 0;
int HIEncMp4init = EncMp4.HIEncMp4init(jArr, this.videowidth, this.videoheight, str2, 0);
if (HIEncMp4init != 0) {
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, 0L, 0, -11);
Stop2Mp4();
HiLog.e("", 1, 1);
return HIEncMp4init;
}
long[] jArr2 = this.mp4_2handle;
jArr2[0] = 0;
int HIEncMp4init2 = EncMp4.HIEncMp4init(jArr2, this.videowidth, this.videoheight, str3, 0);
if (HIEncMp4init2 != 0) {
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, 0L, 0, -11);
Stop2Mp4();
HiLog.e("", 1, 1);
return HIEncMp4init2;
}
HiLog.e("", 1, 0);
this.saveFirstTime = GetOSSFileFirstTime();
startThread();
return HIEncMp4init2;
}
public int Stop2Mp4() {
this.isOpenFile = false;
this.isPlayStop = true;
stopThread();
ThreadOSSDown threadOSSDown = this.mthreadOSSDowndata;
if (threadOSSDown != null) {
threadOSSDown.weakup();
this.mthreadOSSDowndata.stopThread();
this.mthreadOSSDowndata = null;
}
HiLog.e("", 1, 0);
this.video_type = -1;
return 0;
}
public long GetOSSFileFirstTime() {
long[] jArr = new long[4];
PlayLocalFile.HiH264FindIFrameOSS(this.ossread_readhandle[0], -1, jArr);
return jArr[2];
}
public int GetFileTime(String str) {
if (this.isOpenFile) {
HiLog.e("", 1, 1);
return -1;
}
this.isOpenFile = true;
HiLog.e("" + str, 1, 0);
int[] iArr = new int[10];
iArr[4] = -1;
String substring = str.substring(str.length() - 4, str.length());
if (substring.equals(".avi")) {
this.video_type = this.VIDEO_TYPE_AVI;
long[] jArr = this.avi_readhandle;
jArr[0] = 0;
int HiAVICreateReader = PlayLocalFile.HiAVICreateReader(jArr, str);
if (HiAVICreateReader != 0) {
HiLog.e("", 1, 1);
return HiAVICreateReader;
}
int HiAVIGetInfo = PlayLocalFile.HiAVIGetInfo(str, iArr);
PlayLocalFile.HiAVIDestroyReader(this.avi_readhandle[0]);
if (HiAVIGetInfo != 0) {
this.isOpenFile = false;
HiLog.e("", 1, 1);
return HiAVIGetInfo;
}
} else if (substring.equals(".mp4")) {
this.video_type = this.VIDEO_TYPE_MP4;
long[] jArr2 = this.mp4_readhandle;
jArr2[0] = 0;
int HIEncMp4CreateReader2 = EncMp4.HIEncMp4CreateReader2(jArr2, str, iArr);
EncMp4.HIEncMp4DestroyReader2(this.mp4_readhandle[0]);
if (HIEncMp4CreateReader2 != 0) {
this.isOpenFile = false;
return HIEncMp4CreateReader2;
}
} else {
this.video_type = this.VIDEO_TYPE_H264;
long[] jArr3 = this.ossread_readhandle;
jArr3[0] = 0;
int HiH264CreateReaderOSS = PlayLocalFile.HiH264CreateReaderOSS(jArr3, str);
if (HiH264CreateReaderOSS != 0) {
this.isOpenFile = false;
HiLog.e("", 1, 1);
return HiH264CreateReaderOSS;
}
int HiH264GetInfoOSSExt = PlayLocalFile.HiH264GetInfoOSSExt(str, iArr);
PlayLocalFile.HiH264DestroyReaderOSS(this.ossread_readhandle[0]);
if (HiH264GetInfoOSSExt != 0) {
this.isOpenFile = false;
HiLog.e("", 1, 1);
return HiH264GetInfoOSSExt;
}
}
this.videowidth = iArr[0];
this.videoheight = iArr[1];
if (substring.equals(".mp4")) {
this.filetime = iArr[2] / 1000;
} else {
this.filetime = iArr[2];
}
this.audiotype = iArr[4];
if (iArr[3] != 0) {
this.s32SecPerFrame = 1000 / iArr[3];
} else {
this.s32SecPerFrame = 1000;
}
HiLog.e("" + this.videowidth + ":::" + this.videoheight + ":::" + this.filetime + ":::" + iArr[3] + ":::" + this.audiotype + ":::" + iArr[5], 1, 0);
this.isOpenFile = false;
return this.filetime;
}
public int StartPlayLocal(String str) {
int Playlocal_OpenH264;
if (this.isOpenFile) {
HiLog.e("", 1, 1);
return -1;
}
this.mShownum = 0;
this.mOssDownEnd = false;
this.isOpenFile = true;
this.savespeed = 0;
this.saveInterval = 50;
this.isPlaying = true;
this.saveflag = 0;
this.isSeek = false;
this.isSpeed = false;
this.isPlayEnd = false;
this.SaveisSeek = false;
this.SaveSeekTime = 0;
this.is2Mp4 = false;
this.isSeekend = false;
this.isPlayStop = false;
this.mSaveFilepath = str;
this.subtime = 0;
this.mFirstTime = 0;
this.OSSLoadFin = false;
this.isqueueenpty = false;
HiLog.e(this.isOSSFile + "::::" + str, 1, 0);
String substring = str.substring(str.length() + (-4), str.length());
if (substring.equals(".avi")) {
this.video_type = this.VIDEO_TYPE_AVI;
Playlocal_OpenH264 = Playlocal_OpenAVI(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else if (substring.equals(".mp4")) {
this.video_type = this.VIDEO_TYPE_MP4;
Playlocal_OpenH264 = Playlocal_OpenMp4(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else {
if (str.contains(".ch26x")) {
this.OSSLoadFin = true;
this.isOSSFile = true;
}
if (this.OSSLoadFin) {
this.mOssDownEnd = true;
}
this.video_type = this.VIDEO_TYPE_H264;
Playlocal_OpenH264 = Playlocal_OpenH264(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
}
HiLog.e("" + this.video_type, 1, 0);
this.saveFirstTime = GetOSSFileFirstTime();
startThread();
return Playlocal_OpenH264;
}
public int StartPlayLocalExt(String str, int i) {
int Playlocal_OpenH264;
if (this.isOpenFile) {
HiLog.e("", 1, 1);
return -1;
}
this.mShownum = 0;
this.mOssDownEnd = false;
this.isOpenFile = true;
this.savespeed = 0;
this.saveInterval = 50;
this.isPlaying = true;
this.saveflag = 0;
this.isSeek = false;
this.isSpeed = false;
this.isPlayEnd = false;
this.SaveisSeek = false;
this.SaveSeekTime = 0;
this.is2Mp4 = false;
this.isSeekend = false;
this.isPlayStop = false;
this.mSaveFilepath = str;
this.subtime = 0;
this.OSSLoadFin = false;
this.isqueueenpty = false;
if (i <= 0) {
this.mFirstTime = 0;
} else {
this.mFirstTime = i;
}
HiLog.e(this.isOSSFile + "::::" + str, 1, 0);
String substring = str.substring(str.length() + (-4), str.length());
if (substring.equals(".avi")) {
this.video_type = this.VIDEO_TYPE_AVI;
Playlocal_OpenH264 = Playlocal_OpenAVI(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else if (substring.equals(".mp4")) {
this.video_type = this.VIDEO_TYPE_MP4;
Playlocal_OpenH264 = Playlocal_OpenMp4(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else {
if (str.contains(".ch26x")) {
this.OSSLoadFin = true;
this.isOSSFile = true;
}
if (this.OSSLoadFin) {
this.mOssDownEnd = true;
}
this.video_type = this.VIDEO_TYPE_H264;
Playlocal_OpenH264 = Playlocal_OpenH264(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
}
HiLog.e("" + this.video_type, 1, 0);
this.saveFirstTime = GetOSSFileFirstTime();
startThread();
return Playlocal_OpenH264;
}
public int StartPlayLocalTime(String str, int i) {
int Playlocal_OpenH264;
if (this.isOpenFile) {
HiLog.e("", 1, 1);
return -1;
}
this.mShownum = 0;
this.mOssDownEnd = false;
this.isOpenFile = true;
this.savespeed = 0;
this.saveInterval = 50;
this.isPlaying = true;
this.saveflag = 0;
this.isSeek = false;
this.isSpeed = false;
this.isPlayEnd = false;
this.SaveisSeek = false;
this.SaveSeekTime = 0;
this.is2Mp4 = false;
this.isSeekend = false;
this.isPlayStop = false;
this.mSaveFilepath = str;
this.isqueueenpty = false;
this.OSSLoadFin = false;
if (i > 0) {
this.SaveSeekTime = i;
this.SaveisSeek = true;
}
HiLog.e(this.isOSSFile + "::::" + str + ":::::" + i, 1, 0);
String substring = str.substring(str.length() + (-4), str.length());
if (substring.equals(".avi")) {
this.video_type = this.VIDEO_TYPE_AVI;
Playlocal_OpenH264 = Playlocal_OpenAVI(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else if (substring.equals(".mp4")) {
this.video_type = this.VIDEO_TYPE_MP4;
Playlocal_OpenH264 = Playlocal_OpenMp4(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else {
if (str.contains(".ch26x")) {
this.OSSLoadFin = true;
this.isOSSFile = true;
}
if (this.OSSLoadFin) {
this.mOssDownEnd = true;
}
this.video_type = this.VIDEO_TYPE_H264;
Playlocal_OpenH264 = Playlocal_OpenH264(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
}
HiLog.e("" + this.video_type, 1, 0);
this.saveFirstTime = GetOSSFileFirstTime();
startThread();
return Playlocal_OpenH264;
}
public int StartPlayLocalTimeExt(String str, int i, int i2) {
int Playlocal_OpenH264;
if (this.isOpenFile) {
HiLog.e("", 1, 1);
return -1;
}
this.mShownum = 0;
this.mOssDownEnd = false;
this.isOpenFile = true;
this.savespeed = 0;
this.saveInterval = 50;
this.isPlaying = true;
this.saveflag = 0;
this.isSeek = false;
this.isSpeed = false;
this.isPlayEnd = false;
this.SaveisSeek = false;
this.SaveSeekTime = 0;
this.is2Mp4 = false;
this.isSeekend = false;
this.isPlayStop = false;
this.isqueueenpty = false;
this.OSSLoadFin = false;
this.mSaveFilepath = str;
if (i > 0) {
this.SaveSeekTime = i;
this.SaveisSeek = true;
}
if (i2 <= 0) {
this.mFirstTime = 0;
} else {
this.mFirstTime = i2;
}
HiLog.e(this.isOSSFile + ":::::" + i + "::::" + str, 1, 0);
String substring = str.substring(str.length() + (-4), str.length());
if (substring.equals(".avi")) {
this.video_type = this.VIDEO_TYPE_AVI;
Playlocal_OpenH264 = Playlocal_OpenAVI(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else if (substring.equals(".mp4")) {
this.video_type = this.VIDEO_TYPE_MP4;
Playlocal_OpenH264 = Playlocal_OpenMp4(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
} else {
if (str.contains(".ch26x")) {
this.OSSLoadFin = true;
this.isOSSFile = true;
}
if (this.OSSLoadFin) {
this.mOssDownEnd = true;
}
this.video_type = this.VIDEO_TYPE_H264;
Playlocal_OpenH264 = Playlocal_OpenH264(str);
if (Playlocal_OpenH264 != 0) {
HiLog.e("", 1, 1);
return Playlocal_OpenH264;
}
}
HiLog.e("" + this.video_type + ":::" + this.isOSSFile + ":::" + this.OSSLoadFin, 1, 0);
this.saveFirstTime = GetOSSFileFirstTime();
startThread();
return Playlocal_OpenH264;
}
public int StopDownOSS() {
String str;
HiLog.e("StopDownOSS", 1, 0);
this.mOssThreadExit = false;
ThreadManageOSS threadManageOSS = this.mthreadmanageoss;
if (threadManageOSS != null) {
threadManageOSS.weakup();
this.mthreadmanageoss.stopThread();
this.mthreadmanageoss = null;
}
ThreadOSSDown threadOSSDown = this.mthreadOSSDowndata;
if (threadOSSDown != null) {
threadOSSDown.weakup();
this.mthreadOSSDowndata.stopThread();
this.mthreadOSSDowndata = null;
}
ThreadOSSDownFileTime threadOSSDownFileTime = this.mthreadOSSDownFileTime;
if (threadOSSDownFileTime != null) {
threadOSSDownFileTime.weakup();
this.mthreadOSSDownFileTime.stopThread();
this.mthreadOSSDownFileTime = null;
}
ThreadOSSDownFileList threadOSSDownFileList = this.mthreadOSSDownFileList;
if (threadOSSDownFileList != null) {
threadOSSDownFileList.weakup();
this.mthreadOSSDownFileList.stopThread();
this.mthreadOSSDownFileList = null;
}
HiLog.e(this.saveOssLoadLen + "::::" + this.mOssFilesize, 1, 0);
if (this.isOSSFile && (str = this.localfilepathoss) != null && this.saveOssLoadLen != this.mOssFilesize) {
delFile(str);
}
return 1;
}
public int StopPlayLocal() {
String str;
HiLog.e("" + this.isOSSFile, 1, 0);
this.mOssDownEnd = false;
this.isOpenFile = false;
this.isPlayStop = true;
stopThread();
HiLog.e("" + this.video_type + ":::" + this.localfilepathoss, 1, 0);
if (this.isOSSFile && (str = this.localfilepathoss) != null && this.saveOssLoadLen == this.mOssFilesize) {
if (str.contains(HiDataValue.OSSFILEEn)) {
String str2 = this.localfilepathoss;
renameFile(str2, str2.replace(HiDataValue.OSSFILEEn, HiDataValue.OSSFILEEnd));
} else {
String str3 = this.localfilepathoss;
renameFile(str3, str3.replace(HiDataValue.OSSFILEEn_HX, HiDataValue.OSSFILEEnd));
}
}
HiLog.e("0", 1, 0);
this.video_type = -1;
this.mossVideoFrameQueue = null;
this.mossVideo2FrameQueue = null;
this.mossAudioFrameQueue = null;
return 0;
}
public Bitmap getSnapshot() {
HiLog.e("saveSnapshot", 1, 0);
ThreadDecodeVideoCloud threadDecodeVideoCloud = this.mThreadDecodeVideoCloud;
if (threadDecodeVideoCloud == null) {
HiLog.e("", 1, 1);
return null;
}
byte[] yuvBuffer = threadDecodeVideoCloud.getYuvBuffer();
if (yuvBuffer == null) {
HiLog.e("", 1, 1);
return null;
}
int i = this.videowidth;
int i2 = this.videoheight;
if (i <= 0 || i2 <= 0 || i > 5000 || i2 > 5000) {
HiLog.e("", 1, 1);
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
byte[] MallocByte = Packet.MallocByte(i * i2 * 3);
if (MallocByte == null) {
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
HiCoderBitmap.YUVToRGB565(yuvBuffer, i, i2, MallocByte);
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
ByteBuffer wrap = ByteBuffer.wrap(MallocByte);
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.RGB_565);
if (wrap != null) {
createBitmap.copyPixelsFromBuffer(wrap);
}
return createBitmap;
}
public Bitmap getSnapshotCut1() {
HiLog.e("saveSnapshot", 1, 0);
ThreadDecodeVideoCloud threadDecodeVideoCloud = this.mThreadDecodeVideoCloud;
if (threadDecodeVideoCloud == null) {
HiLog.e("", 1, 1);
return null;
}
byte[] yuvBuffer2 = threadDecodeVideoCloud.getYuvBuffer2();
if (yuvBuffer2 == null) {
HiLog.e("", 1, 1);
return null;
}
int i = this.mCutw;
int i2 = this.mCuth;
if (i <= 0 || i2 <= 0 || i > 5000 || i2 > 5000) {
HiLog.e("", 1, 1);
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
byte[] MallocByte = Packet.MallocByte(i * i2 * 3);
if (MallocByte == null) {
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
HiCoderBitmap.YUVToRGB565(yuvBuffer2, i, i2, MallocByte);
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
ByteBuffer wrap = ByteBuffer.wrap(MallocByte);
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.RGB_565);
if (wrap != null) {
createBitmap.copyPixelsFromBuffer(wrap);
}
return createBitmap;
}
public Bitmap getSnapshotCut2() {
HiLog.e("saveSnapshot", 1, 0);
ThreadDecodeVideoCloud threadDecodeVideoCloud = this.mThreadDecodeVideoCloud;
if (threadDecodeVideoCloud == null) {
HiLog.e("", 1, 1);
return null;
}
byte[] yuvBuffer3 = threadDecodeVideoCloud.getYuvBuffer3();
if (yuvBuffer3 == null) {
HiLog.e("", 1, 1);
return null;
}
int i = this.mCutw;
int i2 = this.mCuth;
if (i <= 0 || i2 <= 0 || i > 5000 || i2 > 5000) {
HiLog.e("", 1, 1);
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
byte[] MallocByte = Packet.MallocByte(i * i2 * 3);
if (MallocByte == null) {
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
HiCoderBitmap.YUVToRGB565(yuvBuffer3, i, i2, MallocByte);
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
ByteBuffer wrap = ByteBuffer.wrap(MallocByte);
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.RGB_565);
if (wrap != null) {
createBitmap.copyPixelsFromBuffer(wrap);
}
return createBitmap;
}
public Bitmap get2Snapshot() {
HiLog.e("saveSnapshot", 1, 0);
ThreadDecode2VideoCloud threadDecode2VideoCloud = this.mThreadDecode2VideoCloud;
if (threadDecode2VideoCloud == null) {
HiLog.e("", 1, 1);
return null;
}
byte[] yuvBuffer = threadDecode2VideoCloud.getYuvBuffer();
if (yuvBuffer == null) {
HiLog.e("", 1, 1);
return null;
}
int i = this.videowidth;
int i2 = this.videoheight;
if (i <= 0 || i2 <= 0 || i > 5000 || i2 > 5000) {
HiLog.e("", 1, 1);
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
byte[] MallocByte = Packet.MallocByte(i * i2 * 3);
if (MallocByte == null) {
return null;
}
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
HiCoderBitmap.YUVToRGB565(yuvBuffer, i, i2, MallocByte);
HiLog.e("getSnapshot:" + i + "heigth:" + i2, 1, 0);
ByteBuffer wrap = ByteBuffer.wrap(MallocByte);
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.RGB_565);
if (wrap != null) {
createBitmap.copyPixelsFromBuffer(wrap);
}
return createBitmap;
}
private void startThread() {
ThreadPlayLocal threadPlayLocal = this.threadPlayLocal;
if (threadPlayLocal == null) {
ThreadPlayLocal threadPlayLocal2 = new ThreadPlayLocal();
this.threadPlayLocal = threadPlayLocal2;
threadPlayLocal2.startThread();
} else {
threadPlayLocal.isRunning = true;
DoReadOSS264File(this.threadPlayLocal);
}
HiLog.e("", 1, 0);
if (!this.isOSSFile) {
if (this.threadDecodeVideo == null) {
ThreadDecodeVideo threadDecodeVideo = new ThreadDecodeVideo();
this.threadDecodeVideo = threadDecodeVideo;
threadDecodeVideo.startThread();
}
HiLog.e("", 1, 0);
if (this.threadDecodeAudio == null) {
ThreadDecodeAudio threadDecodeAudio = new ThreadDecodeAudio();
this.threadDecodeAudio = threadDecodeAudio;
threadDecodeAudio.startThread();
return;
}
return;
}
startPlaybackThread();
}
private void stopThread() {
HiLog.e("", 1, 0);
ThreadPlayLocal threadPlayLocal = this.threadPlayLocal;
if (threadPlayLocal != null) {
threadPlayLocal.weakup();
this.threadPlayLocal.stopThread();
this.threadPlayLocal = null;
}
if (!this.isOSSFile) {
ThreadDecodeVideo threadDecodeVideo = this.threadDecodeVideo;
if (threadDecodeVideo != null) {
threadDecodeVideo.stopThread();
this.threadDecodeVideo = null;
}
ThreadDecodeAudio threadDecodeAudio = this.threadDecodeAudio;
if (threadDecodeAudio != null) {
threadDecodeAudio.stopThread();
this.threadDecodeAudio = null;
}
} else {
stopPlaybackThread();
}
HiLog.e("", 1, 0);
FrameQueue frameQueue = this.mossVideoFrameQueue;
if (frameQueue != null) {
frameQueue.removeAll();
}
FrameQueue frameQueue2 = this.mossVideo2FrameQueue;
if (frameQueue2 != null) {
frameQueue2.removeAll();
}
HiLog.e("", 1, 0);
FrameQueue frameQueue3 = this.mossAudioFrameQueue;
if (frameQueue3 != null) {
frameQueue3.removeAll();
}
HiLog.e("", 1, 0);
}
private int Playlocal_CloseAVI() {
return PlayLocalFile.HiAVIDestroyReader(this.avi_readhandle[0]);
}
private int Playlocal_OpenH264(String str) {
int[] iArr = new int[10];
long[] jArr = this.ossread_readhandle;
jArr[0] = 0;
int HiH264CreateReaderOSS = PlayLocalFile.HiH264CreateReaderOSS(jArr, str);
if (HiH264CreateReaderOSS != 0) {
HiLog.e("", 1, 1);
return HiH264CreateReaderOSS;
}
int HiH264GetInfoOSSExt = PlayLocalFile.HiH264GetInfoOSSExt(str, iArr);
if (HiH264GetInfoOSSExt != 0) {
HiLog.e("", 1, 1);
return HiH264GetInfoOSSExt;
}
HiLog.e("sWidth:" + iArr[0] + "::sHeight:" + iArr[1] + "::sTime:" + iArr[2] + "::dwRate:" + iArr[3] + "::sAudioType:" + iArr[4] + "::sVideoType:" + iArr[5], 1, 0);
if (!this.is2Mp4) {
setplaylocal(1, iArr[0], iArr[1], iArr[2], 0L, iArr[4], 0);
} else {
setplaylocal(1, iArr[0], iArr[1], iArr[2], 0L, iArr[4], 10);
}
this.videowidth = iArr[0];
this.videoheight = iArr[1];
this.filetime = iArr[2];
this.audiotype = iArr[4];
int i = iArr[5] == 5 ? 5 : 4;
this.videotype = i;
if (5 == i && Build.VERSION.SDK_INT >= 23) {
this.isH265DevDec = true;
}
if (this.mossVideoFrameQueue == null) {
this.mossVideoFrameQueue = new FrameQueue();
}
if (this.mossVideo2FrameQueue == null) {
this.mossVideo2FrameQueue = new FrameQueue();
}
if (this.mossAudioFrameQueue == null) {
this.mossAudioFrameQueue = new FrameQueue();
}
if (this.isOSSFile) {
this.isDisplayFrist = false;
FrameQueue frameQueue = this.mossVideoFrameQueue;
if (frameQueue != null) {
frameQueue.setmSize(100);
}
FrameQueue frameQueue2 = this.mossVideo2FrameQueue;
if (frameQueue2 != null) {
frameQueue2.setmSize(100);
}
FrameQueue frameQueue3 = this.mossAudioFrameQueue;
if (frameQueue3 != null) {
frameQueue3.setmSize(200);
}
}
this.maxlen = HiSystemValue.Max_getbufsize(this.videowidth);
return HiH264GetInfoOSSExt;
}
private int Playlocal_CloseH264() {
return PlayLocalFile.HiH264DestroyReaderOSS(this.ossread_readhandle[0]);
}
private int Playlocal_OpenMp4(String str) {
int[] iArr = new int[10];
long[] jArr = this.mp4_readhandle;
jArr[0] = 0;
int HIEncMp4CreateReader2 = EncMp4.HIEncMp4CreateReader2(jArr, str, iArr);
if (HIEncMp4CreateReader2 != 0) {
HiLog.e("", 1, 1);
return HIEncMp4CreateReader2;
}
HiLog.e("" + iArr[0] + ":::" + iArr[1] + ":::" + iArr[2] + ":::" + iArr[3] + ":::" + iArr[4] + ":::" + iArr[5], 1, 0);
setplaylocal(1, iArr[0], iArr[1], iArr[2] / 1000, 0L, iArr[4], 0);
this.videowidth = iArr[0];
this.videoheight = iArr[1];
this.filetime = iArr[2];
int i = iArr[3] == 5 ? 5 : 4;
this.videotype = i;
if (5 == i && Build.VERSION.SDK_INT >= 23) {
this.isH265DevDec = true;
}
this.mossVideoFrameQueue = new FrameQueue();
this.mossVideo2FrameQueue = new FrameQueue();
this.mossAudioFrameQueue = new FrameQueue();
this.maxlen = HiSystemValue.Max_getbufsize(this.videowidth);
return HIEncMp4CreateReader2;
}
private int Playlocal_CloseMp4() {
return EncMp4.HIEncMp4DestroyReader2(this.mp4_readhandle[0]);
}
public int PlayLocal_Seek(int i, boolean z) {
HiLog.e("::::" + i, 1, 0);
if (this.isSeekend != z) {
FrameQueue frameQueue = this.mossAudioFrameQueue;
if (frameQueue != null) {
frameQueue.removeAll();
}
FrameQueue frameQueue2 = this.mossVideoFrameQueue;
if (frameQueue2 != null) {
frameQueue2.removeAll();
}
FrameQueue frameQueue3 = this.mossVideo2FrameQueue;
if (frameQueue3 != null) {
frameQueue3.removeAll();
}
this.isqueueenpty = true;
}
if (!this.isSeek) {
this.isSeek = z;
}
this.isSeekend = z;
this.SaveisSeek = true;
this.SaveSeekTime = i;
HiLog.e("PlayLocal_Seek:" + i + ":OSSLoadFin:" + this.OSSLoadFin + ":seeking:" + z, 1, 0);
return 0;
}
public void PlayLocal_Speed(int i, int i2) {
HiLog.e("" + i + ":::" + i2 + "::::" + this.savespeed + "::::" + this.subtime, 1, 0);
int i3 = this.savespeed;
if ((i3 == 0 && i > 2) || ((i3 > 0 && i == 0) || (i3 < 3 && i > 2))) {
this.isSpeed = true;
FrameQueue frameQueue = this.mossAudioFrameQueue;
if (frameQueue != null) {
frameQueue.removeAll();
}
FrameQueue frameQueue2 = this.mossVideoFrameQueue;
if (frameQueue2 != null) {
frameQueue2.removeAll();
}
FrameQueue frameQueue3 = this.mossVideo2FrameQueue;
if (frameQueue3 != null) {
frameQueue3.removeAll();
}
PlayLocal_Seek(this.subtime, false);
}
if (i2 != 0) {
this.saveInterval = i2;
}
this.savespeed = i;
}
public void PlayLocal_pause() {
this.isPlaying = false;
}
public void PlayLocal_Resume() {
this.isPlaying = true;
}
public void SetDecodeVideoType(int i) {
this.DecodeVideoType = i;
}
public void SetDecodeViVoVideoType(int i) {
this.DecodeViVoVideoType = i;
}
private void DecodeSleep(HiThread hiThread, int i) {
switch (this.savespeed) {
case 3:
int i2 = this.saveInterval;
if (i2 * 17 > i) {
hiThread.sleep((i2 * 17) - i);
return;
}
return;
case 4:
int i3 = this.saveInterval;
if (i3 * 16 > i) {
hiThread.sleep((i3 * 16) - i);
return;
}
return;
case 5:
int i4 = this.saveInterval;
if (i4 * 15 > i) {
hiThread.sleep((i4 * 15) - i);
return;
}
return;
case 6:
int i5 = this.saveInterval;
if (i5 * 14 > i) {
hiThread.sleep((i5 * 14) - i);
return;
}
return;
case 7:
int i6 = this.saveInterval;
if (i6 * 13 > i) {
hiThread.sleep((i6 * 13) - i);
return;
}
return;
case 8:
int i7 = this.saveInterval;
if (i7 * 12 > i) {
hiThread.sleep((i7 * 12) - i);
return;
}
return;
case 9:
int i8 = this.saveInterval;
if (i8 * 11 > i) {
hiThread.sleep((i8 * 11) - i);
return;
}
return;
case 10:
int i9 = this.saveInterval;
if (i9 * 10 > i) {
hiThread.sleep((i9 * 10) - i);
return;
}
return;
case 11:
int i10 = this.saveInterval;
if (i10 * 9 > i) {
hiThread.sleep((i10 * 9) - i);
return;
}
return;
case 12:
int i11 = this.saveInterval;
if (i11 * 8 > i) {
hiThread.sleep((i11 * 8) - i);
return;
}
return;
case 13:
int i12 = this.saveInterval;
if (i12 * 7 > i) {
hiThread.sleep((i12 * 7) - i);
return;
}
return;
case 14:
int i13 = this.saveInterval;
if (i13 * 6 > i) {
hiThread.sleep((i13 * 6) - i);
return;
}
return;
case 15:
int i14 = this.saveInterval;
if (i14 * 5 > i) {
hiThread.sleep((i14 * 5) - i);
return;
}
return;
case 16:
int i15 = this.saveInterval;
if (i15 * 4 > i) {
hiThread.sleep((i15 * 4) - i);
return;
}
return;
case 17:
int i16 = this.saveInterval;
if (i16 * 3 > i) {
hiThread.sleep((i16 * 3) - i);
return;
}
return;
case 18:
break;
case 19:
int i17 = this.saveInterval;
if (i17 > i) {
hiThread.sleep(i17 - i);
break;
}
break;
case 20:
return;
default:
hiThread.sleep(50);
return;
}
int i18 = this.saveInterval;
if (i18 * 2 > i) {
hiThread.sleep((i18 * 2) - i);
}
}
private void save2Queue(FrameQueue frameQueue, byte[] bArr, byte[] bArr2, int i, int i2, int i3, int i4, int i5, int i6, Boolean bool) {
byte[] parseContent = HiChipDefines.HI_P2P_S_AVFrame.parseContent(i3, i, i4, i5);
System.arraycopy(parseContent, 0, bArr, 0, parseContent.length);
System.arraycopy(bArr2, 0, bArr, parseContent.length, i);
FrameData frameData = new FrameData(bArr, parseContent.length + i);
HiLog.e("" + i + ":::" + i2 + ":::" + i3 + ":::" + i4 + ":::" + i5 + ":::" + bool + ":::" + this.isSeek + ":::" + this.isSpeed);
if (i2 == 1 || i2 == 1180063816) {
if (frameQueue != null && bool.booleanValue() && this.isPlaying) {
boolean z = this.isSeek;
if (!z && !this.isSpeed) {
frameQueue.addLast(frameData);
} else if (z) {
if (i5 == 1) {
frameQueue.addLast(frameData);
this.isSeek = false;
}
} else if (i5 == 1 || (this.isH265DevDec && i6 < 3)) {
this.isSpeed = false;
frameQueue.addLast(frameData);
}
HiLog.e("======== save2Queue=====::3::" + this.isSeek + "::4::" + this.isSpeed + "::5::" + this.savespeed + ":::" + this.mossVideoFrameQueue.getCount() + ":::" + this.mossVideo2FrameQueue.getCount() + "::" + this.mossAudioFrameQueue.getCount() + ":::" + this.isDisplayFrist + "::" + this.isLoading_FLAG);
return;
}
return;
}
if (!this.isSeek && this.savespeed == 0 && this.mossAudioFrameQueue != null && bool.booleanValue() && this.isPlaying) {
this.mossAudioFrameQueue.addLast(frameData);
}
}
public class ThreadPlayLocal extends HiThread {
public boolean miswaitIFCh1;
public boolean miswaitIFCh2;
private ThreadPlayLocal() {
this.miswaitIFCh1 = false;
this.miswaitIFCh2 = false;
}
@Override
public void run() {
if (HiPlayOSSDualSDK.this.video_type != HiPlayOSSDualSDK.this.VIDEO_TYPE_AVI) {
if (HiPlayOSSDualSDK.this.video_type != HiPlayOSSDualSDK.this.VIDEO_TYPE_MP4) {
if (HiPlayOSSDualSDK.this.video_type == HiPlayOSSDualSDK.this.VIDEO_TYPE_H264) {
if (!HiPlayOSSDualSDK.this.isOSSFile) {
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK.DoRead264File(hiPlayOSSDualSDK.threadPlayLocal);
} else {
HiPlayOSSDualSDK hiPlayOSSDualSDK2 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK2.DoReadOSS264File(hiPlayOSSDualSDK2.threadPlayLocal);
}
}
} else {
HiPlayOSSDualSDK hiPlayOSSDualSDK3 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK3.DoReadMp4File(hiPlayOSSDualSDK3.threadPlayLocal);
}
} else {
HiPlayOSSDualSDK hiPlayOSSDualSDK4 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK4.DoReadAVIFile(hiPlayOSSDualSDK4.threadPlayLocal);
}
HiLog.e("======== ThreadPlayLocal end ========", 1, 0);
}
}
public class ThreadDecodeVideo extends HiThread {
private ThreadDecodeVideo() {
}
}
public class ThreadDecodeAudio extends HiThread {
private ThreadDecodeAudio() {
}
}
private void startPlaybackThread() {
this.isDisplayFrist = false;
FrameQueue frameQueue = this.mossVideoFrameQueue;
if (frameQueue != null) {
frameQueue.setmSize(100);
}
FrameQueue frameQueue2 = this.mossVideo2FrameQueue;
if (frameQueue2 != null) {
frameQueue2.setmSize(100);
}
FrameQueue frameQueue3 = this.mossAudioFrameQueue;
if (frameQueue3 != null) {
frameQueue3.setmSize(200);
}
ThreadDecodeAudioCloud threadDecodeAudioCloud = this.mThreadDecodeAudioCloud;
if (threadDecodeAudioCloud == null) {
ThreadDecodeAudioCloud threadDecodeAudioCloud2 = new ThreadDecodeAudioCloud();
this.mThreadDecodeAudioCloud = threadDecodeAudioCloud2;
threadDecodeAudioCloud2.startThread();
} else {
threadDecodeAudioCloud.isRunning = true;
DoDecodeAudio(this.mThreadDecodeAudioCloud);
}
ThreadDecodeVideoCloud threadDecodeVideoCloud = this.mThreadDecodeVideoCloud;
if (threadDecodeVideoCloud == null) {
ThreadDecodeVideoCloud threadDecodeVideoCloud2 = new ThreadDecodeVideoCloud();
this.mThreadDecodeVideoCloud = threadDecodeVideoCloud2;
threadDecodeVideoCloud2.startThread();
} else {
threadDecodeVideoCloud.isRunning = true;
DoDecodeVideo(this.mThreadDecodeVideoCloud);
}
ThreadDecode2VideoCloud threadDecode2VideoCloud = this.mThreadDecode2VideoCloud;
if (threadDecode2VideoCloud == null) {
ThreadDecode2VideoCloud threadDecode2VideoCloud2 = new ThreadDecode2VideoCloud();
this.mThreadDecode2VideoCloud = threadDecode2VideoCloud2;
threadDecode2VideoCloud2.startThread();
} else {
threadDecode2VideoCloud.isRunning = true;
DoDecode2Video(this.mThreadDecode2VideoCloud);
}
}
private void stopPlaybackThread() {
HiLog.e("stopPlaybackThread", 1, 0);
ThreadDecodeVideoCloud threadDecodeVideoCloud = this.mThreadDecodeVideoCloud;
if (threadDecodeVideoCloud != null) {
threadDecodeVideoCloud.weakup();
this.mThreadDecodeVideoCloud.stopThread();
}
ThreadDecode2VideoCloud threadDecode2VideoCloud = this.mThreadDecode2VideoCloud;
if (threadDecode2VideoCloud != null) {
threadDecode2VideoCloud.weakup();
this.mThreadDecode2VideoCloud.stopThread();
}
ThreadDecodeAudioCloud threadDecodeAudioCloud = this.mThreadDecodeAudioCloud;
if (threadDecodeAudioCloud != null) {
threadDecodeAudioCloud.weakup();
this.mThreadDecodeAudioCloud.stopThread();
}
this.mThreadDecodeVideoCloud = null;
this.mThreadDecode2VideoCloud = null;
this.mThreadDecodeAudioCloud = null;
HiLog.e("stopPlaybackThread", 1, 0);
}
private int JudgmentSeek(int i) {
HiLog.e("JudgmentSeek:" + i, 1, 0);
Oss2FileQueue oss2FileQueue = this.mOssFrameQueue;
if (oss2FileQueue != null && oss2FileQueue.getCount() > 0) {
Oss2File Findindexdata = this.mOssFrameQueue.Findindexdata(i, 0);
if (Findindexdata != null) {
if (Findindexdata.head.u32Start <= i && Findindexdata.head.u32End > i) {
this.mOssFrameQueue.removeindexdata(Findindexdata);
this.mOssFrameQueue.addLast(new Oss2File(HiChipDefines.HI_Oss_DownLoad2File.parseContent(Findindexdata.head.u32Start, i)));
} else if (Findindexdata.head.u32Start > i) {
i = Findindexdata.head.u32Start;
}
return i;
}
i = -1;
return i;
}
int i2 = this.SaveOssLoad;
if (i <= i2) {
return -1;
}
this.mOssFrameQueue.addLast(new Oss2File(HiChipDefines.HI_Oss_DownLoad2File.parseContent(i2, i)));
return -1;
}
public class ThreadOSSDownFileTime extends HiThread {
long Firtime;
byte[] bufferrecdb;
int len;
int msgwhat;
int needlen;
int readlen;
long savetime;
private ThreadOSSDownFileTime() {
this.needlen = 10240;
this.bufferrecdb = new byte[10240];
this.len = 0;
this.readlen = 0;
this.Firtime = System.currentTimeMillis();
this.msgwhat = 24832;
}
public void SetNeedLen(int i) {
this.needlen = i;
this.bufferrecdb = new byte[i];
}
@Override
public void run() {
InputStream OSSDownsync = HiPlayOSSDualSDK.this.mhiCloud.OSSDownsync(HiPlayOSSDualSDK.this.mhiConfig, 0, 0, HiPlayOSSDualSDK.this.handler, this.msgwhat);
if (OSSDownsync != null) {
while (this.isRunning) {
try {
int read = OSSDownsync.read(this.bufferrecdb);
this.len = read;
if (read != -1) {
while (HiPlayOSSDualSDK.this.mstartrecvdata != this.msgwhat - 1 && this.isRunning) {
sleep(10);
}
HiLog.e(this.readlen + ":::" + this.needlen + ";;;;;" + this.len + "::" + this.Firtime + "::::" + this.savetime, 1, 0);
HiPlayOSSDualSDK.this.setOSSData(this.msgwhat + 5, this.bufferrecdb, this.len, 0, 0, 0, 0, 1);
} else {
HiLog.e("" + this.readlen, 1, 0);
HiPlayOSSDualSDK.this.setOSSData(this.msgwhat + 5, this.bufferrecdb, this.len, 0, 0, 0, 0, 2);
this.isRunning = false;
return;
}
} catch (IOException e) {
HiLog.e("", 1, 1);
e.printStackTrace();
Message obtain = Message.obtain();
obtain.obj = e;
obtain.what = this.msgwhat + 2;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain);
return;
}
}
return;
}
HiLog.e("", 1, 1);
Message obtain2 = Message.obtain();
obtain2.what = this.msgwhat + 3;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain2);
}
}
public class ThreadOSSDownFileList extends HiThread {
long Firtime;
byte[] bufferrecdb;
int len;
int msgwhat;
int needlen;
int readlen;
long savetime;
private ThreadOSSDownFileList() {
this.needlen = 10240;
this.bufferrecdb = new byte[10240];
this.len = 0;
this.readlen = 0;
this.Firtime = System.currentTimeMillis();
this.msgwhat = 25088;
}
public void SetNeedLen(int i) {
this.needlen = i;
this.bufferrecdb = new byte[i];
}
@Override
public void run() {
InputStream OSSDownsync = HiPlayOSSDualSDK.this.mhiCloud.OSSDownsync(HiPlayOSSDualSDK.this.mhiConfig, 0, 0, HiPlayOSSDualSDK.this.handler, this.msgwhat);
if (OSSDownsync != null) {
while (true) {
try {
if (!this.isRunning) {
break;
}
int read = OSSDownsync.read(this.bufferrecdb);
this.len = read;
if (read != -1) {
while (HiPlayOSSDualSDK.this.mstartrecvdata != this.msgwhat - 1 && this.isRunning) {
sleep(10);
}
HiPlayOSSDualSDK.this.setOSSData(this.msgwhat + 5, this.bufferrecdb, this.len, 0, 0, 0, 0, 1);
HiLog.e(this.readlen + ":::" + this.needlen + ";;;;;" + this.len + "::" + this.Firtime + "::::" + this.savetime, 1, 0);
} else {
HiLog.e("" + HiPlayOSSDualSDK.this.isPlayEnd + "::::" + HiPlayOSSDualSDK.this.isPlayossEnd + "::::" + HiPlayOSSDualSDK.this.isPlayStop, 1, 0);
HiPlayOSSDualSDK.this.setOSSData(this.msgwhat + 5, this.bufferrecdb, this.len, 0, 0, 0, 0, 2);
this.isRunning = false;
break;
}
} catch (IOException e) {
e.printStackTrace();
HiLog.e("" + HiPlayOSSDualSDK.this.isPlayEnd + "::::" + HiPlayOSSDualSDK.this.isPlayossEnd + "::::" + HiPlayOSSDualSDK.this.isPlayStop + "::" + this.isRunning + ":::" + e.getMessage(), 1, 1);
Message obtain = Message.obtain();
obtain.obj = e;
obtain.what = this.msgwhat + 2;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain);
return;
}
}
HiLog.e("" + HiPlayOSSDualSDK.this.isPlayEnd + "::::" + HiPlayOSSDualSDK.this.isPlayossEnd + "::::" + HiPlayOSSDualSDK.this.isPlayStop + "::" + this.isRunning, 1, 0);
return;
}
HiLog.e("", 1, 1);
Message obtain2 = Message.obtain();
obtain2.what = this.msgwhat + 3;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain2);
}
}
public class ThreadOSSDown extends HiThread {
long Firtime;
byte[] buf;
byte[] bufferhxend;
byte[] bufferhxhead;
int len;
int msgwhat;
int needlen;
int readlen;
int ret;
long savetime;
int seek;
private ThreadOSSDown() {
this.len = 0;
this.readlen = 0;
this.seek = 0;
this.needlen = 20;
this.bufferhxend = new byte[10240];
this.bufferhxhead = new byte[20];
this.buf = new byte[20];
this.Firtime = System.currentTimeMillis();
this.savetime = 0L;
this.msgwhat = 25344;
}
@Override
public void run() {
HiLog.e("======== ThreadOSSDown st ========" + HiPlayOSSDualSDK.this.localfilepathoss + "dddd" + HiPlayOSSDualSDK.this.mOssThreadExit, 1, 0);
HiPlayOSSDualSDK.this.mOssThreadExit = true;
HiPlayOSSDualSDK.this.osswrite_readhandle[0] = 0;
this.ret = PlayLocalFile.HiH264CreateWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle, HiPlayOSSDualSDK.this.localfilepathoss);
HiLog.e("HiH264CreateWriteOSS" + this.ret, 1, 0);
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK.setOSSDownLoad(0, hiPlayOSSDualSDK.saveOssLoadLen, HiPlayOSSDualSDK.this.mOssFilesize);
InputStream OSSDownsync = HiPlayOSSDualSDK.this.mhiCloud.OSSDownsync(HiPlayOSSDualSDK.this.mhiConfig, 0, this.needlen + (-1), HiPlayOSSDualSDK.this.handler, this.msgwhat);
if (OSSDownsync != null) {
while (true) {
try {
if (!this.isRunning) {
break;
}
int read = OSSDownsync.read(this.bufferhxhead);
this.len = read;
if (read == -1) {
break;
}
int i = this.readlen;
int i2 = i + read;
int i3 = this.needlen;
if (i2 <= i3) {
System.arraycopy(this.bufferhxhead, 0, this.buf, i, read);
this.readlen += this.len;
} else {
System.arraycopy(this.bufferhxhead, 0, this.buf, i, i3 - i);
HiPlayOSSDualSDK.this.parserecdata(this.buf, 2);
byte[] bArr = this.bufferhxhead;
int i4 = this.needlen;
int i5 = this.readlen;
System.arraycopy(bArr, i4 - i5, this.buf, 0, this.len - (i4 - i5));
this.readlen = this.len - (this.needlen - this.readlen);
}
if (this.readlen == this.needlen) {
HiPlayOSSDualSDK.this.parserecdata(this.buf, 2);
this.readlen = 0;
}
} catch (IOException e) {
HiLog.e("", 1, 1);
e.printStackTrace();
Message obtain = Message.obtain();
obtain.obj = e;
obtain.what = this.msgwhat + 2;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain);
PlayLocalFile.HiH264DestroyWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0]);
return;
}
}
this.seek = (HiPlayOSSDualSDK.this.mOssFilesize - 12288) - 16;
HiLog.e("" + this.seek + "::" + HiPlayOSSDualSDK.this.mOssFilesize, 1, 0);
HiPlayOSSDualSDK hiPlayOSSDualSDK2 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK2.saveOssLoadLen = hiPlayOSSDualSDK2.saveOssLoadLen + 20;
this.msgwhat = 25600;
this.Firtime = System.currentTimeMillis();
InputStream OSSDownsync2 = HiPlayOSSDualSDK.this.mhiCloud.OSSDownsync(HiPlayOSSDualSDK.this.mhiConfig, HiPlayOSSDualSDK.this.mOssFilesize + (-12288) + (-16), HiPlayOSSDualSDK.this.mOssFilesize + (-1), HiPlayOSSDualSDK.this.handler, this.msgwhat);
if (OSSDownsync2 != null) {
while (true) {
try {
if (!this.isRunning) {
break;
}
int read2 = OSSDownsync2.read(this.bufferhxend);
this.len = read2;
if (read2 == -1) {
break;
}
int HiH264WriteOSS = PlayLocalFile.HiH264WriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0], this.bufferhxend, this.len, this.seek);
this.ret = HiH264WriteOSS;
if (HiH264WriteOSS != 0) {
HiLog.e("HiH264WriteOSS error ", 1, 1);
}
if (this.seek != 0) {
this.seek = 0;
}
HiPlayOSSDualSDK.this.saveOssLoadLen += this.len;
HiPlayOSSDualSDK hiPlayOSSDualSDK3 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK3.setOSSDownLoad(1, hiPlayOSSDualSDK3.saveOssLoadLen, HiPlayOSSDualSDK.this.mOssFilesize);
} catch (IOException e2) {
HiLog.e("", 1, 1);
e2.printStackTrace();
Message obtain2 = Message.obtain();
obtain2.obj = e2;
obtain2.what = this.msgwhat + 2;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain2);
PlayLocalFile.HiH264DestroyWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0]);
return;
}
}
if (HiPlayOSSDualSDK.this.saveOssLoadLen == 12324) {
HiPlayOSSDualSDK.this.isOssreadHead_end = true;
}
HiLog.e("下载头尾" + HiPlayOSSDualSDK.this.mOssFilesize + "::" + HiPlayOSSDualSDK.this.mOssLoadEn, 1, 0);
if (HiPlayOSSDualSDK.this.isOssreadHead_end) {
HiPlayOSSDualSDK.this.saveOssLoadLen = 12324;
HiPlayOSSDualSDK.this.mOssLoadEn = ((r0.mOssFilesize - 12288) - 16) - 1;
HiPlayOSSDualSDK.this.mOssLoadSt = 20;
HiPlayOSSDualSDK.this.setOSSData(4, new byte[1], 1, 1, 1, 1, 1, 1);
}
this.seek = 20;
HiPlayOSSDualSDK hiPlayOSSDualSDK4 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK4.SaveOssLoad = hiPlayOSSDualSDK4.mOssLoadSt;
this.msgwhat = 25856;
this.Firtime = System.currentTimeMillis();
InputStream OSSDownsync3 = HiPlayOSSDualSDK.this.mhiCloud.OSSDownsync(HiPlayOSSDualSDK.this.mhiConfig, HiPlayOSSDualSDK.this.mOssLoadSt, HiPlayOSSDualSDK.this.mOssLoadEn, HiPlayOSSDualSDK.this.handler, this.msgwhat);
if (OSSDownsync3 != null) {
while (true) {
try {
if (!this.isRunning) {
break;
}
int read3 = OSSDownsync3.read(this.bufferhxend);
this.len = read3;
if (read3 == -1) {
break;
}
int HiH264WriteOSS2 = PlayLocalFile.HiH264WriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0], this.bufferhxend, this.len, this.seek);
this.ret = HiH264WriteOSS2;
if (HiH264WriteOSS2 != 0) {
HiLog.e("HiH264WriteOSS error ", 1, 1);
}
if (this.seek != 0) {
this.seek = 0;
}
HiPlayOSSDualSDK.this.SaveOssLoad += this.len;
HiPlayOSSDualSDK.this.saveOssLoadLen += this.len;
HiPlayOSSDualSDK.this.mOssLoadSt += this.len;
HiPlayOSSDualSDK hiPlayOSSDualSDK5 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK5.setOSSDownLoad(1, hiPlayOSSDualSDK5.saveOssLoadLen, HiPlayOSSDualSDK.this.mOssFilesize);
} catch (IOException e3) {
HiLog.e("", 1, 1);
e3.printStackTrace();
Message obtain3 = Message.obtain();
obtain3.obj = e3;
obtain3.what = this.msgwhat + 2;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain3);
PlayLocalFile.HiH264DestroyWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0]);
return;
}
}
} else {
HiLog.e("", 1, 1);
Message obtain4 = Message.obtain();
obtain4.what = this.msgwhat + 3;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain4);
HiPlayOSSDualSDK.this.mOssThreadExit = false;
}
if (HiPlayOSSDualSDK.this.saveOssLoadLen == HiPlayOSSDualSDK.this.mOssFilesize) {
HiPlayOSSDualSDK.this.OSSLoadFin = true;
HiPlayOSSDualSDK hiPlayOSSDualSDK6 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK6.setOSSDownLoad(2, hiPlayOSSDualSDK6.saveOssLoadLen, HiPlayOSSDualSDK.this.mOssFilesize);
} else {
HiLog.e("saveOssLoadLen:" + HiPlayOSSDualSDK.this.saveOssLoadLen + ":mOssFilesize:" + HiPlayOSSDualSDK.this.mOssFilesize + "mOssThreadExit:" + HiPlayOSSDualSDK.this.mOssThreadExit, 1, 1);
if (HiPlayOSSDualSDK.this.mOssThreadExit) {
HiPlayOSSDualSDK hiPlayOSSDualSDK7 = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK7.setOSSDownLoad(4, hiPlayOSSDualSDK7.saveOssLoadLen, HiPlayOSSDualSDK.this.mOssFilesize);
}
}
PlayLocalFile.HiH264DestroyWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0]);
HiPlayOSSDualSDK.this.mOssThreadExit = false;
HiLog.e("======== ThreadOSSDown end ========" + HiPlayOSSDualSDK.this.localfilepathoss, 1, 0);
return;
}
HiLog.e("", 1, 1);
Message obtain5 = Message.obtain();
obtain5.what = this.msgwhat + 3;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain5);
PlayLocalFile.HiH264DestroyWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0]);
HiPlayOSSDualSDK.this.mOssThreadExit = false;
return;
}
HiLog.e("", 1, 1);
Message obtain6 = Message.obtain();
obtain6.what = this.msgwhat + 3;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain6);
PlayLocalFile.HiH264DestroyWriteOSS(HiPlayOSSDualSDK.this.osswrite_readhandle[0]);
HiPlayOSSDualSDK.this.mOssThreadExit = false;
}
}
public class ThreadManageOSS extends HiThread {
private ThreadManageOSS() {
}
@Override
public void run() {
while (HiPlayOSSDualSDK.this.mOssThreadExit) {
sleep(100);
HiLog.e("::::" + HiPlayOSSDualSDK.this.mOssThreadExit, 1, 1);
}
HiLog.e("::::" + HiPlayOSSDualSDK.this.mOssThreadExit, 1, 0);
HiPlayOSSDualSDK.this.isOSSFile = true;
HiPlayOSSDualSDK.this.SaveOssLoad = 0;
HiPlayOSSDualSDK.this.OSSLoadFin = false;
HiPlayOSSDualSDK.this.isPlayossEnd = false;
HiPlayOSSDualSDK.this.isOssreadHead_end = false;
HiPlayOSSDualSDK.this.saveOssLoadLen = 0;
HiPlayOSSDualSDK.this.mOssLoadEn = 0;
HiPlayOSSDualSDK.this.mOssLoadSt = 0;
HiPlayOSSDualSDK.this.isLoading_FLAG = false;
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK.video_type = hiPlayOSSDualSDK.VIDEO_TYPE_H264;
if (HiPlayOSSDualSDK.this.mhiConfig != null) {
long currentTimeMillis = System.currentTimeMillis() - HiPlayOSSDualSDK.this.mSaveOssGetTime;
HiLog.e("" + System.currentTimeMillis() + ":::" + HiPlayOSSDualSDK.this.mSaveOssGetTime + ":::::" + currentTimeMillis + ":::" + HiPlayOSSDualSDK.this.mSetOsstime + "::::" + (((HiPlayOSSDualSDK.this.mosstokentime * 60) * 1000) - HiPlayOSSDualSDK.this.mSetOsstime), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_objectKey(), 1, 0);
if (currentTimeMillis > ((HiPlayOSSDualSDK.this.mosstokentime * 60) * 1000) - HiPlayOSSDualSDK.this.mSetOsstime) {
if (HiPlayOSSDualSDK.this.mIsOCloud) {
if (HiPlayOSSDualSDK.this.mUidEXIPREtimer != null) {
HiPlayOSSDualSDK.this.mUidEXIPREtimer.cancel();
}
HiPlayOSSDualSDK.this.mUidEXIPREtimer = null;
HiCloudSDK hiCloudSDK = HiPlayOSSDualSDK.this.mhiCloudsdk;
HiPlayOSSDualSDK hiPlayOSSDualSDK2 = HiPlayOSSDualSDK.this;
hiCloudSDK.HiCloudSDKgetOCloudinfo(hiPlayOSSDualSDK2, 1, hiPlayOSSDualSDK2.mhiConfig.getOSS_UUID(), HiPlayOSSDualSDK.this.mhiCloudname, HiPlayOSSDualSDK.this.mhiCloudpwd, HiPlayOSSDualSDK.this.mhiCloudKey, HiPlayOSSDualSDK.this.mhiCloudSer, HiPlayOSSDualSDK.this.mhiCloudport, (short) 5);
} else {
HiCloudSDK hiCloudSDK2 = HiPlayOSSDualSDK.this.mhiCloudsdk;
HiPlayOSSDualSDK hiPlayOSSDualSDK3 = HiPlayOSSDualSDK.this;
hiCloudSDK2.HiCloudSDKgetCloudinfo(hiPlayOSSDualSDK3, 1, hiPlayOSSDualSDK3.mhiConfig.getOSS_UUID(), HiPlayOSSDualSDK.this.mhiCloudname, HiPlayOSSDualSDK.this.mhiCloudpwd, HiPlayOSSDualSDK.this.mhiCloudKey, HiPlayOSSDualSDK.this.mhiCloudSer, HiPlayOSSDualSDK.this.mhiCloudport, (short) 5);
}
HiPlayOSSDualSDK.this.mOssOperation = 3;
return;
}
if (HiPlayOSSDualSDK.this.mthreadOSSDowndata != null) {
HiPlayOSSDualSDK.this.mthreadOSSDowndata.weakup();
HiPlayOSSDualSDK.this.mthreadOSSDowndata.stopThread();
HiPlayOSSDualSDK.this.mthreadOSSDowndata = null;
}
if (HiPlayOSSDualSDK.this.mthreadOSSDowndata == null) {
HiPlayOSSDualSDK.this.mthreadOSSDowndata = new ThreadOSSDown();
HiPlayOSSDualSDK.this.mthreadOSSDowndata.startThread();
}
}
}
}
public class ThreadOSSDownCustom extends HiThread {
long Firtime;
byte[] bufferrecdb;
int len;
int msgwhat;
int needlen;
int readlen;
long savetime;
private ThreadOSSDownCustom() {
this.needlen = 2048;
this.bufferrecdb = new byte[2048];
this.len = 0;
this.readlen = 0;
this.Firtime = System.currentTimeMillis();
this.msgwhat = 26112;
}
public void SetNeedLen(int i) {
this.needlen = i;
this.bufferrecdb = new byte[i];
}
@Override
public void run() {
InputStream OSSDownsync = HiPlayOSSDualSDK.this.mhiCloud.OSSDownsync(HiPlayOSSDualSDK.this.mhiConfig, 0, 0, HiPlayOSSDualSDK.this.handler, this.msgwhat);
if (OSSDownsync != null) {
while (true) {
try {
if (!this.isRunning) {
break;
}
int read = OSSDownsync.read(this.bufferrecdb);
this.len = read;
if (read != -1) {
HiLog.e(this.readlen + ":::" + this.needlen + ";;;;;" + this.len + "::" + this.Firtime + ":::" + this.savetime, 1, 0);
HiPlayOSSDualSDK.this.setOSSData(5, this.bufferrecdb, this.len, 0, 0, 0, 0, 1);
} else {
HiLog.e("" + HiPlayOSSDualSDK.this.isPlayEnd + "::::" + HiPlayOSSDualSDK.this.isPlayossEnd + "::::" + HiPlayOSSDualSDK.this.isPlayStop, 1, 0);
HiPlayOSSDualSDK.this.setOSSData(5, this.bufferrecdb, this.len, 0, 0, 0, 0, 2);
this.isRunning = false;
break;
}
} catch (IOException e) {
e.printStackTrace();
HiLog.e("" + HiPlayOSSDualSDK.this.isPlayEnd + "::::" + HiPlayOSSDualSDK.this.isPlayossEnd + "::::" + HiPlayOSSDualSDK.this.isPlayStop + "::" + this.isRunning + ":::" + e.getMessage(), 1, 1);
Message obtain = Message.obtain();
obtain.obj = e;
obtain.what = this.msgwhat + 2;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain);
return;
}
}
HiLog.e("" + HiPlayOSSDualSDK.this.isPlayEnd + "::::" + HiPlayOSSDualSDK.this.isPlayossEnd + "::::" + HiPlayOSSDualSDK.this.isPlayStop + "::" + this.isRunning, 1, 0);
return;
}
HiLog.e("", 1, 1);
Message obtain2 = Message.obtain();
obtain2.what = this.msgwhat + 3;
HiPlayOSSDualSDK.this.handler.sendMessage(obtain2);
}
}
public void DoReadOSS264File(HiThread hiThread) {
int[] iArr;
long j;
long j2;
HiPlayOSSDualSDK hiPlayOSSDualSDK;
HiPlayOSSDualSDK hiPlayOSSDualSDK2;
int i;
int i2;
byte[] bArr;
byte[] bArr2;
long j3;
byte[] bArr3;
byte[] bArr4;
int[] iArr2;
int i3;
int i4;
long j4;
long[] jArr;
HiPlayOSSDualSDK hiPlayOSSDualSDK3;
int i5;
int i6;
int i7;
boolean z;
int i8;
boolean z2;
int i9;
int i10;
byte[] bArr5;
byte[] bArr6;
long j5;
byte[] bArr7;
long j6;
int i11;
int i12;
int i13;
boolean z3;
int i14;
int i15;
long j7;
boolean z4;
byte[] bArr8;
int i16;
int HiH264ReadFrameOSSData;
long j8;
int i17;
int i18;
int i19;
int i20;
byte[] bArr9;
int i21;
byte[] bArr10;
byte[] bArr11;
int[] iArr3;
int i22;
int i23;
int i24;
int i25;
long j9;
int i26;
byte[] bArr12;
int i27;
int i28;
int i29;
int i30;
int i31;
byte[] bArr13;
int i32;
byte[] bArr14;
int i33;
long j10;
int i34;
byte[] bArr15;
boolean z5;
int i35;
int i36;
int i37;
FrameQueue frameQueue;
FrameQueue frameQueue2;
FrameQueue frameQueue3;
int i38;
byte[] bArr16;
int i39;
byte[] bArr17;
int i40;
int i41;
int i42;
int i43;
int i44;
int i45;
int i46;
int i47;
int i48;
boolean z6;
int i49;
int i50;
int i51;
int i52;
int i53;
FrameQueue frameQueue4;
FrameQueue frameQueue5;
FrameQueue frameQueue6;
int i54;
byte[] bArr18;
int i55;
boolean z7;
int i56;
int i57;
boolean z8;
HiPlayOSSDualSDK hiPlayOSSDualSDK4 = this;
int[] iArr4 = new int[16];
long[] jArr2 = new long[5];
byte[] MallocByte = Packet.MallocByte(16);
byte[] MallocByte2 = Packet.MallocByte(16);
byte[] MallocByte3 = Packet.MallocByte(hiPlayOSSDualSDK4.maxlen);
byte[] MallocByte4 = Packet.MallocByte(hiPlayOSSDualSDK4.maxlen);
byte[] MallocByte5 = Packet.MallocByte(hiPlayOSSDualSDK4.maxlen);
?? r7 = 0;
if (MallocByte3 == null || MallocByte4 == null || MallocByte5 == null) {
hiThread.isRunning = false;
}
boolean z9 = true;
HiLog.e("======== ThreadPlayLocal start ========", 1, 0);
int i58 = hiPlayOSSDualSDK4.SaveOssLoad;
boolean z10 = hiPlayOSSDualSDK4.OSSLoadFin;
if (hiPlayOSSDualSDK4.mIsOCloud) {
iArr = iArr4;
j = DoAes.HiOCloudInit(hiPlayOSSDualSDK4.mOCloudUid, hiPlayOSSDualSDK4.mOCloudDate);
} else {
iArr = iArr4;
j = 0;
}
HiLog.e("======== ThreadPlayLocal start ========" + j, 1, 0);
int i59 = 1;
boolean z11 = false;
int i60 = 0;
int i61 = 0;
int i62 = 0;
int i63 = 0;
int i64 = 0;
int i65 = 0;
int i66 = 0;
int i67 = 0;
int i68 = 0;
int i69 = 0;
int i70 = 100;
int i71 = 20;
int i72 = 1180063816;
int i73 = 200;
long j11 = 0;
byte[] bArr19 = MallocByte2;
byte[] bArr20 = MallocByte;
loop0: while (true) {
long j12 = j11;
while (true) {
if (!hiThread.isRunning) {
j2 = j;
break loop0;
}
if (!hiPlayOSSDualSDK4.isPlaying || hiPlayOSSDualSDK4.mossVideoFrameQueue == null || hiPlayOSSDualSDK4.mossVideo2FrameQueue == null) {
break;
}
if (hiPlayOSSDualSDK4.mossAudioFrameQueue == null) {
bArr = MallocByte4;
bArr2 = MallocByte3;
j3 = j;
bArr3 = bArr20;
bArr4 = bArr19;
iArr2 = iArr;
i3 = i61;
i4 = i62;
i6 = 200;
j4 = j12;
jArr = jArr2;
hiPlayOSSDualSDK3 = hiPlayOSSDualSDK4;
i5 = i66;
break;
}
boolean z12 = hiPlayOSSDualSDK4.mOssDownEnd;
if (z12) {
boolean z13 = z10;
i7 = i58;
z = z13;
} else {
z = hiPlayOSSDualSDK4.OSSLoadFin;
i7 = hiPlayOSSDualSDK4.SaveOssLoad;
}
if (z) {
if (!z12) {
hiPlayOSSDualSDK4.mOssDownEnd = z9;
}
if (i70 != 8) {
hiPlayOSSDualSDK4.isLoading_FLAG = r7;
i73 = 50;
i8 = 8;
synchronized (this) {
try {
if (hiPlayOSSDualSDK4.SaveisSeek) {
if (z) {
z2 = z;
i9 = i7;
i10 = i8;
bArr5 = MallocByte4;
bArr6 = MallocByte3;
j5 = j;
bArr7 = bArr19;
j6 = j12;
?? r10 = z9;
int i74 = -1;
int i75 = 0;
while (i74 != 0 && i75 < 100) {
int HiH264FindIFrameOSS = PlayLocalFile.HiH264FindIFrameOSS(hiPlayOSSDualSDK4.ossread_readhandle[0], hiPlayOSSDualSDK4.SaveSeekTime, jArr2);
HiLog.e(hiPlayOSSDualSDK4.SaveSeekTime + "::" + HiH264FindIFrameOSS + "::" + jArr2[0] + "::::" + jArr2[r10] + ":::" + jArr2[2] + "::::::" + j6 + ":::" + jArr2[3], r10, 0);
if (HiH264FindIFrameOSS == 0) {
long j13 = jArr2[0];
i60 = HiH264FindIFrameOSS;
i57 = i75;
setplaylocal(1, hiPlayOSSDualSDK4.videowidth, hiPlayOSSDualSDK4.videoheight, hiPlayOSSDualSDK4.filetime, jArr2[2] - jArr2[3], hiPlayOSSDualSDK4.SaveSeekTime, 7);
} else {
i60 = HiH264FindIFrameOSS;
i57 = i75;
}
i74 = PlayLocalFile.HiH264SeekOSS(hiPlayOSSDualSDK4.ossread_readhandle[0], hiPlayOSSDualSDK4.SaveSeekTime);
HiLog.e("PlayLocalFile.HiH264SeekOSS :" + hiPlayOSSDualSDK4.SaveSeekTime + "dddddd" + i74 + ":::" + i57, 1, 0);
if (i74 == 0) {
FrameQueue frameQueue7 = hiPlayOSSDualSDK4.mossAudioFrameQueue;
if (frameQueue7 != null) {
frameQueue7.removeAll();
}
FrameQueue frameQueue8 = hiPlayOSSDualSDK4.mossVideoFrameQueue;
if (frameQueue8 != null) {
frameQueue8.removeAll();
}
FrameQueue frameQueue9 = hiPlayOSSDualSDK4.mossVideo2FrameQueue;
if (frameQueue9 != null) {
frameQueue9.removeAll();
}
hiPlayOSSDualSDK4.SaveisSeek = false;
i75 = i57;
} else {
i75 = i57 + 1;
HiLog.e("PlayLocalFile.HiH264SeekOSS error :" + i74 + ":::" + i75, 1, 0);
}
r10 = 1;
}
i56 = i60;
} else {
byte[] bArr21 = MallocByte4;
i56 = PlayLocalFile.HiH264FindIFrameOSS(hiPlayOSSDualSDK4.ossread_readhandle[r7], hiPlayOSSDualSDK4.SaveSeekTime, jArr2);
StringBuilder sb = new StringBuilder();
sb.append(hiPlayOSSDualSDK4.SaveSeekTime);
sb.append("::");
sb.append(i56);
sb.append("::");
boolean z14 = z;
int i76 = i7;
sb.append(jArr2[r7]);
sb.append("::::");
byte[] bArr22 = MallocByte3;
sb.append(jArr2[1]);
sb.append(":::");
sb.append(jArr2[2]);
sb.append("::::::");
sb.append(j12);
sb.append(":::");
sb.append(jArr2[3]);
HiLog.e(sb.toString(), 1, 0);
if (i56 == 0) {
long j14 = jArr2[0];
i10 = i8;
i9 = i76;
bArr5 = bArr21;
z2 = z14;
bArr6 = bArr22;
j5 = j;
bArr7 = bArr19;
j6 = j12;
setplaylocal(1, hiPlayOSSDualSDK4.videowidth, hiPlayOSSDualSDK4.videoheight, hiPlayOSSDualSDK4.filetime, jArr2[2] - jArr2[3], hiPlayOSSDualSDK4.SaveSeekTime, 7);
StringBuilder sb2 = new StringBuilder();
sb2.append("播放缓冲中没有 清空播放缓冲 需处理oss:::");
FrameQueue frameQueue10 = hiPlayOSSDualSDK4.mossVideoFrameQueue;
sb2.append(frameQueue10 != null ? frameQueue10.getCount() : -1);
sb2.append(":::");
FrameQueue frameQueue11 = hiPlayOSSDualSDK4.mossVideo2FrameQueue;
sb2.append(frameQueue11 != null ? frameQueue11.getCount() : -1);
sb2.append("::");
FrameQueue frameQueue12 = hiPlayOSSDualSDK4.mossAudioFrameQueue;
sb2.append(frameQueue12 != null ? frameQueue12.getCountDataNew() : -1);
HiLog.e(sb2.toString(), 1, 0);
setplaylocal(1, hiPlayOSSDualSDK4.videowidth, hiPlayOSSDualSDK4.videoheight, hiPlayOSSDualSDK4.filetime, 0L, hiPlayOSSDualSDK4.audiotype, 21);
int i77 = (int) j14;
hiPlayOSSDualSDK4.saveframeseekpos = i77;
hiPlayOSSDualSDK4.isExitOSSLoad = true;
int HiH264SeekOSS = PlayLocalFile.HiH264SeekOSS(hiPlayOSSDualSDK4.ossread_readhandle[0], hiPlayOSSDualSDK4.SaveSeekTime);
hiPlayOSSDualSDK4.SaveisSeek = false;
FrameQueue frameQueue13 = hiPlayOSSDualSDK4.mossAudioFrameQueue;
if (frameQueue13 != null) {
frameQueue13.removeAll();
}
FrameQueue frameQueue14 = hiPlayOSSDualSDK4.mossVideoFrameQueue;
if (frameQueue14 != null) {
frameQueue14.removeAll();
}
FrameQueue frameQueue15 = hiPlayOSSDualSDK4.mossVideo2FrameQueue;
if (frameQueue15 != null) {
frameQueue15.removeAll();
}
StringBuilder sb3 = new StringBuilder();
sb3.append("播放缓冲中没有 清空播放缓冲 需处理oss:::");
FrameQueue frameQueue16 = hiPlayOSSDualSDK4.mossAudioFrameQueue;
sb3.append(frameQueue16 != null ? frameQueue16.getCount() : -1);
sb3.append("::");
FrameQueue frameQueue17 = hiPlayOSSDualSDK4.mossVideoFrameQueue;
sb3.append(frameQueue17 != null ? frameQueue17.getCountDataNew() : -1);
sb3.append("::");
FrameQueue frameQueue18 = hiPlayOSSDualSDK4.mossVideo2FrameQueue;
sb3.append(frameQueue18 != null ? frameQueue18.getCountDataNew() : -1);
HiLog.e(sb3.toString(), 1, 0);
i71 = i77;
i56 = HiH264SeekOSS;
} else {
i10 = i8;
i9 = i76;
bArr7 = bArr19;
bArr5 = bArr21;
z2 = z14;
bArr6 = bArr22;
j5 = j;
j6 = j12;
z8 = false;
hiPlayOSSDualSDK4.SaveisSeek = z8;
i12 = i56;
i11 = i71;
}
}
z8 = false;
hiPlayOSSDualSDK4.SaveisSeek = z8;
i12 = i56;
i11 = i71;
} else {
z2 = z;
i9 = i7;
i10 = i8;
bArr5 = MallocByte4;
bArr6 = MallocByte3;
j5 = j;
bArr7 = bArr19;
j6 = j12;
i11 = i71;
i12 = i60;
}
} finally {
th = th;
hiPlayOSSDualSDK = hiPlayOSSDualSDK4;
while (true) {
try {
break;
} catch (Throwable th) {
th = th;
}
}
}
}
z10 = z2;
if (z10) {
i13 = i9;
} else {
i13 = i9;
if (i13 <= i11 + 16 + 122880) {
HiLog.e(i12 + "::" + i61 + "::" + i62 + ":::" + Integer.toHexString(i63) + "::" + z10 + ":::" + i13 + "::::" + i11, 1, 0);
hiThread.sleep(100);
i71 = i11;
i60 = i12;
i58 = i13;
r7 = 0;
j12 = j6;
bArr19 = bArr7;
j = j5;
i70 = i10;
MallocByte4 = bArr5;
MallocByte3 = bArr6;
z9 = true;
}
}
byte[] bArr23 = bArr20;
int HiH264ReadFrameOSSDualHead = PlayLocalFile.HiH264ReadFrameOSSDualHead(hiPlayOSSDualSDK4.ossread_readhandle[0], bArr23);
int byteArrayToInt_Little = Packet.byteArrayToInt_Little(bArr23, 0);
int byteArrayToInt_Little2 = Packet.byteArrayToInt_Little(bArr23, 4);
int byteArrayToInt_Little3 = Packet.byteArrayToInt_Little(bArr23, 8);
int i78 = byteArrayToInt_Little2 - byteArrayToInt_Little3;
StringBuilder sb4 = new StringBuilder();
sb4.append(HiH264ReadFrameOSSDualHead);
long[] jArr3 = jArr2;
sb4.append("::");
sb4.append(byteArrayToInt_Little3);
sb4.append("::");
sb4.append(i78);
sb4.append(":::");
sb4.append(Integer.toHexString(byteArrayToInt_Little));
long j15 = j6;
HiLog.e(sb4.toString(), 1, 0);
if (i64 != 0 || z11) {
z11 = true;
} else {
int i79 = i65 + 1;
if (i79 > 2) {
Playlocal_CloseH264();
hiThread.sleep(100);
hiPlayOSSDualSDK4.Playlocal_OpenH264(hiPlayOSSDualSDK4.mSaveFilepath);
hiThread.sleep(100);
i71 = i11;
i60 = HiH264ReadFrameOSSDualHead;
i58 = i13;
i63 = byteArrayToInt_Little;
bArr20 = bArr23;
jArr2 = jArr3;
j12 = j15;
j = j5;
i70 = i10;
MallocByte3 = bArr6;
z9 = true;
i65 = 0;
i62 = i78;
i61 = byteArrayToInt_Little3;
bArr19 = bArr7;
MallocByte4 = bArr5;
r7 = 0;
} else {
i65 = i79;
}
}
if (HiH264ReadFrameOSSDualHead != 0) {
i71 = i11;
i60 = HiH264ReadFrameOSSDualHead;
i58 = i13;
i63 = byteArrayToInt_Little;
bArr20 = bArr23;
jArr2 = jArr3;
j12 = j15;
j = j5;
i70 = i10;
MallocByte3 = bArr6;
z9 = true;
} else {
int i80 = i11 + 16;
if (byteArrayToInt_Little == 1229346888) {
if (!hiPlayOSSDualSDK4.isSeekend) {
hiThread.sleep(500);
hiPlayOSSDualSDK4.isPlayEnd = true;
hiPlayOSSDualSDK4.isPlayossEnd = true;
hiPlayOSSDualSDK4.isLoading_FLAG = false;
setplaylocal(1, hiPlayOSSDualSDK4.videowidth, hiPlayOSSDualSDK4.videoheight, hiPlayOSSDualSDK4.filetime, 0L, hiPlayOSSDualSDK4.audiotype, 22);
HiLog.e("", 1, 0);
break loop0;
}
z3 = true;
hiThread.sleep(1000);
i71 = i80;
i60 = HiH264ReadFrameOSSDualHead;
i58 = i13;
i63 = byteArrayToInt_Little;
z9 = z3;
bArr20 = bArr23;
jArr2 = jArr3;
j12 = j15;
j = j5;
i70 = i10;
MallocByte3 = bArr6;
} else if (byteArrayToInt_Little2 <= 0) {
hiPlayOSSDualSDK4.isPlayossEnd = true;
z3 = true;
HiLog.e(z10 + ":SaveOssLoad:" + i13 + ":ossreadloc:" + i80 + ":framelen:" + byteArrayToInt_Little3 + "::" + i78 + ":::" + ((int) bArr23[0]) + ((int) bArr23[1]) + ((int) bArr23[2]) + ((int) bArr23[3]) + ((int) bArr23[4]) + ((int) bArr23[5]) + ((int) bArr23[6]) + ((int) bArr23[7]) + ((int) bArr23[8]) + ((int) bArr23[9]) + ((int) bArr23[10]) + ((int) bArr23[11]) + ((int) bArr23[12]) + ((int) bArr23[13]) + ((int) bArr23[14]) + ((int) bArr23[15]), 1, 0);
hiThread.sleep(100);
i71 = i80;
i60 = HiH264ReadFrameOSSDualHead;
i58 = i13;
i63 = byteArrayToInt_Little;
z9 = z3;
bArr20 = bArr23;
jArr2 = jArr3;
j12 = j15;
j = j5;
i70 = i10;
MallocByte3 = bArr6;
} else {
if (byteArrayToInt_Little2 <= 0) {
hiPlayOSSDualSDK4.isPlayEnd = true;
break loop0;
}
if (byteArrayToInt_Little == 1178687560) {
i14 = 0;
i15 = 16;
} else if (byteArrayToInt_Little != 1126258296) {
if (byteArrayToInt_Little == 1178884168) {
int HiH264ReadFrameOSSHead = PlayLocalFile.HiH264ReadFrameOSSHead(hiPlayOSSDualSDK4.ossread_readhandle[0], bArr7);
int byteArrayToInt_Little4 = Packet.byteArrayToInt_Little(bArr7, 0);
int byteArrayToInt_Little5 = Packet.byteArrayToInt_Little(bArr7, 4);
long readUnsignedInt = Packet.readUnsignedInt(bArr7, 8);
HiLog.e(HiH264ReadFrameOSSHead + "::" + byteArrayToInt_Little5 + ":::" + Integer.toHexString(byteArrayToInt_Little4) + "::" + readUnsignedInt, 1, 0);
i80 += 16;
z4 = z10;
i16 = i13;
j7 = readUnsignedInt;
i64 = byteArrayToInt_Little5;
bArr8 = bArr23;
} else {
i16 = i13;
bArr8 = bArr23;
j7 = j15;
z4 = z10;
}
while (hiThread.isRunning && !z4 && i16 < i80 + i64) {
z7 = this.mOssDownEnd;
if (!z7) {
boolean z15 = this.OSSLoadFin;
i16 = this.SaveOssLoad;
z4 = z15;
}
if (z4 && !z7) {
this.mOssDownEnd = true;
}
hiThread.sleep(100);
}
int[] iArr5 = iArr;
byte[] bArr24 = bArr6;
HiH264ReadFrameOSSData = PlayLocalFile.HiH264ReadFrameOSSData(this.ossread_readhandle[0], bArr24, iArr5, bArr7);
HiLog.e("======== ThreadPlayLocal read ========:::" + HiH264ReadFrameOSSData + ":::" + iArr5[0] + ":::" + iArr5[1] + "::size:" + iArr5[4] + ":frameflag::" + iArr5[5] + "::videoflag::" + iArr5[6]);
if (HiH264ReadFrameOSSData != 0) {
int i81 = iArr5[4];
int i82 = i80 + i81;
if (iArr5[5] == 1229346888) {
if (!this.isSeekend) {
hiThread.sleep(500);
this.isPlayEnd = true;
break loop0;
}
hiThread.sleep(1000);
i60 = HiH264ReadFrameOSSData;
i62 = i78;
i63 = byteArrayToInt_Little;
MallocByte3 = bArr24;
hiPlayOSSDualSDK4 = this;
i58 = i16;
bArr20 = bArr8;
jArr2 = jArr3;
i71 = i82;
z10 = z4;
j = j5;
MallocByte4 = bArr5;
z9 = true;
i61 = byteArrayToInt_Little3;
iArr = iArr5;
bArr19 = bArr7;
j12 = j7;
i70 = i10;
r7 = 0;
} else {
if (i81 > this.maxlen) {
break loop0;
}
if (this.mIsOCloud && iArr5[6] == 1) {
j8 = j5;
DoAes.HiOCloudEDncrypt(j8, bArr24, 128);
} else {
j8 = j5;
}
int i83 = this.savespeed;
if (i83 >= 3) {
if (i83 > 2) {
j2 = j8;
} else {
j2 = j8;
}
if (!this.isH265DevDec || i83 <= 2) {
i17 = i66;
} else {
i17 = i66;
}
i18 = HiH264ReadFrameOSSData;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr9 = bArr24;
i21 = i16;
bArr10 = bArr8;
bArr11 = bArr7;
i70 = i10;
iArr3 = iArr5;
hiPlayOSSDualSDK2 = this;
i22 = i17;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
if (i23 != i24 && i19 > 0) {
byte[] bArr25 = bArr11;
int HiH264ReadFrameOSSHead2 = PlayLocalFile.HiH264ReadFrameOSSHead(hiPlayOSSDualSDK2.ossread_readhandle[0], bArr25);
int byteArrayToInt_Little6 = Packet.byteArrayToInt_Little(bArr25, 0);
int byteArrayToInt_Little7 = Packet.byteArrayToInt_Little(bArr25, 4);
long readUnsignedInt2 = Packet.readUnsignedInt(bArr25, 8);
HiLog.e(HiH264ReadFrameOSSHead2 + "::" + byteArrayToInt_Little7 + ":::" + Integer.toHexString(byteArrayToInt_Little6) + "::" + readUnsignedInt2, 1, 0);
int i84 = i82 + 16;
int i85 = i21;
while (hiThread.isRunning && !z4 && i85 < i84 + byteArrayToInt_Little7) {
boolean z16 = hiPlayOSSDualSDK2.mOssDownEnd;
if (!z16) {
boolean z17 = hiPlayOSSDualSDK2.OSSLoadFin;
i85 = hiPlayOSSDualSDK2.SaveOssLoad;
z4 = z17;
}
if (z4 && !z16) {
hiPlayOSSDualSDK2.mOssDownEnd = true;
}
hiThread.sleep(100);
}
byte[] bArr26 = bArr9;
int HiH264ReadFrameOSSData2 = PlayLocalFile.HiH264ReadFrameOSSData(hiPlayOSSDualSDK2.ossread_readhandle[0], bArr26, iArr3, bArr25);
HiLog.e("======== ThreadPlayLocal read ========:::" + HiH264ReadFrameOSSData2 + ":::" + iArr3[0] + ":::" + iArr3[1] + "::size:" + iArr3[4] + ":frameflag::" + iArr3[5] + "::videoflag::" + iArr3[6]);
if (HiH264ReadFrameOSSData2 == 0) {
int i86 = iArr3[4];
int i87 = i84 + i86;
if (iArr3[5] == 1229346888) {
if (!hiPlayOSSDualSDK2.isSeekend) {
hiThread.sleep(500);
hiPlayOSSDualSDK2.isPlayEnd = true;
break loop0;
}
hiThread.sleep(1000);
bArr13 = bArr26;
i32 = HiH264ReadFrameOSSData2;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
i63 = i23;
i31 = i87;
bArr14 = bArr5;
} else {
if (i86 > hiPlayOSSDualSDK2.maxlen) {
break loop0;
}
if (hiPlayOSSDualSDK2.mIsOCloud && iArr3[6] == 1) {
i25 = HiH264ReadFrameOSSData2;
j9 = j2;
DoAes.HiOCloudEDncrypt(j9, bArr26, 128);
} else {
i25 = HiH264ReadFrameOSSData2;
j9 = j2;
}
int i88 = hiPlayOSSDualSDK2.savespeed;
j2 = j9;
if (i88 < 3 || (i88 > 2 && iArr3[6] == 1)) {
i26 = i69;
} else if (!hiPlayOSSDualSDK2.isH265DevDec) {
bArr13 = bArr26;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
i63 = i23;
i31 = i87;
i32 = i25;
bArr14 = bArr5;
} else if (i88 > 2) {
i26 = i69;
} else {
bArr13 = bArr26;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
i63 = i23;
i31 = i87;
i32 = i25;
bArr14 = bArr5;
}
if (i86 > 0) {
if (1180063816 == iArr3[5]) {
int i89 = iArr3[6];
if (hiPlayOSSDualSDK2.isH265DevDec) {
int i90 = i26 + 1;
if (1 == i89) {
bArr16 = bArr5;
i39 = 0;
i38 = 0;
System.arraycopy(bArr26, i39, bArr16, i39, i86);
i28 = i86 + i39;
i69 = i38;
i72 = 1180063816;
bArr12 = bArr16;
i27 = i89;
} else {
i38 = i90;
}
} else {
i38 = i26;
}
bArr16 = bArr5;
i39 = 0;
System.arraycopy(bArr26, i39, bArr16, i39, i86);
i28 = i86 + i39;
i69 = i38;
i72 = 1180063816;
bArr12 = bArr16;
i27 = i89;
} else {
bArr12 = bArr5;
i69 = i26;
if (1178687560 == iArr3[5]) {
int i91 = iArr3[6];
int i92 = i86 - 4;
System.arraycopy(bArr26, 4, bArr12, 0, i92);
i28 = 0 + i92;
i27 = i91;
i72 = 1178687560;
} else {
i27 = i59;
i28 = 0;
}
}
if (hiPlayOSSDualSDK2.savespeed > 2) {
if (i70 != 2) {
i29 = 2;
i30 = 2;
int i93 = i29;
i63 = i23;
i31 = i87;
bArr13 = bArr26;
int i94 = i30;
int i95 = i27;
i32 = i25;
bArr14 = bArr12;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
save2Queue(hiPlayOSSDualSDK2.mossVideo2FrameQueue, MallocByte5, bArr12, i28, iArr3[5], i72, (iArr3[0] * 10000) + iArr3[1], i95, i69, Boolean.valueOf(hiThread.isRunning));
z5 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z5) {
if (i67 == 0) {
i35 = 1;
i67 = (iArr3[0] * 10000) + iArr3[1];
} else {
i35 = 1;
}
i37 = ((iArr3[0] * 10000) + iArr3[i35]) - i67;
i36 = i95;
} else {
i35 = 1;
i36 = i95;
i37 = i68;
}
if (i36 == i35 && z5) {
hiPlayOSSDualSDK2.Loading_IFrameNum += i35;
}
if (z5 && (frameQueue3 = hiPlayOSSDualSDK2.mossVideo2FrameQueue) != null && (hiPlayOSSDualSDK2.Loading_IFrameNum >= hiPlayOSSDualSDK2.Loading_IFrameNum_tal || i37 > hiPlayOSSDualSDK2.Loading_FramePts * 1000 || frameQueue3.getCount() >= hiPlayOSSDualSDK2.Loading_FrameNum)) {
hiPlayOSSDualSDK2.isLoading_FLAG = false;
StringBuilder sb5 = new StringBuilder();
sb5.append("");
sb5.append(hiPlayOSSDualSDK2.Loading_IFrameNum);
sb5.append("::::");
sb5.append(i37);
sb5.append(":::");
FrameQueue frameQueue19 = hiPlayOSSDualSDK2.mossVideo2FrameQueue;
sb5.append(frameQueue19 != null ? frameQueue19.getCount() : -1);
HiLog.e(sb5.toString(), 1, 0);
setplaylocal(1, hiPlayOSSDualSDK2.videowidth, hiPlayOSSDualSDK2.videoheight, hiPlayOSSDualSDK2.filetime, 0L, hiPlayOSSDualSDK2.audiotype, 22);
i67 = 0;
}
while (hiThread.isRunning && hiPlayOSSDualSDK2.isPlaying && (frameQueue2 = hiPlayOSSDualSDK2.mossVideo2FrameQueue) != null && frameQueue2.getCount() >= i94) {
hiThread.sleep(2);
}
while (hiThread.isRunning && hiPlayOSSDualSDK2.isPlaying && (frameQueue = hiPlayOSSDualSDK2.mossAudioFrameQueue) != null && frameQueue.getCount() >= i93) {
hiThread.sleep(2);
}
i59 = 2;
i68 = i37;
i73 = i93;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
i70 = i94;
iArr = iArr3;
jArr2 = jArr3;
i64 = i34;
MallocByte4 = bArr14;
i71 = i31;
z10 = z4;
i62 = i19;
MallocByte3 = bArr13;
i60 = i32;
j = j2;
bArr19 = bArr15;
i61 = i20;
j12 = j10;
i58 = i33;
z9 = true;
r7 = 0;
}
i30 = i70;
i29 = i73;
int i932 = i29;
i63 = i23;
i31 = i87;
bArr13 = bArr26;
int i942 = i30;
int i952 = i27;
i32 = i25;
bArr14 = bArr12;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
save2Queue(hiPlayOSSDualSDK2.mossVideo2FrameQueue, MallocByte5, bArr12, i28, iArr3[5], i72, (iArr3[0] * 10000) + iArr3[1], i952, i69, Boolean.valueOf(hiThread.isRunning));
z5 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z5) {
}
if (i36 == i35) {
hiPlayOSSDualSDK2.Loading_IFrameNum += i35;
}
if (z5) {
hiPlayOSSDualSDK2.isLoading_FLAG = false;
StringBuilder sb52 = new StringBuilder();
sb52.append("");
sb52.append(hiPlayOSSDualSDK2.Loading_IFrameNum);
sb52.append("::::");
sb52.append(i37);
sb52.append(":::");
FrameQueue frameQueue192 = hiPlayOSSDualSDK2.mossVideo2FrameQueue;
sb52.append(frameQueue192 != null ? frameQueue192.getCount() : -1);
HiLog.e(sb52.toString(), 1, 0);
setplaylocal(1, hiPlayOSSDualSDK2.videowidth, hiPlayOSSDualSDK2.videoheight, hiPlayOSSDualSDK2.filetime, 0L, hiPlayOSSDualSDK2.audiotype, 22);
i67 = 0;
}
while (hiThread.isRunning) {
hiThread.sleep(2);
}
while (hiThread.isRunning) {
hiThread.sleep(2);
}
i59 = 2;
i68 = i37;
i73 = i932;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
i70 = i942;
iArr = iArr3;
jArr2 = jArr3;
i64 = i34;
MallocByte4 = bArr14;
i71 = i31;
z10 = z4;
i62 = i19;
MallocByte3 = bArr13;
i60 = i32;
j = j2;
bArr19 = bArr15;
i61 = i20;
j12 = j10;
i58 = i33;
z9 = true;
r7 = 0;
} else {
if (z4) {
i30 = 8;
if (i70 != 8) {
i29 = 8;
}
i30 = i70;
i29 = i73;
} else {
if (i70 != 100) {
i29 = 100;
i30 = 100;
}
i30 = i70;
i29 = i73;
}
int i9322 = i29;
i63 = i23;
i31 = i87;
bArr13 = bArr26;
int i9422 = i30;
int i9522 = i27;
i32 = i25;
bArr14 = bArr12;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
save2Queue(hiPlayOSSDualSDK2.mossVideo2FrameQueue, MallocByte5, bArr12, i28, iArr3[5], i72, (iArr3[0] * 10000) + iArr3[1], i9522, i69, Boolean.valueOf(hiThread.isRunning));
z5 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z5) {
}
if (i36 == i35) {
}
if (z5) {
}
while (hiThread.isRunning) {
}
while (hiThread.isRunning) {
}
i59 = 2;
i68 = i37;
i73 = i9322;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
i70 = i9422;
iArr = iArr3;
jArr2 = jArr3;
i64 = i34;
MallocByte4 = bArr14;
i71 = i31;
z10 = z4;
i62 = i19;
MallocByte3 = bArr13;
i60 = i32;
j = j2;
bArr19 = bArr15;
i61 = i20;
j12 = j10;
i58 = i33;
z9 = true;
r7 = 0;
}
}
bArr13 = bArr26;
i69 = i26;
i33 = i85;
j10 = readUnsignedInt2;
i34 = byteArrayToInt_Little7;
bArr15 = bArr25;
i63 = i23;
i31 = i87;
i32 = i25;
bArr14 = bArr5;
}
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
iArr = iArr3;
jArr2 = jArr3;
i64 = i34;
MallocByte4 = bArr14;
i71 = i31;
z10 = z4;
i62 = i19;
MallocByte3 = bArr13;
i60 = i32;
j = j2;
bArr19 = bArr15;
i61 = i20;
j12 = j10;
i58 = i33;
z9 = true;
r7 = 0;
} else {
HiLog.e("======== ThreadPlayLocal end ========", 1, 0);
hiThread.sleep(500);
hiPlayOSSDualSDK2.isPlayEnd = true;
break loop0;
}
} else {
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
}
i66 = i22;
bArr20 = bArr10;
} else {
j2 = j8;
}
i17 = i66;
if (i81 > 0) {
int i96 = iArr5[6];
if (1180063816 == iArr5[5]) {
if (this.isH265DevDec) {
i54 = i17 + 1;
if (1 == i96) {
bArr18 = bArr5;
i55 = 0;
i54 = 0;
System.arraycopy(bArr24, i55, bArr18, i55, i81);
i22 = i54;
i40 = HiH264ReadFrameOSSData;
bArr17 = bArr18;
i72 = 1180063816;
i42 = i96;
i41 = i81 + i55;
}
} else {
i54 = i17;
}
bArr18 = bArr5;
i55 = 0;
System.arraycopy(bArr24, i55, bArr18, i55, i81);
i22 = i54;
i40 = HiH264ReadFrameOSSData;
bArr17 = bArr18;
i72 = 1180063816;
i42 = i96;
i41 = i81 + i55;
} else {
bArr17 = bArr5;
i40 = HiH264ReadFrameOSSData;
if (1178687560 == iArr5[5]) {
i96 = iArr5[6];
if (i81 == 164) {
i81 -= 4;
i43 = 0;
System.arraycopy(bArr24, 4, bArr17, 0, i81);
} else {
i43 = 0;
System.arraycopy(bArr24, 0, bArr17, 0, i81);
}
i41 = i81 + i43;
i22 = i17;
i72 = 1178687560;
} else {
i22 = i17;
i41 = 0;
}
i42 = i96;
}
if (this.savespeed > 2) {
i44 = i10;
if (i44 != 2) {
i45 = 2;
i46 = 2;
i21 = i16;
bArr5 = bArr17;
i18 = i40;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr11 = bArr7;
bArr9 = bArr24;
iArr3 = iArr5;
i47 = i45;
bArr10 = bArr8;
hiPlayOSSDualSDK2 = this;
i48 = i46;
save2Queue(this.mossVideoFrameQueue, MallocByte5, bArr5, i41, iArr5[5], i72, (iArr5[0] * 10000) + iArr5[1], i42, i22, Boolean.valueOf(hiThread.isRunning));
z6 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z6) {
i49 = 1;
} else {
if (i67 == 0) {
i49 = 1;
i67 = (iArr3[0] * 10000) + iArr3[1];
} else {
i49 = 1;
}
i68 = ((iArr3[0] * 10000) + iArr3[i49]) - i67;
}
i50 = i67;
i51 = i68;
if (i42 == i49 && z6) {
hiPlayOSSDualSDK2.Loading_IFrameNum += i49;
}
if (z6 && (frameQueue6 = hiPlayOSSDualSDK2.mossVideoFrameQueue) != null && (hiPlayOSSDualSDK2.Loading_IFrameNum >= hiPlayOSSDualSDK2.Loading_IFrameNum_tal || i51 > hiPlayOSSDualSDK2.Loading_FramePts * 1000 || frameQueue6.getCount() >= hiPlayOSSDualSDK2.Loading_FrameNum)) {
hiPlayOSSDualSDK2.isLoading_FLAG = false;
StringBuilder sb6 = new StringBuilder();
sb6.append("");
sb6.append(hiPlayOSSDualSDK2.Loading_IFrameNum);
sb6.append("::::");
sb6.append(i51);
sb6.append(":::");
FrameQueue frameQueue20 = hiPlayOSSDualSDK2.mossVideoFrameQueue;
sb6.append(frameQueue20 == null ? frameQueue20.getCount() : -1);
HiLog.e(sb6.toString(), 1, 0);
setplaylocal(1, hiPlayOSSDualSDK2.videowidth, hiPlayOSSDualSDK2.videoheight, hiPlayOSSDualSDK2.filetime, 0L, hiPlayOSSDualSDK2.audiotype, 22);
i50 = 0;
}
while (hiThread.isRunning && hiPlayOSSDualSDK2.isPlaying && (frameQueue5 = hiPlayOSSDualSDK2.mossVideoFrameQueue) != null) {
i52 = i48;
if (frameQueue5.getCount() >= i52) {
break;
}
hiThread.sleep(2);
i48 = i52;
}
i52 = i48;
while (hiThread.isRunning && hiPlayOSSDualSDK2.isPlaying && (frameQueue4 = hiPlayOSSDualSDK2.mossAudioFrameQueue) != null) {
i53 = i47;
if (frameQueue4.getCount() >= i53) {
break;
}
hiThread.sleep(2);
i47 = i53;
}
i53 = i47;
i70 = i52;
i73 = i53;
i67 = i50;
i68 = i51;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
i59 = 2;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
}
i46 = i44;
i45 = i73;
i21 = i16;
bArr5 = bArr17;
i18 = i40;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr11 = bArr7;
bArr9 = bArr24;
iArr3 = iArr5;
i47 = i45;
bArr10 = bArr8;
hiPlayOSSDualSDK2 = this;
i48 = i46;
save2Queue(this.mossVideoFrameQueue, MallocByte5, bArr5, i41, iArr5[5], i72, (iArr5[0] * 10000) + iArr5[1], i42, i22, Boolean.valueOf(hiThread.isRunning));
z6 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z6) {
}
i50 = i67;
i51 = i68;
if (i42 == i49) {
hiPlayOSSDualSDK2.Loading_IFrameNum += i49;
}
if (z6) {
hiPlayOSSDualSDK2.isLoading_FLAG = false;
StringBuilder sb62 = new StringBuilder();
sb62.append("");
sb62.append(hiPlayOSSDualSDK2.Loading_IFrameNum);
sb62.append("::::");
sb62.append(i51);
sb62.append(":::");
FrameQueue frameQueue202 = hiPlayOSSDualSDK2.mossVideoFrameQueue;
sb62.append(frameQueue202 == null ? frameQueue202.getCount() : -1);
HiLog.e(sb62.toString(), 1, 0);
setplaylocal(1, hiPlayOSSDualSDK2.videowidth, hiPlayOSSDualSDK2.videoheight, hiPlayOSSDualSDK2.filetime, 0L, hiPlayOSSDualSDK2.audiotype, 22);
i50 = 0;
}
while (hiThread.isRunning) {
i52 = i48;
if (frameQueue5.getCount() >= i52) {
}
}
i52 = i48;
while (hiThread.isRunning) {
i53 = i47;
if (frameQueue4.getCount() >= i53) {
}
}
i53 = i47;
i70 = i52;
i73 = i53;
i67 = i50;
i68 = i51;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
i59 = 2;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
} else {
i44 = i10;
if (z4) {
if (i44 != 8) {
i45 = 8;
i46 = 8;
i21 = i16;
bArr5 = bArr17;
i18 = i40;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr11 = bArr7;
bArr9 = bArr24;
iArr3 = iArr5;
i47 = i45;
bArr10 = bArr8;
hiPlayOSSDualSDK2 = this;
i48 = i46;
save2Queue(this.mossVideoFrameQueue, MallocByte5, bArr5, i41, iArr5[5], i72, (iArr5[0] * 10000) + iArr5[1], i42, i22, Boolean.valueOf(hiThread.isRunning));
z6 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z6) {
}
i50 = i67;
i51 = i68;
if (i42 == i49) {
}
if (z6) {
}
while (hiThread.isRunning) {
}
i52 = i48;
while (hiThread.isRunning) {
}
i53 = i47;
i70 = i52;
i73 = i53;
i67 = i50;
i68 = i51;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
i59 = 2;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
}
i46 = i44;
i45 = i73;
i21 = i16;
bArr5 = bArr17;
i18 = i40;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr11 = bArr7;
bArr9 = bArr24;
iArr3 = iArr5;
i47 = i45;
bArr10 = bArr8;
hiPlayOSSDualSDK2 = this;
i48 = i46;
save2Queue(this.mossVideoFrameQueue, MallocByte5, bArr5, i41, iArr5[5], i72, (iArr5[0] * 10000) + iArr5[1], i42, i22, Boolean.valueOf(hiThread.isRunning));
z6 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z6) {
}
i50 = i67;
i51 = i68;
if (i42 == i49) {
}
if (z6) {
}
while (hiThread.isRunning) {
}
i52 = i48;
while (hiThread.isRunning) {
}
i53 = i47;
i70 = i52;
i73 = i53;
i67 = i50;
i68 = i51;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
i59 = 2;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
} else {
if (i44 != 100) {
i45 = 100;
i46 = 100;
i21 = i16;
bArr5 = bArr17;
i18 = i40;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr11 = bArr7;
bArr9 = bArr24;
iArr3 = iArr5;
i47 = i45;
bArr10 = bArr8;
hiPlayOSSDualSDK2 = this;
i48 = i46;
save2Queue(this.mossVideoFrameQueue, MallocByte5, bArr5, i41, iArr5[5], i72, (iArr5[0] * 10000) + iArr5[1], i42, i22, Boolean.valueOf(hiThread.isRunning));
z6 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z6) {
}
i50 = i67;
i51 = i68;
if (i42 == i49) {
}
if (z6) {
}
while (hiThread.isRunning) {
}
i52 = i48;
while (hiThread.isRunning) {
}
i53 = i47;
i70 = i52;
i73 = i53;
i67 = i50;
i68 = i51;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
i59 = 2;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
}
i46 = i44;
i45 = i73;
i21 = i16;
bArr5 = bArr17;
i18 = i40;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr11 = bArr7;
bArr9 = bArr24;
iArr3 = iArr5;
i47 = i45;
bArr10 = bArr8;
hiPlayOSSDualSDK2 = this;
i48 = i46;
save2Queue(this.mossVideoFrameQueue, MallocByte5, bArr5, i41, iArr5[5], i72, (iArr5[0] * 10000) + iArr5[1], i42, i22, Boolean.valueOf(hiThread.isRunning));
z6 = hiPlayOSSDualSDK2.isLoading_FLAG;
if (z6) {
}
i50 = i67;
i51 = i68;
if (i42 == i49) {
}
if (z6) {
}
while (hiThread.isRunning) {
}
i52 = i48;
while (hiThread.isRunning) {
}
i53 = i47;
i70 = i52;
i73 = i53;
i67 = i50;
i68 = i51;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
i59 = 2;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
}
}
}
i18 = HiH264ReadFrameOSSData;
i19 = i78;
i20 = byteArrayToInt_Little3;
bArr9 = bArr24;
i21 = i16;
bArr10 = bArr8;
bArr11 = bArr7;
i70 = i10;
iArr3 = iArr5;
hiPlayOSSDualSDK2 = this;
i22 = i17;
i23 = byteArrayToInt_Little;
i24 = HiChipDefines.HI_SDK_T_DUAL_FRAME_FLAG;
if (i23 != i24) {
}
i63 = i23;
z9 = true;
r7 = 0;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK2;
jArr2 = jArr3;
MallocByte4 = bArr5;
i71 = i82;
i60 = i18;
z10 = z4;
i62 = i19;
MallocByte3 = bArr9;
j12 = j7;
j = j2;
bArr19 = bArr11;
i61 = i20;
i58 = i21;
iArr = iArr3;
i66 = i22;
bArr20 = bArr10;
}
} else {
hiPlayOSSDualSDK2 = this;
j2 = j5;
HiLog.e("======== ThreadPlayLocal end ========", 1, 0);
hiThread.sleep(500);
hiPlayOSSDualSDK2.isPlayEnd = true;
break loop0;
}
} else {
i15 = 16;
i14 = 0;
}
System.arraycopy(bArr23, i14, bArr7, i14, i15);
int byteArrayToInt_Little8 = Packet.byteArrayToInt_Little(bArr7, i14);
int byteArrayToInt_Little9 = Packet.byteArrayToInt_Little(bArr7, 4);
bArr8 = bArr23;
long readUnsignedInt3 = Packet.readUnsignedInt(bArr7, 8);
HiLog.e(HiH264ReadFrameOSSDualHead + "::" + byteArrayToInt_Little9 + ":::" + Integer.toHexString(byteArrayToInt_Little8) + "::" + readUnsignedInt3, 1, 0);
z4 = z10;
j7 = readUnsignedInt3;
i64 = byteArrayToInt_Little9;
i16 = i13;
while (hiThread.isRunning) {
z7 = this.mOssDownEnd;
if (!z7) {
}
if (z4) {
this.mOssDownEnd = true;
}
hiThread.sleep(100);
}
int[] iArr52 = iArr;
byte[] bArr242 = bArr6;
HiH264ReadFrameOSSData = PlayLocalFile.HiH264ReadFrameOSSData(this.ossread_readhandle[0], bArr242, iArr52, bArr7);
HiLog.e("======== ThreadPlayLocal read ========:::" + HiH264ReadFrameOSSData + ":::" + iArr52[0] + ":::" + iArr52[1] + "::size:" + iArr52[4] + ":frameflag::" + iArr52[5] + "::videoflag::" + iArr52[6]);
if (HiH264ReadFrameOSSData != 0) {
}
}
}
i62 = i78;
i61 = byteArrayToInt_Little3;
bArr19 = bArr7;
MallocByte4 = bArr5;
r7 = 0;
}
}
i8 = i70;
synchronized (this) {
}
}
hiThread.sleep(i6);
HiLog.e("======== ThreadPlayLocal ========" + hiPlayOSSDualSDK3.isPlaying + ":::::" + hiThread.isRunning, 1, 0);
z9 = true;
i66 = i5;
hiPlayOSSDualSDK4 = hiPlayOSSDualSDK3;
iArr = iArr2;
jArr2 = jArr;
MallocByte3 = bArr2;
bArr20 = bArr3;
j = j3;
bArr19 = bArr4;
j11 = j4;
i62 = i4;
i61 = i3;
r7 = 0;
MallocByte4 = bArr;
}
hiPlayOSSDualSDK2 = this;
j2 = j5;
if (hiPlayOSSDualSDK2.mIsOCloud) {
DoAes.HiOCloudDinit(j2);
}
if (hiPlayOSSDualSDK2.isPlayStop && hiPlayOSSDualSDK2.video_type == hiPlayOSSDualSDK2.VIDEO_TYPE_H264) {
i = 1;
i2 = 0;
HiLog.e("" + hiPlayOSSDualSDK2.isPlayossEnd, 1, 0);
Playlocal_CloseH264();
HiLog.e(hiPlayOSSDualSDK2.saveOssLoadLen + "::::" + hiPlayOSSDualSDK2.mOssFilesize, 1, 0);
} else {
i = 1;
i2 = 0;
}
HiLog.e("======== ThreadPlayLocal end ========", i, i2);
}
public void DoDecodeAudio(HiThread hiThread) {
FrameQueue frameQueue;
ThreadDecodeAudioCloud threadDecodeAudioCloud;
HiLog.e("======== ThreadDecodeAudio start ========" + this.isLoading_FLAG, 1, 0);
HiAudioPlay hiAudioPlay = new HiAudioPlay();
if (!hiAudioPlay.init(this.audiotype) && (threadDecodeAudioCloud = this.mThreadDecodeAudioCloud) != null) {
threadDecodeAudioCloud.weakup();
this.mThreadDecodeAudioCloud.stopThread();
}
while (true) {
if (!hiThread.isRunning) {
break;
}
if (this.isLoading_FLAG || this.mossAudioFrameQueue == null) {
hiThread.sleep(20);
} else {
hiAudioPlay.setaudiotype(this.audiotype);
FrameQueue frameQueue2 = this.mossAudioFrameQueue;
if (frameQueue2 != null && frameQueue2.getCount() > 0) {
if (this.video_type == this.VIDEO_TYPE_MP4) {
continue;
} else {
FrameQueue frameQueue3 = this.mossAudioFrameQueue;
if (frameQueue3 != null && frameQueue3.getCount() <= 0) {
hiThread.sleep(20);
} else {
FrameQueue frameQueue4 = this.mossAudioFrameQueue;
if (frameQueue4 == null || this.mossVideoFrameQueue == null || this.mossVideo2FrameQueue == null) {
break;
}
FrameData removeHead = frameQueue4.removeHead();
if (removeHead != null) {
int frmSize = removeHead.getFrmSize();
if (this.video_type != this.VIDEO_TYPE_MP4) {
if (!this.is2Mp4) {
long currentTimeMillis = System.currentTimeMillis();
hiAudioPlay.audioPlay(removeHead.frmData, frmSize, true);
int currentTimeMillis2 = (int) ((20 - (System.currentTimeMillis() - currentTimeMillis)) - 8);
if (currentTimeMillis2 < 20 && currentTimeMillis2 > 0) {
hiThread.sleep(currentTimeMillis2);
}
} else {
byte[] audioPlay = hiAudioPlay.audioPlay(removeHead.frmData, frmSize, false);
this.writemp4lock.lock();
long[] jArr = this.mp4_handle;
if (jArr[0] != 0) {
EncMp4.HIEncMp4write(jArr[0], audioPlay, 320, 2, removeHead.getTimeStamp(), 0);
}
long[] jArr2 = this.mp4_2handle;
if (jArr2[0] != 0) {
EncMp4.HIEncMp4write(jArr2[0], audioPlay, 320, 2, removeHead.getTimeStamp(), 0);
}
this.writemp4lock.unlock();
}
} else {
long currentTimeMillis3 = System.currentTimeMillis();
hiAudioPlay.audioPlay(removeHead.frmData, frmSize, true);
int currentTimeMillis4 = (int) ((20 - (System.currentTimeMillis() - currentTimeMillis3)) - 8);
if (currentTimeMillis4 < 20 && currentTimeMillis4 > 0) {
hiThread.sleep(currentTimeMillis4);
}
}
}
}
}
} else if (!hiThread.isRunning) {
continue;
} else if (this.isPlayEnd && (frameQueue = this.mossAudioFrameQueue) != null && frameQueue.getCount() == 0) {
hiThread.sleep(10);
break;
} else if (this.isPlayStop) {
break;
}
}
}
hiAudioPlay.setaudiotype(1);
hiAudioPlay.uninit();
HiLog.e("mSessionHandle:======== ThreadDecodeAudio end ========uid_byte::::", 1, 0);
}
public class ThreadDecodeAudioCloud extends HiThread {
private ThreadDecodeAudioCloud() {
}
@Override
public void run() {
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK.DoDecodeAudio(hiPlayOSSDualSDK.mThreadDecodeAudioCloud);
}
}
public void DoDecodeVideo(HiThread hiThread) {
int i;
String str;
int i2;
int i3;
int i4;
long[] jArr;
int i5;
int i6;
int i7;
FrameData frameData;
long j;
FrameData frameData2;
long[] jArr2;
long j2;
FrameData frameData3;
FrameData frameData4;
String str2;
long j3;
Boolean bool;
int i8;
int i9;
int i10;
int i11;
FrameData frameData5;
int yuvFrameData;
FrameQueue frameQueue;
FrameQueue frameQueue2;
String str3;
int i12;
int HIH264Dec_init;
int i13;
int i14 = 0;
HiLog.e("======== ThreadDecodeVideo start ========", 1, 0);
long[] jArr3 = new long[1];
Boolean bool2 = false;
Boolean.valueOf(true);
int i15 = this.videoheight;
if (i15 < 0 || (i13 = this.videowidth) < 0 || i15 > 5000 || i13 > 5000) {
hiThread.isRunning = false;
}
int i16 = ((this.videowidth * this.videoheight) * 3) / 2;
FrameData frameData6 = null;
int i17 = Build.VERSION.SDK_INT;
if (!hiThread.isRunning || this.is2Mp4 || i16 <= 0) {
i = 4;
str = "";
i2 = 2;
} else {
byte[] MallocByte = Packet.MallocByte(i16);
this.yuvBuffer = MallocByte;
if (MallocByte == null) {
HiLog.e("", 1, 1);
str3 = "";
i12 = i17;
i2 = 2;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, 0L, this.audiotype, -1);
hiThread.isRunning = false;
} else {
str3 = "";
i12 = i17;
i2 = 2;
}
if (this.isDualThrid) {
int i18 = (int) (this.videowidth * 0.7d);
this.mCut2w = i18;
this.mCutw = i18;
int i19 = this.videoheight / i2;
this.mCut2h = i19;
this.mCuth = i19;
byte[] MallocByte2 = Packet.MallocByte(((i18 * i19) * 3) / i2);
this.yuvBuffer2 = MallocByte2;
if (MallocByte2 == null) {
hiThread.isRunning = false;
}
byte[] MallocByte3 = Packet.MallocByte(((this.mCutw * this.mCuth) * 3) / i2);
this.yuvBuffer3 = MallocByte3;
if (MallocByte3 == null) {
hiThread.isRunning = false;
}
}
if (this.videotype != 5) {
this.videotype = 4;
}
if (this.DecodeVideoType != 1) {
this.DecodeVideoType = 0;
}
if (this.DecodeViVoVideoType == 1) {
int i20 = this.videotype;
if (i20 == 4) {
if (i12 < 16 || this.DecodeVideoType == 0) {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr3, 0, i20);
} else {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr3, 1, i20);
}
} else if (i12 < 23) {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr3, 0, i20);
} else {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr3, 1, i20);
}
} else {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr3, 0, this.videotype);
}
if (HIH264Dec_init < 0) {
String str4 = str3;
HiLog.e(str4, 1, 1);
hiThread.isRunning = false;
if (this.videotype == 5) {
str = str4;
i = 4;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, 0L, this.audiotype, -5);
} else {
str = str4;
i = 4;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, 0L, this.audiotype, -4);
}
} else {
i = 4;
str = str3;
}
}
int i21 = 0;
int i22 = 0;
boolean z = false;
long j4 = 0;
while (true) {
if (!hiThread.isRunning) {
break;
}
if (!this.isPlaying) {
jArr = jArr3;
i5 = 20;
} else if (this.mossVideoFrameQueue == null) {
i5 = 20;
jArr = jArr3;
} else {
if (this.videotype == 5 && this.mDeciveInfo.getDeviceDecode5() != this.isDeviceDecode5) {
this.isDeviceDecode5 = this.mDeciveInfo.getDeviceDecode5();
H264Decoder.HIH264Dec_uninit(jArr3[i14]);
H264Decoder.HIH264Dec_init(jArr3, i14, this.videotype);
}
if (this.isDisplayFrist && this.isLoading_FLAG) {
hiThread.sleep(20);
jArr = jArr3;
jArr3 = jArr;
i2 = 2;
i14 = 0;
} else {
if (1 != i22) {
j4 = System.currentTimeMillis();
}
if (i22 == i2 || ((frameQueue = this.mossVideoFrameQueue) != null && frameQueue.getCount() > 0)) {
if (i21 != 0 || (frameData6 = this.mossVideoFrameQueue.removeHead()) != null) {
String str5 = ":::";
if (1 == i22) {
frameData6 = this.mossVideoFrameQueue.removeHead();
if (frameData6 == null) {
i14 = 0;
} else {
this.u32AVFramePTS1 = frameData6.getTimeStamp();
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis < j4) {
currentTimeMillis += 1000;
}
if (hiThread.isRunning && !this.isSeek && this.savespeed == 0) {
int i23 = (this.u32AVFramePTS1 - i21) - ((int) (currentTimeMillis - j4));
StringBuilder sb = new StringBuilder();
sb.append("dec ----- start ");
sb.append(j4);
str5 = ":::";
sb.append(str5);
sb.append(currentTimeMillis);
sb.append(str5);
sb.append(this.u32AVFramePTS1);
sb.append(str5);
sb.append(i21);
sb.append(str5);
sb.append(i23);
sb.append(str5);
sb.append(this.isSeek);
HiLog.e(sb.toString());
if (i23 > 0 && i23 < 1000) {
hiThread.sleep(i23);
} else if (i23 > 1000) {
hiThread.sleep(500);
}
} else if (hiThread.isRunning) {
int i24 = this.saveInterval;
int i25 = ((this.u32AVFramePTS1 - i21) * i24) / 40;
int i26 = this.savespeed;
if (i26 == 1) {
if (i24 != 0) {
long j5 = currentTimeMillis - j4;
if (i25 > j5) {
hiThread.sleep(i25 - ((int) j5));
}
}
} else if (i26 == 2) {
if (i24 != 0) {
long j6 = currentTimeMillis - j4;
if (i25 > j6) {
hiThread.sleep(i25 - ((int) j6));
}
}
} else if (i26 > 2 && i24 != 0 && this.mThreadDecodeVideoCloud != null && frameData6.isIFrame()) {
DecodeSleep(this.mThreadDecodeVideoCloud, (int) (currentTimeMillis - j4));
}
}
i6 = this.u32AVFramePTS1;
j = System.currentTimeMillis();
frameData = frameData6;
i7 = 0;
}
} else {
i6 = i21;
i7 = i22;
frameData = frameData6;
j = j4;
}
if (this.isqueueenpty && !frameData.isIFrame()) {
hiThread.sleep(20);
frameData6 = frameData;
j4 = j;
i21 = i6;
i22 = 1;
} else {
if (true == this.isqueueenpty) {
this.isqueueenpty = false;
}
int i27 = 2 == i7 ? 0 : i7;
if (frameData.getFrmSize() > 0) {
if (!this.is2Mp4) {
if (!z) {
if (frameData.isIFrame()) {
z = true;
}
}
int timeStamp = frameData.getTimeStamp();
if (!hiThread.isRunning) {
break;
}
int HIH264Dec_decoder = H264Decoder.HIH264Dec_decoder(jArr3[0], frameData.frmData, frameData.getFrmSize(), this.videowidth, this.videoheight, this.yuvBuffer, frameData.isIFrame());
if (!hiThread.isRunning) {
break;
}
if (HIH264Dec_decoder == 0 && !this.isDisplayFrist) {
this.isDisplayFrist = true;
}
if (this.mMonitorview == null || HIH264Dec_decoder != 0) {
frameData4 = frameData;
str2 = "dec ----- start ";
j3 = j;
if (HIH264Dec_decoder < -100) {
this.mDeciveInfo.setDeviceDecode5(false);
}
} else {
if (!z || bool2.booleanValue()) {
i10 = HIH264Dec_decoder;
str2 = "dec ----- start ";
j3 = j;
i11 = 1;
frameData5 = frameData;
} else {
HiLog.e("PlayOSSFileCallback.PLAYLOCAL_STATE_START::::" + this.videowidth + "::::" + this.videoheight, 1, 0);
if (this.mFirstTime == 0) {
this.mFirstTime = frameData.getTimeStamp();
}
i10 = HIH264Dec_decoder;
str2 = "dec ----- start ";
j3 = j;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, frameData.getTimeStamp(), this.audiotype, 1);
i11 = 1;
frameData5 = frameData;
bool2 = true;
}
int i28 = this.mShownum;
if (i28 == 0 || i28 == i11) {
if (this.isDualThrid) {
byte[] bArr = this.yuvBuffer;
int i29 = this.videoheight;
HiCoderBitmap.YUVCut(bArr, 0, i29 / 4, this.videowidth, i29, this.mCutw, this.mCuth, this.yuvBuffer2);
if (hiThread.isRunning) {
this.mMonitorview.setYuvFrameData(this.yuvBuffer2, this.mCutw, this.mCuth);
if (this.mMonitor3view != null) {
byte[] bArr2 = this.yuvBuffer;
int i30 = this.videowidth;
int i31 = this.videoheight;
HiCoderBitmap.YUVCut(bArr2, (int) (i30 * 0.3d), i31 / 4, i30, i31, this.mCut2w, this.mCut2h, this.yuvBuffer3);
if (hiThread.isRunning) {
this.mMonitor3view.setYuvFrameData(this.yuvBuffer3, this.mCut2w, this.mCut2h);
}
}
}
yuvFrameData = i10;
} else {
yuvFrameData = this.mMonitorview.setYuvFrameData(this.yuvBuffer, this.videowidth, this.videoheight);
}
if (yuvFrameData < 0) {
HiLog.e(str, 1, 1);
frameData4 = frameData5;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, frameData5.getTimeStamp(), this.audiotype, 5);
}
}
frameData4 = frameData5;
}
this.subtime = (frameData4.getTimeStamp() - this.mFirstTime) / 1000;
if (this.isH265DevDec && this.savespeed > 2) {
if (frameData4.isIFrame()) {
bool = bool2;
i8 = 1000;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, frameData4.getTimeStamp(), this.audiotype, 2);
} else {
bool = bool2;
i8 = 1000;
}
} else {
bool = bool2;
i8 = 1000;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, frameData4.getTimeStamp(), this.audiotype, 2);
}
FrameQueue frameQueue3 = this.mossVideoFrameQueue;
if (frameQueue3 == null || frameQueue3.getCount() <= 0) {
j4 = j3;
i21 = timeStamp;
i2 = 2;
frameData6 = frameData4;
bool2 = bool;
i22 = 1;
} else {
frameData6 = this.mossVideoFrameQueue.removeHead();
if (frameData6 == null) {
HiLog.e("======== ThreadDecodeVideo mVideoFrameQueue.removeHead end ========", 1, 0);
i14 = 0;
i21 = timeStamp;
bool2 = bool;
j4 = j3;
i22 = 1;
i2 = 2;
} else {
this.u32AVFramePTS1 = frameData6.getTimeStamp();
long currentTimeMillis2 = System.currentTimeMillis();
long j7 = j3;
if (currentTimeMillis2 < j7) {
currentTimeMillis2 += 1000;
}
if (hiThread.isRunning && !this.isSeek && this.savespeed == 0) {
int i32 = (this.u32AVFramePTS1 - timeStamp) - ((int) (currentTimeMillis2 - j7));
HiLog.e(str2 + j7 + str5 + currentTimeMillis2 + str5 + this.u32AVFramePTS1 + str5 + timeStamp + str5 + i32 + str5 + this.isSeek);
if (i32 > 0 && i32 < i8) {
hiThread.sleep(i32);
} else if (i32 > i8) {
hiThread.sleep(500);
}
} else if (hiThread.isRunning) {
int i33 = this.saveInterval;
int i34 = ((this.u32AVFramePTS1 - timeStamp) * i33) / 40;
int i35 = this.savespeed;
if (i35 == 1) {
if (i33 != 0) {
long j8 = currentTimeMillis2 - j7;
if (i34 > j8) {
hiThread.sleep(i34 - ((int) j8));
}
}
} else if (i35 != 2) {
i9 = 2;
if (i35 > 2 && i33 != 0 && this.mThreadDecodeVideoCloud != null && frameData6.isIFrame()) {
DecodeSleep(this.mThreadDecodeVideoCloud, (int) (currentTimeMillis2 - j7));
}
i21 = this.u32AVFramePTS1;
j4 = j7;
i22 = i9;
i2 = i22;
bool2 = bool;
} else if (i33 != 0) {
long j9 = currentTimeMillis2 - j7;
if (i34 > j9) {
hiThread.sleep(i34 - ((int) j9));
}
}
}
i9 = 2;
i21 = this.u32AVFramePTS1;
j4 = j7;
i22 = i9;
i2 = i22;
bool2 = bool;
}
}
i14 = 0;
} else {
FrameData frameData7 = frameData;
this.writemp4lock.lock();
if (this.mp4_handle[0] != 0) {
if (frameData7.isIFrame()) {
frameData3 = frameData7;
EncMp4.HIEncMp4write(this.mp4_handle[0], frameData3.frmData, frameData3.getFrmSize(), 0, frameData3.getTimeStamp(), 0);
} else {
frameData3 = frameData7;
EncMp4.HIEncMp4write(this.mp4_handle[0], frameData3.frmData, frameData3.getFrmSize(), 1, frameData3.getTimeStamp(), 0);
}
ThreadDecodeVideoCloud threadDecodeVideoCloud = this.mThreadDecodeVideoCloud;
if (threadDecodeVideoCloud != null) {
threadDecodeVideoCloud.sleep(1);
}
} else {
frameData3 = frameData7;
}
this.writemp4lock.unlock();
jArr2 = jArr3;
frameData2 = frameData3;
j2 = j;
setplaylocal(1, this.videowidth, this.videoheight, this.filetime, frameData3.getTimeStamp(), this.audiotype, 12);
i21 = i6;
j4 = j2;
i22 = i27;
jArr3 = jArr2;
frameData6 = frameData2;
}
}
frameData2 = frameData;
jArr2 = jArr3;
j2 = j;
i21 = i6;
j4 = j2;
i22 = i27;
jArr3 = jArr2;
frameData6 = frameData2;
}
i2 = 2;
i14 = 0;
}
} else if (hiThread.isRunning) {
HiLog.e(str, 1, i14);
if (this.isPlayEnd && (frameQueue2 = this.mossVideoFrameQueue) != null && frameQueue2.getCount() == 0) {
hiThread.sleep(100);
break;
} else if (this.isPlayStop) {
break;
} else {
hiThread.sleep(20);
}
} else {
continue;
}
}
}
hiThread.sleep(i5);
jArr3 = jArr;
i2 = 2;
i14 = 0;
}
long[] jArr4 = jArr3;
if (!this.is2Mp4) {
H264Decoder.HIH264Dec_uninit(jArr4[0]);
if (this.isPlayEnd) {
i4 = 3;
} else {
i4 = this.isPlayStop ? i : -1;
}
int i36 = this.videowidth;
int i37 = this.videoheight;
int i38 = this.filetime;
setplaylocal(1, i36, i37, i38, i38, this.audiotype, i4);
} else {
if (this.isPlayEnd) {
i3 = 13;
} else {
i3 = this.isPlayStop ? 14 : -11;
}
int i39 = i3;
this.writemp4lock.lock();
long[] jArr5 = this.mp4_handle;
if (jArr5[0] != 0) {
EncMp4.HIEncMp4deinit(jArr5[0]);
this.mp4_handle[0] = 0;
}
this.writemp4lock.unlock();
int i40 = this.videowidth;
int i41 = this.videoheight;
int i42 = this.filetime;
setplaylocal(1, i40, i41, i42, i42, this.audiotype, i39);
}
HiLog.e("======== ThreadDecodeVideo end ========", 1, 0);
}
public class ThreadDecodeVideoCloud extends HiThread {
private ThreadDecodeVideoCloud() {
}
public byte[] getYuvBuffer() {
return HiPlayOSSDualSDK.this.yuvBuffer;
}
public byte[] getYuvBuffer2() {
return HiPlayOSSDualSDK.this.yuvBuffer2;
}
public byte[] getYuvBuffer3() {
return HiPlayOSSDualSDK.this.yuvBuffer3;
}
@Override
public void run() {
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK.DoDecodeVideo(hiPlayOSSDualSDK.mThreadDecodeVideoCloud);
}
}
public void DoDecode2Video(HiThread hiThread) {
String str;
int i;
int i2;
int i3;
int i4;
Boolean bool;
int i5;
FrameData frameData;
int i6;
int i7;
long j;
Boolean bool2;
FrameData frameData2;
long j2;
FrameData frameData3;
String str2;
int i8;
FrameData frameData4;
String str3;
int i9;
long j3;
FrameData frameData5;
FrameQueue frameQueue;
FrameQueue frameQueue2;
int i10;
int HIH264Dec_init;
int i11;
int i12 = 0;
HiLog.e("======== ThreadDecode2Video start ========", 1, 0);
long[] jArr = new long[1];
Boolean bool3 = false;
Boolean.valueOf(true);
int i13 = this.videoheight;
if (i13 < 0 || (i11 = this.videowidth) < 0 || i13 > 5000 || i11 > 5000) {
hiThread.isRunning = false;
}
int i14 = ((this.videowidth * this.videoheight) * 3) / 2;
FrameData frameData6 = null;
int i15 = Build.VERSION.SDK_INT;
if (!hiThread.isRunning || this.is2Mp4 || i14 <= 0) {
str = "";
i = 4;
i2 = 5;
} else {
byte[] MallocByte = Packet.MallocByte(i14);
this.yuv2Buffer = MallocByte;
if (MallocByte == null) {
HiLog.e("", 1, 1);
str = "";
i2 = 5;
i10 = i15;
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, 0L, this.audiotype, -1);
hiThread.isRunning = false;
} else {
str = "";
i2 = 5;
i10 = i15;
}
if (this.videotype != i2) {
this.videotype = 4;
}
if (this.DecodeVideoType != 1) {
this.DecodeVideoType = 0;
}
if (this.DecodeViVoVideoType == 1) {
int i16 = this.videotype;
if (i16 == 4) {
if (i10 < 16 || this.DecodeVideoType == 0) {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr, 0, i16);
} else {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr, 1, i16);
}
} else if (i10 < 23) {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr, 0, i16);
} else {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr, 1, i16);
}
} else {
HIH264Dec_init = H264Decoder.HIH264Dec_init(jArr, 0, this.videotype);
}
if (HIH264Dec_init < 0) {
HiLog.e(str, 1, 1);
hiThread.isRunning = false;
if (this.videotype == i2) {
i = 4;
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, 0L, this.audiotype, -5);
} else {
i = 4;
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, 0L, this.audiotype, -4);
}
} else {
i = 4;
}
}
int i17 = 0;
int i18 = 0;
boolean z = false;
long j4 = 0;
while (true) {
if (!hiThread.isRunning) {
break;
}
if (!this.isPlaying) {
bool = bool3;
i5 = 20;
} else if (this.mossVideo2FrameQueue == null) {
i5 = 20;
bool = bool3;
} else {
if (this.videotype == i2 && this.mDeciveInfo.getDeviceDecode5() != this.isDeviceDecode5) {
this.isDeviceDecode5 = this.mDeciveInfo.getDeviceDecode5();
H264Decoder.HIH264Dec_uninit(jArr[i12]);
H264Decoder.HIH264Dec_init(jArr, i12, this.videotype);
}
if (this.isDisplayFrist && this.isLoading_FLAG) {
hiThread.sleep(20);
bool = bool3;
} else {
if (1 != i18) {
j4 = System.currentTimeMillis();
}
if (i18 == 2 || ((frameQueue = this.mossVideo2FrameQueue) != null && frameQueue.getCount() > 0)) {
if (i17 != 0 || (frameData6 = this.mossVideo2FrameQueue.removeHead()) != null) {
if (1 == i18) {
frameData6 = this.mossVideo2FrameQueue.removeHead();
if (frameData6 == null) {
i2 = 5;
i12 = 0;
} else {
this.u32AVFramePTS1 = frameData6.getTimeStamp();
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis < j4) {
currentTimeMillis += 1000;
}
long j5 = currentTimeMillis;
if (hiThread.isRunning && !this.isSeek && this.savespeed == 0) {
int i19 = (this.u32AVFramePTS1 - i17) - ((int) (j5 - j4));
HiLog.e("dec ----- start " + j4 + ":::" + j5 + ":::" + this.u32AVFramePTS1 + ":::" + i17 + ":::" + i19 + ":::" + this.isSeek);
if (i19 > 0 && i19 < 1000) {
hiThread.sleep(i19);
} else if (i19 > 1000) {
hiThread.sleep(500);
}
} else if (hiThread.isRunning) {
int i20 = this.saveInterval;
int i21 = ((this.u32AVFramePTS1 - i17) * i20) / 40;
int i22 = this.savespeed;
if (i22 == 1) {
if (i20 != 0) {
long j6 = j5 - j4;
if (i21 > j6) {
hiThread.sleep(i21 - ((int) j6));
}
}
} else if (i22 == 2) {
if (i20 != 0) {
long j7 = j5 - j4;
if (i21 > j7) {
hiThread.sleep(i21 - ((int) j7));
}
}
} else if (i22 > 2 && i20 != 0 && this.mThreadDecode2VideoCloud != null && frameData6.isIFrame()) {
DecodeSleep(this.mThreadDecode2VideoCloud, (int) (j5 - j4));
}
}
int i23 = this.u32AVFramePTS1;
j = System.currentTimeMillis();
frameData = frameData6;
i6 = i23;
i7 = 0;
}
} else {
frameData = frameData6;
i6 = i17;
i7 = i18;
j = j4;
}
if (this.isqueueenpty && !frameData.isIFrame()) {
hiThread.sleep(20);
j4 = j;
i17 = i6;
i18 = 1;
i2 = 5;
i12 = 0;
frameData6 = frameData;
} else {
if (true == this.isqueueenpty) {
this.isqueueenpty = false;
}
int i24 = 2 == i7 ? 0 : i7;
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(frameData.getFrmSize());
sb.append("::");
sb.append(frameData.getFrameFlag());
sb.append("::");
sb.append(frameData.getTimeStamp());
sb.append("getCount:");
FrameQueue frameQueue3 = this.mossVideo2FrameQueue;
sb.append(frameQueue3 != null ? frameQueue3.getCount() : -1);
sb.append(":::::");
sb.append(this.mossAudioFrameQueue.getCount());
sb.append("::");
sb.append(this.isDisplayFrist);
sb.append(":::");
sb.append(frameData.isIFrame());
HiLog.e(sb.toString(), 1, 0);
if (frameData.getFrmSize() > 0) {
if (!this.is2Mp4) {
if (!z) {
if (frameData.isIFrame()) {
z = true;
}
}
int timeStamp = frameData.getTimeStamp();
if (!hiThread.isRunning) {
break;
}
int HIH264Dec_decoder = H264Decoder.HIH264Dec_decoder(jArr[0], frameData.frmData, frameData.getFrmSize(), this.videowidth, this.videoheight, this.yuv2Buffer, frameData.isIFrame());
if (!hiThread.isRunning) {
break;
}
if (HIH264Dec_decoder == 0 && !this.isDisplayFrist) {
this.isDisplayFrist = true;
}
if (this.mMonitor2view == null || HIH264Dec_decoder != 0) {
str2 = "dec ----- start ";
i8 = timeStamp;
frameData4 = frameData;
str3 = ":::";
bool = bool3;
i9 = 2;
j3 = j;
if (HIH264Dec_decoder < -100) {
this.mDeciveInfo.setDeviceDecode5(false);
}
} else {
if (!z || bool3.booleanValue()) {
str2 = "dec ----- start ";
i8 = timeStamp;
str3 = ":::";
bool = bool3;
i9 = 2;
j3 = j;
frameData5 = frameData;
} else {
HiLog.e("PlayOSSFileCallback.PLAYLOCAL_STATE_START::::" + this.videowidth + "::::" + this.videoheight, 1, 0);
if (this.mFirstTime == 0) {
this.mFirstTime = frameData.getTimeStamp();
}
str3 = ":::";
str2 = "dec ----- start ";
i8 = timeStamp;
j3 = j;
i9 = 2;
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, frameData.getTimeStamp(), this.audiotype, 1);
frameData5 = frameData;
bool = true;
}
int i25 = this.mShownum;
if ((i25 == 0 || i25 == i9) && this.mMonitor2view.setYuvFrameData(this.yuv2Buffer, this.videowidth, this.videoheight) < 0) {
HiLog.e(str, 1, 1);
frameData4 = frameData5;
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, frameData5.getTimeStamp(), this.audiotype, 5);
} else {
frameData4 = frameData5;
}
}
this.subtime = (frameData4.getTimeStamp() - this.mFirstTime) / 1000;
if (this.isH265DevDec && this.savespeed > i9) {
if (frameData4.isIFrame()) {
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, frameData4.getTimeStamp(), this.audiotype, 2);
}
} else {
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, frameData4.getTimeStamp(), this.audiotype, 2);
}
FrameQueue frameQueue4 = this.mossVideo2FrameQueue;
if (frameQueue4 == null || frameQueue4.getCount() <= 0) {
i17 = i8;
j4 = j3;
bool3 = bool;
frameData6 = frameData4;
i18 = 1;
i2 = 5;
i12 = 0;
} else {
frameData6 = this.mossVideo2FrameQueue.removeHead();
if (frameData6 == null) {
HiLog.e("======== ThreadDecodeVideo mVideoFrameQueue.removeHead end ========", 1, 0);
bool3 = bool;
i17 = i8;
i18 = 1;
i12 = 0;
j4 = j3;
i2 = 5;
} else {
this.u32AVFramePTS1 = frameData6.getTimeStamp();
long currentTimeMillis2 = System.currentTimeMillis();
if (currentTimeMillis2 < j3) {
currentTimeMillis2 += 1000;
}
if (hiThread.isRunning && !this.isSeek && this.savespeed == 0) {
int i26 = i8;
int i27 = (this.u32AVFramePTS1 - i26) - ((int) (currentTimeMillis2 - j3));
StringBuilder sb2 = new StringBuilder();
sb2.append(str2);
sb2.append(j3);
String str4 = str3;
sb2.append(str4);
sb2.append(currentTimeMillis2);
sb2.append(str4);
sb2.append(this.u32AVFramePTS1);
sb2.append(str4);
sb2.append(i26);
sb2.append(str4);
sb2.append(i27);
sb2.append(str4);
sb2.append(this.isSeek);
HiLog.e(sb2.toString());
if (i27 > 0 && i27 < 1000) {
hiThread.sleep(i27);
} else if (i27 > 1000) {
hiThread.sleep(500);
}
} else {
int i28 = i8;
if (hiThread.isRunning) {
int i29 = this.saveInterval;
int i30 = ((this.u32AVFramePTS1 - i28) * i29) / 40;
int i31 = this.savespeed;
if (i31 == 1) {
if (i29 != 0) {
long j8 = currentTimeMillis2 - j3;
if (i30 > j8) {
hiThread.sleep(i30 - ((int) j8));
}
}
} else if (i31 == i9) {
if (i29 != 0) {
long j9 = currentTimeMillis2 - j3;
if (i30 > j9) {
hiThread.sleep(i30 - ((int) j9));
}
}
} else if (i31 > i9 && i29 != 0 && this.mThreadDecode2VideoCloud != null && frameData6.isIFrame()) {
DecodeSleep(this.mThreadDecode2VideoCloud, (int) (currentTimeMillis2 - j3));
}
}
}
i17 = this.u32AVFramePTS1;
j4 = j3;
i18 = i9;
}
}
} else {
FrameData frameData7 = frameData;
j2 = j;
bool2 = bool3;
this.writemp4lock.lock();
if (this.mp4_2handle[0] != 0) {
if (frameData7.isIFrame()) {
frameData3 = frameData7;
EncMp4.HIEncMp4write(this.mp4_2handle[0], frameData3.frmData, frameData3.getFrmSize(), 0, frameData3.getTimeStamp(), 0);
} else {
frameData3 = frameData7;
EncMp4.HIEncMp4write(this.mp4_2handle[0], frameData3.frmData, frameData3.getFrmSize(), 1, frameData3.getTimeStamp(), 0);
}
ThreadDecode2VideoCloud threadDecode2VideoCloud = this.mThreadDecode2VideoCloud;
if (threadDecode2VideoCloud != null) {
threadDecode2VideoCloud.sleep(1);
}
} else {
frameData3 = frameData7;
}
this.writemp4lock.unlock();
frameData2 = frameData3;
setplaylocal(2, this.videowidth, this.videoheight, this.filetime, frameData3.getTimeStamp(), this.audiotype, 12);
j4 = j2;
i17 = i6;
frameData6 = frameData2;
bool3 = bool2;
i18 = i24;
i2 = 5;
i12 = 0;
}
}
frameData2 = frameData;
j2 = j;
bool2 = bool3;
j4 = j2;
i17 = i6;
frameData6 = frameData2;
bool3 = bool2;
i18 = i24;
i2 = 5;
i12 = 0;
}
}
} else if (hiThread.isRunning) {
HiLog.e(str, 1, i12);
if (this.isPlayEnd && (frameQueue2 = this.mossVideo2FrameQueue) != null && frameQueue2.getCount() == 0) {
hiThread.sleep(100);
break;
} else if (this.isPlayStop) {
break;
} else {
hiThread.sleep(20);
}
} else {
continue;
}
}
bool3 = bool;
i2 = 5;
i12 = 0;
}
hiThread.sleep(i5);
bool3 = bool;
i2 = 5;
i12 = 0;
}
if (!this.is2Mp4) {
H264Decoder.HIH264Dec_uninit(jArr[0]);
if (this.isPlayEnd) {
i4 = 3;
} else {
i4 = this.isPlayStop ? i : -1;
}
int i32 = this.videowidth;
int i33 = this.videoheight;
int i34 = this.filetime;
setplaylocal(2, i32, i33, i34, i34, this.audiotype, i4);
} else {
if (this.isPlayEnd) {
i3 = 13;
} else {
i3 = this.isPlayStop ? 14 : -11;
}
int i35 = i3;
this.writemp4lock.lock();
long[] jArr2 = this.mp4_2handle;
if (jArr2[0] != 0) {
EncMp4.HIEncMp4deinit(jArr2[0]);
this.mp4_2handle[0] = 0;
}
this.writemp4lock.unlock();
int i36 = this.videowidth;
int i37 = this.videoheight;
int i38 = this.filetime;
setplaylocal(2, i36, i37, i38, i38, this.audiotype, i35);
}
HiLog.e("======== ThreadDecode2Video end ========", 1, 0);
}
public class ThreadDecode2VideoCloud extends HiThread {
private ThreadDecode2VideoCloud() {
}
public byte[] getYuvBuffer() {
return HiPlayOSSDualSDK.this.yuv2Buffer;
}
@Override
public void run() {
HiPlayOSSDualSDK hiPlayOSSDualSDK = HiPlayOSSDualSDK.this;
hiPlayOSSDualSDK.DoDecode2Video(hiPlayOSSDualSDK.mThreadDecode2VideoCloud);
}
}
public static void renameFile(String str, String str2) {
HiLog.e(str, 1, 0);
HiLog.e(str2, 1, 0);
new File(str).renameTo(new File(str2));
}
boolean delFile(String str) {
File file = new File(str);
if (!file.exists()) {
return false;
}
if (file.isDirectory()) {
for (File file2 : file.listFiles()) {
delFile(file2.getPath());
}
}
return file.delete();
}
public HiConfig getHiConfig() {
if (this.mhiConfig == null) {
HiConfig hiConfig = new HiConfig();
this.mhiConfig = hiConfig;
hiConfig.setOSS_UUID("BBBB-000000-CDEFG");
}
return this.mhiConfig;
}
public class ThreadOSSFileList extends HiThread {
private ThreadOSSFileList() {
}
@Override
public void run() {
if (HiPlayOSSDualSDK.this.mhiConfig != null) {
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_objectKey(), 1, 0);
HiPlayOSSDualSDK.this.mhiCloud.GetOSSFilelist(HiPlayOSSDualSDK.this.mhiConfig, HiPlayOSSDualSDK.this.cumhandler, 28672);
}
}
}
public class ThreadOSSdoesobj extends HiThread {
private ThreadOSSdoesobj() {
}
@Override
public void run() {
if (HiPlayOSSDualSDK.this.mhiConfig != null) {
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
HiLog.e(HiPlayOSSDualSDK.this.mhiConfig.getOSS_objectKey(), 1, 0);
HiPlayOSSDualSDK.this.mhiCloud.GetOSSdoesObject(HiPlayOSSDualSDK.this.mhiConfig, HiPlayOSSDualSDK.this.cumhandler, 28928);
}
}
}
public void GetOSSFilelistExt(String str, int i) {
String replaceAll;
HiLog.e("" + i, 1, 0);
if (i != 0) {
this.mcumCounttry = 0;
}
if (this.mhiConfig != null) {
HiLog.e("" + str + "::::" + this.isPlayStop, 1, 0);
if (i != 0) {
if (str != null) {
this.mhiConfig.setOSS_objectKey(str);
} else {
HiConfig hiConfig = this.mhiConfig;
hiConfig.setOSS_objectKey(hiConfig.getOSS_UUID());
}
}
if (this.mIsOCloud) {
int indexOf = this.mhiConfig.getOSS_objectKey().indexOf(Const.Config.DB_NAME_SUFFIX);
String bucket_name = this.mhiConfig.getBUCKET_NAME();
HiLog.e(indexOf + ":::" + bucket_name, 1, 0);
if (indexOf > 0) {
replaceAll = bucket_name.replaceAll("-rec", "-db");
} else {
replaceAll = bucket_name.replaceAll("-db", "-rec");
}
this.mhiConfig.setBUCKET_NAME(replaceAll);
}
HiLog.e(this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
if (System.currentTimeMillis() - this.mSaveOssGetTime > 3600000 - this.mSetOsstime) {
if (this.mIsOCloud) {
Timer timer = this.mUidEXIPREtimer;
if (timer != null) {
timer.cancel();
}
this.mUidEXIPREtimer = null;
this.mhiCloudsdk.HiCloudSDKgetOCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
} else {
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
}
this.mOssOperation = 5;
return;
}
ThreadOSSFileList threadOSSFileList = this.mthreadossfilelist;
if (threadOSSFileList != null) {
threadOSSFileList.weakup();
this.mthreadossfilelist.stopThread();
this.mthreadossfilelist = null;
}
if (this.mthreadossfilelist == null) {
ThreadOSSFileList threadOSSFileList2 = new ThreadOSSFileList();
this.mthreadossfilelist = threadOSSFileList2;
threadOSSFileList2.startThread();
}
}
}
public void GetOSSdoesObjectExt(String str, int i) {
String replaceAll;
HiLog.e("" + i, 1, 0);
if (i != 0) {
this.mcumCounttry = 0;
}
if (this.mhiConfig != null) {
HiLog.e("" + str + "::::" + this.isPlayStop, 1, 0);
if (i != 0) {
if (str != null) {
this.mhiConfig.setOSS_objectKey(str);
} else {
HiConfig hiConfig = this.mhiConfig;
hiConfig.setOSS_objectKey(hiConfig.getOSS_UUID());
}
}
if (this.mIsOCloud) {
int indexOf = this.mhiConfig.getOSS_objectKey().indexOf(Const.Config.DB_NAME_SUFFIX);
String bucket_name = this.mhiConfig.getBUCKET_NAME();
HiLog.e(indexOf + ":::" + bucket_name, 1, 0);
if (indexOf > 0) {
replaceAll = bucket_name.replaceAll("-rec", "-db");
} else {
replaceAll = bucket_name.replaceAll("-db", "-rec");
}
this.mhiConfig.setBUCKET_NAME(replaceAll);
}
HiLog.e(this.mhiConfig.getOSS_ENDPOINT(), 1, 0);
HiLog.e(this.mhiConfig.getBUCKET_NAME(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_ID(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_KEY_SECRET(), 1, 0);
HiLog.e(this.mhiConfig.getOSS_ACCESS_TOKEN(), 1, 0);
if (System.currentTimeMillis() - this.mSaveOssGetTime > 3600000 - this.mSetOsstime) {
if (this.mIsOCloud) {
Timer timer = this.mUidEXIPREtimer;
if (timer != null) {
timer.cancel();
}
this.mUidEXIPREtimer = null;
this.mhiCloudsdk.HiCloudSDKgetOCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
} else {
this.mhiCloudsdk.HiCloudSDKgetCloudinfo(this, 1, this.mhiConfig.getOSS_UUID(), this.mhiCloudname, this.mhiCloudpwd, this.mhiCloudKey, this.mhiCloudSer, this.mhiCloudport, (short) 5);
}
this.mOssOperation = 6;
return;
}
ThreadOSSdoesobj threadOSSdoesobj = this.mthreadossdoesobj;
if (threadOSSdoesobj != null) {
threadOSSdoesobj.weakup();
this.mthreadossdoesobj.stopThread();
this.mthreadossdoesobj = null;
}
if (this.mthreadossdoesobj == null) {
ThreadOSSdoesobj threadOSSdoesobj2 = new ThreadOSSdoesobj();
this.mthreadossdoesobj = threadOSSdoesobj2;
threadOSSdoesobj2.startThread();
}
}
}
}