Skip to content

Commit 2d94015

Browse files
committed
Initial release with persistence
1 parent b9b5414 commit 2d94015

File tree

6 files changed

+216
-2
lines changed

6 files changed

+216
-2
lines changed

README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
This archive contains libraries and scripts needed to restore DTS playback
2+
on LG Smart TVs, such as OLED CX models.
3+
4+
See https://github.com/RootMyTV/RootMyTV.github.io/issues/72 for details.
5+
6+
7+
License and disclaimers:
8+
------------------------
9+
10+
GNU LGPL v2.1 or later (same as the GStreamer project and its plugins)
11+
12+
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
13+
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
15+
TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE
16+
SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
17+
REPAIR OR CORRECTION.
18+
19+
THIS SOFTWARE IS *NOT* ENDORSED BY LG OR ANY OF ITS SUBSIDIARIES.
20+
21+
22+
Limitations:
23+
------------
24+
25+
- Root required (https://github.com/RootMyTV/RootMyTV.github.io/issues/85)
26+
- Only mkv playback supported (no .mp4, no .dts).
27+
- Only PCM stereo downmix supported (no multichannel, no passthrough).
28+
- The libraries and scripts have been designed for LG OLED CX models.
29+
While there is a good chance that, if your TV is not too dissimilar to
30+
OLED CXs, you might also be able to restore DTS support there, any issue
31+
that arises from not running this software on an OLED CX is entirely
32+
yours to troubleshoot and support.
33+
34+
35+
Installation:
36+
-------------
37+
38+
- Open a root shell to your TV (e.g. using ssh)
39+
- Download, extract and run the installer by issuing:
40+
cd /home/root
41+
wget https://github.com/lgstreamer/dts_restore/releases/download/1.0/dts_restore_1.0.tgz
42+
tar -xzvf dts_restore_1.0.tgz
43+
./dts_install.sh
44+
45+
46+
Uninstallation:
47+
---------------
48+
49+
- Open a root shell to your TV (e.g. using ssh)
50+
- Run the command: ./home/root/dts_uninstall.sh
51+
- Fully power off or reboot your TV.
52+
53+
54+
Additional notes:
55+
-----------------
56+
57+
- The DTS restoration process does not alter the original LG firmware
58+
content. All changes are applied in a temporary manner which means that,
59+
should you want reset media playback to its original behaviour, you can
60+
just remove the /var/lib/webosbrew/init.d/restore_dts init script or run
61+
dst_uninstall.sh.
62+
- If you still see the "This video does not support audio" message on first
63+
attempt, just close the video file and try again.
64+
- If you want to adjust the stereo downmix settings, you can edit the
65+
[downmix] section from /var/lib/webosbrew/init.d/restore_dts (permanent)
66+
of /etc/gst/gstcool.conf (temporary).
67+
68+
69+
Source code:
70+
------------
71+
72+
- libgstmatroska.so was compiled from the 1.14.4 LG 'gst-plugins-good'
73+
source for OLED CX models, with matroska audio DTS demuxing re-enabled.
74+
The complete source for it, along with compilation instructions, can be
75+
found at: https://github.com/lgstreamer/gst-plugins-good
76+
- libgstlibav.so was compiled from the 1.14.4 LG 'gst-libav' source for
77+
OLED CX models with the following changes applied for DTS (dca) decoding:
78+
* Force stereo downmix always.
79+
* Force integer output always.
80+
* Allow the reading of downmix coefficient from gstcool.conf.
81+
The complete source for it, along with compilation instructions, can be
82+
found at: https://github.com/lgstreamer/gst-libav

dts_install.sh

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/bin/bash
2+
3+
# DTS playback restoration script for LG OLED CX
4+
# Copyright (c) 2022-2023 Pete Batard <pete@akeo.ie>
5+
# See https://github.com/RootMyTV/RootMyTV.github.io/issues/72#issuecomment-1343204028
6+
7+
# Set the following to the directory where you have the GST plugins
8+
GST_SRC=/home/root/gst
9+
10+
# Validate that we have the relevant init.d directory
11+
INIT_DIR=/var/lib/webosbrew/init.d
12+
if [[ ! -d $INIT_DIR ]]; then
13+
echo "$INIT_DIR/ is missing - Aborting"
14+
exit 1
15+
fi
16+
17+
# Validate that there is a GStreamer registry to override
18+
if [[ ! -f $GST_REGISTRY_1_0 ]]; then
19+
echo "$GST_REGISTRY_1_0 is missing - Aborting"
20+
exit 1
21+
fi
22+
23+
# Validate that the media player isn't running
24+
MEDIA_PLAYER_INSTANCES=`ps -ef | grep [s]tarfish-media | wc -l`
25+
if [[ $MEDIA_PLAYER_INSTANCES -gt 1 ]]; then
26+
echo "Cannot install while media player is running - Aborting"
27+
exit 1
28+
fi
29+
30+
# Validate that the libraries we need are there
31+
for lib in libgstmatroska.so libgstlibav.so; do
32+
if [[ ! -f "$GST_SRC/$lib" ]]; then
33+
echo "$GST_SRC/$lib is missing - Aborting"
34+
exit 1
35+
fi
36+
done
37+
38+
# Display a notice if not installing on the expected platform
39+
GST_VERSION=`gst-inspect-1.0 --version | grep GStreamer | cut -d " " -f 2`
40+
WEBOS_VERSION=`nyx-cmd OSInfo query webos_release`
41+
MODEL_NAME=`nyx-cmd DeviceInfo query product_id`
42+
if [[ "$GST_VERSION" != "1.14.4" || "${WEBOS_VERSION::1}" != "5" || "${MODEL_NAME::4}" != "OLED" || "${MODEL_NAME:6:2}" != "CX" ]]; then
43+
echo
44+
echo "This installer was designed specifically for LG OLED CX TVs running"
45+
echo "webOS 5.x with Gstreamer 1.14.4. However, you are trying run it on a(n)"
46+
echo "$MODEL_NAME TV with webOS $WEBOS_VERSION and GStreamer $GST_VERSION."
47+
echo
48+
echo "While installing this software on an incompatible platform should not"
49+
echo "cause irreversible damage, if you choose to proceed, you do acknowlegde"
50+
echo "that, because you are not using the relevant target system:"
51+
echo "1. The software may not work as expected, it at all."
52+
echo "2. You may lose existing features and/or functionality."
53+
echo "3. The entire responsibility for trying this software on an unsupported"
54+
echo " platform lies entirely with you."
55+
echo
56+
read -r -p "Do you wish to proceed? [y/N] " response
57+
case "$response" in
58+
[yY][eE][sS]|[yY])
59+
;;
60+
*)
61+
exit 1
62+
;;
63+
esac
64+
fi
65+
66+
echo "Installing $INIT_DIR/restore_dts"
67+
68+
# The script must *NOT* have a .sh extension
69+
cat <<EOS > $INIT_DIR/restore_dts
70+
#!/bin/bash
71+
72+
# Override the GST plugins that were nerfed by LG
73+
for lib in libgstmatroska.so libgstlibav.so; do
74+
if [[ -f $GST_SRC/\$lib ]]; then
75+
echo "Installing /usr/lib/gstreamer-1.0/\$lib override"
76+
mount -n --bind -o ro $GST_SRC/\$lib /usr/lib/gstreamer-1.0/\$lib
77+
fi
78+
done
79+
80+
# Override the GST registry
81+
if [[ -f $GST_REGISTRY_1_0 ]]; then
82+
echo "Installing $GST_REGISTRY_1_0 override"
83+
export GST_REGISTRY_1_0=/tmp/gst_1_0_registry.arm.bin
84+
/usr/bin/gst-inspect-1.0 > /var/tmp/gst-inspect.log
85+
chmod 666 \$GST_REGISTRY_1_0
86+
chown :compositor \$GST_REGISTRY_1_0
87+
mount -n --bind \$GST_REGISTRY_1_0 $GST_REGISTRY_1_0
88+
fi
89+
90+
# Override /etc/gst/gstcool.conf
91+
if [[ ! -f /tmp/gstcool.conf ]]; then
92+
echo "Installing /etc/gst/gstcool.conf override"
93+
if [[ -f /etc/gst/gstcool.conf ]]; then
94+
sed "s/avdec_dca=0/avdec_dca=290/" /etc/gst/gstcool.conf > /tmp/gstcool.conf
95+
cat <<EOT >> /tmp/gstcool.conf
96+
97+
[downmix]
98+
front=1.25
99+
center=0.75
100+
lfe=0.75
101+
rear=0.75
102+
rear2=0.70
103+
EOT
104+
mount -n --bind /tmp/gstcool.conf /etc/gst/gstcool.conf
105+
fi
106+
fi
107+
EOS
108+
109+
chmod 755 $INIT_DIR/restore_dts
110+
if [[ ! -f /tmp/gstcool.conf ]]; then
111+
echo "Running $INIT_DIR/restore_dts"
112+
source $INIT_DIR/restore_dts
113+
echo "DTS playback has been permanently re-enabled - Enjoy!"
114+
fi

dts_uninstall.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# DTS playback restoration script for LG OLED CX
4+
# Copyright (c) 2022-2023 Pete Batard <pete@akeo.ie>
5+
# See https://github.com/RootMyTV/RootMyTV.github.io/issues/72#issuecomment-1343204028
6+
7+
# Validate that we have the relevant init.d directory
8+
INIT_DIR=/var/lib/webosbrew/init.d
9+
if [[ ! -d $INIT_DIR ]]; then
10+
echo "$INIT_DIR/ is missing - Aborting"
11+
exit 1
12+
fi
13+
14+
if [[ ! -f $INIT_DIR/restore_dts ]]; then
15+
echo "$INIT_DIR/restore_dts is missing - Nothing to uninstall!"
16+
exit 1
17+
fi
18+
19+
rm $INIT_DIR/restore_dts
20+
echo "DTS playback has been uninstalled - Please reboot your TV"

gst/libgstlibav.so

11.9 MB
Binary file not shown.

gst/libgstmatroska.so

1.07 MB
Binary file not shown.

0 commit comments

Comments
 (0)