AVClip is the abstract base class of displayable/playable clips. More...
#include <foleys_AVClip.h>
Inheritance diagram for AVClip:Public Member Functions | |
| AVClip (VideoEngine &videoEngine) | |
| virtual | ~AVClip ()=default |
| virtual juce::String | getClipType () const =0 |
| Used to identify the clip type to the user. | |
| virtual juce::URL | getMediaFile () const |
| returns the original media file to restore | |
| virtual juce::String | getDescription () const =0 |
| returns a string describing the clip. | |
| virtual Size | getVideoSize () const =0 |
| returns the pixel size of the media as a tuple. | |
| virtual double | getLengthInSeconds () const =0 |
| Returns the length of the clip in seconds. | |
| virtual VideoFrame & | getFrame (double pts)=0 |
| Returns the frame for a certain timecode. | |
| virtual void | render (juce::Graphics &g, juce::Rectangle< float > area, double pts, float rotation=0.0f, float zoom=100.0f, juce::Point< float > translation=juce::Point< float >(), float alpha=1.0f)=0 |
| This is the virtual render() method for OpenGL rendering. | |
| void | renderFrame (juce::Graphics &g, juce::Rectangle< float > area, VideoFrame &frame, float rotation, float zoom, juce::Point< float > translation, float alpha) |
| Renders a frame on the OpenGLView. | |
| virtual bool | isFrameAvailable (double pts) const =0 |
| Checks, if a frame is available. | |
| virtual juce::Image | getStillImage (double seconds, Size size)=0 |
| This returns a still frame on the selected position. | |
| virtual bool | hasVideo () const =0 |
| Returns true, if this clip will produce visual frames. | |
| virtual bool | hasAudio () const =0 |
| Returns true, if this clip will produce audio. | |
| virtual double | getSampleRate () const =0 |
| This is the samplerate supplied from prepareToPlay and the sample rate this clip will produce audio and use as clock source. | |
| void | setAspectType (Aspect type) |
| virtual double | getFrameDurationInSeconds () const |
| Returns the duration of a frame in seconds. | |
| virtual std::shared_ptr< AVClip > | createCopy (StreamTypes types)=0 |
| This returns a copy of the clip. | |
| virtual bool | waitForSamplesReady (int samples, int timeout=1000) |
| When rendering non realtime (bounce), use this to wait for background threads to read ahead. | |
| virtual bool | waitForFrameReady (double pts, int timeout=1000) |
| When rendering non realtime (bounce), use this to wait for background threads to read ahead. | |
| const ParameterMap & | getVideoParameters () |
| const ParameterMap & | getAudioParameters () |
| virtual juce::TimeSliceClient * | getBackgroundJob () |
| VideoEngine * | getVideoEngine () const |
Public Member Functions inherited from TimeCodeAware | |
| TimeCodeAware ()=default | |
| virtual | ~TimeCodeAware ()=default |
| virtual double | getCurrentTimeInSeconds () const =0 |
| Return the clip's read position in seconds. | |
| void | addTimecodeListener (Listener *listener) |
| Register a TimecodeListener to be notified, when the visual frame changes. | |
| void | removeTimecodeListener (Listener *listener) |
| Unregister a TimecodeListener. | |
Static Public Member Functions | |
| static void | addDefaultAudioParameters (AVClip &clip) |
| static void | addDefaultVideoParameters (AVClip &clip) |
Protected Member Functions | |
| void | addAudioParameter (std::unique_ptr< ProcessorParameter > parameter) |
| void | addVideoParameter (std::unique_ptr< ProcessorParameter > parameter) |
Protected Member Functions inherited from TimeCodeAware | |
| void | sendTimecode (int64_t count, double seconds, juce::NotificationType nt) |
| Subclasses can call this to notify displays, that the time code has changed, e.g. | |
AVClip is the abstract base class of displayable/playable clips.
They can provide video frames an/or audio streams.
To be compatible with juce's playback engines, they inherit PositionableAudioSource. Each AVClip is responsible to resample the audio to the sampleRate that is set in prepareToPlay. The audio stream acts as clock master.
When you created a shared_ptr of an AVClip, call manageLifeTime() on the VideoEngine, that will add it to the auto release pool and register possible background jobs with the TimeSliceThreads.
| AVClip | ( | VideoEngine & | videoEngine | ) |
|
virtualdefault |
|
pure virtual |
Used to identify the clip type to the user.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
virtual |
|
pure virtual |
returns a string describing the clip.
This could be the filename of the original media file
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
returns the pixel size of the media as a tuple.
In some video files this can change at any frame.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
Returns the length of the clip in seconds.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
Returns the frame for a certain timecode.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
This is the virtual render() method for OpenGL rendering.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
| void renderFrame | ( | juce::Graphics & | g, |
| juce::Rectangle< float > | area, | ||
| VideoFrame & | frame, | ||
| float | rotation, | ||
| float | zoom, | ||
| juce::Point< float > | translation, | ||
| float | alpha | ||
| ) |
Renders a frame on the OpenGLView.
You can call this from the AVClip subclasses
References foleys::Crop, VideoFrame::image, foleys::LetterBox, and foleys::ZoomScale.
Referenced by ImageClip::render(), and MovieClip::render().
|
pure virtual |
Checks, if a frame is available.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
This returns a still frame on the selected position.
Don't use this method for streaming a video, because it will be slow
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
Returns true, if this clip will produce visual frames.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
Returns true, if this clip will produce audio.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
pure virtual |
This is the samplerate supplied from prepareToPlay and the sample rate this clip will produce audio and use as clock source.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
| void setAspectType | ( | Aspect | type | ) |
|
virtual |
Returns the duration of a frame in seconds.
This is the inverse of frame rate.
Reimplemented in ComposedClip, and MovieClip.
|
pure virtual |
This returns a copy of the clip.
Note that this will not work properly if the clip is not properly registered in the engine, because the copy will automatically be registered with the engine as well.
Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.
|
virtual |
When rendering non realtime (bounce), use this to wait for background threads to read ahead.
Reimplemented in ComposedClip, and MovieClip.
|
virtual |
When rendering non realtime (bounce), use this to wait for background threads to read ahead.
Reimplemented in MovieClip.
|
static |
References AVClip::addAudioParameter(), foleys::IDs::colour, and foleys::IDs::gain.
Referenced by AudioClip::AudioClip(), and MovieClip::MovieClip().
|
static |
References AVClip::addVideoParameter(), foleys::IDs::alpha, foleys::IDs::colour, foleys::IDs::rotation, foleys::IDs::translateX, foleys::IDs::translateY, and foleys::IDs::zoom.
Referenced by ImageClip::ImageClip(), and MovieClip::MovieClip().
| const ParameterMap & getVideoParameters | ( | ) |
| const ParameterMap & getAudioParameters | ( | ) |
Referenced by AudioClip::getNextAudioBlock(), and MovieClip::getNextAudioBlock().
|
virtual |
Reimplemented in MovieClip.
| VideoEngine * getVideoEngine | ( | ) | const |
|
protected |
Referenced by AVClip::addDefaultAudioParameters().
|
protected |
Referenced by AVClip::addDefaultVideoParameters().