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::FFmpegDecoder Class Reference

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

#include <H3D/FFmpegDecoder.h>

Inheritance diagram for H3D::FFmpegDecoder:
Inheritance graph

Public Member Functions

 FFmpegDecoder ()
 Constructor.
 
 ~FFmpegDecoder ()
 Destructor.
 
virtual bool testClip (const string &url)
 test if video clip is valid. Returns true on success.
 
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)
 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 bool theTimeIsRight ()
 Should the next frame be processed?

 
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.
 
virtual unsigned int getFrameByteAlignment ()
 The byte alignment of each row in the buffer data from getNewFrame.
 
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

void cleanupFFmpeg (void)
 Clean up all resources used by the current FFmpeg 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_bpp
 Bits per pixel of the frame.
 
unsigned int data_size
 The size in bytes of the data.
 
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.
 
bool looping
 True if the video should loop when it reaches the end.
 
H3DTime duration
 The duration of the current clip in seconds.
 
bool just_a_test
 For proper functioning of testClip()
 

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 FFmpeg to decode video clips.

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

Member Function Documentation

◆ setRate()

virtual bool H3D::FFmpegDecoder::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: