forked from my-groove/ffmpeg-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaInformation.h
More file actions
181 lines (155 loc) · 6.09 KB
/
Copy pathMediaInformation.h
File metadata and controls
181 lines (155 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
* Copyright (c) 2022 Taner Sener
*
* This file is part of FFmpegKit.
*
* FFmpegKit is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FFmpegKit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FFMPEG_KIT_MEDIA_INFORMATION_H
#define FFMPEG_KIT_MEDIA_INFORMATION_H
#include "Chapter.h"
#include "StreamInformation.h"
#include <memory>
#include <vector>
namespace ffmpegkit {
/**
* Media information class.
*/
class MediaInformation {
public:
static constexpr const char* KeyFormatProperties = "format";
static constexpr const char* KeyFilename = "filename";
static constexpr const char* KeyFormat = "format_name";
static constexpr const char* KeyFormatLong = "format_long_name";
static constexpr const char* KeyStartTime = "start_time";
static constexpr const char* KeyDuration = "duration";
static constexpr const char* KeySize = "size";
static constexpr const char* KeyBitRate = "bit_rate";
static constexpr const char* KeyTags = "tags";
MediaInformation(std::shared_ptr<rapidjson::Value> mediaInformationValue, std::shared_ptr<std::vector<std::shared_ptr<ffmpegkit::StreamInformation>>> streams, std::shared_ptr<std::vector<std::shared_ptr<ffmpegkit::Chapter>>> chapters);
/**
* Returns file name.
*
* @return media file name
*/
std::shared_ptr<std::string> getFilename();
/**
* Returns format.
*
* @return media format
*/
std::shared_ptr<std::string> getFormat();
/**
* Returns long format.
*
* @return media long format
*/
std::shared_ptr<std::string> getLongFormat();
/**
* Returns duration.
*
* @return media duration in milliseconds
*/
std::shared_ptr<std::string> getDuration();
/**
* Returns start time.
*
* @return media start time in milliseconds
*/
std::shared_ptr<std::string> getStartTime();
/**
* Returns size.
*
* @return media size in bytes
*/
std::shared_ptr<std::string> getSize();
/**
* Returns bitrate.
*
* @return media bitrate in kb/s
*/
std::shared_ptr<std::string> getBitrate();
/**
* Returns all tags.
*
* @return tags Value
*/
std::shared_ptr<rapidjson::Value> getTags();
/**
* Returns all streams.
*
* @return streams vector
*/
std::shared_ptr<std::vector<std::shared_ptr<ffmpegkit::StreamInformation>>> getStreams();
/**
* Returns all chapters.
*
* @return chapters vector
*/
std::shared_ptr<std::vector<std::shared_ptr<ffmpegkit::Chapter>>> getChapters();
/**
* Returns the property associated with the key.
*
* @return property as string or nullptr if the key is not found
*/
std::shared_ptr<std::string> getStringProperty(const char* key);
/**
* Returns the property associated with the key.
*
* @return property as number or nullptr if the key is not found
*/
std::shared_ptr<int64_t> getNumberProperty(const char* key);
/**
* Returns the property associated with the key.
*
* @return property in a Value or nullptr if the key is not found
*/
std::shared_ptr<rapidjson::Value> getProperty(const char* key);
/**
* Returns the format property associated with the key.
*
* @return format property as string or nullptr if the key is not found
*/
std::shared_ptr<std::string> getStringFormatProperty(const char* key);
/**
* Returns the format property associated with the key.
*
* @return format property as number or nullptr if the key is not found
*/
std::shared_ptr<int64_t> getNumberFormatProperty(const char* key);
/**
* Returns the format property associated with the key.
*
* @return format property in a Value or nullptr if the key is not found
*/
std::shared_ptr<rapidjson::Value> getFormatProperty(const char* key);
/**
* Returns all format properties defined.
*
* @return all format properties in a Value or nullptr if no format properties are defined
*/
std::shared_ptr<rapidjson::Value> getFormatProperties();
/**
* Returns all properties defined.
*
* @return all properties in a Value or nullptr if no properties are defined
*/
std::shared_ptr<rapidjson::Value> getAllProperties();
private:
std::shared_ptr<rapidjson::Value> _mediaInformationValue;
std::shared_ptr<std::vector<std::shared_ptr<ffmpegkit::StreamInformation>>> _streams;
std::shared_ptr<std::vector<std::shared_ptr<ffmpegkit::Chapter>>> _chapters;
};
}
#endif // FFMPEG_KIT_MEDIA_INFORMATION_H