Ocean
Loading...
Searching...
No Matches
Recorder.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_RECORDER_H
9#define META_OCEAN_MEDIA_RECORDER_H
10
11#include "ocean/media/Media.h"
12
14
15#include <vector>
16
17namespace Ocean
18{
19
20namespace Media
21{
22
23// Forward declaration.
24class Recorder;
25
26/**
27 * Definition of a object reference holding recorder objects.
28 * @ingroup media
29 */
31
32/**
33 * This class is the base class for all recorder.
34 * @ingroup media
35 */
36class OCEAN_MEDIA_EXPORT Recorder
37{
38 friend class ObjectRef<Recorder>;
39
40 public:
41
42 /**
43 * Definition of different recorder types.
44 */
45 enum Type
46 {
47 /// Simple recorder.
49 /// Frame recorder.
51 /// Sound recorder.
53 /// Explicit recorder.
55 /// Implicit recorder.
57 /// File recorder.
59 /// Buffer recorder.
61 /// Streaming recorder.
63 /// Movie recorder.
65 /// Frame streaming recorder.
67 /// Image recorder.
69 /// Buffer image recorder.
71 /// Image sequence recorder.
73 /// Frame memory recorder.
75 };
76
77 /**
78 * Definition of a vector holding encoder names.
79 */
81
82 public:
83
84 /**
85 * Returns whether this recorder is currently recording.
86 * @return True, if so
87 */
88 virtual bool isRecording() const = 0;
89
90 /**
91 * Sets the preferred bit rate when recording the data.
92 * @param preferredBitrate Preferred bit rate, in bits per seconds, with range (0, infinity); 0 to use the default bit rate
93 * @return True, if succeeded
94 */
95 virtual bool setPreferredBitrate(const unsigned int preferredBitrate);
96
97 /**
98 * Returns the type of this recorder.
99 * @return Recorder type
100 */
101 inline Type type() const;
102
103 protected:
104
105 /**
106 * Creates a new recorder.
107 */
108 Recorder() = default;
109
110 /**
111 * Destructs a recorder.
112 */
113 virtual ~Recorder();
114
115 protected:
116
117 /// Type of this recorder.
119
120 /// Lock of this recorder.
121 mutable Lock lock_;
122};
123
125{
126 return recorderType_;
127}
128
129}
130
131}
132
133#endif // META_OCEAN_MEDIA_RECORDER_H
This class implements a recursive lock object.
Definition Lock.h:31
This class is the base class for all recorder.
Definition Recorder.h:37
virtual bool setPreferredBitrate(const unsigned int preferredBitrate)
Sets the preferred bit rate when recording the data.
virtual bool isRecording() const =0
Returns whether this recorder is currently recording.
Recorder()=default
Creates a new recorder.
Type recorderType_
Type of this recorder.
Definition Recorder.h:118
virtual ~Recorder()
Destructs a recorder.
Type type() const
Returns the type of this recorder.
Definition Recorder.h:124
Lock lock_
Lock of this recorder.
Definition Recorder.h:121
Type
Definition of different recorder types.
Definition Recorder.h:46
@ EXPLICIT_RECORDER
Explicit recorder.
Definition Recorder.h:54
@ FRAME_MEMORY_RECORDER
Frame memory recorder.
Definition Recorder.h:74
@ RECORDER
Simple recorder.
Definition Recorder.h:48
@ IMAGE_SEQUENCE_RECORDER
Image sequence recorder.
Definition Recorder.h:72
@ STREAMING_RECORDER
Streaming recorder.
Definition Recorder.h:62
@ BUFFER_IMAGE_RECORDER
Buffer image recorder.
Definition Recorder.h:70
@ MOVIE_RECORDER
Movie recorder.
Definition Recorder.h:64
@ FRAME_STREAMING_RECORDER
Frame streaming recorder.
Definition Recorder.h:66
@ SOUND_RECORDER
Sound recorder.
Definition Recorder.h:52
@ FILE_RECORDER
File recorder.
Definition Recorder.h:58
@ BUFFER_RECORDER
Buffer recorder.
Definition Recorder.h:60
@ IMAGE_RECORDER
Image recorder.
Definition Recorder.h:68
@ FRAME_RECORDER
Frame recorder.
Definition Recorder.h:50
@ IMPLICIT_RECORDER
Implicit recorder.
Definition Recorder.h:56
Strings Encoders
Definition of a vector holding encoder names.
Definition Recorder.h:80
This template class implements a object reference with an internal reference counter.
Definition base/ObjectRef.h:58
std::vector< std::string > Strings
Definition of a vector holding strings.
Definition Base.h:162
Ocean::ObjectRef< Recorder > RecorderRef
Definition of a object reference holding recorder objects.
Definition Recorder.h:30
Namespace of the Media library.
Definition AAudio.h:26
The namespace covering the entire Ocean framework.
Definition Accessor.h:15