28 #include "../include/ReaderBase.h"
30 using namespace openshot;
68 string arg2_name,
float arg2_value,
69 string arg3_name,
float arg3_value,
70 string arg4_name,
float arg4_value,
71 string arg5_name,
float arg5_value,
72 string arg6_name,
float arg6_value)
79 #pragma omp critical (debug_output)
82 message << fixed << setprecision(4);
83 message << method_name <<
" (";
86 if (arg1_name.length() > 0)
87 message << arg1_name <<
"=" << arg1_value;
89 if (arg2_name.length() > 0)
90 message <<
", " << arg2_name <<
"=" << arg2_value;
92 if (arg3_name.length() > 0)
93 message <<
", " << arg3_name <<
"=" << arg3_value;
95 if (arg4_name.length() > 0)
96 message <<
", " << arg4_name <<
"=" << arg4_value;
98 if (arg5_name.length() > 0)
99 message <<
", " << arg5_name <<
"=" << arg5_value;
101 if (arg6_name.length() > 0)
102 message <<
", " << arg6_name <<
"=" << arg6_value;
105 message <<
")" << endl;
114 cout << fixed << setprecision(2) << boolalpha;
115 cout <<
"----------------------------" << endl;
116 cout <<
"----- File Information -----" << endl;
117 cout <<
"----------------------------" << endl;
121 cout <<
"--> Duration: " <<
info.
duration <<
" Seconds" << endl;
122 cout <<
"--> File Size: " << double(
info.
file_size) / 1024 / 1024 <<
" MB" << endl;
123 cout <<
"----------------------------" << endl;
124 cout <<
"----- Video Attributes -----" << endl;
125 cout <<
"----------------------------" << endl;
126 cout <<
"--> Width: " <<
info.
width << endl;
127 cout <<
"--> Height: " <<
info.
height << endl;
133 cout <<
"--> Video Codec: " <<
info.
vcodec << endl;
139 cout <<
"----------------------------" << endl;
140 cout <<
"----- Audio Attributes -----" << endl;
141 cout <<
"----------------------------" << endl;
142 cout <<
"--> Audio Codec: " <<
info.
acodec << endl;
149 cout <<
"----------------------------" << endl;
161 stringstream filesize_stream;
163 root[
"file_size"] = filesize_stream.str();
167 root[
"fps"] = Json::Value(Json::objectValue);
171 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
174 root[
"display_ratio"] = Json::Value(Json::objectValue);
178 stringstream video_length_stream;
180 root[
"video_length"] = video_length_stream.str();
182 root[
"video_timebase"] = Json::Value(Json::objectValue);
193 root[
"audio_timebase"] = Json::Value(Json::objectValue);
205 if (!root[
"has_video"].isNull())
207 if (!root[
"has_audio"].isNull())
209 if (!root[
"has_single_image"].isNull())
211 if (!root[
"duration"].isNull())
213 if (!root[
"file_size"].isNull())
214 info.
file_size = atoll(root[
"file_size"].asString().c_str());
215 if (!root[
"height"].isNull())
217 if (!root[
"width"].isNull())
219 if (!root[
"pixel_format"].isNull())
221 if (!root[
"fps"].isNull() && root[
"fps"].isObject()) {
222 if (!root[
"fps"][
"num"].isNull())
224 if (!root[
"fps"][
"den"].isNull())
227 if (!root[
"video_bit_rate"].isNull())
229 if (!root[
"pixel_ratio"].isNull() && root[
"pixel_ratio"].isObject()) {
230 if (!root[
"pixel_ratio"][
"num"].isNull())
232 if (!root[
"pixel_ratio"][
"den"].isNull())
235 if (!root[
"display_ratio"].isNull() && root[
"display_ratio"].isObject()) {
236 if (!root[
"display_ratio"][
"num"].isNull())
238 if (!root[
"display_ratio"][
"den"].isNull())
241 if (!root[
"vcodec"].isNull())
243 if (!root[
"video_length"].isNull())
245 if (!root[
"video_stream_index"].isNull())
247 if (!root[
"video_timebase"].isNull() && root[
"video_timebase"].isObject()) {
248 if (!root[
"video_timebase"][
"num"].isNull())
250 if (!root[
"video_timebase"][
"den"].isNull())
253 if (!root[
"interlaced_frame"].isNull())
255 if (!root[
"top_field_first"].isNull())
257 if (!root[
"acodec"].isNull())
260 if (!root[
"audio_bit_rate"].isNull())
262 if (!root[
"sample_rate"].isNull())
264 if (!root[
"channels"].isNull())
266 if (!root[
"channel_layout"].isNull())
268 if (!root[
"audio_stream_index"].isNull())
270 if (!root[
"audio_timebase"].isNull() && root[
"audio_timebase"].isObject()) {
271 if (!root[
"audio_timebase"][
"num"].isNull())
273 if (!root[
"audio_timebase"][
"den"].isNull())
282 QGraphicsScene *scene =
reinterpret_cast<QGraphicsScene*
>(_graphics_scene_address);
283 QGraphicsPixmapItem *item =
new QGraphicsPixmapItem(QPixmap(QString(path.c_str())));
284 scene->addItem(item);
long long file_size
Size of file (in bytes)
int num
Numerator for the fraction.
void DrawFrameOnScene(string path, long _graphics_scene_address)
Test method to draw a bitmap on a Qt QGraphicsScene.
ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
int width
The width of the video (in pixesl)
ReaderBase()
Constructor for the base reader, where many things are initialized.
float duration
Length of time (in seconds)
string acodec
The name of the audio codec used to encode / decode the video stream.
bool has_video
Determines if this file has a video stream.
void Log(string message)
Log message to all subscribers of this logger (if any)
Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) ...
int audio_bit_rate
The bit rate of the audio stream (in bytes)
bool has_audio
Determines if this file has an audio stream.
void AppendDebugMethod(string method_name, string arg1_name, float arg1_value, string arg2_name, float arg2_value, string arg3_name, float arg3_value, string arg4_name, float arg4_value, string arg5_name, float arg5_value, string arg6_name, float arg6_value)
Append debug information as JSON.
int audio_stream_index
The index of the audio stream.
int height
The height of the video (in pixels)
This class represents a fraction.
bool has_single_image
Determines if this file only contains a single image.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround...
virtual Json::Value JsonValue()=0
Generate Json::JsonValue for this object.
virtual void SetJsonValue(Json::Value root)=0
Load Json::JsonValue into this object.
ReaderInfo info
Information about the current media file.
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.
static ZmqLogger * Instance()
Create or get an instance of this logger singleton (invoke the class with this method) ...
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) ...
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
int video_bit_rate
The bit rate of the video stream (in bytes)
Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
string vcodec
The name of the video codec used to encode / decode the video stream.
void DisplayInfo()
Display file information in the standard output stream (stdout)
int den
Denominator for the fraction.
int channels
The number of audio channels used in the audio stream.
int video_stream_index
The index of the video stream.
long int video_length
The number of frames in the video stream.
double ToDouble()
Return this fraction as a double (i.e. 1/2 = 0.5)
int sample_rate
The number of audio samples per second (44100 is a common sample rate)