OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimVideoSource.cpp
Go to the documentation of this file.
1 //**************************************************************************************************
2 // OSSIM -- Open Source Software Image Map
3 //
4 // LICENSE: See top level LICENSE.txt file.
5 //
6 // AUTHOR: Oscar Kramer, SPADAC Inc.
7 //
8 // DESCRIPTION: Interface for all ossim Video types
9 //
10 //**************************************************************************************************
11 // $Id: ossimVideoSource.cpp 2695 2011-06-08 21:12:15Z oscar.kramer $
12 
17 
18 RTTI_DEF1(ossimVideoSource, "ossimVideoSource", ossimSource)
19 
20  //*************************************************************************************************
21 // Protected constructor. This is a pure virtual base class with protected default constructor
22 //*************************************************************************************************
24 { }
25 
26 //*************************************************************************************************
27 // Rewind command is passed down the chain until a video handler can process it.
28 //*************************************************************************************************
30 {
32  if (inter)
33  inter->rewind();
34 }
35 
36 //*************************************************************************************************
39 //*************************************************************************************************
40 bool ossimVideoSource::seek(ossim_float64 reference_time_sec, SeekType seekType)
41 {
43  if (inter)
44  return inter->seek(reference_time_sec, seekType);
45 
46  return false;
47 }
48 
49 //*************************************************************************************************
51 //*************************************************************************************************
53 {
55  if (inter)
56  return inter->nextFrame();
57 
58  return false;
59 }
60 
61 //*************************************************************************************************
63 //*************************************************************************************************
65 {
67  if (inter)
68  return inter->duration();
69 
70  return 0.0;
71 }
72 
73 //*************************************************************************************************
75 //*************************************************************************************************
77 {
79  if (inter)
80  return inter->currentFrameTime();
81 
82  return 0.0;
83 }
84 
85 //*************************************************************************************************
87 //*************************************************************************************************
89 {
91  if (inter)
92  return inter->videoFrameRate();
93 
94  return 0.0;
95 }
96 
97 //*************************************************************************************************
99 //*************************************************************************************************
101 {
103  if (inter)
104  return inter->getVideoGeometry();
105 
106  return NULL;
107 }
108 
109 //*************************************************************************************************
111 //*************************************************************************************************
113 {
114  //STUB
115  return NULL;
116 }
117 
118 //*************************************************************************************************
120 //*************************************************************************************************
122 {
123  // Base class implementation just computes number of frames from duration:
125  return num_frames;
126 }
127 
128 //*************************************************************************************************
130 //*************************************************************************************************
131 int ossimVideoSource::computeFrameNumber(double seconds_from_start) const
132 {
133  double frame_rate = videoFrameRate();
134  if (frame_rate > 0.0)
135  return (int) seconds_from_start*frame_rate;
136  // else
137  return -1;
138 }
139 
140 //*************************************************************************************************
142 //*************************************************************************************************
144 {
145  double frame_rate = videoFrameRate();
146  if (frame_rate > 0.0)
147  return frame_count/frame_rate;
148  // else
149  return ossim::nan();
150 }
151 
152 //*************************************************************************************************
154 //*************************************************************************************************
156  const ossimConnectableObject* object) const
157 {
158  if (object && (index == 0) && PTR_CAST(ossimVideoSource, object))
159  return true;
160  // else
161  return false;
162 }
163 
164 //*************************************************************************************************
167 //*************************************************************************************************
169  const ossimConnectableObject* object) const
170 {
171  if (!object || (index != 0))
172  return false;
173 
174  if (PTR_CAST(ossimVideoSource, object))
175  return true;
176 
177  if (PTR_CAST(ossimVideoImageSource, object))
178  return true;
179 
180  if (PTR_CAST(ossimVideoImageHandler, object))
181  return true;
182 
183  return false;
184 }
Contains class declaration for ossimVideoImageSource.
virtual void rewind()
For rewinding all active streams to beginning.
Pure virtual base class for all video sources – analogous to ossimImageSource.
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual bool canConnectMyOutputTo(ossim_int32 index, const ossimConnectableObject *object) const
Presently can only connect into an image chain via an ossimVideoImageSource bridge, or to another video source for video chains.
int computeFrameNumber(double seconds_from_start) const
Utility method for computing frame number from frame time.
virtual ossim_float64 duration() const
Total length of video in seconds.
virtual bool seek(ossim_float64 reference_time_sec, SeekType seekType)
Seeks to the frame at time specified, according to the seekType (relative to active frame or absolute...
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
double ossim_float64
OSSIM Image handler for video frames.
virtual bool canConnectMyInputTo(ossim_int32 index, const ossimConnectableObject *object) const
Connections only to other video sources are allowed.
unsigned int ossim_uint32
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual const ossimRefPtr< ossimVideoGeometry > getVideoGeometry() const
Access to video geometry object.
virtual ossim_float64 videoFrameRate() const
Nominal frames per second.
virtual ossim_uint32 getNumberOfFrames() const
Total number of frames in video.
virtual ossim_float64 currentFrameTime() const
Time in seconds from start of video of the current active frame, or NAN if no active frame...
double computeFrameTime(ossim_uint32 frame_count) const
Utility method for computing frame time from frame number.
virtual bool nextFrame()
Seeks to start of next frame. Returns TRUE if successful.
virtual const ossimRefPtr< ossimVideoImageHandler > getCurrentFrame() const
Access to current active frame.
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
int ossim_int32