Video display and composing engine for JUCE
Loading...
Searching...
No Matches
AVClip Class Referenceabstract

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 VideoFramegetFrame (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< AVClipcreateCopy (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 ParameterMapgetVideoParameters ()
 
const ParameterMapgetAudioParameters ()
 
virtual juce::TimeSliceClient * getBackgroundJob ()
 
VideoEnginegetVideoEngine () 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AVClip()

AVClip ( VideoEngine videoEngine)

◆ ~AVClip()

virtual ~AVClip ( )
virtualdefault

Member Function Documentation

◆ getClipType()

virtual juce::String getClipType ( ) const
pure virtual

Used to identify the clip type to the user.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ getMediaFile()

virtual juce::URL getMediaFile ( ) const
virtual

returns the original media file to restore

Reimplemented in AudioClip, ImageClip, and MovieClip.

◆ getDescription()

virtual juce::String getDescription ( ) const
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.

◆ getVideoSize()

virtual Size getVideoSize ( ) const
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.

◆ getLengthInSeconds()

virtual double getLengthInSeconds ( ) const
pure virtual

Returns the length of the clip in seconds.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ getFrame()

virtual VideoFrame & getFrame ( double  pts)
pure virtual

Returns the frame for a certain timecode.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ render()

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 
)
pure virtual

This is the virtual render() method for OpenGL rendering.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ renderFrame()

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().

◆ isFrameAvailable()

virtual bool isFrameAvailable ( double  pts) const
pure virtual

Checks, if a frame is available.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ getStillImage()

virtual juce::Image getStillImage ( double  seconds,
Size  size 
)
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.

◆ hasVideo()

virtual bool hasVideo ( ) const
pure virtual

Returns true, if this clip will produce visual frames.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ hasAudio()

virtual bool hasAudio ( ) const
pure virtual

Returns true, if this clip will produce audio.

Implemented in AudioClip, ComposedClip, ImageClip, and MovieClip.

◆ getSampleRate()

virtual double getSampleRate ( ) const
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.

◆ setAspectType()

void setAspectType ( Aspect  type)

◆ getFrameDurationInSeconds()

virtual double getFrameDurationInSeconds ( ) const
virtual

Returns the duration of a frame in seconds.

This is the inverse of frame rate.

Reimplemented in ComposedClip, and MovieClip.

◆ createCopy()

virtual std::shared_ptr< AVClip > createCopy ( StreamTypes  types)
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.

◆ waitForSamplesReady()

virtual bool waitForSamplesReady ( int  samples,
int  timeout = 1000 
)
virtual

When rendering non realtime (bounce), use this to wait for background threads to read ahead.

Reimplemented in ComposedClip, and MovieClip.

◆ waitForFrameReady()

virtual bool waitForFrameReady ( double  pts,
int  timeout = 1000 
)
virtual

When rendering non realtime (bounce), use this to wait for background threads to read ahead.

Reimplemented in MovieClip.

◆ addDefaultAudioParameters()

void addDefaultAudioParameters ( AVClip clip)
static

◆ addDefaultVideoParameters()

◆ getVideoParameters()

const ParameterMap & getVideoParameters ( )

◆ getAudioParameters()

const ParameterMap & getAudioParameters ( )

◆ getBackgroundJob()

juce::TimeSliceClient * getBackgroundJob ( )
virtual

Reimplemented in MovieClip.

◆ getVideoEngine()

◆ addAudioParameter()

void addAudioParameter ( std::unique_ptr< ProcessorParameter parameter)
protected

◆ addVideoParameter()

void addVideoParameter ( std::unique_ptr< ProcessorParameter parameter)
protected

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