;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;; 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., 59 Temple Place, Suite 330, Boston, MA 02111, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; $Id: avsource.lsh,v 1.5 2006/04/10 17:03:46 laseray Exp $
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


#? ** Audio/Video Sources

#? * AVSource
;; {<p>
;;   Class <AVSource> is a common superclass for the <AudioSource> and
;;   <VideoSource> classes.
;; }
(defclass AVSource Object)
(defmethod AVSource AVSource() ())


#? (==> <avsource> process)
;; {<p>
;;   This internal function is called when new data is available for the
;;   source.
;; }
(defmethod AVSource process() t)



;;; ----------------------------------------

#? * AudioSource
;; {<see> AvAudioSource}
;;
;; {<p>
;;   The abstract class <AudioSource> defines generic methods 
;;   that enable access to a stream of audio data. The actual work is
;;   performed by related subclasses, such as <AvAudioSource>.
;;
;; {<b> WARNING}: Currently, this class is not usable.
;; }
(defclass AudioSource AVSource)

(defmethod AudioSource AudioSource() ())

#? (==> <audiosource> nextframe)
;; {<p>
;;   Method <nextframe> obtains the next segment of audio data. It returns
;;   <t> if new audio data is available, and returns <()> when it reaches the
;;   end of an audio stream.
;; }
;; {<p>
;;   After initialization of an audio source, this method must be called
;;   once in order to access the first segment of audio data.
;; }
(defmethod AudioSource nextframe() 
  () )


;;; ----------------------------------------

#? * VideoSource
;; {<see> AvAudioSource}
;;
;; {<p>
;;   The abstract class <VideoSource> defines generic methods to enable
;;   access to a stream of video data. The actual work is performed by
;;   related subclasses, such as <AvVideoSource>.
;; }
(defclass VideoSource AVSource)

(defmethod VideoSource VideoSource() ())

#? (==> <videosource> nextframe)
;; {<p>
;;   Method <nextframe> obtains the next video frame. It returns <t> if a
;;   new frame can be accessed using the frame access methods 
;;   <get-frame-xxx>, and returns <()> when reaching the end of the
;;   video stream.
;; }
;; {<p>
;;   After initialization of a video source, this method must be called once
;;   in order to access the first video frame.
;; }
(defmethod VideoSource nextframe() 
  () )

#? (==> <videosource> get-frame-pts)
;; {<p>
;;   Returns the presentation time stamp of the current frame. The
;;   presentation time stamp is a real number expressed in seconds.
;;   Calling this function before the first call to <nextframe>
;;   gives the starting time of a movie.
;; }
(defmethod VideoSource get-frame-pts()
  (to-real 0) )

#? (==> <videosource> get-frame-gray)
;; {<p>
;;   Returns the gray level image associated with the current frame
;;   as a two dimensional matrix of unsigned bytes.
;; }
(defmethod VideoSource get-frame-gray() 
  (error "not implemented")
  (ubyte-matrix 1 1))

#? (==> <videosource> get-frame-rgba)
;; {<p>
;;   Returns the RBGA image associated with the current frame as a three
;;   dimensional matrix of unsigned bytes. The last dimentsion contains four
;;   elements: three color components (R, G, B) and one alpha channel (A).
;; }
(defmethod VideoSource get-frame-rgba()
  (error "not implemented")
  (ubyte-matrix 1 1 4))

#? (==> <videosource> get-frame-yuv)
;; {<p>
;;   Returns the YUV image associated with the current frame as a three
;;   dimensional matrix of unsigned bytes. The last dimension contains
;;   three elements, one per color component (Y, U, V).
;; }
(defmethod VideoSource get-frame-yuv() 
  (error "not implemented")
  (ubyte-matrix 1 1 3))




;;; ----------------------------------------

(dhc-make ()
          (AVSource AVSource process)
	  (AudioSource AudioSource
		       nextframe )
	  (VideoSource VideoSource 
		       nextframe 
		       get-frame-pts
		       get-frame-gray 
		       get-frame-rgba 
		       get-frame-yuv ) )
