File indexing completed on 2025-01-05 03:56:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-04-21 0007 * Description : video information container 0008 * 0009 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "videoinfocontainer.h" 0016 0017 // Qt includes 0018 0019 #include <QDataStream> 0020 0021 namespace Digikam 0022 { 0023 0024 VideoInfoContainer::VideoInfoContainer() 0025 { 0026 } 0027 0028 VideoInfoContainer::~VideoInfoContainer() 0029 { 0030 } 0031 0032 bool VideoInfoContainer::operator==(const VideoInfoContainer& t) const 0033 { 0034 bool b1 = (aspectRatio == t.aspectRatio); 0035 bool b2 = (duration == t.duration); 0036 bool b3 = (frameRate == t.frameRate); 0037 bool b4 = (videoCodec == t.videoCodec); 0038 bool b5 = (audioBitRate == t.audioBitRate); 0039 bool b6 = (audioChannelType == t.audioChannelType); 0040 bool b7 = (audioCodec == t.audioCodec); 0041 0042 return (b1 && b2 && b3 && b4 && b5 && b6 && b7); 0043 } 0044 0045 bool VideoInfoContainer::isEmpty() const 0046 { 0047 if ( 0048 aspectRatio.isEmpty() && 0049 duration.isEmpty() && 0050 frameRate.isEmpty() && 0051 videoCodec.isEmpty() && 0052 audioBitRate.isEmpty() && 0053 audioChannelType.isEmpty() && 0054 audioCodec.isEmpty() 0055 ) 0056 { 0057 return true; 0058 } 0059 else 0060 { 0061 return false; 0062 } 0063 } 0064 0065 bool VideoInfoContainer::isNull() const 0066 { 0067 return ( 0068 aspectRatio.isEmpty() && 0069 duration.isEmpty() && 0070 frameRate.isEmpty() && 0071 videoCodec.isEmpty() && 0072 audioBitRate.isEmpty() && 0073 audioChannelType.isEmpty() && 0074 audioCodec.isEmpty() 0075 ); 0076 } 0077 0078 QDataStream& operator<<(QDataStream& ds, const VideoInfoContainer& info) 0079 { 0080 ds << info.aspectRatio; 0081 ds << info.duration; 0082 ds << info.frameRate; 0083 ds << info.videoCodec; 0084 ds << info.audioBitRate; 0085 ds << info.audioChannelType; 0086 ds << info.audioCodec; 0087 0088 return ds; 0089 } 0090 0091 QDataStream& operator>>(QDataStream& ds, VideoInfoContainer& info) 0092 { 0093 ds >> info.aspectRatio; 0094 ds >> info.duration; 0095 ds >> info.frameRate; 0096 ds >> info.videoCodec; 0097 ds >> info.audioBitRate; 0098 ds >> info.audioChannelType; 0099 ds >> info.audioCodec; 0100 0101 return ds; 0102 } 0103 0104 QDebug operator<<(QDebug dbg, const VideoInfoContainer& t) 0105 { 0106 dbg.nospace() << "VideoInfoContainer::aspectRatio: " 0107 << t.aspectRatio << ", "; 0108 dbg.nospace() << "VideoInfoContainer::duration: " 0109 << t.duration << ", "; 0110 dbg.nospace() << "VideoInfoContainer::frameRate: " 0111 << t.frameRate << ", "; 0112 dbg.nospace() << "VideoInfoContainer::videoCodec: " 0113 << t.videoCodec << ", "; 0114 dbg.nospace() << "VideoInfoContainer::audioBitRate: " 0115 << t.audioBitRate << ", "; 0116 dbg.nospace() << "VideoInfoContainer::audioChannelType: " 0117 << t.audioChannelType << ", "; 0118 dbg.nospace() << "VideoInfoContainer::audioCodec: " 0119 << t.audioCodec << ", "; 0120 0121 return dbg.space(); 0122 } 0123 0124 } // namespace Digikam