32 #ifndef __FFMPEGDECODER_H__
33 #define __FFMPEGDECODER_H__
42 #define __STDC_CONSTANT_MACROS
64 class FFmpegEventHandler:
public AutoUpdate< SFTime > {
65 virtual void update();
76 virtual bool testClip(
const string &url );
79 virtual bool loadClip(
const string &url );
82 virtual void startPlaying();
86 virtual void stopPlaying();
89 virtual void pausePlaying();
111 virtual void setPosition(
H3DTime pos );
132 virtual void getNewFrame(
unsigned char *buffer );
145 return frame_height * frame_width * (frame_bpp / 8);
149 virtual bool theTimeIsRight();
156 return Image::UNSIGNED;
167 static bool supportsFileType(
const string &url );
171 uint8_t *temp_buffer;
173 struct SwsContext *imgConvertCtx;
175 AVFormatContext *pFormatCtx;
177 AVCodecContext *pCodecCtx;
179 AVCodecContext *aCodecCtx;
207 unsigned long current_time;
209 unsigned long start_time;
213 void cleanupFFmpeg(
void );
Contains different templates to modify field behaviour.
Header file for H3DVideoClipDecoderNode, the abstract base class for all nodes the decodes video clip...
Contains the SFTime field class.
This node uses FFmpeg to decode video clips.
Definition: FFmpegDecoder.h:62
static DecoderRegistration reader_registration
Register this node to the H3DVideoClipDecoderNodes available.
Definition: FFmpegDecoder.h:163
virtual unsigned int getFrameBitsPerPixel()
Get the number of bits per pixel in the current frame.
Definition: FFmpegDecoder.h:141
virtual bool setRate(double r)
Set the playback rate.
Definition: FFmpegDecoder.h:117
bool just_a_test
For proper functioning of testClip()
Definition: FFmpegDecoder.h:241
unsigned int frame_height
The height in pixels of the frame.
Definition: FFmpegDecoder.h:219
unsigned int frame_bpp
Bits per pixel of the frame.
Definition: FFmpegDecoder.h:222
virtual H3DTime getDuration()
Returns the duration in seconds at normal play rate of the currently loaded video clip.
Definition: FFmpegDecoder.h:124
unsigned int frame_width
The width in pixels of the frame.
Definition: FFmpegDecoder.h:216
virtual Image::PixelType getFramePixelType()
The pixel type of the current frame.
Definition: FFmpegDecoder.h:152
virtual bool haveNewFrame()
Returns true when a new frame is available.
Definition: FFmpegDecoder.h:129
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: FFmpegDecoder.h:160
virtual unsigned int getFrameWidth()
The width in pixels of the current frame.
Definition: FFmpegDecoder.h:135
bool have_new_frame
Set to true when a new frame is available, reset to false when getNewFrame is called.
Definition: FFmpegDecoder.h:229
double rate
The speed at which to play the clip. 1 is normal speed, 0.5 half.
Definition: FFmpegDecoder.h:232
virtual unsigned int getFrameSize()
The size in bytes of the current frame.
Definition: FFmpegDecoder.h:144
bool looping
True if the video should loop when it reaches the end.
Definition: FFmpegDecoder.h:235
unsigned int data_size
The size in bytes of the data.
Definition: FFmpegDecoder.h:225
virtual unsigned int getFrameHeight()
The height in pixels of the current frame.
Definition: FFmpegDecoder.h:138
virtual Image::PixelComponentType getFramePixelComponentType()
The pixel component type of the current frame.
Definition: FFmpegDecoder.h:155
virtual void setLooping(bool)
Set whether the clip should loop and start from the start again when the end has been reached.
Definition: FFmpegDecoder.h:93
H3DTime duration
The duration of the current clip in seconds.
Definition: FFmpegDecoder.h:238
H3DVideoClipDecoderNode is a virtual base class for classes decoding video clips making new frames av...
Definition: H3DVideoClipDecoderNode.h:43
H3D API namespace.
Definition: Anchor.h:38
The AutoUpdate field is a template to force the BaseField to update itself as soon as an event is rec...
Definition: FieldTemplates.h:130
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194
Class used to register a class to the registered file readers.
Definition: H3DVideoClipDecoderNode.h:60