|
OpenShot Library | libopenshot
0.7.0
|
Go to the documentation of this file.
65 *out << std::fixed << std::setprecision(2) << std::boolalpha;
66 *out <<
"----------------------------" << std::endl;
67 *out <<
"----- File Information -----" << std::endl;
68 *out <<
"----------------------------" << std::endl;
72 *out <<
"--> Duration: " <<
info.
duration <<
" Seconds" << std::endl;
73 *out <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << std::endl;
74 *out <<
"----------------------------" << std::endl;
75 *out <<
"----- Video Attributes -----" << std::endl;
76 *out <<
"----------------------------" << std::endl;
77 *out <<
"--> Width: " <<
info.
width << std::endl;
78 *out <<
"--> Height: " <<
info.
height << std::endl;
84 *out <<
"--> Video Codec: " <<
info.
vcodec << std::endl;
90 *out <<
"----------------------------" << std::endl;
91 *out <<
"----- Audio Attributes -----" << std::endl;
92 *out <<
"----------------------------" << std::endl;
93 *out <<
"--> Audio Codec: " <<
info.
acodec << std::endl;
96 *out <<
"--> # of Channels: " <<
info.
channels << std::endl;
100 *out <<
"----------------------------" << std::endl;
101 *out <<
"--------- Metadata ---------" << std::endl;
102 *out <<
"----------------------------" << std::endl;
106 *out <<
"--> " << it.first <<
": " << it.second << std::endl;
118 root[
"file_size"] =
static_cast<Json::Value::Int64
>(
info.
file_size);
122 root[
"fps"] = Json::Value(Json::objectValue);
126 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
129 root[
"display_ratio"] = Json::Value(Json::objectValue);
135 root[
"video_timebase"] = Json::Value(Json::objectValue);
146 root[
"audio_timebase"] = Json::Value(Json::objectValue);
151 root[
"metadata"] = Json::Value(Json::objectValue);
154 root[
"metadata"][it.first] = it.second;
164 if (!root[
"has_video"].isNull())
166 if (!root[
"has_audio"].isNull())
168 if (!root[
"has_single_image"].isNull())
170 if (!root[
"duration"].isNull())
172 if (!root[
"file_size"].isNull())
174 if (!root[
"height"].isNull())
176 if (!root[
"width"].isNull())
178 if (!root[
"pixel_format"].isNull())
180 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
181 if (!root[
"fps"][
"num"].isNull())
183 if (!root[
"fps"][
"den"].isNull())
186 if (!root[
"video_bit_rate"].isNull())
188 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
189 if (!root[
"pixel_ratio"][
"num"].isNull())
191 if (!root[
"pixel_ratio"][
"den"].isNull())
194 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
195 if (!root[
"display_ratio"][
"num"].isNull())
197 if (!root[
"display_ratio"][
"den"].isNull())
200 if (!root[
"vcodec"].isNull())
202 if (!root[
"video_length"].isNull())
204 if (!root[
"video_stream_index"].isNull())
206 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
207 if (!root[
"video_timebase"][
"num"].isNull())
209 if (!root[
"video_timebase"][
"den"].isNull())
212 if (!root[
"interlaced_frame"].isNull())
214 if (!root[
"top_field_first"].isNull())
216 if (!root[
"acodec"].isNull())
219 if (!root[
"audio_bit_rate"].isNull())
221 if (!root[
"sample_rate"].isNull())
223 if (!root[
"channels"].isNull())
225 if (!root[
"channel_layout"].isNull())
227 if (!root[
"audio_stream_index"].isNull())
229 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
230 if (!root[
"audio_timebase"][
"num"].isNull())
232 if (!root[
"audio_timebase"][
"den"].isNull())
235 if (!root[
"metadata"].isNull() && root[
"metadata"].isObject()) {
236 for( Json::Value::const_iterator itr = root[
"metadata"].begin() ; itr != root[
"metadata"].end() ; itr++ ) {
237 std::string key = itr.key().asString();
void DisplayInfo(std::ostream *out=&std::cout)
Display file information in the standard output stream (stdout)
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
int MaxDecodeHeight() const
Return the current maximum decoded frame height (0 when unlimited).
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
This namespace is the default namespace for all code in the openshot library.
int max_decode_width
Optional maximum decoded frame width (0 disables the limit)
This class represents a fraction.
openshot::ReaderInfo info
Information about the current media file.
bool apply_orientation_metadata
Apply source orientation metadata while reading frames.
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.
int width
The width of the video (in pixesl)
double ToDouble() const
Return this fraction as a double (i.e. 1/2 = 0.5)
openshot::ClipBase * clip
Pointer to the parent clip instance (if any)
int MaxDecodeWidth() const
Return the current maximum decoded frame width (0 when unlimited).
int64_t video_length
The number of frames in the video stream.
int height
The height of the video (in pixels)
int num
Numerator for the fraction.
void SetMaxDecodeSize(int width, int height)
Set an optional maximum decoded frame size. Use 0,0 to disable the limit.
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)
bool has_single_image
Determines if this file only contains a single image.
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
int max_decode_height
Optional maximum decoded frame height (0 disables the limit)
std::map< std::string, std::string > metadata
An optional map/dictionary of metadata for this reader.
Header file for Frame class.
int audio_stream_index
The index of the audio stream.
openshot::Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
std::string vcodec
The name of the video codec used to encode / decode the video stream.
Header file for ReaderBase class.
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
ReaderBase()
Constructor for the base reader, where many things are initialized.
bool ApplyOrientationMetadata() const
Return whether readers apply source orientation metadata to returned frames.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
int video_bit_rate
The bit rate of the video stream (in bytes)
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
Header file for JSON class.
int video_stream_index
The index of the video stream.
bool HasMaxDecodeSize() const
Return true when a maximum decoded frame size is active.
This abstract class is the base class, used by all clips in libopenshot.
std::string acodec
The name of the audio codec used to encode / decode the video stream.
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
int channels
The number of audio channels used in the audio stream.
Header file for ClipBase class.
openshot::ClipBase * ParentClip()
Parent clip object of this reader (which can be unparented and NULL)