2011-10-11 08:44:27 -05:00
|
|
|
#include "../include/FileReaderBase.h"
|
|
|
|
|
|
|
|
|
|
using namespace openshot;
|
|
|
|
|
|
|
|
|
|
// Initialize the values of the FileInfo struct
|
|
|
|
|
void FileReaderBase::InitFileInfo()
|
|
|
|
|
{
|
|
|
|
|
info.has_video = false;
|
|
|
|
|
info.has_audio = false;
|
|
|
|
|
info.duration = 0.0;
|
|
|
|
|
info.file_size = 0;
|
|
|
|
|
info.height = 0;
|
|
|
|
|
info.width = 0;
|
|
|
|
|
info.pixel_format = -1;
|
|
|
|
|
info.fps = Fraction();
|
|
|
|
|
info.video_bit_rate = 0;
|
|
|
|
|
info.pixel_ratio = Fraction();
|
|
|
|
|
info.display_ratio = Fraction();
|
|
|
|
|
info.vcodec = "";
|
|
|
|
|
info.video_length = 0;
|
|
|
|
|
info.video_stream_index = -1;
|
|
|
|
|
info.video_timebase = Fraction();
|
2011-12-11 20:42:50 -06:00
|
|
|
info.interlaced_frame = false;
|
|
|
|
|
info.top_field_first = true;
|
2011-10-11 08:44:27 -05:00
|
|
|
info.acodec = "";
|
|
|
|
|
info.audio_bit_rate = 0;
|
|
|
|
|
info.sample_rate = 0;
|
|
|
|
|
info.channels = 0;
|
|
|
|
|
info.audio_stream_index = -1;
|
|
|
|
|
info.audio_timebase = Fraction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Display file information
|
|
|
|
|
void FileReaderBase::DisplayInfo() {
|
2011-12-11 20:42:50 -06:00
|
|
|
cout << fixed << setprecision(2) << cout << boolalpha;
|
2011-10-11 08:44:27 -05:00
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
cout << "----- File Information -----" << endl;
|
|
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
cout << "--> Has Video: " << info.has_video << endl;
|
|
|
|
|
cout << "--> Has Audio: " << info.has_audio << endl;
|
|
|
|
|
cout << "--> Duration: " << info.duration << " Seconds" << endl;
|
|
|
|
|
cout << "--> File Size: " << double(info.file_size) / 1024 / 1024 << " MB" << endl;
|
|
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
cout << "----- Video Attributes -----" << endl;
|
|
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
cout << "--> Width: " << info.width << endl;
|
2011-12-11 20:42:50 -06:00
|
|
|
cout << "--> Height: " << info.height << endl;
|
2011-10-11 08:44:27 -05:00
|
|
|
cout << "--> Pixel Format: " << info.pixel_format << endl;
|
|
|
|
|
cout << "--> Frames Per Second: " << info.fps.ToDouble() << " (" << info.fps.num << "/" << info.fps.den << ")" << endl;
|
|
|
|
|
cout << "--> Video Bit Rate: " << info.video_bit_rate/1000 << " kb/s" << endl;
|
|
|
|
|
cout << "--> Pixel Ratio: " << info.pixel_ratio.ToDouble() << " (" << info.pixel_ratio.num << "/" << info.pixel_ratio.den << ")" << endl;
|
|
|
|
|
cout << "--> Display Aspect Ratio: " << info.display_ratio.ToDouble() << " (" << info.display_ratio.num << "/" << info.display_ratio.den << ")" << endl;
|
|
|
|
|
cout << "--> Video Codec: " << info.vcodec << endl;
|
|
|
|
|
cout << "--> Video Length: " << info.video_length << " Frames" << endl;
|
|
|
|
|
cout << "--> Video Stream Index: " << info.video_stream_index << endl;
|
|
|
|
|
cout << "--> Video Timebase: " << info.video_timebase.ToDouble() << " (" << info.video_timebase.num << "/" << info.video_timebase.den << ")" << endl;
|
2011-12-11 20:42:50 -06:00
|
|
|
cout << "--> Interlaced: " << info.interlaced_frame << endl;
|
|
|
|
|
cout << "--> Interlaced: Top Field First: " << info.top_field_first << endl;
|
2011-10-11 08:44:27 -05:00
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
cout << "----- Audio Attributes -----" << endl;
|
|
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
cout << "--> Audio Codec: " << info.acodec << endl;
|
|
|
|
|
cout << "--> Audio Bit Rate: " << info.audio_bit_rate/1000 << " kb/s" << endl;
|
|
|
|
|
cout << "--> Sample Rate: " << info.sample_rate << " Hz" << endl;
|
|
|
|
|
cout << "--> # of Channels: " << info.channels << endl;
|
|
|
|
|
cout << "--> Audio Stream Index: " << info.audio_stream_index << endl;
|
|
|
|
|
cout << "--> Audio Timebase: " << info.audio_timebase.ToDouble() << " (" << info.audio_timebase.num << "/" << info.audio_timebase.den << ")" << endl;
|
|
|
|
|
cout << "----------------------------" << endl;
|
|
|
|
|
}
|
|
|
|
|
|