bongo-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bongo-patches] Remove the MPlayer backend code as per discussion on the


From: Daniel Brockman
Subject: [bongo-patches] Remove the MPlayer backend code as per discussion on the mailing list
Date: Mon, 05 Feb 2007 01:16:34 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux)

I have moved this code to the Emacs wiki:

   <http://www.emacswiki.org/cgi-bin/wiki/BongoMPlayer>

Mon Feb  5 00:40:58 CET 2007  Daniel Brockman <address@hidden>

 * Remove the MPlayer backend code as per discussion on the
   mailing list.

diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-02-05 01:15:44.000000000 +0100
+++ new-bongo/bongo.el  2007-02-05 01:15:44.000000000 +0100
@@ -270,13 +270,13 @@
 backends will still be used if these rules say so.  In addition,
 it always takes precedence over `bongo-backend-matchers'.
 
-For example, let's say that you want to use mplayer instead of
+For example, let's say that you want to use VLC instead of
 mpg123 to play MP3 files, use speexdec to play \".speex\" files
 in addition to \".spx\" files, and ignore WAV files altogether.
 Then you could use the following setting:
 
    (setq bongo-custom-backend-matchers
-         '((mplayer local-file \"mp3\")
+         '((vlc local-file \"mp3\")
            (speexdec local-file \"speex\")
            (ignore local-file \"wav\")))"
     :type
@@ -4575,236 +4575,6 @@
         (process-send-string process (format "LOAD %s\n" file-name))))))
 
 
-;;;; The mplayer backend
-
-(define-bongo-backend mplayer
-  :constructor 'bongo-start-mplayer-player
-
-  ;; We define this variable manually so that we can get
-  ;; some other customization variables to appear before it.
-  :extra-program-arguments-variable nil
-
-  ;; Play generic URLs and files if the file extension
-  ;; matches that of some potentially supported format.
-  :matcher '((local-file "file:" "http:" "ftp:")
-             "ogg" "flac" "mp3" "mka" "wav" "wma"
-             "mpg" "mpeg" "vob" "avi" "ogm" "mp4" "mkv"
-             "mov" "asf" "wmv" "rm" "rmvb" "ts")
-
-  ;; Play special media URIs regardless of the file name.
-  :matcher '(("mms:" "mmst:" "rtp:" "rtsp:" "udp:" "unsv:"
-              "dvd:" "vcd:" "tv:" "dvb:" "mf:" "cdda:" "cddb:"
-              "cue:" "sdp:" "mpst:" "tivo:") . t)
-
-  ;; Play all HTTP URLs (necessary for many streams).
-  ;; XXX: This is not a good long-term solution.  (But it
-  ;;      would be good to keep this matcher as a fallback
-  ;;      if we could somehow declare that more specific
-  ;;      matchers should be tried first.)
-  :matcher '(("http:") . t)
-
-  ;; Transform CDDA URIs into the right syntax for mplayer.
-  :file-name-transformer
-  (cons (eval-when-compile
-          (rx (and string-start
-                   (submatch (and (or "cdda" "cddb") "://"))
-                   ;; Device file name.
-                   (optional (submatch
-                              (one-or-more (not (any "@")))))
-                   ;; Track number.
-                   (optional (and "@" (submatch
-                                       (zero-or-more anything))))
-                   string-end)))
-        "\\1\\3/\\2"))
-
-(defun bongo-mplayer-available-drivers (type)
-  (unless (memq type '(audio video))
-    (error "Invalid device type"))
-  (when (executable-find bongo-mplayer-program-name)
-    (let ((result nil))
-      (with-temp-buffer
-        (call-process bongo-mplayer-program-name nil t nil
-                      (ecase type
-                        (audio "-ao")
-                        (video "-vo"))
-                      "help")
-        (goto-char (point-min))
-        (search-forward (concat "Available " (ecase type
-                                               (audio "audio")
-                                               (video "video"))
-                                " output drivers:\n"))
-        (while (looking-at
-                (eval-when-compile
-                  (rx (and line-start
-                           (one-or-more space)
-                           (submatch (one-or-more word))
-                           (one-or-more space)
-                           (submatch (zero-or-more not-newline))
-                           line-end))))
-          (setq result (cons (cons (match-string 1)
-                                   (match-string 2))
-                             result))
-          (forward-line)))
-      (reverse result))))
-
-(defcustom bongo-mplayer-audio-driver nil
-  "Audio driver to be used by mplayer.
-This corresponds to the `-ao' option of mplayer."
-  :type `(choice (const :tag "System default" nil)
-                 ,@(mapcar (lambda (entry)
-                             `(const :tag ,(concat (car entry)
-                                                   " (" (cdr entry) ")")))
-                           (bongo-mplayer-available-drivers 'audio))
-                 (string :tag "Other audio driver"))
-  :group 'bongo-mplayer)
-
-(bongo-define-obsolete-variable-alias
-  'bongo-mplayer-audio-device
-  'bongo-mplayer-audio-driver)
-
-(defcustom bongo-mplayer-video-driver nil
-  "Video driver to be used by mplayer.
-This corresponds to the `-vo' option of mplayer."
-  :type `(choice (const :tag "System default" nil)
-                 ,@(mapcar (lambda (entry)
-                             `(const :tag ,(concat (car entry)
-                                                   " (" (cdr entry) ")")))
-                           (bongo-mplayer-available-drivers 'video))
-                 (string :tag "Other video driver"))
-  :group 'bongo-mplayer)
-
-(bongo-define-obsolete-variable-alias
-  'bongo-mplayer-video-device
-  'bongo-mplayer-video-driver)
-
-(defcustom bongo-mplayer-interactive t
-  "If non-nil, use the slave mode of mplayer.
-Setting this to nil disables the pause and seek functionality."
-  :type 'boolean
-  :group 'bongo-mplayer)
-
-(defcustom bongo-mplayer-time-update-delay-after-seek 1
-  "Number of seconds to delay time updates from mplayer after seeking.
-Such delays may prevent jerkiness in the visual seek interface."
-  :type 'number
-  :group 'bongo-mplayer)
-
-(defcustom bongo-mplayer-extra-arguments nil
-  "Extra command-line arguments to pass to `mplayer'.
-These will come at the end or right before the file name, if any."
-  :type '(repeat (choice string variable sexp))
-  :group 'bongo-mplayer)
-
-(bongo-define-obsolete-function-alias
-  'bongo-mplayer-player-interactive-p
-  'bongo-default-player-interactive-p)
-
-(bongo-define-obsolete-function-alias
-  'bongo-mplayer-player-paused-p
-  'bongo-default-player-paused-p)
-
-(defun bongo-mplayer-player-pause/resume (player)
-  (when (not (bongo-player-interactive-p player))
-    (error (concat "This mplayer process is not interactive "
-                   "and so does not support pausing")))
-  (process-send-string (bongo-player-process player) "pause\n")
-  (bongo-player-put player 'paused
-    (not (bongo-player-get player 'paused)))
-  (bongo-player-paused/resumed player))
-
-(defun bongo-mplayer-player-seek-to (player seconds)
-  (when (not (bongo-player-interactive-p player))
-    (error (concat "This mplayer process is not interactive "
-                   "and so does not support seeking")))
-  (process-send-string (bongo-player-process player)
-                       (format "seek %f 2\n" (max seconds 0)))
-  (bongo-player-sought player seconds))
-
-(bongo-define-obsolete-function-alias
-  'bongo-mplayer-player-seek-by
-  'bongo-default-player-seek-by)
-
-(defun bongo-mplayer-player-start-timer (player)
-  (bongo-mplayer-player-stop-timer player)
-  (let ((timer (run-with-timer 0 1 'bongo-mplayer-player-tick player)))
-    (bongo-player-put player 'timer timer)))
-
-(defun bongo-mplayer-player-stop-timer (player)
-  (let ((timer (bongo-player-get player 'timer)))
-    (when timer
-      (cancel-timer timer)
-      (bongo-player-put player 'timer nil))))
-
-(defun bongo-mplayer-player-tick (player)
-  (cond ((not (bongo-player-running-p player))
-         (bongo-mplayer-player-stop-timer player))
-        ((not (bongo-player-paused-p player))
-         (let ((process (bongo-player-process player)))
-           (process-send-string
-            process "pausing_keep get_time_pos\n")
-           (when (null (bongo-player-total-time player))
-             (process-send-string
-              process "pausing_keep get_time_length\n"))))))
-
-;;; XXX: What happens if a record is split between two calls
-;;;      to the process filter?
-(defun bongo-mplayer-process-filter (process string)
-  (condition-case condition
-      (let ((player (bongo-process-get process 'bongo-player)))
-        (with-temp-buffer
-          (insert string)
-          (goto-char (point-min))
-          (while (not (eobp))
-            (cond ((looking-at "^ANS_TIME_POSITION=\\(.+\\)$")
-                   (bongo-player-update-elapsed-time
-                    player (string-to-number (match-string 1)))
-                   (bongo-player-times-changed player))
-                  ((looking-at "^ANS_LENGTH=\\(.+\\)$")
-                   (bongo-player-update-total-time
-                    player (string-to-number (match-string 1)))
-                   (bongo-player-times-changed player)))
-            (forward-line))))
-    ;; Getting errors in process filters is not fun, so stop.
-    (error (bongo-stop)
-           (signal (car condition) (cdr condition)))))
-
-(defun bongo-start-mplayer-player (file-name &optional extra-arguments)
-  (let* ((process-connection-type nil)
-         (arguments (append
-                     (when bongo-mplayer-audio-driver
-                       (list "-ao" bongo-mplayer-audio-driver))
-                     (when bongo-mplayer-video-driver
-                       (list "-vo" bongo-mplayer-video-driver))
-                     (when bongo-mplayer-interactive
-                       (list "-quiet" "-slave"))
-                     (bongo-evaluate-program-arguments
-                      bongo-mplayer-extra-arguments)
-                     extra-arguments
-                     (list file-name)))
-         (process (apply 'start-process "bongo-mplayer" nil
-                         bongo-mplayer-program-name arguments))
-         (player
-          (list 'mplayer
-                (cons 'process process)
-                (cons 'file-name file-name)
-                (cons 'buffer (current-buffer))
-                (cons 'interactive bongo-mplayer-interactive)
-                (cons 'pausing-supported bongo-mplayer-interactive)
-                (cons 'seeking-supported bongo-mplayer-interactive)
-                (cons 'time-update-delay-after-seek
-                      bongo-mplayer-time-update-delay-after-seek)
-                (cons 'paused nil)
-                (cons 'pause/resume 'bongo-mplayer-player-pause/resume)
-                (cons 'seek-to 'bongo-mplayer-player-seek-to)
-                (cons 'seek-unit 'seconds))))
-    (prog1 player
-      (set-process-sentinel process 'bongo-default-player-process-sentinel)
-      (bongo-process-put process 'bongo-player player)
-      (when bongo-mplayer-interactive
-        (set-process-filter process 'bongo-mplayer-process-filter)
-        (bongo-mplayer-player-start-timer player)))))
-
-
 ;;;; The VLC backend
 
 (define-bongo-backend vlc
-- 
Daniel Brockman <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]