pull/171/head
FongMi 2 years ago
parent 400c3f4ded
commit 713f088ac1
  1. 2
      .gitignore
  2. 2
      app/build.gradle
  3. 20
      app/schemas/com.fongmi.android.tv.db.AppDatabase/26.json
  4. 14
      app/src/main/java/com/fongmi/android/tv/bean/Site.java
  5. 13
      app/src/main/java/com/fongmi/android/tv/db/AppDatabase.java
  6. 4
      app/src/main/java/com/fongmi/android/tv/player/ExoUtil.java
  7. 1
      app/src/main/java/com/fongmi/android/tv/player/Players.java
  8. 8
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  9. 7
      app/src/mobile/java/com/fongmi/android/tv/ui/custom/CustomKeyDownLive.java
  10. 6
      app/src/mobile/res/layout/view_control_live_action.xml
  11. 1
      build.gradle
  12. 2
      ijkplayer/src/main/java/tv/danmaku/ijk/media/player/ui/IjkVideoView.java
  13. 1
      settings.gradle

2
.gitignore vendored

@ -3,5 +3,5 @@
*build *build
*.jks *.jks
/local.properties /local.properties
/media /media*
/Release /Release

@ -86,13 +86,13 @@ dependencies {
implementation project(':jianpian') implementation project(':jianpian')
implementation project(':forcetech') implementation project(':forcetech')
implementation project(':ijkplayer') implementation project(':ijkplayer')
implementation project(':media3ext')
pythonImplementation project(':pyramid') pythonImplementation project(':pyramid')
implementation project(':media-lib-database') implementation project(':media-lib-database')
implementation project(':media-lib-datasource') implementation project(':media-lib-datasource')
implementation project(':media-lib-datasource-okhttp') implementation project(':media-lib-datasource-okhttp')
implementation project(':media-lib-datasource-rtmp') implementation project(':media-lib-datasource-rtmp')
implementation project(':media-lib-decoder-av1') implementation project(':media-lib-decoder-av1')
implementation project(':media-lib-decoder-ffmpeg')
implementation project(':media-lib-exoplayer') implementation project(':media-lib-exoplayer')
implementation project(':media-lib-exoplayer-dash') implementation project(':media-lib-exoplayer-dash')
implementation project(':media-lib-exoplayer-hls') implementation project(':media-lib-exoplayer-hls')

@ -1,8 +1,8 @@
{ {
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 25, "version": 26,
"identityHash": "aa43d70f082d5a861c294a307ca6ce6f", "identityHash": "67f0132775fe3d51407f4715ee568544",
"entities": [ "entities": [
{ {
"tableName": "Keep", "tableName": "Keep",
@ -62,7 +62,7 @@
}, },
{ {
"tableName": "Site", "tableName": "Site",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` TEXT NOT NULL, `name` TEXT, `searchable` INTEGER, `filterable` INTEGER, `changeable` INTEGER, `recordable` INTEGER, `activated` INTEGER NOT NULL, PRIMARY KEY(`key`))", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` TEXT NOT NULL, `name` TEXT, `searchable` INTEGER, `changeable` INTEGER, `recordable` INTEGER, PRIMARY KEY(`key`))",
"fields": [ "fields": [
{ {
"fieldPath": "key", "fieldPath": "key",
@ -82,12 +82,6 @@
"affinity": "INTEGER", "affinity": "INTEGER",
"notNull": false "notNull": false
}, },
{
"fieldPath": "filterable",
"columnName": "filterable",
"affinity": "INTEGER",
"notNull": false
},
{ {
"fieldPath": "changeable", "fieldPath": "changeable",
"columnName": "changeable", "columnName": "changeable",
@ -99,12 +93,6 @@
"columnName": "recordable", "columnName": "recordable",
"affinity": "INTEGER", "affinity": "INTEGER",
"notNull": false "notNull": false
},
{
"fieldPath": "activated",
"columnName": "activated",
"affinity": "INTEGER",
"notNull": true
} }
], ],
"primaryKey": { "primaryKey": {
@ -444,7 +432,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'aa43d70f082d5a861c294a307ca6ce6f')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '67f0132775fe3d51407f4715ee568544')"
] ]
} }
} }

