Loading...
Searching...
No Matches
Process::MediaTrimmer Class Referenceabstract

Writes the used part of a media file into a new one. More...

Inheritance diagram for Process::MediaTrimmer:
score::InterfaceBase Media::AudioTrimmer

Detailed Description

Writes the used part of a media file into a new one.

The trimming operation itself lives in whichever plug-in knows how to read and write that kind of media – audio in score-plugin-media, and video in the graphics plug-in if anyone ever wants it – while the decision of what to trim, and all the safety around it, stays in one place.

Implementations must never write over their source and never touch anything but destination.

Public Member Functions

virtual bool supports (const QString &absolutePath) const noexcept=0
 Can this trimmer read that file?
 
virtual QString outputExtension () const noexcept=0
 The extension the trimmed file must take, without the dot.
 
virtual double duration (const QString &absolutePath) const =0
 Duration of the file in seconds, or 0 if it cannot be read.
 
virtual qint64 estimatedSize (const QString &absolutePath, MediaRange kept) const =0
 
virtual QString trim (const QString &source, const QString &destination, MediaRange range) const =0
 
- Public Member Functions inherited from score::InterfaceBase
virtual InterfaceKey interfaceKey () const noexcept=0
 Identifies an interface uniquely.
 

Member Function Documentation

◆ duration()

virtual double Process::MediaTrimmer::duration ( const QString &  absolutePath) const
pure virtual

Duration of the file in seconds, or 0 if it cannot be read.

Implemented in Media::AudioTrimmer.

◆ estimatedSize()

virtual qint64 Process::MediaTrimmer::estimatedSize ( const QString &  absolutePath,
MediaRange  kept 
) const
pure virtual

Size the trimmed file would take, so the plan shown to the user is the one that happens.

Scaling the source's size by the kept fraction is not good enough: a trimmer that re-encodes – and the audio one writes 32-bit float – can hand back a bigger file from a smaller region, and a plan promising space that never appears is exactly the complaint other implementations get.

Implemented in Media::AudioTrimmer.

◆ outputExtension()

virtual QString Process::MediaTrimmer::outputExtension ( ) const
pure virtualnoexcept

The extension the trimmed file must take, without the dot.

Implemented in Media::AudioTrimmer.

◆ supports()

virtual bool Process::MediaTrimmer::supports ( const QString &  absolutePath) const
pure virtualnoexcept

Can this trimmer read that file?

Implemented in Media::AudioTrimmer.

◆ trim()

virtual QString Process::MediaTrimmer::trim ( const QString &  source,
const QString &  destination,
MediaRange  range 
) const
pure virtual

Write range of source into destination.

range is in seconds of the source's own timeline and has already been clamped to it. Returns an empty string on success, the reason otherwise.

Implemented in Media::AudioTrimmer.


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