diff options
author | Yoni Rabkin <yonirabkin@member.fsf.org> | 2008-09-30 23:32:21 +0300 |
---|---|---|
committer | Yoni Rabkin <yonirabkin@member.fsf.org> | 2008-09-30 23:32:21 +0300 |
commit | 31841733b197fb4ad41b4270d0669059ad6e88c6 (patch) | |
tree | 26acbe97dc9ea4f05818e542cd4b35fe73ca9e83 /lisp | |
parent | bd8bb8af89086bbf336c7890813e2a35a3349525 (diff) |
Add VideoLAN, aka vlc, support to Emms.
* lisp/emms-player-vlc.el: Add new file emms-player-vlc.el with
preliminary support for vlc.
* lisp/emms-setup.el: (emms-setup-default-player-list) Add the
emms-player-vlc player. (emms-minimalistic) Add emms-player-vlc as a
requirement.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-player-vlc.el | 81 | ||||
-rw-r--r-- | lisp/emms-setup.el | 6 |
2 files changed, 85 insertions, 2 deletions
diff --git a/lisp/emms-player-vlc.el b/lisp/emms-player-vlc.el new file mode 100644 index 0000000..fce1fee --- /dev/null +++ b/lisp/emms-player-vlc.el @@ -0,0 +1,81 @@ +;;; emms-player-vlc.el --- vlc support for EMMS + +;; Copyright (C) 2008 Free Software Foundation, Inc. + +;; Authors: Yoni Rabkin <yonirabkin@member.fsf.org> + +;; This file is part of EMMS. + +;; EMMS 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 3 +;; of the License, or (at your option) any later version. + +;; EMMS 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 EMMS; if not, write to the Free Software Foundation, +;; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +;;; Commentary: + +;;; Code: + +(require 'emms-compat) +(require 'emms-player-simple) + +;; I use this macro, and later override some of the stuff it defines +;; in order to accomodate VLC's particular idioms. +(define-emms-simple-player vlc '(file url) + (concat "\\`\\(http\\|mms\\)://\\|" + (emms-player-simple-regexp + "ogg" "mp3" "wav" "mpg" "mpeg" "wmv" "wma" + "mov" "avi" "divx" "ogm" "asf" "mkv" + "rm" "rmvb" "mp4" "flac" "vob" "m4a" "ape")) + "vlc" "--intf" "rc") ; these are never used + +;; (kludge) By default, VLC does not quit after finishing to play a +;; track, so the player sentinel has no way of telling that the next +;; track should be played. Therefore I redefine this low-level +;; function and add a "quit" track which is invisible to Emms. +(defun emms-player-vlc-start (track) + "Cause vlc to play TRACK." + (let ((process (apply 'start-process + emms-player-simple-process-name + nil + "vlc" + ;; splice in params here + (append '("vlc" "--intf" "rc") + (list (emms-track-name track)) + '("vlc:quit"))))) + ;; add a sentinel for signaling termination + (set-process-sentinel process 'emms-player-simple-sentinel)) + (emms-player-started emms-player-vlc)) + +(defun emms-player-vlc-pause () + "Depends on vlc's rc mode." + (process-send-string + emms-player-simple-process-name "pause\n")) + +;; Pending a patch to CVS vlc to add relative seeking to the "rc" vlc +;; interface. +(defun emms-player-vlc-seek (sec) + (message "Relative seeking not supported yet (bug yonirabkin@member.fsf.org about it).")) + +(defun emms-player-vlc-seek-to (sec) + (process-send-string + emms-player-simple-process-name + (format "seek %d\n" sec))) + +(emms-player-set emms-player-vlc 'pause 'emms-player-vlc-pause) +(emms-player-set emms-player-vlc 'resume nil) ; pause is also resume +(emms-player-set emms-player-vlc 'start 'emms-player-vlc-start) +(emms-player-set emms-player-vlc 'seek 'emms-player-vlc-seek) +(emms-player-set emms-player-vlc 'seek-to 'emms-player-vlc-seek-to) + +(provide 'emms-player-vlc) + +;;; emms-player-vlc.el ends here diff --git a/lisp/emms-setup.el b/lisp/emms-setup.el index 6aba756..c230d4a 100644 --- a/lisp/emms-setup.el +++ b/lisp/emms-setup.el @@ -50,7 +50,8 @@ '(emms-player-mpg321 emms-player-ogg123 emms-player-mplayer-playlist - emms-player-mplayer) + emms-player-mplayer + emms-player-vlc) "*Default list of players for emms-setup." :group 'emms-setup :type 'list) @@ -62,7 +63,8 @@ Invisible playlists and all the basics for playing media." (require 'emms-source-file) (require 'emms-source-playlist) (require 'emms-player-simple) - (require 'emms-player-mplayer)) + (require 'emms-player-mplayer) + (require 'emms-player-vlc)) ;;;###autoload (defun emms-standard () |