@ -22,7 +22,7 @@ import java.util.List;
import okhttp3.Headers; import okhttp3.Headers;
@Entity(ignoredColumns = {"api", "ext", "jar", "type", "playUrl", "timeout", "playerType", "categories", "header", "style"}) @Entity(ignoredColumns = {"api", "ext", "jar", "playUrl", "type", "timeout", "playerType", "categories", "header", "style", "activated"})
public class Site implements Parcelable { public class Site implements Parcelable {
@NonNull @NonNull
@ -48,8 +48,6 @@ public class Site implements Parcelable {
private Integer playerType; private Integer playerType;
@SerializedName("searchable") @SerializedName("searchable")
private Integer searchable; private Integer searchable;
@SerializedName("filterable")
private Integer filterable;
@SerializedName("changeable") @SerializedName("changeable")
private Integer changeable; private Integer changeable;
@SerializedName("recordable") @SerializedName("recordable")
@ -151,14 +149,6 @@ public class Site implements Parcelable {
this.searchable = searchable; this.searchable = searchable;
} }
public Integer getFilterable() {
return filterable == null ? 1 : filterable;
}
public void setFilterable(Integer filterable) {
this.filterable = filterable;
}
public Integer getChangeable() { public Integer getChangeable() {
return changeable == null ? 1 : changeable; return changeable == null ? 1 : changeable;
} }
@ -280,7 +270,6 @@ public class Site implements Parcelable {
dest.writeValue(this.timeout); dest.writeValue(this.timeout);
dest.writeValue(this.playerType); dest.writeValue(this.playerType);
dest.writeValue(this.searchable); dest.writeValue(this.searchable);
dest.writeValue(this.filterable);
dest.writeValue(this.changeable); dest.writeValue(this.changeable);
dest.writeValue(this.recordable); dest.writeValue(this.recordable);
dest.writeStringList(this.categories); dest.writeStringList(this.categories);
@ -299,7 +288,6 @@ public class Site implements Parcelable {
this.timeout = (Integer) in.readValue(Integer.class.getClassLoader()); this.timeout = (Integer) in.readValue(Integer.class.getClassLoader());
this.playerType = (Integer) in.readValue(Integer.class.getClassLoader()); this.playerType = (Integer) in.readValue(Integer.class.getClassLoader());
this.searchable = (Integer) in.readValue(Integer.class.getClassLoader()); this.searchable = (Integer) in.readValue(Integer.class.getClassLoader());
this.filterable = (Integer) in.readValue(Integer.class.getClassLoader());
this.changeable = (Integer) in.readValue(Integer.class.getClassLoader()); this.changeable = (Integer) in.readValue(Integer.class.getClassLoader());
this.recordable = (Integer) in.readValue(Integer.class.getClassLoader()); this.recordable = (Integer) in.readValue(Integer.class.getClassLoader());
this.categories = in.createStringArrayList(); this.categories = in.createStringArrayList();

@ -34,7 +34,7 @@ import java.util.Locale;
@Database(entities = {Keep.class, Site.class, Track.class, Config.class, Device.class, History.class}, version = AppDatabase.VERSION) @Database(entities = {Keep.class, Site.class, Track.class, Config.class, Device.class, History.class}, version = AppDatabase.VERSION)
public abstract class AppDatabase extends RoomDatabase { public abstract class AppDatabase extends RoomDatabase {
public static final int VERSION = 25; public static final int VERSION = 26;
public static final String NAME = "tv"; public static final String NAME = "tv";
public static final String SYMBOL = "@@@"; public static final String SYMBOL = "@@@";
@ -99,6 +99,7 @@ public abstract class AppDatabase extends RoomDatabase {
.addMigrations(MIGRATION_22_23) .addMigrations(MIGRATION_22_23)
.addMigrations(MIGRATION_23_24) .addMigrations(MIGRATION_23_24)
.addMigrations(MIGRATION_24_25) .addMigrations(MIGRATION_24_25)
.addMigrations(MIGRATION_25_26)
.allowMainThreadQueries() .allowMainThreadQueries()
.fallbackToDestructiveMigration() .fallbackToDestructiveMigration()
.build(); .build();
@ -220,4 +221,14 @@ public abstract class AppDatabase extends RoomDatabase {
database.execSQL("ALTER TABLE Site ADD COLUMN recordable INTEGER DEFAULT 1"); database.execSQL("ALTER TABLE Site ADD COLUMN recordable INTEGER DEFAULT 1");
} }
}; };
static final Migration MIGRATION_25_26 = new Migration(25, 26) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("CREATE TABLE Site_Backup (`key` TEXT NOT NULL, name TEXT, searchable INTEGER, changeable INTEGER, recordable INTEGER, PRIMARY KEY (`key`))");
database.execSQL("INSERT INTO Site_Backup SELECT `key`, name, searchable, changeable, recordable FROM Site");
database.execSQL("DROP TABLE Site");
database.execSQL("ALTER TABLE Site_Backup RENAME to Site");
}
};
} }

