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