[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: lookup の動画対応



From: 小関 吉則 (KOSEKI Yoshinori) <kose@xxxxxxxxxxx> さん曰く
Subject: Re: lookup の動画対応
Message-ID: <20060704upsgm2dx0.00kose@xxxxxxxxxxx>
Date: Tue, 04 Jul 2006 13:26:51 +0900

> もう一回 ebzip したら音が出ました。

良かった良かった。

> > 白井さんも書かれていますが、HONMONSファイルが無いと
> > そんな反応になりますけど、ありますか?
> > squeezeで削った場合は音声リンクもなくなるはずです。
>
> squeeze した覚えはないのだけど、

ebzip の option でも消せますよ。そっちじゃないかな?

% du -k koujien5/
328513  koujien5/KOJIEN/DATA
1478    koujien5/KOJIEN/GAIJI
127507  koujien5/KOJIEN/MOVIE
457499  koujien5/KOJIEN
457502  koujien5

ぼくのは↑となっています。"ebzip -l 5" で圧縮しました。


で、またまた、パッチなのですが。。。

(1) http://green.ribbon.to/~ikazuhiro/lookup/lookup.html の

 >>> 2006/07/03 パッチを更新。文字等を一切含まないreferenceを参照可
 >>> 能にした。 Entryモードからいろいろ再生の実装を変更した。これで
 >>> describe-keyでlambda式が出てきたりはしなくなった。

 ですが、ぼくの様に

  (setq ndeb-play-binaries-from-entry
        '(("\M-s" wave)
          ("\M-i" xbm bmp jpeg)
          ("\M-m" mpeg)))

  としていると、last-command-event じゃ引っかけられないので、
  this-command-keys() に変えました。

(2) bmp 画像の表示 & ndeb-max-image-size を越えた画像の表示

  http://openlab.jp/edict/fpw/ の "通信用語の基礎知識 (2004 年後
  期版)" で『mule』や『emacsz』を検索して気付いたのですが、この
  エントリの画像データを inline 表示しようとすると、

 ・bmp であるため tiff で inline 表示しようとする。
 ・tiff で保存後 ndeb-max-image-size => 1048576 を越えているので、
   途中までのデータで inline 表示しようとする。
 ・Solaris の Emacs22 も Meadow3 もほとんど固まったと同様の状態
   に落ち込む。

  となってしまいます。tiff はぼくの過去の経験では壊れた画像デー
  タに対する耐性がいちばん弱いように感じるのでなるだけ避けた方が
  よいと思います。たとえば、ppm だと後半が壊れた画像になるだけで
  すみます。

  そのため、

 ・ndeb-max-image-size を越えた画像は inline 表示しない。
 ・Meadow を使っていて bmp が inline 表示できるときは bmp のまま
   表示。その後は ppm, tiff という優先順位で画像の形式を決める。

  としてみました。なお、ppm を pbm として扱っているのは UNIX の
  Emacs21 でのバッドノウハウです ^^;;; pbm を登録するときに pgm,
  ppm も登録してくれると良かったんですが。。。

毎度毎度すいませんが、御検討下さい (__)
bmp を ppm とか tiff で保存する機能はいらないですよね、きっと。

--
白井秀行 (mailto:shirai@xxxxxxxxxxx)
--- lookup-types.el.orig	2006-07-04 11:48:37.000000000 +0900
+++ lookup-types.el	2006-07-04 16:51:42.700200000 +0900
@@ -1065,12 +1065,13 @@
     (insert-image glyph))
 
   (defun lookup-img-file-insert (file type)
-    (let ((glyph
-	   (with-temp-buffer
-	     (insert-file-contents-literally file nil 0 ndeb-max-image-size)
-	     (string-make-unibyte
-	      (buffer-substring-no-properties (point-min) (point-max))))))
-      (lookup-glyph-insert (create-image glyph type t :ascent 'center))))
+    (unless (and ndeb-max-image-size
+		 (>= (nth 7 (file-attributes file)) ndeb-max-image-size))
+      (let ((glyph (with-temp-buffer
+		     (insert-file-contents-literally file)
+		     (string-make-unibyte
+		      (buffer-substring-no-properties (point-min) (point-max))))))
+	(lookup-glyph-insert (create-image glyph type t :ascent 'center)))))
   )
 
  (t
--- ndeb-binary.el.orig	2006-07-04 11:48:37.000000000 +0900
+++ ndeb-binary.el	2006-07-04 16:51:46.750145000 +0900
@@ -99,7 +99,6 @@
 (defcustom ndeb-binary-extensions
   '((xbm . "xbm")
     (bmp . "bmp")
-    (tiff . "tif")
     (jpeg . "jpg")
     (wave . "wav")
     (mpeg . "mpg"))
@@ -236,6 +235,7 @@
   ;; or should be set as dictionary options...??
   '((xbm . "xbm %s %s %s")
     (bmp . "bmp %s %%s")
+    (ppm . "bmp2ppm %s %%s")
     (tiff . "bmp2tiff %s %%s")
     (jpeg . "jpeg %s %%s")
     (wave . "wav %s %%s")
@@ -563,7 +563,7 @@
   (interactive "p")
   (let (types)
     (setq types (or (lookup-assoc-ref ndeb-play-binaries-from-entry
-				      last-command-event)
+				      (this-command-keys))
 		    (when (char-valid-p last-command-event)
 		      (lookup-assoc-ref ndeb-play-binaries-from-entry
 					(char-to-string last-command-event)))))
@@ -663,7 +663,7 @@
 		 (make-temp-name "nb") ndeb-binary-temporary-directory)))
       (ndeb-binary-extract dictionary type target nil file)
       (insert ?\n)
-      (lookup-img-file-insert file type)
+      (lookup-img-file-insert file (if (eq type 'ppm) 'pbm type))
       (unless (= (following-char) ?\n)
 	(insert ?\n))
       (condition-case nil
@@ -699,7 +699,11 @@
 (defun ndeb-arrange-bmp (entry)
   "Arrange bmp images on an ndeb entry."
   (let* ((dictionary (lookup-entry-dictionary entry))
-	 (regexp (lookup-dictionary-option dictionary :bmp-regexp t)))
+	 (regexp (lookup-dictionary-option dictionary :bmp-regexp t))
+	 (type (or (and (lookup-inline-image-p 'bmp) 'bmp)
+		   (and (lookup-inline-image-p 'pbm) 'ppm)
+		   ;; use tiff if available to support RLE.
+		   (and (lookup-inline-image-p 'tiff) 'tiff))))
     (while (re-search-forward (car regexp) nil t)
       (let ((start (match-beginning 0)))
 	(replace-match "" t t)
@@ -711,9 +715,7 @@
 	      (replace-match "" t t)
 	      (ndeb-binary-format-caption start end 'bmp target)
 	      (when lookup-inline-image
-		;; use tiff if available to support RLE.
-		(or (ndeb-binary-insert-color-image dictionary 'tiff target)
-		    (ndeb-binary-insert-color-image dictionary 'bmp target))))
+		(ndeb-binary-insert-color-image dictionary type target)))
 	  (error (message "%s" err)))))))
 
 (defun ndeb-arrange-jpeg (entry)