@ -22,7 +22,6 @@ import androidx.media3.datasource.cache.NoOpCacheEvictor;
import androidx.media3.datasource.cache.SimpleCache; import androidx.media3.datasource.cache.SimpleCache;
import androidx.media3.datasource.okhttp.OkHttpDataSource; import androidx.media3.datasource.okhttp.OkHttpDataSource;
import androidx.media3.exoplayer.DefaultLoadControl; import androidx.media3.exoplayer.DefaultLoadControl;
import androidx.media3.exoplayer.DefaultRenderersFactory;
import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.LoadControl; import androidx.media3.exoplayer.LoadControl;
import androidx.media3.exoplayer.RenderersFactory; import androidx.media3.exoplayer.RenderersFactory;
@ -54,6 +53,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.github.anilbeesetti.nextlib.media3ext.ffdecoder.NextRenderersFactory;
import okhttp3.Call; import okhttp3.Call;
public class ExoUtil { public class ExoUtil {
@ -75,7 +75,7 @@ public class ExoUtil {
} }
public static RenderersFactory buildRenderersFactory() { public static RenderersFactory buildRenderersFactory() {
return new DefaultRenderersFactory(App.get()).setExtensionRendererMode(Math.abs(Setting.getDecode() - 2)); return new NextRenderersFactory(App.get()).setEnableDecoderFallback(true).setExtensionRendererMode(Math.abs(Setting.getDecode() - 2));
} }
public static CaptionStyleCompat getCaptionStyle() { public static CaptionStyleCompat getCaptionStyle() {

@ -124,6 +124,7 @@ public class Players implements Player.Listener, IMediaPlayer.Listener, Analytic
exoPlayer = new ExoPlayer.Builder(App.get()).setLoadControl(ExoUtil.buildLoadControl()).setRenderersFactory(ExoUtil.buildRenderersFactory()).setTrackSelector(ExoUtil.buildTrackSelector()).build(); exoPlayer = new ExoPlayer.Builder(App.get()).setLoadControl(ExoUtil.buildLoadControl()).setRenderersFactory(ExoUtil.buildRenderersFactory()).setTrackSelector(ExoUtil.buildTrackSelector()).build();
exoPlayer.setAudioAttributes(AudioAttributes.DEFAULT, true); exoPlayer.setAudioAttributes(AudioAttributes.DEFAULT, true);
exoPlayer.addAnalyticsListener(new EventLogger()); exoPlayer.addAnalyticsListener(new EventLogger());
exoPlayer.setHandleAudioBecomingNoisy(true);
exoPlayer.addAnalyticsListener(this); exoPlayer.addAnalyticsListener(this);
exoPlayer.setPlayWhenReady(true); exoPlayer.setPlayWhenReady(true);
exoPlayer.addListener(this); exoPlayer.addListener(this);

@ -190,6 +190,7 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
mBinding.control.action.line.setOnClickListener(view -> onLine()); mBinding.control.action.line.setOnClickListener(view -> onLine());
mBinding.control.action.scale.setOnClickListener(view -> onScale()); mBinding.control.action.scale.setOnClickListener(view -> onScale());
mBinding.control.action.speed.setOnClickListener(view -> onSpeed()); mBinding.control.action.speed.setOnClickListener(view -> onSpeed());
mBinding.control.action.invert.setOnClickListener(view -> onInvert());
mBinding.control.action.across.setOnClickListener(view -> onAcross()); mBinding.control.action.across.setOnClickListener(view -> onAcross());
mBinding.control.action.change.setOnClickListener(view -> onChange()); mBinding.control.action.change.setOnClickListener(view -> onChange());
mBinding.control.action.player.setOnClickListener(view -> onPlayer()); mBinding.control.action.player.setOnClickListener(view -> onPlayer());
@ -225,6 +226,7 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
getExo().getSubtitleView().setStyle(ExoUtil.getCaptionStyle()); getExo().getSubtitleView().setStyle(ExoUtil.getCaptionStyle());
getIjk().getSubtitleView().setStyle(ExoUtil.getCaptionStyle()); getIjk().getSubtitleView().setStyle(ExoUtil.getCaptionStyle());
mBinding.control.action.speed.setText(mPlayers.getSpeedText()); mBinding.control.action.speed.setText(mPlayers.getSpeedText());
mBinding.control.action.invert.setActivated(Setting.isInvert());
mBinding.control.action.across.setActivated(Setting.isAcross()); mBinding.control.action.across.setActivated(Setting.isAcross());
mBinding.control.action.change.setActivated(Setting.isChange()); mBinding.control.action.change.setActivated(Setting.isChange());
mBinding.control.action.home.setVisibility(LiveConfig.isOnly() ? View.GONE : View.VISIBLE); mBinding.control.action.home.setVisibility(LiveConfig.isOnly() ? View.GONE : View.VISIBLE);
@ -376,6 +378,12 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
return true; return true;
} }
private void onInvert() {
setR1Callback();
Setting.putInvert(!Setting.isInvert());
mBinding.control.action.invert.setActivated(Setting.isInvert());
}
private void onAcross() { private void onAcross() {
setR1Callback(); setR1Callback();
Setting.putAcross(!Setting.isAcross()); Setting.putAcross(!Setting.isAcross());

@ -10,6 +10,7 @@ import android.view.WindowManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.fongmi.android.tv.Setting;
import com.fongmi.android.tv.utils.ResUtil; import com.fongmi.android.tv.utils.ResUtil;
import com.fongmi.android.tv.utils.Util; import com.fongmi.android.tv.utils.Util;
@ -113,9 +114,11 @@ public class CustomKeyDownLive extends GestureDetector.SimpleOnGestureListener {
} else if (e2.getX() - e1.getX() > DISTANCE && Math.abs(velocityX) > VELOCITY) { } else if (e2.getX() - e1.getX() > DISTANCE && Math.abs(velocityX) > VELOCITY) {
listener.onFlingRight(); listener.onFlingRight();
} else if (e1.getY() - e2.getY() > DISTANCE && Math.abs(velocityY) > VELOCITY) { } else if (e1.getY() - e2.getY() > DISTANCE && Math.abs(velocityY) > VELOCITY) {
listener.onFlingUp(); if (Setting.isInvert()) listener.onFlingDown();
else listener.onFlingUp();
} else if (e2.getY() - e1.getY() > DISTANCE && Math.abs(velocityY) > VELOCITY) { } else if (e2.getY() - e1.getY() > DISTANCE && Math.abs(velocityY) > VELOCITY) {
listener.onFlingDown(); if (Setting.isInvert()) listener.onFlingUp();
else listener.onFlingDown();
} }
} }

