Skip to content

Commit

Permalink
Add hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Nov 29, 2019
1 parent 2427f1f commit de54038
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions ffmpeg-player.el
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
:group 'ffmpeg-player)

(defcustom ffmpeg-player-mode-hook nil
"*Hook called by `ffmpeg-player-mode'."
"Hook called by `ffmpeg-player-mode'."
:type 'hook
:group 'ffmpeg-player)

Expand All @@ -89,6 +89,26 @@
:type 'boolean
:group 'ffmpeg-player)

(defcustom ffmpeg-player-before-insert-image-hook nil
"Hook called before inserting image."
:type 'hook
:group 'ffmpeg-player)

(defcustom ffmpeg-player-after-insert-image-hook nil
"Hook called after inserting image."
:type 'hook
:group 'ffmpeg-player)

(defcustom ffmpeg-player-before-insert-string-hook nil
"Hook called before inserting string."
:type 'hook
:group 'ffmpeg-player)

(defcustom ffmpeg-player-after-insert-string-hook nil
"Hook called after inserting string."
:type 'hook
:group 'ffmpeg-player)

(defconst ffmpeg-player--command-video-to-images
"ffmpeg -i \"%s\" %s \"%s%s%s.%s\""
"Command that convert video to image source.")
Expand Down Expand Up @@ -442,15 +462,19 @@ Information about first frame timer please see variable `ffmpeg-player--first-fr
(ffmpeg-player--clean-up)
(with-current-buffer ffmpeg-player--buffer
(erase-buffer)
(insert-image-file path))))
(run-hooks 'ffmpeg-player-before-insert-image-hook)
(insert-image-file path)
(run-hooks 'ffmpeg-player-after-insert-image-hook))))

(defun ffmpeg-player--update-frame-by-string (str)
"Update the frame by STR."
(if (not (ffmpeg-player--buffer-alive-p))
(ffmpeg-player--clean-up)
(with-current-buffer ffmpeg-player--buffer
(erase-buffer)
(insert str))))
(run-hooks 'ffmpeg-player-before-insert-string-hook)
(insert str)
(run-hooks 'ffmpeg-player-after-insert-string-hook))))

(defun ffmpeg-player--update-frame-index ()
"Calculate then update the frame index by time."
Expand Down

0 comments on commit de54038

Please sign in to comment.