30 #ifndef __H3DVIDEOCLIPDECODERNODE_H__
31 #define __H3DVIDEOCLIPDECODERNODE_H__
54 typedef bool ( *SupportsFileFunc)(
const string &url );
64 CreateNodeFunc _create,
65 SupportsFileFunc _supports ):
67 create_func( _create ),
68 supports_func( _supports ) {
70 if( !H3DVideoClipDecoderNode::initialized ) {
71 H3DVideoClipDecoderNode::registered_decoders.reset(
72 new list< DecoderRegistration >);
79 CreateNodeFunc create_func;
80 SupportsFileFunc supports_func;
83 friend struct DecoderRegistration;
89 type_name =
"H3DVideoClipDecoderNode";
94 virtual bool loadClip(
const string &url ) = 0;
177 CreateNodeFunc create,
178 SupportsFileFunc supports ) {
185 registered_decoders->push_back( fr );
196 class local_auto_ptr{
200 typedef T element_type;
203 explicit local_auto_ptr (T* ptr = 0) {
211 local_auto_ptr (local_auto_ptr& rhs)
throw() : ap(rhs.release()) { }
214 local_auto_ptr (local_auto_ptr<Y>& rhs)
throw() : ap(rhs.release()) { }
218 local_auto_ptr& operator= (local_auto_ptr& rhs)
throw(){
220 reset(rhs.release());
225 local_auto_ptr& operator= (local_auto_ptr<Y>& rhs)
throw(){
227 reset(rhs.release());
233 ~local_auto_ptr() throw(){
238 T* get()
const throw(){
244 T* operator->()
const throw(){
249 T* release() throw(){
258 void reset (T* ptr=0) throw(){
269 static local_auto_ptr< list< DecoderRegistration > > registered_decoders;
272 static bool initialized;
H3DVideoClipDecoderNode is a virtual base class for classes decoding video clips making new frames av...
Definition: H3DVideoClipDecoderNode.h:43
virtual unsigned int getFrameBitsPerPixel()=0
Get the number of bits per pixel in the current frame.
virtual unsigned int getFrameSize()=0
The size in bytes of the current frame.
virtual bool loadClip(const string &url)=0
Pure virtual function to load an video clip from a url.
virtual bool setRate(double r)=0
Set the playback rate.
static void registerDecoder(const string &name, CreateNodeFunc create, SupportsFileFunc supports)
Register a decoder that can then be returned by getSupportedDecoder().
Definition: H3DVideoClipDecoderNode.h:176
virtual void setLooping(bool on)=0
Set whether the clip should loop and start from the start again when the end has been reached.
static void registerDecoder(const DecoderRegistration &fr)
Register a file reader that can then be returned by getSupportedDecoder().
Definition: H3DVideoClipDecoderNode.h:184
virtual void pausePlaying()=0
Pause the decoding of the video clip.
H3DVideoClipDecoderNode()
Constructor.
Definition: H3DVideoClipDecoderNode.h:87
virtual string defaultXMLContainerField()
Returns the default xml containerField attribute value.
Definition: H3DVideoClipDecoderNode.h:160
virtual void stopPlaying()=0
Stop decoding the video clip and set the position to the start position.
virtual void startPlaying()=0
Start decoding the video clip.
virtual void setPosition(H3DTime pos)=0
Set the current position in the clip(in seconds from start position)
virtual unsigned int getFrameWidth()=0
The width in pixels of the current frame.
virtual bool haveNewFrame()=0
Returns true when a new frame is available.
virtual Image::PixelType getFramePixelType()=0
The pixel type of the current frame.
virtual unsigned int getFrameByteAlignment()
The byte alignment of each row in the buffer data from getNewFrame.
Definition: H3DVideoClipDecoderNode.h:115
virtual Image::PixelComponentType getFramePixelComponentType()=0
The pixel component type of the current frame.
PlayStatus getPlayStatus()
Returns the current play status.
Definition: H3DVideoClipDecoderNode.h:155
virtual void getNewFrame(unsigned char *buffer)=0
Get the new frame. The buffer must be at least getFrameSize() bytes.
virtual H3DTime getDuration()=0
Returns the duration in seconds at normal play rate of the currently loaded video clip.
virtual unsigned int getFrameHeight()=0
The height in pixels of the current frame.
virtual H3DTime getPosition()=0
Get the current position in the clip (in seconds from start position)
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
DualQuaternion operator*(const DualQuaternion &q1, const DualQuaternion &q2)
H3D API namespace.
Definition: Anchor.h:38
Class used to register a class to the registered file readers.
Definition: H3DVideoClipDecoderNode.h:60
DecoderRegistration(const string &_name, CreateNodeFunc _create, SupportsFileFunc _supports)
Constructor.
Definition: H3DVideoClipDecoderNode.h:63