Panda3D
movieVideoCursor.I
1 // Filename: movieVideoCursor.I
2 // Created by: jyelon (02Jul07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: MovieVideoCursor::get_source
17 // Access: Published
18 // Description: Get the MovieVideo which this cursor references.
19 ////////////////////////////////////////////////////////////////////
20 INLINE PT(MovieVideo) MovieVideoCursor::
21 get_source() const {
22  return _source;
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: MovieVideoCursor::size_x
27 // Access: Published
28 // Description: Get the horizontal size of the movie.
29 ////////////////////////////////////////////////////////////////////
30 INLINE int MovieVideoCursor::
31 size_x() const {
32  return _size_x;
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function: MovieVideoCursor::size_y
37 // Access: Published
38 // Description: Get the vertical size of the movie.
39 ////////////////////////////////////////////////////////////////////
40 INLINE int MovieVideoCursor::
41 size_y() const {
42  return _size_y;
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: MovieVideoCursor::get_num_components
47 // Access: Published
48 // Description: Returns 4 if the movie has an alpha
49 // channel, 3 otherwise.
50 ////////////////////////////////////////////////////////////////////
51 INLINE int MovieVideoCursor::
52 get_num_components() const {
53  return _num_components;
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: MovieVideoCursor::length
58 // Access: Published
59 // Description: Returns the length of the movie.
60 //
61 // Some kinds of Movie, such as internet TV station,
62 // might not have a predictable length. In that case,
63 // the length will be set to a very large number: 1.0E10.
64 // If the internet TV station goes offline, the video
65 // or audio stream will set its abort flag. Reaching the
66 // end of the movie (ie, the specified length) normally
67 // does not cause the abort flag to be set.
68 //
69 // The video and audio streams produced by get_video and
70 // get_audio are always of unlimited duration - you can
71 // always read another video frame or another audio
72 // sample. This is true even if the specified length
73 // is reached, or an abort is flagged. If either stream
74 // runs out of data, it will synthesize blank video
75 // frames and silent audio samples as necessary to
76 // satisfy read requests.
77 //
78 // Some AVI files have incorrect length values encoded
79 // into them - usually, they're a second or two long or
80 // short. When playing such an AVI using the Movie class,
81 // you may see a slightly truncated video, or a slightly
82 // elongated video (padded with black frames). There are
83 // utilities out there to fix the length values in AVI
84 // files.
85 //
86 ////////////////////////////////////////////////////////////////////
87 INLINE double MovieVideoCursor::
88 length() const {
89  return _length;
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: MovieVideoCursor::can_seek
94 // Access: Published
95 // Description: Returns true if the movie can seek. If this is
96 // true, seeking is still not guaranteed to be fast:
97 // for some movies, seeking is implemented by rewinding
98 // to the beginning and then fast-forwarding to the
99 // desired location. Even if the movie cannot seek,
100 // the fetch methods can still advance to an arbitrary
101 // location by reading frames and discarding them.
102 // However, to move backward, can_seek must return true.
103 ////////////////////////////////////////////////////////////////////
104 INLINE bool MovieVideoCursor::
105 can_seek() const {
106  return _can_seek;
107 }
108 
109 ////////////////////////////////////////////////////////////////////
110 // Function: MovieVideoCursor::can_seek_fast
111 // Access: Published
112 // Description: Returns true if seek operations are constant time.
113 ////////////////////////////////////////////////////////////////////
114 INLINE bool MovieVideoCursor::
115 can_seek_fast() const {
116  return _can_seek_fast;
117 }
118 
119 ////////////////////////////////////////////////////////////////////
120 // Function: MovieVideoCursor::aborted
121 // Access: Published
122 // Description: Returns true if the video has aborted prematurely.
123 // For example, this could occur if the Movie was actually
124 // an internet TV station, and the connection was lost.
125 // Reaching the normal end of the video does not
126 // constitute an 'abort' condition.
127 ////////////////////////////////////////////////////////////////////
128 INLINE bool MovieVideoCursor::
129 aborted() const {
130  return _aborted;
131 }
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: MovieVideoCursor::streaming
135 // Access: Published
136 // Description: Returns true if the video frames are being "pushed"
137 // at us by something that operates at its own speed -
138 // for example, a webcam. In this case, the frames come
139 // when they're ready to come. Attempting to read too
140 // soon will produce nothing, reading too late will cause
141 // frames to be dropped. In this case, the ready flag
142 // can be used to determine whether or not a frame is
143 // ready for reading.
144 //
145 // When streaming, you should still pay attention to
146 // last_start, but the value of next_start is only a
147 // guess.
148 ////////////////////////////////////////////////////////////////////
149 INLINE bool MovieVideoCursor::
150 streaming() const {
151  return _streaming;
152 }
153 
154 ////////////////////////////////////////////////////////////////////
155 // Function: MovieVideoCursor::ready
156 // Access: Published
157 // Description: Returns true if the cursor is a streaming source, and
158 // if a video frame is ready to be read. For non-
159 // streaming sources, this is always false.
160 ////////////////////////////////////////////////////////////////////
161 INLINE bool MovieVideoCursor::
162 ready() const {
163  return _ready;
164 }
165 
A MovieVideo is actually any source that provides a sequence of video frames.
Definition: movieVideo.h:42