DirectShow file input stream object. More...
#include <vidl_dshow_file_istream.h>
Public Member Functions | |
vidl_dshow_file_istream (const vcl_string &name) | |
Constructor - from a string containing the file name. | |
virtual | ~vidl_dshow_file_istream () |
Destructor. | |
virtual bool | is_open () const |
Return true if the stream is open for reading. | |
virtual bool | is_valid () const |
Return true if the stream is in a valid state. | |
virtual bool | is_seekable () const |
Return true if the stream supports seeking. | |
virtual int | num_frames () const |
Return the number of frames if known. | |
virtual unsigned int | frame_number () const |
Return the current frame number. | |
virtual unsigned int | width () const |
Return the width of each frame. | |
virtual unsigned int | height () const |
Return the height of each frame. | |
virtual vidl_pixel_format | format () const |
Return the pixel format. | |
virtual double | frame_rate () const |
Return the frame rate (FPS, 0.0 if unspecified). | |
virtual double | duration () const |
Return the duration in seconds (0.0 if unknown). | |
virtual void | close () |
Close the stream. | |
virtual bool | advance () |
Advance to the next frame (but don't acquire an image). | |
virtual bool | advance_wait () |
Initiate advance and wait for completion; synchronous advance. | |
virtual bool | advance_start () |
Initiate advance and return immediately; asynchronous advance. | |
virtual bool | is_frame_available () const |
Returns true if the advance has finished and a frame is available. | |
virtual vidl_frame_sptr | read_frame () |
Read the next frame from the stream (advance and acquire). | |
virtual vidl_frame_sptr | current_frame () |
Return the current frame in the stream. | |
virtual bool | seek_frame (unsigned int frame_number) |
Seek to the given frame number. | |
void | ref () |
Increment reference count. | |
void | unref () |
Decrement reference count. | |
int | ref_count () const |
Number of objects referring to this data. | |
Private Member Functions | |
vidl_dshow_file_istream (const vidl_dshow_file_istream &) | |
vidl_dshow_file_istream & | operator= (const vidl_dshow_file_istream &) |
void | open (const vcl_string &filename) |
Open a video file. | |
Private Attributes | |
CComPtr< IFilterGraph2 > | filter_graph_ |
CComPtr< IMediaControl > | media_control_ |
CComPtr< IMediaSeeking > | media_seeking_ |
CComPtr< IMediaEventEx > | media_event_ |
CComPtr< ISampleGrabber > | sample_grabber_ |
vcl_vector< unsigned char > | buffer_ [2] |
double | buffer_time_ [2] |
unsigned char | buffer_index_ |
unsigned int | buffer_width_ |
unsigned int | buffer_height_ |
vidl_pixel_format | buffer_pixel_format_ |
unsigned int | frame_index_ |
REFERENCE_TIME | end_position_ |
bool | is_time_format_frame_ |
bool | is_valid_ |
DWORD | register_ |
ID in Running Object Table (ROT), for debugging with GraphEdit. |
DirectShow file input stream object.
This is still in an experimental stage, but should be usable. It should be able to open avi and wmv files as long as the system has the available decoder, in the case of compressed video.
DirectShow is very flexible and complex. Therefore we have taken the approach to throw an exception or abort in the case where something that is not supported fails, rather than try to parse through every error and provide an alternative. However, we welcome any feedback on desired features to make vidl_dshow_file_istream more usable in the VXL context.
Definition at line 50 of file vidl_dshow_file_istream.h.
vidl_dshow_file_istream::vidl_dshow_file_istream | ( | const vcl_string & | name | ) |
Constructor - from a string containing the file name.
Constructor - from a string containing a device name.
Definition at line 19 of file vidl_dshow_file_istream.cxx.
vidl_dshow_file_istream::~vidl_dshow_file_istream | ( | void | ) | [virtual] |
Destructor.
Definition at line 34 of file vidl_dshow_file_istream.cxx.
vidl_dshow_file_istream::vidl_dshow_file_istream | ( | const vidl_dshow_file_istream & | ) | [private] |
virtual bool vidl_dshow_file_istream::advance | ( | ) | [inline, virtual] |
Advance to the next frame (but don't acquire an image).
Implements vidl_istream.
Definition at line 100 of file vidl_dshow_file_istream.h.
bool vidl_dshow_file_istream::advance_start | ( | void | ) | [inline, virtual] |
Initiate advance and return immediately; asynchronous advance.
Blocks; no asynchronous advance supported.
Definition at line 197 of file vidl_dshow_file_istream.cxx.
bool vidl_dshow_file_istream::advance_wait | ( | void | ) | [inline, virtual] |
Initiate advance and wait for completion; synchronous advance.
Definition at line 186 of file vidl_dshow_file_istream.cxx.
void vidl_dshow_file_istream::close | ( | void | ) | [virtual] |
Close the stream.
Implements vidl_istream.
Definition at line 164 of file vidl_dshow_file_istream.cxx.
vidl_frame_sptr vidl_dshow_file_istream::current_frame | ( | void | ) | [inline, virtual] |
Return the current frame in the stream.
Implements vidl_istream.
Definition at line 247 of file vidl_dshow_file_istream.cxx.
virtual double vidl_dshow_file_istream::duration | ( | ) | const [inline, virtual] |
Return the duration in seconds (0.0 if unknown).
Implements vidl_istream.
Definition at line 92 of file vidl_dshow_file_istream.h.
virtual vidl_pixel_format vidl_dshow_file_istream::format | ( | ) | const [inline, virtual] |
Return the pixel format.
Implements vidl_istream.
Definition at line 84 of file vidl_dshow_file_istream.h.
virtual unsigned int vidl_dshow_file_istream::frame_number | ( | ) | const [inline, virtual] |
Return the current frame number.
Implements vidl_istream.
Definition at line 75 of file vidl_dshow_file_istream.h.
virtual double vidl_dshow_file_istream::frame_rate | ( | ) | const [inline, virtual] |
Return the frame rate (FPS, 0.0 if unspecified).
Implements vidl_istream.
Definition at line 88 of file vidl_dshow_file_istream.h.
virtual unsigned int vidl_dshow_file_istream::height | ( | ) | const [inline, virtual] |
Return the height of each frame.
Implements vidl_istream.
Definition at line 81 of file vidl_dshow_file_istream.h.
bool vidl_dshow_file_istream::is_frame_available | ( | void | ) | const [inline, virtual] |
Returns true if the advance has finished and a frame is available.
Always true; no asynchronous advance supported.
***** Apparently it is asynchronous after all...
Definition at line 232 of file vidl_dshow_file_istream.cxx.
virtual bool vidl_dshow_file_istream::is_open | ( | ) | const [inline, virtual] |
Return true if the stream is open for reading.
***** if closed, should return false
Implements vidl_istream.
Definition at line 61 of file vidl_dshow_file_istream.h.
virtual bool vidl_dshow_file_istream::is_seekable | ( | ) | const [inline, virtual] |
Return true if the stream supports seeking.
Implements vidl_istream.
Definition at line 67 of file vidl_dshow_file_istream.h.
virtual bool vidl_dshow_file_istream::is_valid | ( | void | ) | const [inline, virtual] |
Return true if the stream is in a valid state.
Implements vidl_istream.
Definition at line 64 of file vidl_dshow_file_istream.h.
virtual int vidl_dshow_file_istream::num_frames | ( | ) | const [inline, virtual] |
Return the number of frames if known.
returns -1 for non-seekable streams
Implements vidl_istream.
Definition at line 72 of file vidl_dshow_file_istream.h.
void vidl_dshow_file_istream::open | ( | const vcl_string & | filename | ) | [private] |
Open a video file.
Open the file specified in params object.
Definition at line 40 of file vidl_dshow_file_istream.cxx.
vidl_dshow_file_istream& vidl_dshow_file_istream::operator= | ( | const vidl_dshow_file_istream & | ) | [private] |
vidl_frame_sptr vidl_dshow_file_istream::read_frame | ( | void | ) | [inline, virtual] |
Read the next frame from the stream (advance and acquire).
Implements vidl_istream.
Definition at line 240 of file vidl_dshow_file_istream.cxx.
void vidl_istream::ref | ( | ) | [inline, inherited] |
Increment reference count.
Definition at line 87 of file vidl_istream.h.
int vidl_istream::ref_count | ( | ) | const [inline, inherited] |
Number of objects referring to this data.
Definition at line 93 of file vidl_istream.h.
bool vidl_dshow_file_istream::seek_frame | ( | unsigned int | frame_number | ) | [inline, virtual] |
Seek to the given frame number.
Implements vidl_istream.
Definition at line 280 of file vidl_dshow_file_istream.cxx.
void vidl_istream::unref | ( | ) | [inline, inherited] |
Decrement reference count.
Definition at line 90 of file vidl_istream.h.
virtual unsigned int vidl_dshow_file_istream::width | ( | ) | const [inline, virtual] |
Return the width of each frame.
Implements vidl_istream.
Definition at line 78 of file vidl_dshow_file_istream.h.
vcl_vector<unsigned char> vidl_dshow_file_istream::buffer_[2] [private] |
Definition at line 137 of file vidl_dshow_file_istream.h.
unsigned int vidl_dshow_file_istream::buffer_height_ [private] |
Definition at line 141 of file vidl_dshow_file_istream.h.
unsigned char vidl_dshow_file_istream::buffer_index_ [private] |
Definition at line 139 of file vidl_dshow_file_istream.h.
Definition at line 142 of file vidl_dshow_file_istream.h.
double vidl_dshow_file_istream::buffer_time_[2] [private] |
Definition at line 138 of file vidl_dshow_file_istream.h.
unsigned int vidl_dshow_file_istream::buffer_width_ [private] |
Definition at line 140 of file vidl_dshow_file_istream.h.
REFERENCE_TIME vidl_dshow_file_istream::end_position_ [private] |
Definition at line 146 of file vidl_dshow_file_istream.h.
CComPtr<IFilterGraph2> vidl_dshow_file_istream::filter_graph_ [private] |
Definition at line 130 of file vidl_dshow_file_istream.h.
unsigned int vidl_dshow_file_istream::frame_index_ [private] |
Definition at line 145 of file vidl_dshow_file_istream.h.
bool vidl_dshow_file_istream::is_time_format_frame_ [private] |
Definition at line 147 of file vidl_dshow_file_istream.h.
bool vidl_dshow_file_istream::is_valid_ [private] |
Definition at line 148 of file vidl_dshow_file_istream.h.
CComPtr<IMediaControl> vidl_dshow_file_istream::media_control_ [private] |
Definition at line 131 of file vidl_dshow_file_istream.h.
CComPtr<IMediaEventEx> vidl_dshow_file_istream::media_event_ [private] |
Definition at line 133 of file vidl_dshow_file_istream.h.
CComPtr<IMediaSeeking> vidl_dshow_file_istream::media_seeking_ [private] |
Definition at line 132 of file vidl_dshow_file_istream.h.
DWORD vidl_dshow_file_istream::register_ [private] |
ID in Running Object Table (ROT), for debugging with GraphEdit.
Definition at line 151 of file vidl_dshow_file_istream.h.
CComPtr<ISampleGrabber> vidl_dshow_file_istream::sample_grabber_ [private] |
Definition at line 134 of file vidl_dshow_file_istream.h.