# HipTV 1.0.0: third-party source code and relinking material HipTV (Android package `app.hiptv`, version 1.0.0, version code 10001) is distributed through Google Play. This archive contains the complete corresponding source code for the parts of HipTV whose licences require it: - **FFmpeg n9.0.2**, licensed under the GNU LGPL version 2.1 or later. It is linked statically into `libffmpegJNI.so`, the native library of the Media3 FFmpeg audio extension (Apache License 2.0). The FFmpeg source code is used without modification. - **juniversalchardet 2.5.0**, used unmodified under the Mozilla Public License 1.1 option (one file is under WTFPL 2). With this archive you can rebuild FFmpeg, change it, and relink `libffmpegJNI.so` with your version. FFmpeg is not owned by the HipTV developer; its copyright belongs to the FFmpeg authors. Download page: https://hiptv.app/kaynak/. Written offer and questions: destek@hiptv.app (see `licenses/SOURCE-ACCESS.txt`). ## Native libraries this archive corresponds to The Google Play bundle for version 1.0.0 contains the `arm64-v8a` and `armeabi-v7a` libraries. The `x86_64` library is used only by the x86_64 build of the same source and is included for completeness. | ABI | In the Google Play bundle | Bytes | SHA-256 | | --- | --- | --- | --- | | `arm64-v8a` | yes | 1806480 | `62086ebc9fb881f41e8dad7045e10254bb0cd615cefe6d9d4b740e68d7f79421` | | `armeabi-v7a` | yes | 1652636 | `43111db5bd38709dfee9c1c0aad89a74ce4783b30f87808a268614008fae1af2` | | `x86_64` | no | 2101088 | `b63784ab98b34310d71efadcd6e97c27a20a7339ec839e829dec73fd16a5af8a` | The same files are in `decoder-ffmpeg/src/main/jniLibs/`. ## Contents | Path | What it is | | --- | --- | | `ffmpeg/source/` | Complete FFmpeg n9.0.2 source tree, commit `946fcce07b6dcd0331c8cc609192aeff5e1924f8` (the `n9.0.2` release tag), with all of its licence files | | `ffmpeg/source-manifest.json` | SHA-256 of every FFmpeg source file; the canonical hash of this map is `c6d060cfb66aa75e3b4305cfdc44f6b18c0a0e96d1071b21659cf1c5bf6e82e7` | | `decoder-ffmpeg/` | The HipTV module that wraps FFmpeg: Media3 1.11.1 FFmpeg extension Java and JNI sources, public FFmpeg headers, the build script `build_ffmpeg.py` (configure flags, compiler and linker flags), `native-lock.json`, licences and the shipped libraries | | `relink-inputs//` | FFmpeg static libraries (`libavcodec.a`, `libswresample.a`, `libavutil.a`), the headers generated by `configure`, and `ffbuild/config.mak` / `config.sh` | | `work-objects//ffmpeg_jni.o` | The compiled JNI bridge, the only other object linked into `libffmpegJNI.so` | | `relink.py` | Rebuild and relink tool (uses the settings in `decoder-ffmpeg/build_ffmpeg.py`) | | `juniversalchardet/` | The published Maven sources JAR and the upstream repository at commit `790939b8bd56892336d61356c139b774494006dc` | | `licenses/` | LGPL 2.1, FFmpeg licence notes, Apache 2.0, MPL 1.1 and the other texts shipped in the app, and `SOURCE-ACCESS.txt` | | `manifest.json`, `MANIFEST.sha256` | Identities and the SHA-256 of every file in this archive | ## Requirements - Python 3.9 or later, a POSIX shell, `make`; `nasm` for the x86_64 build. - Android NDK r27b (revision 27.1.12297006) from https://developer.android.com/ndk/downloads. Another NDK works, but its output will not be byte-identical to the shipped library. - The commands were run on macOS (Apple silicon, NDK `darwin-x86_64` host tools). `relink.py` also selects the `linux-x86_64` tools on Linux. Check the archive first: ```sh python3 relink.py verify # or: shasum -a 256 -c MANIFEST.sha256 export NDK=/path/to/android-ndk-r27b ``` Output directories must not exist yet; put them outside this folder. ## 1. Relink from the supplied objects Links the supplied static libraries and JNI objects. The result is identical to the shipped library: ```sh python3 relink.py link --ndk "$NDK" --objects work-objects --out ../relink-objects --expect-identical ``` To compile the JNI bridge from its source as well, leave out `--objects`: ```sh python3 relink.py link --ndk "$NDK" --out ../relink-source --expect-identical ``` ## 2. Rebuild FFmpeg, with or without your changes ```sh cp -R ffmpeg/source ../my-ffmpeg # change ../my-ffmpeg as you wish python3 relink.py build-ffmpeg --ndk "$NDK" --source ../my-ffmpeg --out ../my-ffmpeg-build --jobs 8 python3 relink.py link --ndk "$NDK" --libs ../my-ffmpeg-build --ffmpeg-source ../my-ffmpeg \ --objects work-objects --out ../my-relink ``` `--abi arm64-v8a` (repeatable) limits either command to one ABI. If your changes alter FFmpeg's public headers, leave out `--objects` so that the JNI bridge is compiled against your headers. `link-report.json` in the output directory lists the SHA-256 of each library. `build-ffmpeg` runs the same `configure` command and flags as `decoder-ffmpeg/build_ffmpeg.py`, the script that built the shipped library. Without changes, the rebuilt `libffmpegJNI.so` is byte-identical to the shipped one. The static `.a` files will not be: FFmpeg stores the full `configure` command line, including absolute paths of the build machine, in the `*_configuration()` strings of each library, and those strings are not linked into `libffmpegJNI.so`. ## 3. Use your library in HipTV 1. Copy the installed packages from your device: `adb shell pm path app.hiptv`, then `adb pull` each listed APK (`base.apk` and the `split_config.*.apk` files). 2. Replace `lib//libffmpegJNI.so` in the APK that contains it, stored without compression: `mkdir -p lib/arm64-v8a && cp ../my-relink/arm64-v8a/libffmpegJNI.so lib/arm64-v8a/ && zip -0 split_config.arm64_v8a.apk lib/arm64-v8a/libffmpegJNI.so` 3. Align and sign every APK with the same key of your own (Android SDK build-tools 35 or later): `zipalign -P 16 -f 4 in.apk out.apk`, then `apksigner sign --ks my.keystore out.apk`. 4. Uninstall the Google Play version (this removes its data), then `adb install-multiple` all signed APKs. Android does not accept a package signed with a different key as an update of the Google Play version. ## juniversalchardet `juniversalchardet/juniversalchardet-2.5.0-sources.jar` is the sources JAR published on Maven Central for `com.github.albfernandez:juniversalchardet:2.5.0`; `juniversalchardet/juniversalchardet-github-790939b.zip` is the upstream repository (https://github.com/albfernandez/juniversalchardet) at the `v2.5.0` commit, with its build files, tests and original licence headers. The library is used without changes; the Android build only shrinks and optimises its compiled classes together with the rest of the application. ## Licences The texts are in `licenses/`; FFmpeg's own `COPYING.*` and `LICENSE.md` are in `ffmpeg/source/`. Rights under these licences are not limited by any HipTV terms. To the extent LGPL 2.1 section 6 requires, you may modify HipTV for your own use and reverse engineer it to debug such modifications.