Display file information
| 61 | |
| 62 | // Display file information |
| 63 | void ReaderBase::DisplayInfo(std::ostream* out) { |
| 64 | *out << std::fixed << std::setprecision(2) << std::boolalpha; |
| 65 | *out << "----------------------------" << std::endl; |
| 66 | *out << "----- File Information -----" << std::endl; |
| 67 | *out << "----------------------------" << std::endl; |
| 68 | *out << "--> Has Video: " << info.has_video << std::endl; |
| 69 | *out << "--> Has Audio: " << info.has_audio << std::endl; |
| 70 | *out << "--> Has Single Image: " << info.has_single_image << std::endl; |
| 71 | *out << "--> Duration: " << info.duration << " Seconds" << std::endl; |
| 72 | *out << "--> File Size: " << double(info.file_size) / 1024 / 1024 << " MB" << std::endl; |
| 73 | *out << "----------------------------" << std::endl; |
| 74 | *out << "----- Video Attributes -----" << std::endl; |
| 75 | *out << "----------------------------" << std::endl; |
| 76 | *out << "--> Width: " << info.width << std::endl; |
| 77 | *out << "--> Height: " << info.height << std::endl; |
| 78 | *out << "--> Pixel Format: " << info.pixel_format << std::endl; |
| 79 | *out << "--> Frames Per Second: " << info.fps.ToDouble() << " (" << info.fps.num << "/" << info.fps.den << ")" << std::endl; |
| 80 | *out << "--> Video Bit Rate: " << info.video_bit_rate/1000 << " kb/s" << std::endl; |
| 81 | *out << "--> Pixel Ratio: " << info.pixel_ratio.ToDouble() << " (" << info.pixel_ratio.num << "/" << info.pixel_ratio.den << ")" << std::endl; |
| 82 | *out << "--> Display Aspect Ratio: " << info.display_ratio.ToDouble() << " (" << info.display_ratio.num << "/" << info.display_ratio.den << ")" << std::endl; |
| 83 | *out << "--> Video Codec: " << info.vcodec << std::endl; |
| 84 | *out << "--> Video Length: " << info.video_length << " Frames" << std::endl; |
| 85 | *out << "--> Video Stream Index: " << info.video_stream_index << std::endl; |
| 86 | *out << "--> Video Timebase: " << info.video_timebase.ToDouble() << " (" << info.video_timebase.num << "/" << info.video_timebase.den << ")" << std::endl; |
| 87 | *out << "--> Interlaced: " << info.interlaced_frame << std::endl; |
| 88 | *out << "--> Interlaced: Top Field First: " << info.top_field_first << std::endl; |
| 89 | *out << "----------------------------" << std::endl; |
| 90 | *out << "----- Audio Attributes -----" << std::endl; |
| 91 | *out << "----------------------------" << std::endl; |
| 92 | *out << "--> Audio Codec: " << info.acodec << std::endl; |
| 93 | *out << "--> Audio Bit Rate: " << info.audio_bit_rate/1000 << " kb/s" << std::endl; |
| 94 | *out << "--> Sample Rate: " << info.sample_rate << " Hz" << std::endl; |
| 95 | *out << "--> # of Channels: " << info.channels << std::endl; |
| 96 | *out << "--> Channel Layout: " << info.channel_layout << std::endl; |
| 97 | *out << "--> Audio Stream Index: " << info.audio_stream_index << std::endl; |
| 98 | *out << "--> Audio Timebase: " << info.audio_timebase.ToDouble() << " (" << info.audio_timebase.num << "/" << info.audio_timebase.den << ")" << std::endl; |
| 99 | *out << "----------------------------" << std::endl; |
| 100 | *out << "--------- Metadata ---------" << std::endl; |
| 101 | *out << "----------------------------" << std::endl; |
| 102 | |
| 103 | // Iterate through metadata |
| 104 | for (auto it : info.metadata) |
| 105 | *out << "--> " << it.first << ": " << it.second << std::endl; |
| 106 | } |
| 107 | |
| 108 | // Generate Json::Value for this object |
| 109 | Json::Value ReaderBase::JsonValue() const { |