Public Member Functions | Private Member Functions | Private Attributes
vidl_dshow_live_istream< ParamsObject > Class Template Reference

DirectShow live video input stream support. More...

#include <vidl_dshow_live_istream.h>

Inheritance diagram for vidl_dshow_live_istream< ParamsObject >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vidl_dshow_live_istream ()
 Constructor - default.
 vidl_dshow_live_istream (const vcl_string &device_name)
 Constructor - from a string containing a device name.
 vidl_dshow_live_istream (const ParamsObject &params)
 Constructor - from a parameter object.
virtual ~vidl_dshow_live_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 support 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 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 run (void)
void pause (void)
void stop (void)
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_live_istream (const vidl_dshow_live_istream &)
vidl_dshow_live_istreamoperator= (const vidl_dshow_live_istream &)
void connect (void)
 Connect to a device using its FriendlyName (in params_ object).
void wait_for_state_change (HRESULT hr)
 If hr == S_FALSE, wait for the state change to complete.
bool advance_wait ()
 Initiate advance and wait for completion; synchronous advance.
bool advance_start ()
 Initiate advance and return immediately; asynchronous advance.
bool is_frame_available () const
 Advance to the next frame (but don't acquire an image).

Private Attributes

ParamsObject params_
 Parameters that define the input stream process.
sample_grabber_cb sample_grabber_callback_
 ***** Callback method...
CComPtr< IFilterGraph2 > filter_graph_
CComPtr< IMoniker > moniker_
CComPtr< IMediaControl > media_control_
vidl_frame_sptr buffer_
unsigned int buffer_width_
unsigned int buffer_height_
vidl_pixel_format buffer_pixel_format_
bool is_valid_
DWORD register_
 ID in Running Object Table (ROT), for debugging with GraphEdit.

Detailed Description

template<class ParamsObject>
class vidl_dshow_live_istream< ParamsObject >

DirectShow live video input stream support.

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 83 of file vidl_dshow_live_istream.h.


Constructor & Destructor Documentation

template<class ParamsObject >
vidl_dshow_live_istream< ParamsObject >::vidl_dshow_live_istream ( void  )

Constructor - default.

Definition at line 110 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
vidl_dshow_live_istream< ParamsObject >::vidl_dshow_live_istream ( const vcl_string &  device_name)

Constructor - from a string containing a device name.

Definition at line 131 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
vidl_dshow_live_istream< ParamsObject >::vidl_dshow_live_istream ( const ParamsObject &  params)

Constructor - from a parameter object.

Definition at line 141 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
virtual vidl_dshow_live_istream< ParamsObject >::~vidl_dshow_live_istream ( ) [inline, virtual]

Destructor.

Definition at line 96 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
vidl_dshow_live_istream< ParamsObject >::vidl_dshow_live_istream ( const vidl_dshow_live_istream< ParamsObject > &  ) [private]

Member Function Documentation

template<class ParamsObject >
virtual bool vidl_dshow_live_istream< ParamsObject >::advance ( void  ) [inline, virtual]

Advance to the next frame (but don't acquire an image).

Implements vidl_istream.

Definition at line 138 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
bool vidl_dshow_live_istream< ParamsObject >::advance_start ( void  ) [inline, private]

Initiate advance and return immediately; asynchronous advance.

Definition at line 340 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
bool vidl_dshow_live_istream< ParamsObject >::advance_wait ( void  ) [inline, private]

Initiate advance and wait for completion; synchronous advance.

Definition at line 331 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
void vidl_dshow_live_istream< ParamsObject >::close ( void  ) [inline, virtual]

Close the stream.

Implements vidl_istream.

Definition at line 312 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
void vidl_dshow_live_istream< ParamsObject >::connect ( void  ) [private]

Connect to a device using its FriendlyName (in params_ object).

Connect to the device specified in params object.

Definition at line 158 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
vidl_frame_sptr vidl_dshow_live_istream< ParamsObject >::current_frame ( void  ) [inline, virtual]

Return the current frame in the stream.

Implements vidl_istream.

Definition at line 366 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
virtual double vidl_dshow_live_istream< ParamsObject >::duration ( ) const [inline, virtual]

Return the duration in seconds (0.0 if unknown).

Implements vidl_istream.

Definition at line 130 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual vidl_pixel_format vidl_dshow_live_istream< ParamsObject >::format ( ) const [inline, virtual]

Return the pixel format.

Implements vidl_istream.

Definition at line 123 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual unsigned int vidl_dshow_live_istream< ParamsObject >::frame_number ( ) const [inline, virtual]

Return the current frame number.

***** through exception ??

Implements vidl_istream.

Definition at line 114 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual double vidl_dshow_live_istream< ParamsObject >::frame_rate ( ) const [inline, virtual]

Return the frame rate (FPS, 0.0 if unspecified).

Todo:
return a framerate if it is constant for a live video

Implements vidl_istream.

Definition at line 127 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual unsigned int vidl_dshow_live_istream< ParamsObject >::height ( ) const [inline, virtual]

Return the height of each frame.

Implements vidl_istream.

Definition at line 120 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
bool vidl_dshow_live_istream< ParamsObject >::is_frame_available ( void  ) const [inline, private]

Advance to the next frame (but don't acquire an image).

Definition at line 349 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
virtual bool vidl_dshow_live_istream< ParamsObject >::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 100 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual bool vidl_dshow_live_istream< ParamsObject >::is_seekable ( ) const [inline, virtual]

Return true if the stream support seeking.

Implements vidl_istream.

Definition at line 106 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual bool vidl_dshow_live_istream< ParamsObject >::is_valid ( void  ) const [inline, virtual]

Return true if the stream is in a valid state.

Implements vidl_istream.

Definition at line 103 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
virtual int vidl_dshow_live_istream< ParamsObject >::num_frames ( ) const [inline, virtual]

Return the number of frames if known.

returns -1 for non-seekable streams

Implements vidl_istream.

Definition at line 110 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
vidl_dshow_live_istream& vidl_dshow_live_istream< ParamsObject >::operator= ( const vidl_dshow_live_istream< ParamsObject > &  ) [private]
template<class ParamsObject >
void vidl_dshow_live_istream< ParamsObject >::pause ( void  ) [inline]

Definition at line 400 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
vidl_frame_sptr vidl_dshow_live_istream< ParamsObject >::read_frame ( void  ) [inline, virtual]

Read the next frame from the stream (advance and acquire).

Implements vidl_istream.

Definition at line 357 of file vidl_dshow_live_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.

template<class ParamsObject >
void vidl_dshow_live_istream< ParamsObject >::run ( void  ) [inline]

Definition at line 394 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
virtual bool vidl_dshow_live_istream< ParamsObject >::seek_frame ( unsigned int  frame_number) [inline, virtual]

Seek to the given frame number.

***** throw exception ??

Implements vidl_istream.

Definition at line 148 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
void vidl_dshow_live_istream< ParamsObject >::stop ( void  ) [inline]

Definition at line 406 of file vidl_dshow_live_istream.cxx.

void vidl_istream::unref ( ) [inline, inherited]

Decrement reference count.

Definition at line 90 of file vidl_istream.h.

template<class ParamsObject >
void vidl_dshow_live_istream< ParamsObject >::wait_for_state_change ( HRESULT  hr) [inline, private]

If hr == S_FALSE, wait for the state change to complete.

Definition at line 384 of file vidl_dshow_live_istream.cxx.

template<class ParamsObject >
virtual unsigned int vidl_dshow_live_istream< ParamsObject >::width ( ) const [inline, virtual]

Return the width of each frame.

Implements vidl_istream.

Definition at line 117 of file vidl_dshow_live_istream.h.


Member Data Documentation

template<class ParamsObject >
vidl_frame_sptr vidl_dshow_live_istream< ParamsObject >::buffer_ [private]

Definition at line 177 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
unsigned int vidl_dshow_live_istream< ParamsObject >::buffer_height_ [private]

Definition at line 179 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
vidl_pixel_format vidl_dshow_live_istream< ParamsObject >::buffer_pixel_format_ [private]

Definition at line 180 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
unsigned int vidl_dshow_live_istream< ParamsObject >::buffer_width_ [private]

Definition at line 178 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
CComPtr<IFilterGraph2> vidl_dshow_live_istream< ParamsObject >::filter_graph_ [private]

Definition at line 172 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
bool vidl_dshow_live_istream< ParamsObject >::is_valid_ [private]

Definition at line 183 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
CComPtr<IMediaControl> vidl_dshow_live_istream< ParamsObject >::media_control_ [private]

Definition at line 174 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
CComPtr<IMoniker> vidl_dshow_live_istream< ParamsObject >::moniker_ [private]

Definition at line 173 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
ParamsObject vidl_dshow_live_istream< ParamsObject >::params_ [private]

Parameters that define the input stream process.

Definition at line 160 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
DWORD vidl_dshow_live_istream< ParamsObject >::register_ [private]

ID in Running Object Table (ROT), for debugging with GraphEdit.

Definition at line 186 of file vidl_dshow_live_istream.h.

template<class ParamsObject >
sample_grabber_cb vidl_dshow_live_istream< ParamsObject >::sample_grabber_callback_ [private]

***** Callback method...

Definition at line 169 of file vidl_dshow_live_istream.h.


The documentation for this class was generated from the following files: