This class implements a AVFoundation movie recorder.
More...
#include <AVFMovieRecorder.h>
|
bool | setFilename (const std::string &filename) override |
| Sets the filename of this recorder.
|
|
bool | start () override |
| Sets the recorder.
|
|
bool | stop () override |
| Stops the recorder.
|
|
bool | isRecording () const override |
| Returns whether this recorder is currently recording.
|
|
Encoders | frameEncoders () const override |
| Returns a list of possible frame encoders for this recorder.
|
|
bool | lockBufferToFill (Frame &recorderFrame, const bool respectFrameFrequency=true) override |
| Returns a pointer to the most recent buffer to be filled immediately and locks it.
|
|
void | unlockBufferToFill () override |
| Unlocks the filled buffer.
|
|
const std::string & | filename () const |
| Returns the filename of this recorder.
|
|
bool | filenameSuffixed () const |
| Returns whether the filename of this recorder will be suffixed with date and time.
|
|
virtual bool | setFilenameSuffixed (const bool suffixed) |
| Sets whether the filename will be suffixed with date and time.
|
|
Type | type () const |
| Returns the type of this recorder.
|
|
const FrameType & | frameType () const |
| Returns the actual frame type of this recorder.
|
|
double | frameFrequency () const |
| Returns the frame frequency of this recorder in Hz.
|
|
const std::string & | frameEncoder () const |
| Returns the name of the encoder used to encoder the frames.
|
|
virtual bool | frameEncoderHasConfiguration () |
| Returns whether the selected frame encoder has a configuration possibility.
|
|
virtual bool | setPreferredFrameType (const FrameType &type) |
| Sets the preferred frame type of this recorder.
|
|
virtual bool | setFrameFrequency (const double frequency) |
| Sets the frame frequency of this recorder.
|
|
virtual bool | setFrameEncoder (const std::string &encoder) |
| Sets the frame encoder used to encode the frames.
|
|
virtual bool | frameEncoderConfiguration (long long data) |
| Starts the frame encoder configuration possibility.
|
|
|
enum | Type {
RECORDER = 0
, FRAME_RECORDER = 1
, SOUND_RECORDER = 2
, EXPLICIT_RECORDER = 4
,
IMPLICIT_RECORDER = 8
, FILE_RECORDER = 16 | EXPLICIT_RECORDER
, BUFFER_RECORDER = 32 | EXPLICIT_RECORDER
, STREAMING_RECORDER = 64 | IMPLICIT_RECORDER
,
MOVIE_RECORDER = 128 | FRAME_RECORDER | FILE_RECORDER
, FRAME_STREAMING_RECORDER = 256 | FRAME_RECORDER | STREAMING_RECORDER
, IMAGE_RECORDER = 512 | FRAME_RECORDER | FILE_RECORDER
, BUFFER_IMAGE_RECORDER = 1024 | FRAME_RECORDER | BUFFER_RECORDER
,
IMAGE_SEQUENCE_RECORDER = 2048 | FRAME_RECORDER | FILE_RECORDER
, FRAME_MEMORY_RECORDER = 4096 | FRAME_RECORDER
} |
| Definition of different recorder types. More...
|
|
typedef std::vector< std::string > | Encoders |
| Definition of a vector holding encoder names.
|
|
This class implements a AVFoundation movie recorder.
The recorder can record mp4 files and mov files.
◆ AVFMovieRecorder()
Ocean::Media::AVFoundation::AVFMovieRecorder::AVFMovieRecorder |
( |
| ) |
|
|
protected |
Creates a new movie recorder object.
◆ ~AVFMovieRecorder()
Ocean::Media::AVFoundation::AVFMovieRecorder::~AVFMovieRecorder |
( |
| ) |
|
|
overrideprotected |
Destructs a movie recorder object.
◆ bestMatchingPixelFormat()
Returns the best matching pixel format for a preferred pixel format.
Depending on the platform, not each preferred pixel format may be supported. This function allows to determine the best matching pixel format closes to the preferred pixel format.
- Parameters
-
preferredPixelFormat | The preferred pixel format, can be invalid |
- Returns
- The supported pixel format best matching with the preferred pixel format
◆ createNewAssetWriter()
bool Ocean::Media::AVFoundation::AVFMovieRecorder::createNewAssetWriter |
( |
| ) |
|
|
protected |
Creates a new asset writer and all associated resources.
- Returns
- True, if succeeded
◆ fileExtensionToFileType()
static AVFileType Ocean::Media::AVFoundation::AVFMovieRecorder::fileExtensionToFileType |
( |
const std::string & |
fileExtension | ) |
|
|
static |
Translates the file extension of a movie to a corresponding AVFileType.
The following extensions are supported: mp4, mov.
- Parameters
-
fileExtension | The extension of the movie's filename |
- Returns
- The corresponding AVFileType value, if existing, invalid otherwise
◆ frameEncoders()
Encoders Ocean::Media::AVFoundation::AVFMovieRecorder::frameEncoders |
( |
| ) |
const |
|
overridevirtual |
◆ frameEncoderToVideoCodecType()
static AVVideoCodecType Ocean::Media::AVFoundation::AVFMovieRecorder::frameEncoderToVideoCodecType |
( |
const std::string & |
frameEncoder | ) |
|
|
static |
Translates a frame encoder to a corresponding AVVideoCodecType.
- Parameters
-
frameEncoder | The name of the encoder |
- Returns
- The corresponding AVVideoCodecType value, if existing, invalid otherwise
- See also
- frameEncoders().
◆ isRecording()
bool Ocean::Media::AVFoundation::AVFMovieRecorder::isRecording |
( |
| ) |
const |
|
overridevirtual |
◆ lockBufferToFill()
bool Ocean::Media::AVFoundation::AVFMovieRecorder::lockBufferToFill |
( |
Frame & |
recorderFrame, |
|
|
const bool |
respectFrameFrequency = true |
|
) |
| |
|
overridevirtual |
Returns a pointer to the most recent buffer to be filled immediately and locks it.
Beware: Call unlockBufferToFill() once the image data is written to the frame.
- Parameters
-
recorderFrame | The resulting frame in which the image data can be copied, the frame type of this frame must not be changed |
respectFrameFrequency | Flag determining that a buffer will be returned if it is time for a new frame only |
Implements Ocean::Media::FrameRecorder.
◆ release()
void Ocean::Media::AVFoundation::AVFMovieRecorder::release |
( |
| ) |
|
|
protected |
◆ setFilename()
bool Ocean::Media::AVFoundation::AVFMovieRecorder::setFilename |
( |
const std::string & |
filename | ) |
|
|
overridevirtual |
◆ start()
bool Ocean::Media::AVFoundation::AVFMovieRecorder::start |
( |
| ) |
|
|
overridevirtual |
◆ stop()
bool Ocean::Media::AVFoundation::AVFMovieRecorder::stop |
( |
| ) |
|
|
overridevirtual |
◆ time()
CMTime Ocean::Media::AVFoundation::AVFMovieRecorder::time |
( |
const double |
timestamp | ) |
|
|
inlineprotected |
Returns the time for a given timestamp.
- Parameters
-
timestamp | Playback timestamp in seconds, with range [0, infinity) |
◆ unlockBufferToFill()
void Ocean::Media::AVFoundation::AVFMovieRecorder::unlockBufferToFill |
( |
| ) |
|
|
overridevirtual |
◆ AVFLibrary
◆ assetWriter_
AVAssetWriter* Ocean::Media::AVFoundation::AVFMovieRecorder::assetWriter_ = nullptr |
|
protected |
◆ assetWriterInput_
AVAssetWriterInput* Ocean::Media::AVFoundation::AVFMovieRecorder::assetWriterInput_ = nullptr |
|
protected |
The input for the asset writer.
◆ assetWriterInputPixelBufferAdaptor_
AVAssetWriterInputPixelBufferAdaptor* Ocean::Media::AVFoundation::AVFMovieRecorder::assetWriterInputPixelBufferAdaptor_ = nullptr |
|
protected |
The pixel buffer adaptor for the input asset writer.
◆ isRecording_
bool Ocean::Media::AVFoundation::AVFMovieRecorder::isRecording_ = false |
|
protected |
True, if the recoder is actively recording frames; False, otherwise.
◆ isStopped_
bool Ocean::Media::AVFoundation::AVFMovieRecorder::isStopped_ = true |
|
protected |
True, if this recorder is stopped.
◆ nextFrameTimestamp_
double Ocean::Media::AVFoundation::AVFMovieRecorder::nextFrameTimestamp_ = 0.0 |
|
protected |
The timestamp of the next frame.
◆ pixelBuffer_
CVPixelBufferRef Ocean::Media::AVFoundation::AVFMovieRecorder::pixelBuffer_ = nullptr |
|
protected |
The pixel buffer to be filled.
◆ pixelBufferAccessor_
The pixel buffer accessor.
◆ previousFrameTimestamp_
double Ocean::Media::AVFoundation::AVFMovieRecorder::previousFrameTimestamp_ = -1.0 |
|
protected |
The timestamp of the previous frame.
The documentation for this class was generated from the following file: