Fix live crash on arm64_v8a

pull/137/head
FongMi 3 years ago
parent 6d8c334868
commit 9aac01e13e
  1. 10
      app/src/main/java/com/fongmi/android/tv/bean/Core.java
  2. 8
      app/src/main/java/com/fongmi/android/tv/model/LiveViewModel.java
  3. 14
      app/src/main/java/com/fongmi/android/tv/player/source/TVBus.java
  4. 7
      forcetech/src/main/java/com/gsoft/mitv/MainActivity.java
  5. 99
      tvbus/src/main/java/com/tvbus/engine/TVCore.java

@ -1,5 +1,7 @@
package com.fongmi.android.tv.bean;
import android.text.TextUtils;
import com.google.gson.annotations.SerializedName;
public class Core {
@ -14,18 +16,18 @@ public class Core {
private String broker;
public String getAuth() {
return auth;
return TextUtils.isEmpty(auth) ? "" : auth;
}
public String getName() {
return name;
return TextUtils.isEmpty(name) ? "" : name;
}
public String getPass() {
return pass;
return TextUtils.isEmpty(pass) ? "" : pass;
}
public String getBroker() {
return broker;
return TextUtils.isEmpty(broker) ? "" : broker;
}
}

@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModel;
import com.fongmi.android.tv.Constant;
import com.fongmi.android.tv.api.LiveParser;
import com.fongmi.android.tv.bean.Channel;
import com.fongmi.android.tv.bean.Group;
import com.fongmi.android.tv.bean.Live;
import com.fongmi.android.tv.player.source.BiliBili;
import com.fongmi.android.tv.player.source.Force;
@ -13,6 +14,7 @@ import com.fongmi.android.tv.player.source.TVBus;
import com.fongmi.android.tv.player.source.Youtube;
import com.fongmi.android.tv.player.source.ZLive;
import java.util.Iterator;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -35,10 +37,16 @@ public class LiveViewModel extends ViewModel {
public void getLive(Live item) {
execute(LIVE, () -> {
LiveParser.start(item);
verify(item);
return item;
});
}
private void verify(Live item) {
Iterator<Group> iterator = item.getGroups().iterator();
while (iterator.hasNext()) if (iterator.next().getChannel().isEmpty()) iterator.remove();
}
public void getUrl(Channel item) {
execute(CHANNEL, () -> {
TVBus.get().stop();

@ -21,10 +21,16 @@ public class TVBus implements Listener {
}
private void init(Core core) {
if (core == null) return;
tvcore = new TVCore().listener(this);
tvcore.auth(core.getAuth()).name(core.getName()).pass(core.getPass()).broker(core.getBroker());
tvcore.serv(0).play(8902).mode(1).init(App.get());
tvcore = new TVCore();
tvcore.listener(this);
tvcore.auth(core.getAuth());
tvcore.name(core.getName());
tvcore.pass(core.getPass());
tvcore.broker(core.getBroker());
tvcore.serv(0);
tvcore.play(8902);
tvcore.mode(1);
tvcore.init(App.get());
}
public String fetch(String url) throws InterruptedException {

@ -12,8 +12,11 @@ public class MainActivity extends Service {
private ForceTV forceTV;
private IBinder binder;
static {
System.loadLibrary("mitv");
public MainActivity() {
try {
System.loadLibrary("mitv");
} catch (Throwable ignored) {
}
}
@Override

@ -5,71 +5,104 @@ import android.text.TextUtils;
public class TVCore {
private final long handle;
private long handle;
public TVCore() {
PmsHook.inject();
System.loadLibrary("tvcore");
handle = initialise();
try {
PmsHook.inject();
System.loadLibrary("tvcore");
handle = initialise();
} catch (Throwable ignored) {
}
}
public TVCore listener(Listener listener) {
setListener(handle, listener);
return this;
public void listener(Listener listener) {
try {
setListener(handle, listener);
} catch (Throwable ignored) {
}
}
public TVCore play(int port) {
setPlayPort(handle, port);
return this;
public void play(int port) {
try {
setPlayPort(handle, port);
} catch (Throwable ignored) {
}
}
public TVCore serv(int port) {
setServPort(handle, port);
return this;
public void serv(int port) {
try {
setServPort(handle, port);
} catch (Throwable ignored) {
}
}
public TVCore mode(int mode) {
setRunningMode(handle, mode);
return this;
public void mode(int mode) {
try {
setRunningMode(handle, mode);
} catch (Throwable ignored) {
}
}
public TVCore auth(String str) {
if (!TextUtils.isEmpty(str)) setAuthUrl(handle, str);
return this;
public void auth(String str) {
try {
setAuthUrl(handle, str);
} catch (Throwable ignored) {
}
}
public TVCore broker(String str) {
if (!TextUtils.isEmpty(str)) setMKBroker(handle, str);
return this;
public void broker(String str) {
try {
setMKBroker(handle, str);
} catch (Throwable ignored) {
}
}
public TVCore name(String str) {
if (!TextUtils.isEmpty(str)) setUsername(handle, str);
return this;
public void name(String str) {
try {
setUsername(handle, str);
} catch (Throwable ignored) {
}
}
public TVCore pass(String str) {
if (!TextUtils.isEmpty(str)) setPassword(handle, str);
return this;
public void pass(String str) {
try {
setPassword(handle, str);
} catch (Throwable ignored) {
}
}
public void init(Context context) {
new Thread(() -> {
new Thread(() -> initRun(context)).start();
}
private void initRun(Context context) {
try {
init(handle, context);
run(handle);
}).start();
} catch (Throwable ignored) {
}
}
public void start(String url) {
start(handle, url);
try {
start(handle, url);
} catch (Throwable ignored) {
}
}
public void stop() {
stop(handle);
try {
stop(handle);
} catch (Throwable ignored) {
}
}
public void quit() {
quit(handle);
try {
quit(handle);
} catch (Throwable ignored) {
}
}
private native long initialise();

Loading…
Cancel
Save