Ocean
Loading...
Searching...
No Matches
WICBufferImageRecorder.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_WIC_WIC_BUFFER_IMAGE_RECORDER_H
9#define META_OCEAN_MEDIA_WIC_WIC_BUFFER_IMAGE_RECORDER_H
10
11#include "ocean/media/wic/WIC.h"
13
15
16namespace Ocean
17{
18
19namespace Media
20{
21
22namespace WIC
23{
24
25/**
26 * This class implements a buffer image recorder for WIC.
27 * This recorder can be used to save images to files.
28 * @ingroup mediawic
29 */
30class OCEAN_MEDIA_WIC_EXPORT WICBufferImageRecorder :
31 virtual public WICObject,
32 virtual public BufferImageRecorder
33{
34 friend class WICLibrary;
35
36 public:
37
38 /**
39 * Saves a given frame as file explicity.
40 * @see BufferRecorder::saveImage().
41 */
42 bool saveImage(const Frame& frame, const std::string& imageType, std::vector<uint8_t>& buffer) override;
43
44 /**
45 * Returns the buffer of the most recently saved image.
46 * @see BufferRecorder::buffer().
47 */
48 bool buffer(std::vector<uint8_t>& data) const override;
49
50 /**
51 * Returns a list of possible frame encoders for this recorder.
52 * @see FrameRecorder::frameEncoders().
53 */
54 Encoders frameEncoders() const override;
55
56 /**
57 * Locks the most recent frame and returns it so that the image data can be written to this frame.
58 * @see FrameRecorder::lockBufferToFill().
59 */
60 bool lockBufferToFill(Frame& recorderFrame, const bool respectFrameFrequency = true) override;
61
62 /**
63 * Unlocks the filled buffer.
64 * @see BufferImageRecorder::unlockBufferToFill().
65 */
66 void unlockBufferToFill() override;
67
68 protected:
69
70 /**
71 * Creates a new buffer image recorder object.
72 */
74
75 /**
76 * Destructs a buffer image recorder object.
77 */
79
80 protected:
81
82 /// Image buffer if the image is not saved explicitly but by a buffer request.
84
85 /// Internal image buffer if the image is not saved explicitly but by a buffer request.
86 std::vector<uint8_t> recorderBuffer;
87};
88
89}
90
91}
92
93}
94
95#endif // META_OCEAN_MEDIA_WIC_WIC_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
std::vector< std::string > Encoders
Definition of a vector holding encoder names.
Definition Recorder.h:80
This class implements a buffer image recorder for WIC.
Definition WICBufferImageRecorder.h:33
WICBufferImageRecorder()
Creates a new buffer image recorder object.
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.
Frame recorderFrame_
Image buffer if the image is not saved explicitly but by a buffer request.
Definition WICBufferImageRecorder.h:83
std::vector< uint8_t > recorderBuffer
Internal image buffer if the image is not saved explicitly but by a buffer request.
Definition WICBufferImageRecorder.h:86
bool saveImage(const Frame &frame, const std::string &imageType, std::vector< uint8_t > &buffer) override
Saves a given frame as file explicity.
bool buffer(std::vector< uint8_t > &data) const override
Returns the buffer of the most recently saved image.
void unlockBufferToFill() override
Unlocks the filled buffer.
Encoders frameEncoders() const override
Returns a list of possible frame encoders for this recorder.
virtual ~WICBufferImageRecorder()
Destructs a buffer image recorder object.
This class implements the WIC library.
Definition WICLibrary.h:32
This class is the base class for all object inside this library.
Definition WICObject.h:31
The namespace covering the entire Ocean framework.
Definition Accessor.h:15