Ocean
Loading...
Searching...
No Matches
OILBufferImageRecorder.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_MEDIA_OPEN_IMAGE_LIBRARIES_OL_BUFFER_IMAGE_RECORDER_H
9#define META_OCEAN_MEDIA_OPEN_IMAGE_LIBRARIES_OL_BUFFER_IMAGE_RECORDER_H
10
12
14
15namespace Ocean
16{
17
18namespace Media
19{
20
21namespace OpenImageLibraries
22{
23
24/**
25 * This class implements a buffer image recorder for OpenImageLibraries.
26 * This recorder can be used to save images to files.
27 * @ingroup mediaoil
28 */
29class OCEAN_MEDIA_OIL_EXPORT OILBufferImageRecorder : virtual public BufferImageRecorder
30{
31 friend class OILLibrary;
32
33 public:
34
35 /**
36 * Saves a given frame as file explicity.
37 * @see BufferRecorder::saveImage().
38 */
39 bool saveImage(const Frame& frame, const std::string& imageType, std::vector<uint8_t>& buffer) override;
40
41 /**
42 * Returns the buffer of the most recently saved image.
43 * @see BufferRecorder::buffer().
44 */
45 bool buffer(std::vector<unsigned char>& data) const override;
46
47 /**
48 * Returns a list of possible frame encoders for this recorder.
49 * @see FrameRecorder::frameEncoders().
50 */
51 Encoders frameEncoders() const override;
52
53 /**
54 * Locks the most recent frame and returns it so that the image data can be written to this frame.
55 * @see FrameRecorder::lockBufferToFill().
56 */
57 bool lockBufferToFill(Frame& recorderFrame, const bool respectFrameFrequency = true) override;
58
59 /**
60 * Unlocks the filled buffer.
61 * @see BufferImageRecorder::unlockBufferToFill().
62 */
63 void unlockBufferToFill() override;
64
65 protected:
66
67 /**
68 * Creates a new buffer image recorder object.
69 */
71
72 /**
73 * Destructs a buffer image recorder object.
74 */
76
77 protected:
78
79 /// Image buffer if the image is not saved explicitly but by a buffer request.
81
82 /// Internal image buffer if the image is not saved explicitly but by a buffer request.
83 std::vector<unsigned char> recorderBuffer;
84};
85
86}
87
88}
89
90}
91
92#endif // META_OCEAN_MEDIA_OPEN_IMAGE_LIBRARIES_OL_BUFFER_IMAGE_RECORDER_H
This class implements Ocean's image class.
Definition Frame.h:1808
This class is the base class for all buffer recorders.
Definition BufferImageRecorder.h:45
This class implements a buffer image recorder for OpenImageLibraries.
Definition OILBufferImageRecorder.h:30
void unlockBufferToFill() override
Unlocks the filled buffer.
~OILBufferImageRecorder() override
Destructs a buffer image recorder object.
Frame recorderFrame_
Image buffer if the image is not saved explicitly but by a buffer request.
Definition OILBufferImageRecorder.h:80
bool lockBufferToFill(Frame &recorderFrame, const bool respectFrameFrequency=true) override
Locks the most recent frame and returns it so that the image data can be written to this frame.
bool buffer(std::vector< unsigned char > &data) const override
Returns the buffer of the most recently saved image.
std::vector< unsigned char > recorderBuffer
Internal image buffer if the image is not saved explicitly but by a buffer request.
Definition OILBufferImageRecorder.h:83
Encoders frameEncoders() const override
Returns a list of possible frame encoders for this recorder.
OILBufferImageRecorder()
Creates a new buffer image recorder object.
bool saveImage(const Frame &frame, const std::string &imageType, std::vector< uint8_t > &buffer) override
Saves a given frame as file explicity.
This class implements the OpenImageLibraries library.
Definition OILLibrary.h:30
std::vector< std::string > Encoders
Definition of a vector holding encoder names.
Definition Recorder.h:80
The namespace covering the entire Ocean framework.
Definition Accessor.h:15