OpenShot Library | libopenshot
0.2.2
|
Go to the documentation of this file.
28 #include "../include/ReaderBase.h"
67 cout << fixed << setprecision(2) << boolalpha;
68 cout <<
"----------------------------" << endl;
69 cout <<
"----- File Information -----" << endl;
70 cout <<
"----------------------------" << endl;
74 cout <<
"--> Duration: " <<
info.
duration <<
" Seconds" << endl;
75 cout <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << endl;
76 cout <<
"----------------------------" << endl;
77 cout <<
"----- Video Attributes -----" << endl;
78 cout <<
"----------------------------" << endl;
79 cout <<
"--> Width: " <<
info.
width << endl;
86 cout <<
"--> Video Codec: " <<
info.
vcodec << endl;
92 cout <<
"----------------------------" << endl;
93 cout <<
"----- Audio Attributes -----" << endl;
94 cout <<
"----------------------------" << endl;
95 cout <<
"--> Audio Codec: " <<
info.
acodec << endl;
102 cout <<
"----------------------------" << endl;
103 cout <<
"--------- Metadata ---------" << endl;
104 cout <<
"----------------------------" << endl;
107 map<string, string>::iterator it;
109 cout <<
"--> " << it->first <<
": " << it->second << endl;
121 stringstream filesize_stream;
123 root[
"file_size"] = filesize_stream.str();
127 root[
"fps"] = Json::Value(Json::objectValue);
131 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
134 root[
"display_ratio"] = Json::Value(Json::objectValue);
138 stringstream video_length_stream;
140 root[
"video_length"] = video_length_stream.str();
142 root[
"video_timebase"] = Json::Value(Json::objectValue);
153 root[
"audio_timebase"] = Json::Value(Json::objectValue);
158 root[
"metadata"] = Json::Value(Json::objectValue);
159 map<string, string>::iterator it;
161 root[
"metadata"][it->first] = it->second;
171 if (!root[
"has_video"].isNull())
173 if (!root[
"has_audio"].isNull())
175 if (!root[
"has_single_image"].isNull())
177 if (!root[
"duration"].isNull())
179 if (!root[
"file_size"].isNull())
180 info.
file_size = atoll(root[
"file_size"].asString().c_str());
181 if (!root[
"height"].isNull())
183 if (!root[
"width"].isNull())
185 if (!root[
"pixel_format"].isNull())
187 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
188 if (!root[
"fps"][
"num"].isNull())
190 if (!root[
"fps"][
"den"].isNull())
193 if (!root[
"video_bit_rate"].isNull())
195 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
196 if (!root[
"pixel_ratio"][
"num"].isNull())
198 if (!root[
"pixel_ratio"][
"den"].isNull())
201 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
202 if (!root[
"display_ratio"][
"num"].isNull())
204 if (!root[
"display_ratio"][
"den"].isNull())
207 if (!root[
"vcodec"].isNull())
209 if (!root[
"video_length"].isNull())
211 if (!root[
"video_stream_index"].isNull())
213 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
214 if (!root[
"video_timebase"][
"num"].isNull())
216 if (!root[
"video_timebase"][
"den"].isNull())
219 if (!root[
"interlaced_frame"].isNull())
221 if (!root[
"top_field_first"].isNull())
223 if (!root[
"acodec"].isNull())
226 if (!root[
"audio_bit_rate"].isNull())
228 if (!root[
"sample_rate"].isNull())
230 if (!root[
"channels"].isNull())
232 if (!root[
"channel_layout"].isNull())
234 if (!root[
"audio_stream_index"].isNull())
236 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
237 if (!root[
"audio_timebase"][
"num"].isNull())
239 if (!root[
"audio_timebase"][
"den"].isNull())
242 if (!root[
"metadata"].isNull() && root[
"metadata"].isObject()) {
243 for( Json::Value::iterator itr = root[
"metadata"].begin() ; itr != root[
"metadata"].end() ; itr++ ) {
244 string key = itr.key().asString();
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
virtual void SetJsonValue(Json::Value root)=0
Load Json::JsonValue into this object.
This namespace is the default namespace for all code in the openshot library.
This class represents a fraction.
ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
int audio_bit_rate
The bit rate of the audio stream (in bytes)
float duration
Length of time (in seconds)
bool has_video
Determines if this file has a video stream.
Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
virtual Json::Value JsonValue()=0
Generate Json::JsonValue for this object.
int width
The width of the video (in pixesl)
ReaderInfo info
Information about the current media file.
string acodec
The name of the audio codec used to encode / decode the video stream.
int max_height
The maximium image height needed by this clip (used for optimizations)
int64_t video_length
The number of frames in the video stream.
void DisplayInfo()
Display file information in the standard output stream (stdout)
int height
The height of the video (in pixels)
int num
Numerator for the fraction.
int den
Denominator for the fraction.
bool has_audio
Determines if this file has an audio stream.
int64_t file_size
Size of file (in bytes)
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
bool has_single_image
Determines if this file only contains a single image.
int max_width
The maximum image width needed by this clip (used for optimizations)
std::map< string, string > metadata
An optional map/dictionary of metadata for this reader.
int audio_stream_index
The index of the audio stream.
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
string vcodec
The name of the video codec used to encode / decode the video stream.
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
ReaderBase()
Constructor for the base reader, where many things are initialized.
int video_bit_rate
The bit rate of the video stream (in bytes)
double ToDouble()
Return this fraction as a double (i.e. 1/2 = 0.5)
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
int video_stream_index
The index of the video stream.
Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
int channels
The number of audio channels used in the audio stream.