summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/tweaker/bin/twk_cpu.pl
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/tweaker/bin/twk_cpu.pl')
-rwxr-xr-xabs/core-testing/tweaker/bin/twk_cpu.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/abs/core-testing/tweaker/bin/twk_cpu.pl b/abs/core-testing/tweaker/bin/twk_cpu.pl
index 118bac1..8bddbe3 100755
--- a/abs/core-testing/tweaker/bin/twk_cpu.pl
+++ b/abs/core-testing/tweaker/bin/twk_cpu.pl
@@ -57,6 +57,36 @@ sub get_HDD_size {
#
#}
+# Edit mplayer.conf to tell mplayer to drop video frames when necessary. This should do no harm
+# on systems that don't need the option, and it should make video watchable on those that do.
+sub edit_mplayer_conf {
+ use vars qw($mplayer_conf);
+ $mplayer_conf = "/etc/mplayer/mplayer.conf";
+
+ # delete any old entries that Tweaker made, relevant to this particular edit
+ my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*hardframedrop.*=.*#TWEAKER/d' $mplayer_conf";
+ # comment out old entries that some other process may have made
+ my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(hardframedrop.*=.*\\)/#\\1/g' $mplayer_conf";
+ my $command1;
+ my $command2="";
+ my $logger = get_logger('tweaker.script');
+
+ if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) {
+ $logger->error("ERROR: $error");
+ $logger->error("ERROR: Unable to implement option $option.");
+ exit(-1);
+ }
+
+ $command2 = "echo -e 'hardframedrop=true #TWEAKER' >> $mplayer_conf";
+ if (my $error = execute_shell_command($command2)) {
+ $logger->error("ERROR: $error");
+ $logger->error("ERROR: Unable to implement option $option.");
+ exit(-1);
+ }
+
+ $logger->info("Edited $mplayer_conf to drop video frames when CPU is overloaded.");
+}
+
# Try to implement the given option.
sub implement_option {
my($option) = @_;
@@ -106,6 +136,7 @@ sub implement_option {
change_or_make_setting('OSDTheme', 'blootube-osd') || exit -1;
change_or_make_setting('PlayBoxShading', '0') || exit -1;
change_or_make_setting('PlaybackExitPrompt', '2') || exit -1;
+ edit_mplayer_conf();
} else {
exit -1;
}