Ocean
FFMMedium.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_FFM_MEDIUM_H
9
#define META_OCEAN_MEDIA_FFM_MEDIUM_H
10
11
#include "
ocean/media/ffmpeg/FFmpeg.h
"
12
13
#include "
ocean/media/Medium.h
"
14
15
// Forward declaration.
16
struct
AVFormatContext;
17
18
namespace
Ocean
19
{
20
21
namespace
Media
22
{
23
24
namespace
FFmpeg
25
{
26
27
/**
28
* This is the base class for all FFmpeg mediums.
29
* @ingroup mediaffm
30
*/
31
class
FFMMedium
:
virtual
public
Medium
32
{
33
public
:
34
35
/**
36
* Returns whether the medium is started currently.
37
* @see Medium::isStarted()
38
*/
39
bool
isStarted
()
const override
;
40
41
/**
42
* Returns the start timestamp.
43
* @return Start timestamp
44
*/
45
Timestamp
startTimestamp
()
const override
;
46
47
/**
48
* Returns the pause timestamp.
49
* @return Pause timestamp
50
*/
51
Timestamp
pauseTimestamp
()
const override
;
52
53
/**
54
* Returns the stop timestamp.
55
* @return Stop timestamp
56
*/
57
Timestamp
stopTimestamp
()
const override
;
58
59
protected
:
60
61
/**
62
* Creates a new medium by a given url.
63
* @param url Url of the medium
64
*/
65
explicit
FFMMedium
(
const
std::string&
url
);
66
67
/**
68
* Destructs a FFMMedium object.
69
*/
70
~FFMMedium
()
override
;
71
72
/**
73
* Starts the medium.
74
* The internalStart() function will be called inside.
75
* @see Medium::start()
76
*/
77
bool
start
()
override
;
78
79
/**
80
* Pauses the medium.
81
* The internalPause() function will be called inside.
82
* @see Medium::pause()
83
*/
84
bool
pause
()
override
;
85
86
/**
87
* Stops the medium.
88
* The internalStop() function will be called inside.
89
* @see Medium::stop()
90
*/
91
bool
stop
()
override
;
92
93
/**
94
* Internally starts the medium.
95
* @return True, if succeeded or if the medium is already started
96
*/
97
virtual
bool
internalStart
() = 0;
98
99
/**
100
* Internally pauses the medium.
101
* @return True, if succeeded or if the medium is already paused
102
*/
103
virtual
bool
internalPause
() = 0;
104
105
/**
106
* Internally stops the medium.
107
* @return True, if succeeded or if the medium is already stopped
108
*/
109
virtual
bool
internalStop
() = 0;
110
111
/**
112
* Creates a FFmpeg context and opens a given file.
113
* @param filename The name of the file to open, must be valid
114
* @return True, if succeeded
115
*/
116
bool
createContextAndOpenFile
(
const
std::string& filename);
117
118
/**
119
* Releases the FFmpeg context.
120
*/
121
void
releaseContext
();
122
123
protected
:
124
125
/// FFmpeg's format context object.
126
AVFormatContext*
avFormatContext_
=
nullptr
;
127
128
/// Start timestamp
129
Timestamp
startTimestamp_
=
Timestamp
(
false
);
130
131
/// Pause timestamp
132
Timestamp
pauseTimestamp_
=
Timestamp
(
false
);
133
134
/// Stop timestamp
135
Timestamp
stopTimestamp_
=
Timestamp
(
false
);
136
};
137
138
}
139
140
}
141
142
}
143
144
#endif
// META_OCEAN_MEDIA_FFM_MEDIUM_H
FFmpeg.h
Medium.h
Ocean::Media::FFmpeg::FFMMedium
This is the base class for all FFmpeg mediums.
Definition:
FFMMedium.h:32
Ocean::Media::FFmpeg::FFMMedium::pauseTimestamp
Timestamp pauseTimestamp() const override
Returns the pause timestamp.
Ocean::Media::FFmpeg::FFMMedium::internalStart
virtual bool internalStart()=0
Internally starts the medium.
Ocean::Media::FFmpeg::FFMMedium::FFMMedium
FFMMedium(const std::string &url)
Creates a new medium by a given url.
Ocean::Media::FFmpeg::FFMMedium::start
bool start() override
Starts the medium.
Ocean::Media::FFmpeg::FFMMedium::internalStop
virtual bool internalStop()=0
Internally stops the medium.
Ocean::Media::FFmpeg::FFMMedium::pause
bool pause() override
Pauses the medium.
Ocean::Media::FFmpeg::FFMMedium::stopTimestamp_
Timestamp stopTimestamp_
Stop timestamp.
Definition:
FFMMedium.h:135
Ocean::Media::FFmpeg::FFMMedium::pauseTimestamp_
Timestamp pauseTimestamp_
Pause timestamp.
Definition:
FFMMedium.h:132
Ocean::Media::FFmpeg::FFMMedium::avFormatContext_
AVFormatContext * avFormatContext_
FFmpeg's format context object.
Definition:
FFMMedium.h:126
Ocean::Media::FFmpeg::FFMMedium::startTimestamp_
Timestamp startTimestamp_
Start timestamp.
Definition:
FFMMedium.h:129
Ocean::Media::FFmpeg::FFMMedium::stop
bool stop() override
Stops the medium.
Ocean::Media::FFmpeg::FFMMedium::startTimestamp
Timestamp startTimestamp() const override
Returns the start timestamp.
Ocean::Media::FFmpeg::FFMMedium::releaseContext
void releaseContext()
Releases the FFmpeg context.
Ocean::Media::FFmpeg::FFMMedium::createContextAndOpenFile
bool createContextAndOpenFile(const std::string &filename)
Creates a FFmpeg context and opens a given file.
Ocean::Media::FFmpeg::FFMMedium::stopTimestamp
Timestamp stopTimestamp() const override
Returns the stop timestamp.
Ocean::Media::FFmpeg::FFMMedium::internalPause
virtual bool internalPause()=0
Internally pauses the medium.
Ocean::Media::FFmpeg::FFMMedium::isStarted
bool isStarted() const override
Returns whether the medium is started currently.
Ocean::Media::FFmpeg::FFMMedium::~FFMMedium
~FFMMedium() override
Destructs a FFMMedium object.
Ocean::Media::Medium
This is the base class for all mediums.
Definition:
Medium.h:48
Ocean::Media::Medium::url
const std::string & url() const
Returns the url of the medium.
Definition:
Medium.h:236
Ocean::Timestamp
This class implements a timestamp.
Definition:
Timestamp.h:36
Ocean
The namespace covering the entire Ocean framework.
Definition:
Accessor.h:15
impl
ocean
media
ffmpeg
FFMMedium.h
Generated on Sat Dec 28 2024 06:03:11 for Ocean by
1.9.1