aboutsummaryrefslogtreecommitdiff
path: root/emms-player-mplayer.el
blob: 6b7b243986f70d32d4a15ebb3fafb7174060c938 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;;; emms-player-mplayer.el --- mplayer support for EMMS

;; Copyright (C) 2005, 2006 Free Software Foundation, Inc.

;; Authors: William XWL <william.xwl@gmail.com>
;;          Jorgen Schaefer <forcer@forcix.cx>

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301  USA

;;; Commentary:

;; This provides a player that uses mplayer. It supports pause and
;; seeking.

;;; Code:

(require 'emms-player-simple)

(define-emms-simple-player mplayer '(file url)
  (regexp-opt '(".ogg" ".mp3" ".wav" ".mpg" ".mpeg" ".wmv" ".wma"
                ".mov" ".avi" ".divx" ".ogm" ".asf" ".mkv" "http://"
		".rm" ".rmvb" ".mp4" ".flac"))
  "mplayer")

(define-emms-simple-player mplayer-playlist '(streamlist)
  "http://"
  "mplayer" "-playlist")

(emms-player-set emms-player-mplayer
		 'pause
		 'emms-player-mplayer-pause)

;;; Pause is also resume for mplayer
(emms-player-set emms-player-mplayer
                 'resume
                 nil)

(emms-player-set emms-player-mplayer
		 'seek
		 'emms-player-mplayer-seek)

(defun emms-player-mplayer-pause ()
  "Depends on mplayer's -slave mode."
  (process-send-string
   emms-player-simple-process-name "pause\n"))

(defun emms-player-mplayer-seek (sec)
  "Depends on mplayer's -slave mode."
  (process-send-string
   emms-player-simple-process-name
   (format "seek %d\n" sec)))

(provide 'emms-player-mplayer)
;;; emms-player-mplayer.el ends here