📄 mplayertv
字号:
my $error = join ("\n", @output); my $dialog = new Gtk2::MessageDialog ($self->{window}, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Can't execute mplayer!\n$error"); $dialog->run; $dialog->destroy; } return @vo_drivers;}sub update_vo_drivers_list{ my ($self) = @_; my @vo_drivers = $self->get_vo_drivers (); # removing menuitems my @items = $self->{vo_drivers_menu}->get_children; foreach (@items) { $self->{vo_drivers_menu}->remove ($_); } # adding new menuitems my $i = 0; foreach (sort @vo_drivers) { my $item = new Gtk2::MenuItem ($_); $item->{label} = $_; $self->{vo_drivers_menu}->append ($item); $self->{vo_drivers_option}->set_history ($i) if ($_ eq $self->{config}->{vo}); $item->show; $i++; }}sub get_ao_drivers{ my ($self) = @_; my @ao_drivers; my $prg = $mplayer_path; #$self->{mplayer_path_ent}->get_text (); $prg .= " -ao help"; print "*** [mplayerTV] Running: $prg\n" if ($verbose_level >= 1); @output = `$prg`; print "\n", @output, "\n" if ($verbose_level >= 2); foreach $line (@output) { if ($line =~ /^\s+(\w+)\s+/) { push @ao_drivers, $1; } } if ($#ao_drivers <= 1) { push @ao_drivers, "null"; my $error = join ("\n", @output); my $dialog = new Gtk2::MessageDialog ($self->{window}, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Can't execute mplayer!\n$error"); $dialog->run; $dialog->destroy; } return @ao_drivers;}sub update_ao_drivers_list{ my ($self) = @_; my @ao_drivers = $self->get_ao_drivers (); # removing menuitems my @items = $self->{ao_drivers_menu}->get_children; foreach (@items) { $self->{ao_drivers_menu}->remove ($_); } # adding new menuitems my $i = 0; foreach (sort @ao_drivers) { my $item = new Gtk2::MenuItem ($_); $item->{label} = $_; $self->{ao_drivers_menu}->append ($item); $self->{ao_drivers_option}->set_history ($i) if ($_ eq $self->{config}->{ao}); $item->signal_connect ('activate', sub { my ($item, $self) = @_; if ($item->{label} eq "oss") { $self->{amixer_device_ent}->show_all; $self->{amixer_device_label}->show_all; $self->{amixer_channel_option}->show_all; $self->{amixer_channel_label}->show_all; } else { $self->{amixer_device_ent}->hide_all; $self->{amixer_device_label}->hide_all; $self->{amixer_channel_option}->hide_all; $self->{amixer_channel_label}->hide_all; } }, $self); $item->show; $i++; }}sub get_outfmts{ my ($self) = @_; my @outfmts = ("default"); my $prg = $mplayer_path; $prg .= " -tv outfmt=help"; print "*** [mplayerTV] Running: $prg\n" if ($verbose_level >= 1); @output = `$prg`; print "\n", @output, "\n" if ($verbose_level >= 2); foreach $line (@output) { if ($line =~ /^Available formats: (.*)$/) { push @outfmts, split /\s+/, $1; } } if ($#outfmts <= 1) { push @outfmts, "null"; my $error = join ("\n", @output); my $dialog = new Gtk2::MessageDialog ($self->{window}, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Can't execute mplayer!\n$error"); $dialog->run; $dialog->destroy; } return @outfmts;}sub update_outfmts_list{ my ($self) = @_; my @outfmts = $self->get_outfmts (); # removing menuitems my @items = $self->{outfmts_menu}->get_children; foreach (@items) { $self->{outfmts_menu}->remove ($_); } # adding new menuitems my $i = 0; foreach (@outfmts) { my $item = new Gtk2::MenuItem ($_); $item->{label} = $_; $self->{outfmts_menu}->append ($item); $self->{outfmts_option}->set_history ($i) if ($_ eq $self->{config}->{outfmt}); $item->show; $i++; }}### updates channel list on Configuration/Channels pagesub update_channel_list{ my ($self) = @_; my @list = $self->{name_list}->get_children; my $items = $#list; $self->{name_list}->clear_items (0, $items + 1); my $folders = $self->{config}->{_folders}; my @channels = (); my $i = 1; foreach (@$folders) { next if ($_ eq "defaults" || $_ eq "global"); my $item = new Gtk2::ListItem ($_); push @channels, $item; $item->{name} = $_; $item->{number} = $i++; $item->{channel} = $self->{config}->{"_$_"}->{channel}; $item->{brightness} = $self->{config}->{"_$_"}->{brightness}; $item->{contrast} = $self->{config}->{"_$_"}->{contrast}; $item->{hue} = $self->{config}->{"_$_"}->{hue}; $item->{saturation} = $self->{config}->{"_$_"}->{saturation}; $item->{volume} = $self->{config}->{"_$_"}->{volume}; $item->signal_connect ('select', \&select_channel_item, $self); $self->{name_list}->add ($item); } $self->{channels} = \@channels;}sub get_option_menu_text{ my ($option_menu) = @_; my $menu = $option_menu->get_menu (); my $menuitem = $menu->get_active (); return $menuitem->{label};}### Configuration/Filters, callback function for mouse button press on# pp filter names (eg. lb, hb)sub vf_pp_button_press_event{ my ($widget, $event) = @_; if ($event->type () eq 'button-press' && $event->button () == 3) { my ($x,$y) = $event->get_coords; my $menu = Gtk2::Menu->new (); my $tooltips = new Gtk2::Tooltips (); my $menuitem1 = new Gtk2::CheckMenuItem ("Auto off"); $menuitem1->set_active ($widget->{auto_off}); $tooltips->set_tip ($menuitem1, "Automatically switches the " . $widget->{code} . " filter off if the CPU is too slow"); my $menuitem2 = new Gtk2::CheckMenuItem ("Chroma filtering"); $menuitem2->set_active ($widget->{chroma}); $tooltips->set_tip ($menuitem2, "Do chrominance filtering on " . $widget->{code}); $menuitem1->show (); $menuitem2->show (); $menuitem1->signal_connect (activate => sub { $widget->{auto_off} = !$widget->{auto_off}}); $menuitem2->signal_connect (activate => sub { $widget->{chroma} = !$widget->{chroma}}); $menu->append ($menuitem1); $menu->append ($menuitem2); $menu->popup (undef, # parent menu shell undef, # parent menu item undef, # menu pos func undef, # data $event->button, $event->time); return 1; } return undef;}sub show{ my ($self) = @_; $self->{dialog}->show_all; if ($self->{config}->{ao} ne "oss") { $self->{amixer_device_ent}->hide_all; $self->{amixer_device_label}->hide_all; $self->{amixer_channel_option}->hide_all; $self->{amixer_channel_label}->hide_all; } if ($self->{config}->{mjpeg} ne "no") { $self->{capt_label}->hide_all (); $self->{size_option}->hide_all (); }}### Configuration/Channels, callback function for selecting item on channel listsub select_channel_item{ my ($item, $self) = @_; if ($self->{app}->mplayer_running ()) { $self->{app}->{mplayer}->tv_set_channel ($item->{number}); $self->{app}->restore_mplayer_parameters (); $self->{app}->{brightness_delta} = $item->{brightness}; $self->{app}->{contrast_delta} = $item->{contrast}; $self->{app}->{hue_delta} = $item->{hue}; $self->{app}->{saturation_delta} = $item->{saturation}; $self->{app}->{volume_delta} = $item->{volume}; $self->{app}->set_mplayer_parameters (); } $self->{name_ent}->set_text ($item->{name}); $self->{channel_ent}->set_text ($item->{channel}); $self->{brightness_spin}->set_text ($item->{brightness}); $self->{contrast_spin}->set_text ($item->{contrast}); $self->{hue_spin}->set_text ($item->{hue}); $self->{saturation_spin}->set_text ($item->{saturation}); $self->{volume_spin}->set_text ($item->{volume}); $self->{selected_channel} = $item; #print "number: ", $item->{number}, "\n";}### Configuration/Channels page, callback function for up button# moves channel upsub UpBtn{ my ($btn, $self) = @_; my $item = $self->{selected_channel}; my $pos = $self->{name_list}->child_position ($item); my @channels = @{$self->{channels}}; if (defined ($item) && $pos > 0) { my @list = $self->{name_list}->get_children; my $items = $#list; $self->{name_list}->clear_items (0, $items + 1); my $item2 = $self->{channels}[$pos - 1]; $channels[$pos - 1] = $channels[$pos]; $channels[$pos] = $item2; #my $i = 1; foreach (@channels) { #$_->{number} = $i++; $self->{name_list}->add ($_); } $item->select; $self->{channels} = \@channels; }}### Configuration/Channels page, callback function down button# moves channel downsub DownBtn{ my ($btn, $self) = @_; my $item = $self->{selected_channel}; my $pos = $self->{name_list}->child_position ($item); my @channels = @{$self->{channels}}; my @list = $self->{name_list}->get_children; my $items = $#list; if (defined ($item) && $pos < $items) { $self->{name_list}->clear_items (0, $items + 1); my $item2 = $self->{channels}[$pos + 1]; $channels[$pos + 1] = $channels[$pos]; $channels[$pos] = $item2; #my $i = 1; foreach (@channels) { #$_->{number} = $i++; $self->{name_list}->add ($_); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -