LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1739|回复: 14

请问如何把 快捷键 用命令传递给正在运行的程序。

[复制链接]
发表于 2008-12-9 16:14:14 | 显示全部楼层 |阅读模式
正在运行的mplayer可以用快捷键f控制全屏,快捷键 右箭头 前进播放....


这些快捷键都需要用手去按键盘,请问如何用命令把快捷前传递给正在运行的程序呢???
发表于 2008-12-9 21:06:25 | 显示全部楼层
LX来教大家强大的IPC~
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-9 22:04:16 | 显示全部楼层
Post by Jockey;1921680
LX来教大家强大的IPC~


能给个具体的实例吗?比如 把 f快捷键传给 运行着的mplayer 控制全屏。
回复 支持 反对

使用道具 举报

发表于 2008-12-10 10:53:56 | 显示全部楼层
控制mplayer不用那么麻烦,看它的-input 命令。
       -input <commands>
              This option can be used to configure certain parts of the input system.  Paths are relative to ~/.mplayer/.
              NOTE: Autorepeat is currently only supported by joysticks.

              Available commands are:

                 conf=<filename>
                      Specify  input configuration file other than the default ~/.mplayer/input.conf.  ~/.mplayer/<filename>
                      is assumed if no full path is given.
                 ar-delay
                      Delay in milliseconds before we start to autorepeat a key (0 to disable).
                 ar-rate
                      Number of key presses to generate per second on autorepeat.
                 keylist
                      Prints all keys that can be bound to commands.
                 cmdlist
                      Prints all commands that can be bound to keys.
                 js-dev
                      Specifies the joystick device to use (default: /dev/input/js0).
                 file=<filename>
                      Read commands from the given file.  Mostly useful with a FIFO.
                      NOTE: When the given file is a FIFO MPlayer opens both ends so you can do several 'echo  "seek  10"  >
                      mp_pipe' and the pipe will stay valid.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-10 12:18:28 | 显示全部楼层
不适合我,太麻烦。
我只想知道如何用shell命令把快捷键传给正在运行的mplayer进程。
回复 支持 反对

使用道具 举报

发表于 2008-12-10 12:24:56 | 显示全部楼层
mplayer 的 slave 模式
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-10 12:34:07 | 显示全部楼层
Post by remote fish;1921907
mplayer 的 slave 模式


请问下具体如何做呢?
回复 支持 反对

使用道具 举报

发表于 2008-12-10 12:53:42 | 显示全部楼层
举个例子

  1. $ mplayer -slave -quiet file.avi

  2. vo_fullscreen
  3. pause
  4. quit
复制代码

第一行是运行方式,然后 mplayer 会读取用户的输入并执行相应的命令,例子中分别执行了全屏,暂停,结束三个操作。

更多信息去 man mplayer 找 -slave 与 -input,更详细的可以看 MPlayer 代码中的 DOCS/tech/slave.txt
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-10 13:16:52 | 显示全部楼层
谢谢了,不过这也不符合我的需求。
这些控制命令只能在当前运行mplayer的终端来输入这些控制命令,从另一个终端就不行了。
回复 支持 反对

使用道具 举报

发表于 2008-12-10 17:42:50 | 显示全部楼层
我说,既然有了slave模式,对设备文件读写操作那么在行的您,不会没办法将文本内容echo到mplayer的pts去吧?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表