OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimVideoImageHandler.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:
9 //
10 //**************************************************************************************************
11 // $Id$
12 
16 
17 RTTI_DEF1(ossimVideoImageHandler, "ossimVideoImageHandler", ossimImageHandler)
18 
19 //*************************************************************************************************
20 // Constructor
21 //*************************************************************************************************
23 : m_currentFrameNumber (-1)
24 {
25 }
26 
27 //*************************************************************************************************
28 // Closes "image" by detaching from the video
29 //*************************************************************************************************
31 {
32  m_video = 0;
33  m_videoGeometry = 0;
34 }
35 
36 //*************************************************************************************************
37 // Returns list of all frames available in the video.
38 //*************************************************************************************************
39 void ossimVideoImageHandler::getEntryList(std::vector<ossim_uint32>& entryList) const
40 {
41  entryList.clear();
42  ossim_uint32 num_frames = getNumberOfEntries();
43  for (ossim_uint32 i=0; i<num_frames; ++i)
44  entryList.push_back(i);
45 }
46 
47 //*************************************************************************************************
48 // Indirectly sets the frame time given a frame index from the start frame.
50 //*************************************************************************************************
52 {
53  if (!m_video.valid())
54  return false;
55 
56  ossim_float64 frameTime = m_video->computeFrameTime(frame_number);
58  {
59  m_currentFrameNumber = frame_number;
60  return true;
61  }
62 
63  return false;
64 }
65 
66 //*************************************************************************************************
67 // Converts frame time to frame index using frame rate:
68 //*************************************************************************************************
70 {
71  if (m_currentFrameNumber < 0 )
72  return 0;
73 
74  return m_currentFrameNumber;
75 }
76 
77 //*************************************************************************************************
78 // Determines total number of frames using frame rate and video duration:
79 //*************************************************************************************************
81 {
82  if (!m_video.valid())
83  return 0;
84 
86  return num_frames;
87 }
88 
89 //*************************************************************************************************
90 // Returns number of lines per video frame.
91 //*************************************************************************************************
93 {
94  // Only full-image res level = 0 presently supported:
95  if (!m_video.valid() || (resLevel != 0))
96  return 0;
97 
98  return m_video->frameSize().line;
99 }
100 
101 //*************************************************************************************************
102 // Returns number of lines per video frame.
103 //*************************************************************************************************
105 {
106  // Only full-image res level = 0 presently supported:
107  if (!m_video.valid() || (resLevel != 0))
108  return 0;
109 
110  return m_video->frameSize().samp;
111 }
112 
113 //*************************************************************************************************
114 // Returns Image Geometry for current frame.
115 //*************************************************************************************************
117 {
118  if (theGeometry.valid())
119  return theGeometry;
120 
121  // Only full-image res level = 0 presently supported:
122  if (!m_video.valid() || !m_videoGeometry.valid())
123  return NULL;
124 
126  return theGeometry;
127 }
virtual bool seek(ossim_float64 reference_time_sec, SeekType seekType)=0
Seeks to the frame at time specified, according to the seekType (relative to active frame or absolute...
ossimRefPtr< ossimImageGeometry > theGeometry
ossimRefPtr< ossimVideoGeometry > m_videoGeometry
bool valid() const
Definition: ossimRefPtr.h:75
int m_currentFrameNumber
This is the currently active entry.
const ossimIpt & frameSize() const
Nominal size of a frame in pixels.
int computeFrameNumber(double seconds_from_start) const
Utility method for computing frame number from frame time.
virtual ossim_uint32 getCurrentEntry() const
double ossim_float64
OSSIM Image handler for video frames.
unsigned int ossim_uint32
virtual ossim_uint32 getNumberOfEntries() const
ossimRefPtr< ossimVideoHandler > m_video
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry(const double &t)=0
Provides an image geometry object for frame at specified time in seconds since start of sequence...
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
ossim_float64 duration() const
Total length of video in seconds.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const
Pure virtual, derived classes must implement.
ossim_int32 samp
Definition: ossimIpt.h:141
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const
Pure virtual, derived classes must implement.
double computeFrameTime(ossim_uint32 frame_count) const
Utility method for computing frame time from frame number.
virtual bool setCurrentEntry(ossim_uint32 frame_number)
Sets the currently active frame number as count from start of video.
ossim_int32 line
Definition: ossimIpt.h:142
virtual void close()
Deletes the overview and clears the valid image vertices.
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485