Panda3D
 All Classes Functions Variables Enumerations
movieVideoCursor.I
00001 // Filename: movieVideoCursor.I
00002 // Created by: jyelon (02Jul07)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 ////////////////////////////////////////////////////////////////////
00016 //     Function: MovieVideoCursor::get_source
00017 //       Access: Published
00018 //  Description: Get the MovieVideo which this cursor references.
00019 ////////////////////////////////////////////////////////////////////
00020 INLINE PT(MovieVideo) MovieVideoCursor::
00021 get_source() const {
00022   return _source;
00023 }
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: MovieVideoCursor::size_x
00027 //       Access: Published
00028 //  Description: Get the horizontal size of the movie.
00029 ////////////////////////////////////////////////////////////////////
00030 INLINE int MovieVideoCursor::
00031 size_x() const {
00032   return _size_x;
00033 }
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //     Function: MovieVideoCursor::size_y
00037 //       Access: Published
00038 //  Description: Get the vertical size of the movie.
00039 ////////////////////////////////////////////////////////////////////
00040 INLINE int MovieVideoCursor::
00041 size_y() const {
00042   return _size_y;
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: MovieVideoCursor::get_num_components
00047 //       Access: Published
00048 //  Description: Returns 4 if the movie has an alpha
00049 //               channel, 3 otherwise.
00050 ////////////////////////////////////////////////////////////////////
00051 INLINE int MovieVideoCursor::
00052 get_num_components() const {
00053   return _num_components;
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: MovieVideoCursor::length
00058 //       Access: Published
00059 //  Description: Returns the length of the movie.
00060 //
00061 //               Some kinds of Movie, such as internet TV station, 
00062 //               might not have a predictable length.  In that case,
00063 //               the length will be set to a very large number: 1.0E10.
00064 //               If the internet TV station goes offline, the video
00065 //               or audio stream will set its abort flag.  Reaching the
00066 //               end of the movie (ie, the specified length) normally
00067 //               does not cause the abort flag to be set.
00068 //
00069 //               The video and audio streams produced by get_video and
00070 //               get_audio are always of unlimited duration - you can
00071 //               always read another video frame or another audio
00072 //               sample.  This is true even if the specified length
00073 //               is reached, or an abort is flagged. If either stream
00074 //               runs out of data, it will synthesize blank video
00075 //               frames and silent audio samples as necessary to
00076 //               satisfy read requests.
00077 //
00078 //               Some AVI files have incorrect length values encoded
00079 //               into them - usually, they're a second or two long or
00080 //               short.  When playing such an AVI using the Movie class,
00081 //               you may see a slightly truncated video, or a slightly
00082 //               elongated video (padded with black frames).  There are
00083 //               utilities out there to fix the length values in AVI
00084 //               files.
00085 //
00086 ////////////////////////////////////////////////////////////////////
00087 INLINE double MovieVideoCursor::
00088 length() const {
00089   return _length;
00090 }
00091 
00092 ////////////////////////////////////////////////////////////////////
00093 //     Function: MovieVideoCursor::can_seek
00094 //       Access: Published
00095 //  Description: Returns true if the movie can seek.  If this is
00096 //               true, seeking is still not guaranteed to be fast:
00097 //               for some movies, seeking is implemented by rewinding
00098 //               to the beginning and then fast-forwarding to the
00099 //               desired location.  Even if the movie cannot seek,
00100 //               the fetch methods can still advance to an arbitrary
00101 //               location by reading frames and discarding them.
00102 //               However, to move backward, can_seek must return true.
00103 ////////////////////////////////////////////////////////////////////
00104 INLINE bool MovieVideoCursor::
00105 can_seek() const {
00106   return _can_seek;
00107 }
00108 
00109 ////////////////////////////////////////////////////////////////////
00110 //     Function: MovieVideoCursor::can_seek_fast
00111 //       Access: Published
00112 //  Description: Returns true if seek operations are constant time.
00113 ////////////////////////////////////////////////////////////////////
00114 INLINE bool MovieVideoCursor::
00115 can_seek_fast() const {
00116   return _can_seek_fast;
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: MovieVideoCursor::aborted
00121 //       Access: Published
00122 //  Description: Returns true if the video has aborted prematurely.
00123 //               For example, this could occur if the Movie was actually
00124 //               an internet TV station, and the connection was lost.
00125 //               Reaching the normal end of the video does not
00126 //               constitute an 'abort' condition.
00127 ////////////////////////////////////////////////////////////////////
00128 INLINE bool MovieVideoCursor::
00129 aborted() const {
00130   return _aborted;
00131 }
00132 
00133 ////////////////////////////////////////////////////////////////////
00134 //     Function: MovieVideoCursor::streaming
00135 //       Access: Published
00136 //  Description: Returns true if the video frames are being "pushed"
00137 //               at us by something that operates at its own speed - 
00138 //               for example, a webcam.  In this case, the frames come
00139 //               when they're ready to come.  Attempting to read too
00140 //               soon will produce nothing, reading too late will cause
00141 //               frames to be dropped.  In this case, the ready flag
00142 //               can be used to determine whether or not a frame is
00143 //               ready for reading.
00144 //
00145 //               When streaming, you should still pay attention to
00146 //               last_start, but the value of next_start is only a
00147 //               guess.
00148 ////////////////////////////////////////////////////////////////////
00149 INLINE bool MovieVideoCursor::
00150 streaming() const {
00151   return _streaming;
00152 }
00153 
00154 ////////////////////////////////////////////////////////////////////
00155 //     Function: MovieVideoCursor::ready
00156 //       Access: Published
00157 //  Description: Returns true if the cursor is a streaming source, and
00158 //               if a video frame is ready to be read.  For non-
00159 //               streaming sources, this is always false.
00160 ////////////////////////////////////////////////////////////////////
00161 INLINE bool MovieVideoCursor::
00162 ready() const {
00163   return _ready;
00164 }
00165 
 All Classes Functions Variables Enumerations