H3D API  2.4.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
H3D::DirectShowDecoder Class Reference

This node uses DirectShow to decode video clips. More...

#include <H3D/DirectShowDecoder.h>

Inheritance diagram for H3D::DirectShowDecoder:
Inheritance graph

Public Member Functions

 DirectShowDecoder ()
 Constructor.
 
 ~DirectShowDecoder ()
 Destructor.
 
virtual bool loadClip (const string &url)
 load an video clip from a url. Returns true on success.
 
virtual void startPlaying ()
 Start decoding the video clip.
 
virtual void stopPlaying ()
 Stop decoding the video clip and set the position to the start position.
 
virtual void pausePlaying ()
 Pause the decoding of the video clip.
 
virtual void setLooping (bool v)
 Set whether the clip should loop and start from the start again when the end has been reached.
 
virtual H3DTime getPosition ()
 Get the current position in the clip (in seconds from start position)
 
virtual void setPosition (H3DTime pos)
 Set the current position in the clip(in seconds from start position)
 
virtual bool setRate (double r)
 Set the playback rate. More...
 
virtual H3DTime getDuration ()
 Returns the duration in seconds at normal play rate of the currently loaded video clip.
 
virtual bool haveNewFrame ()
 Returns true when a new frame is available.
 
virtual void getNewFrame (unsigned char *buffer)
 Get the new frame. The buffer must be at least getFrameSize() bytes.
 
virtual unsigned int getFrameWidth ()
 The width in pixels of the current frame.
 
virtual unsigned int getFrameHeight ()
 The height in pixels of the current frame.
 
virtual unsigned int getFrameBitsPerPixel ()
 Get the number of bits per pixel in the current frame.
 
virtual unsigned int getFrameSize ()
 The size in bytes of the current frame.
 
virtual unsigned int getFrameByteAlignment ()
 The byte alignment of each row in the buffer data from getNewFrame.
 
virtual Image::PixelType getFramePixelType ()
 The pixel type of the current frame.
 
virtual Image::PixelComponentType getFramePixelComponentType ()
 The pixel component type of the current frame.
 
- Public Member Functions inherited from H3D::H3DVideoClipDecoderNode
 H3DVideoClipDecoderNode ()
 Constructor.
 
PlayStatus getPlayStatus ()
 Returns the current play status.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual void render ()
 the render() function is used for the depth-first rendering traversal of the scene-graph. More...
 
virtual void traverseSG (TraverseInfo &ti)
 traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More...
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 

Static Public Member Functions

static bool supportsFileType (const string &url)
 Returns true if the node supports the filetype of the file specified by url.
 
- Static Public Member Functions inherited from H3D::H3DVideoClipDecoderNode
static H3DVideoClipDecoderNodegetSupportedDecoder (const string &url)
 Given an url to a file, it returns an instance of a H3DVideoClipDecoderNode class that can handle that file type. More...
 
static void registerDecoder (const string &name, CreateNodeFunc create, SupportsFileFunc supports)
 Register a decoder that can then be returned by getSupportedDecoder(). More...
 
static void registerDecoder (const DecoderRegistration &fr)
 Register a file reader that can then be returned by getSupportedDecoder().
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
static DecoderRegistration reader_registration
 Register this node to the H3DVideoClipDecoderNodes available.
 

Protected Member Functions

HRESULT initDShowTextureRenderer (const string &url)
 Set up a DirectShow graph for playing the given url.
 
void cleanupDShow (void)
 Clean up all resources used by the current DirectShow graph.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 

Protected Attributes

unsigned int frame_width
 The width in pixels of the frame.
 
unsigned int frame_height
 The height in pixels of the frame.
 
unsigned int frame_size
 The size in bytes of a frame.
 
unsigned int data_size
 The size in bytes of the memory allocated in the data member.
 
unsigned char * data
 The latest frame.
 
bool have_new_frame
 Set to true when a new frame is available, reset to false when getNewFrame is called.
 
double rate
 The speed at which to play the clip. 1 is normal speed, 0.5 half.
 
CFrameGrabber * frame_grabber
 The DirectShow object used to get frames.
 
bool looping
 True if the video should loop when it reaches the end.
 
H3DTime duration
 The duration of the current clip in seconds.
 
H3DUniquePtr< DShowEventHandler > event_handler
 Event handler for DirectShow events.
 

Additional Inherited Members

- Public Types inherited from H3D::H3DVideoClipDecoderNode
typedef bool(* SupportsFileFunc) (const string &url)
 Function ptr type for

 
- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

This node uses DirectShow to decode video clips.

All video types that are supported by an installed DirectShow filter can be decoded.

Member Function Documentation

◆ setRate()

virtual bool H3D::DirectShowDecoder::setRate ( double  r)
inlinevirtual

Set the playback rate.

A rate of 1 means normal playback speed, 2 double. Negative values means playing backwards.

Returns
true if the new rate is supported by the decoder.

Implements H3D::H3DVideoClipDecoderNode.


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