Skip to content

Commit

Permalink
Balanced sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Jun 3, 2024
1 parent cf8d7f0 commit e55584c
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 43 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 更新日誌

### v2.1.1

* 平衡聲音

### v2.1.0

* 恢復播放
Expand Down
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/CMakeFiles/
/Makefile
/src/main/cpp/native.c
/src/main/cpp/aes.c
4 changes: 3 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ if (IS_SO_BUILD)
SHARED

# Provides a relative path to your source file(s).
src/main/cpp/native.c)
src/main/cpp/native.c
src/main/cpp/aes.c
)

# 设置编译输出路径
set_target_properties(
Expand Down
32 changes: 25 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ static def VersionName() {
}
}

def gson_version = "2.10.1"
def failureaccess_version = "1.0.2"
def guava_version = "33.2.1-android"

dependencies {

// minSdk17
Expand All @@ -106,11 +110,13 @@ dependencies {
implementation "androidx.media3:media3-ui:$media3_version"

// For media playback using ExoPlayer
implementation ("com.google.guava:guava:31.1-android")
implementation ("androidx.media3:media3-common:$media3_version") {
exclude group: 'com.google.common', module: 'guava'
implementation("com.google.guava:failureaccess:$failureaccess_version")
implementation("com.google.guava:guava:$guava_version")
implementation("androidx.media3:media3-common:$media3_version") {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.google.guava', module: 'failureaccess'
}
implementation ("androidx.media3:media3-exoplayer:$media3_version")
implementation("androidx.media3:media3-exoplayer:$media3_version")

// For HLS playback support with ExoPlayer
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
Expand All @@ -120,7 +126,7 @@ dependencies {

implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
// Gson 2.10.1 and older: API level 19
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.code.gson:gson:$gson_version")
implementation("com.squareup.retrofit2:converter-gson:$retrofit2_version") {
exclude group: 'com.google.code.gson', module: 'gson'
}
Expand All @@ -144,7 +150,19 @@ dependencies {

configurations.configureEach {
resolutionStrategy {
force 'com.google.code.gson:gson:2.10.1'
force 'com.google.guava:guava:31.1-android'
force("com.google.code.gson:gson:$gson_version")
force "com.google.guava:failureaccess:$failureaccess_version"
force "com.google.guava:guava:$guava_version"
eachDependency { details ->
if (details.requested.group == 'com.google.code.gson') {
details.useVersion "$gson_version"
}
if (details.requested.group == 'com.google.guava' && details.requested.name == 'failureaccess') {
details.useVersion "$failureaccess_version"
}
if (details.requested.group == 'com.google.guava' && details.requested.name == 'guava') {
details.useVersion "$guava_version"
}
}
}
}
8 changes: 7 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keep class com.google.gson.** { *; }
-dontwarn com.google.gson.**

-keep class com.google.guava.** { *; }
-dontwarn com.google.guava.**
Binary file modified app/src/main/cpp/arm64-v8a/libnative.so
Binary file not shown.
Binary file modified app/src/main/cpp/armeabi-v7a/libnative.so
Binary file not shown.
9 changes: 9 additions & 0 deletions app/src/main/cpp/include/aes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef AES_H
#define AES_H

#include <stddef.h>

void init();
void encode(const char *in, size_t size, char *out);

#endif
1 change: 1 addition & 0 deletions app/src/main/java/com/lizongying/mytv/PlayerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class PlayerFragment : Fragment() {
playerView?.player?.run {
setMediaItem(MediaItem.fromUri(tvViewModel.getVideoUrlCurrent()))
prepare()
volume = tvViewModel.getTV().volume
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/lizongying/mytv/api/Encryptor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class Encryptor {

external fun encrypt(t: String, e: String, r: String, n: String, i: String): String

external fun encrypt2(t: String): String

external fun hash(data: ByteArray): ByteArray?

external fun hash2(data: ByteArray): ByteArray?
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/lizongying/mytv/api/YSP.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.lizongying.mytv.api

import android.content.Context
import android.util.Log
import com.lizongying.mytv.SP
import com.lizongying.mytv.Utils.getDateTimestamp
import com.lizongying.mytv.models.TVViewModel
Expand Down Expand Up @@ -57,6 +58,7 @@ object YSP {

var yspsdkinput = ""
var openapi_signature = ""
var yspticket = ""

var nseqId = 1
var nrequest_id = ""
Expand Down Expand Up @@ -85,6 +87,8 @@ object YSP {
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
randStr = getRand()
signature = getSignature()
yspticket = encryptor.encrypt2("$livepid&$timeStr&$guid&519748109").lowercase()

return """{"cnlid":"$cnlid","livepid":"$livepid","stream":"$stream","guid":"$guid","cKey":"$cKey","adjust":$adjust,"sphttps":"$sphttps","platform":"$platform","cmd":"$cmd","encryptVer":"$encryptVer","dtype":"$dtype","devid":"$devid","otype":"$otype","appVer":"$appVer","app_version":"$appVersion","rand_str":"$randStr","channel":"$channel","defn":"$defn","signature":"$signature"}"""
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/lizongying/mytv/api/YSPApiService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface YSPApiService {
@Header("Yspplayertoken") token: String,
@Header("Yspsdkinput") Yspsdkinput: String,
@Header("yspsdksign") yspsdksign: String,
@Header("Yspticket") Yspticket: String,
@Header("Seqid") Seqid: String,
@Header("Request-Id") RequestId: String,
@Header("Yspappid") Yspappid: String="519748109",
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/lizongying/mytv/models/TV.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data class TV(
var programType: ProgramType,
var needToken: Boolean = false,
var mustToken: Boolean = false,
var volume: Float = 0.1F,
) : Serializable {

override fun toString(): String {
Expand Down
Loading

0 comments on commit e55584c

Please sign in to comment.