@ -75,6 +75,12 @@
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />
<TextView
android:id="@+id/invert"
style="@style/Control.Action"
android:text="@string/play_invert"
android:textColor="@color/text" />
<TextView <TextView
android:id="@+id/across" android:id="@+id/across"
style="@style/Control.Action" style="@style/Control.Action"

@ -2,6 +2,7 @@ plugins {
id 'com.android.application' version '7.2.2' apply false id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false id 'com.android.library' version '7.2.2' apply false
id 'com.chaquo.python' version '14.0.2' apply false id 'com.chaquo.python' version '14.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
} }
tasks.register('clean', Delete) { tasks.register('clean', Delete) {

@ -357,7 +357,7 @@ public class IjkVideoView extends FrameLayout implements MediaController.MediaPl
@Override @Override
public int getAudioSessionId() { public int getAudioSessionId() {
return 0; return mPlayer.getAudioSessionId();
} }
public boolean haveTrack(int type) { public boolean haveTrack(int type) {

@ -35,6 +35,7 @@ include ':thunder'
include ':jianpian' include ':jianpian'
include ':forcetech' include ':forcetech'
include ':ijkplayer' include ':ijkplayer'
include ':media3ext'
rootProject.name = "TV" rootProject.name = "TV"
gradle.ext.androidxMediaModulePrefix = 'media-' gradle.ext.androidxMediaModulePrefix = 'media-'
apply from: file("/media/core_settings.gradle") apply from: file("/media/core_settings.gradle")

Loading…
Cancel
Save