This clip does the actual work of composing images into a video. More...
#include <foleys_ComposedClip.h>
Inheritance diagram for ComposedClip:Classes | |
| struct | ClipPosition |
Public Member Functions | |
| ComposedClip (VideoEngine &videoEngine) | |
| juce::String | getClipType () const override |
| Used to identify the clip type to the user. | |
| void | invalidateVideo () |
| Forces the video to re-render, e.g. | |
| juce::String | getDescription () const override |
| returns a string describing the clip. | |
| VideoFrame & | getFrame (double pts) override |
| Returns the frame for a certain timecode. | |
| bool | isFrameAvailable (double pts) const override |
| Checks, if a frame is available. | |
| void | render (juce::Graphics &view, 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) override |
| This is the virtual render() method for OpenGL rendering. | |
| Size | getVideoSize () const override |
| returns the pixel size of the media as a tuple. | |
| double | getCurrentTimeInSeconds () const override |
| Return the clip's read position in seconds. | |
| juce::Image | getStillImage (double seconds, Size size) override |
| This returns a still frame on the selected position. | |
| double | getLengthInSeconds () const override |
| Returns the length of the clip in seconds. | |
| void | prepareToPlay (int samplesPerBlockExpected, double sampleRate) override |
| void | releaseResources () override |
| void | getNextAudioBlock (const juce::AudioSourceChannelInfo &) override |
| void | setNextReadPosition (juce::int64 samples) override |
| juce::int64 | getNextReadPosition () const override |
| juce::int64 | getTotalLength () const override |
| bool | isLooping () const override |
| void | setLooping (bool shouldLoop) override |
| bool | hasVideo () const override |
| Returns true, if this clip will produce visual frames. | |
| bool | hasAudio () const override |
| Returns true, if this clip will produce audio. | |
| double | getFrameDurationInSeconds () const override |
| Returns the duration of a frame in seconds. | |
| void | parameterAutomationChanged (const ParameterAutomation *) override |
| std::shared_ptr< AVClip > | createCopy (StreamTypes types) override |
| This returns a copy of the clip. | |
| double | getSampleRate () const override |
| This is the samplerate supplied from prepareToPlay and the sample rate this clip will produce audio and use as clock source. | |
| bool | waitForSamplesReady (int samples, int timeout=1000) override |
| When rendering non realtime (bounce), use this to wait for background threads to read ahead. | |
| int | getDefaultBufferSize () const |
| void | readPluginStatesIntoValueTree () |
| Read all plugins getStateInformation() and save it into the statusTree as BLOB. | |
| juce::ValueTree & | getStatusTree () |
| The ValueTree describes the media and positions of the individual clips. | |
| std::shared_ptr< ClipDescriptor > | addClip (std::shared_ptr< AVClip > clip, ClipPosition position, int zPosition=-1) |
| Add an existing clip to the ComposedClip. | |
| void | removeClip (std::shared_ptr< ClipDescriptor > descriptor) |
| remove a ClipDescriptor from the clips vector | |
| std::vector< std::shared_ptr< ClipDescriptor > > | getClips () const |
| allows safe access to the clips list. | |
| std::shared_ptr< ClipDescriptor > | getClip (int index) |
| void | valueTreePropertyChanged (juce::ValueTree &treeWhosePropertyHasChanged, const juce::Identifier &property) override |
| void | valueTreeChildAdded (juce::ValueTree &parentTree, juce::ValueTree &childWhichHasBeenAdded) override |
| void | valueTreeChildRemoved (juce::ValueTree &parentTree, juce::ValueTree &childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved) override |
| void | valueTreeChildOrderChanged (juce::ValueTree &, int oldIndex, int newIndex) override |
| void | valueTreeParentChanged (juce::ValueTree &) override |
| juce::UndoManager * | getUndoManager () |
| juce::CriticalSection & | getCallbackLock () |
| This lock is used, when the vector of clips is changed, or when a clip is altered in a way, that it cannot render correctly, e.g. | |
| juce::String | makeUniqueDescription (const juce::String &description) const |
| Create a unique description by appending or incrementing a number. | |
Public Member Functions inherited from AVClip | |
| AVClip (VideoEngine &videoEngine) | |
| virtual | ~AVClip ()=default |
| virtual juce::URL | getMediaFile () const |
| returns the original media file to restore | |
| 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. | |
| void | setAspectType (Aspect type) |
| 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 |
| void | addTimecodeListener (Listener *listener) |
| Register a TimecodeListener to be notified, when the visual frame changes. | |
| void | removeTimecodeListener (Listener *listener) |
| Unregister a TimecodeListener. | |
Additional Inherited Members | |
Static Public Member Functions inherited from AVClip | |
| static void | addDefaultAudioParameters (AVClip &clip) |
| static void | addDefaultVideoParameters (AVClip &clip) |
Protected Member Functions inherited from AVClip | |
| 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. | |
This clip does the actual work of composing images into a video.
It is assembled by a number of ComposedClip::ClipDescriptor instances. ComposedClip does audio mixing as well as video compositing. While the video is done on a background thread ahead of time, the audio is pulled in realtime to allow low latency processing.
When you created a shared_ptr of an ComposedClip, call manageLifeTime() on the VideoEngine, that will add it to the auto release pool and register possible background jobs with the TimeSliceThreads.
| ComposedClip | ( | VideoEngine & | videoEngine | ) |
|
overridevirtual |
Used to identify the clip type to the user.
Implements AVClip.
| void invalidateVideo | ( | ) |
Forces the video to re-render, e.g.
if a parameter was changed
Referenced by ComposedClip::parameterAutomationChanged(), and ProcessorController::setActive().
|
overridevirtual |
returns a string describing the clip.
This could be the filename of the original media file
Implements AVClip.
|
overridevirtual |
Returns the frame for a certain timecode.
Implements AVClip.
References VideoStreamSettings::frameSize, ComposedClip::getClips(), Size::height, VideoFrame::image, ComposedClip::render(), VideoFrame::timecode, and Size::width.
|
overridevirtual |
Checks, if a frame is available.
Implements AVClip.
References ComposedClip::getClips(), and ComposedClip::getSampleRate().
|
overridevirtual |
This is the virtual render() method for OpenGL rendering.
Implements AVClip.
References foleys::IDs::alpha, ComposedClip::getClips(), foleys::IDs::rotation, foleys::IDs::translateX, foleys::IDs::translateY, and foleys::IDs::zoom.
Referenced by ComposedClip::getFrame().
|
overridevirtual |
returns the pixel size of the media as a tuple.
In some video files this can change at any frame.
Implements AVClip.
References VideoStreamSettings::frameSize.
|
overridevirtual |
Return the clip's read position in seconds.
Implements TimeCodeAware.
Referenced by ComposedClip::getNextAudioBlock().
|
overridevirtual |
This returns a still frame on the selected position.
Don't use this method for streaming a video, because it will be slow
Implements AVClip.
|
overridevirtual |
Returns the length of the clip in seconds.
Implements AVClip.
References ComposedClip::getTotalLength().
|
override |
|
override |
References ComposedClip::getClips().
|
override |
References ComposedClip::getClips(), and ComposedClip::getCurrentTimeInSeconds().
|
override |
References ComposedClip::getClips().
|
override |
|
override |
References ComposedClip::getClips().
Referenced by ComposedClip::getLengthInSeconds().
|
override |
|
override |
|
overridevirtual |
Returns true, if this clip will produce visual frames.
Implements AVClip.
References ComposedClip::getClips(), and ComposedClip::hasVideo().
Referenced by ComposedClip::hasVideo().
|
overridevirtual |
Returns true, if this clip will produce audio.
Implements AVClip.
References ComposedClip::hasAudio().
Referenced by ComposedClip::hasAudio().
|
overridevirtual |
Returns the duration of a frame in seconds.
This is the inverse of frame rate.
Reimplemented from AVClip.
References VideoStreamSettings::defaultDuration, and VideoStreamSettings::timebase.
|
overridevirtual |
Implements ControllableBase::Listener.
References ComposedClip::invalidateVideo().
|
overridevirtual |
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.
Implements AVClip.
References ComposedClip::getStatusTree(), and AVClip::getVideoEngine().
|
overridevirtual |
This is the samplerate supplied from prepareToPlay and the sample rate this clip will produce audio and use as clock source.
Implements AVClip.
References AudioStreamSettings::timebase.
Referenced by ClipDescriptor::addAudioProcessor(), ComposedClip::isFrameAvailable(), and ComposedClip::valueTreeChildAdded().
|
overridevirtual |
When rendering non realtime (bounce), use this to wait for background threads to read ahead.
Reimplemented from AVClip.
References ComposedClip::getClips().
| int getDefaultBufferSize | ( | ) | const |
References AudioStreamSettings::defaultNumSamples.
Referenced by ClipDescriptor::addAudioProcessor(), and ComposedClip::valueTreeChildAdded().
| void readPluginStatesIntoValueTree | ( | ) |
Read all plugins getStateInformation() and save it into the statusTree as BLOB.
References ComposedClip::getClips().
| juce::ValueTree & getStatusTree | ( | ) |
The ValueTree describes the media and positions of the individual clips.
You can use this to listen to changes or to serialise a clip / project
Referenced by ComposedClip::createCopy().
| std::shared_ptr< ClipDescriptor > addClip | ( | std::shared_ptr< AVClip > | clip, |
| ClipPosition | position, | ||
| int | zPosition = -1 |
||
| ) |
Add an existing clip to the ComposedClip.
| clip | is the clip you want to add |
| position | is a struct containing start, length and offset |
| zPosition | is the position in the clips vector. This value determins the drawing order of the clip. -1 will add at the end. |
References AudioStreamSettings::defaultNumSamples, ComposedClip::getUndoManager(), ComposedClip::ClipPosition::length, ComposedClip::makeUniqueDescription(), ComposedClip::ClipPosition::offset, ComposedClip::ClipPosition::start, and AudioStreamSettings::timebase.
| void removeClip | ( | std::shared_ptr< ClipDescriptor > | descriptor | ) |
remove a ClipDescriptor from the clips vector
References ComposedClip::getUndoManager().
| std::vector< std::shared_ptr< ClipDescriptor > > getClips | ( | ) | const |
allows safe access to the clips list.
It returns a copy you can modify at will
Referenced by ComposedClip::getFrame(), ComposedClip::getNextAudioBlock(), ComposedClip::getTotalLength(), ComposedClip::hasVideo(), ComposedClip::isFrameAvailable(), ComposedClip::makeUniqueDescription(), ComposedClip::prepareToPlay(), ComposedClip::readPluginStatesIntoValueTree(), ComposedClip::releaseResources(), ComposedClip::render(), ComposedClip::setNextReadPosition(), and ComposedClip::waitForSamplesReady().
| std::shared_ptr< ClipDescriptor > getClip | ( | int | index | ) |
|
override |
|
override |
|
override |
|
override |
|
override |
| juce::UndoManager * getUndoManager | ( | ) |
References AVClip::getVideoEngine().
Referenced by ComposedClip::addClip(), ComposedClip::removeClip(), ProcessorController::setActive(), and ComposedClip::valueTreeChildAdded().
| juce::CriticalSection & getCallbackLock | ( | ) |
This lock is used, when the vector of clips is changed, or when a clip is altered in a way, that it cannot render correctly, e.g.
when adding or removing an audio plugin
Referenced by ClipDescriptor::addAudioProcessor(), ClipDescriptor::addVideoProcessor(), ClipDescriptor::removeAudioProcessor(), ClipDescriptor::removeProcessor(), and ClipDescriptor::removeVideoProcessor().
| juce::String makeUniqueDescription | ( | const juce::String & | description | ) | const |
Create a unique description by appending or incrementing a number.
References ComposedClip::getClips().
Referenced by ComposedClip::addClip().