/* * Sailfin: a Jellyfin client written using Qt * Copyright (C) 2021 Chris Josten and the Sailfin Contributors. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* * WARNING: THIS IS AN AUTOMATICALLY GENERATED FILE! PLEASE DO NOT EDIT THIS, AS YOUR EDITS WILL GET * OVERWRITTEN AT SOME POINT! * * If there is a bug in this file, please fix the code generator used to generate this file found in * core/openapigenerator.d. * * This file is generated based on Jellyfin's OpenAPI description, "openapi.json". Please update that * file with a newer file if needed instead of manually updating the files. */ #include namespace Jellyfin { namespace DTO { TranscodingInfo::TranscodingInfo() {} TranscodingInfo::TranscodingInfo ( bool isVideoDirect, bool isAudioDirect ) : m_isVideoDirect(isVideoDirect), m_isAudioDirect(isAudioDirect) { } TranscodingInfo::TranscodingInfo(const TranscodingInfo &other) : m_audioCodec(other.m_audioCodec), m_videoCodec(other.m_videoCodec), m_container(other.m_container), m_isVideoDirect(other.m_isVideoDirect), m_isAudioDirect(other.m_isAudioDirect), m_bitrate(other.m_bitrate), m_framerate(other.m_framerate), m_completionPercentage(other.m_completionPercentage), m_width(other.m_width), m_height(other.m_height), m_audioChannels(other.m_audioChannels), m_transcodeReasons(other.m_transcodeReasons){} void TranscodingInfo::replaceData(TranscodingInfo &other) { m_audioCodec = other.m_audioCodec; m_videoCodec = other.m_videoCodec; m_container = other.m_container; m_isVideoDirect = other.m_isVideoDirect; m_isAudioDirect = other.m_isAudioDirect; m_bitrate = other.m_bitrate; m_framerate = other.m_framerate; m_completionPercentage = other.m_completionPercentage; m_width = other.m_width; m_height = other.m_height; m_audioChannels = other.m_audioChannels; m_transcodeReasons = other.m_transcodeReasons; } TranscodingInfo TranscodingInfo::fromJson(QJsonObject source) { TranscodingInfo instance; instance.setFromJson(source); return instance; } void TranscodingInfo::setFromJson(QJsonObject source) { m_audioCodec = Jellyfin::Support::fromJsonValue(source["AudioCodec"]); m_videoCodec = Jellyfin::Support::fromJsonValue(source["VideoCodec"]); m_container = Jellyfin::Support::fromJsonValue(source["Container"]); m_isVideoDirect = Jellyfin::Support::fromJsonValue(source["IsVideoDirect"]); m_isAudioDirect = Jellyfin::Support::fromJsonValue(source["IsAudioDirect"]); m_bitrate = Jellyfin::Support::fromJsonValue>(source["Bitrate"]); m_framerate = Jellyfin::Support::fromJsonValue>(source["Framerate"]); m_completionPercentage = Jellyfin::Support::fromJsonValue>(source["CompletionPercentage"]); m_width = Jellyfin::Support::fromJsonValue>(source["Width"]); m_height = Jellyfin::Support::fromJsonValue>(source["Height"]); m_audioChannels = Jellyfin::Support::fromJsonValue>(source["AudioChannels"]); m_transcodeReasons = Jellyfin::Support::fromJsonValue>(source["TranscodeReasons"]); } QJsonObject TranscodingInfo::toJson() const { QJsonObject result; if (!(m_audioCodec.isNull())) { result["AudioCodec"] = Jellyfin::Support::toJsonValue(m_audioCodec); } if (!(m_videoCodec.isNull())) { result["VideoCodec"] = Jellyfin::Support::toJsonValue(m_videoCodec); } if (!(m_container.isNull())) { result["Container"] = Jellyfin::Support::toJsonValue(m_container); } result["IsVideoDirect"] = Jellyfin::Support::toJsonValue(m_isVideoDirect); result["IsAudioDirect"] = Jellyfin::Support::toJsonValue(m_isAudioDirect); if (!(!m_bitrate.has_value())) { result["Bitrate"] = Jellyfin::Support::toJsonValue>(m_bitrate); } if (!(!m_framerate.has_value())) { result["Framerate"] = Jellyfin::Support::toJsonValue>(m_framerate); } if (!(!m_completionPercentage.has_value())) { result["CompletionPercentage"] = Jellyfin::Support::toJsonValue>(m_completionPercentage); } if (!(!m_width.has_value())) { result["Width"] = Jellyfin::Support::toJsonValue>(m_width); } if (!(!m_height.has_value())) { result["Height"] = Jellyfin::Support::toJsonValue>(m_height); } if (!(!m_audioChannels.has_value())) { result["AudioChannels"] = Jellyfin::Support::toJsonValue>(m_audioChannels); } if (!(m_transcodeReasons.size() == 0)) { result["TranscodeReasons"] = Jellyfin::Support::toJsonValue>(m_transcodeReasons); } return result; } QString TranscodingInfo::audioCodec() const { return m_audioCodec; } void TranscodingInfo::setAudioCodec(QString newAudioCodec) { m_audioCodec = newAudioCodec; } bool TranscodingInfo::audioCodecNull() const { return m_audioCodec.isNull(); } void TranscodingInfo::setAudioCodecNull() { m_audioCodec.clear(); } QString TranscodingInfo::videoCodec() const { return m_videoCodec; } void TranscodingInfo::setVideoCodec(QString newVideoCodec) { m_videoCodec = newVideoCodec; } bool TranscodingInfo::videoCodecNull() const { return m_videoCodec.isNull(); } void TranscodingInfo::setVideoCodecNull() { m_videoCodec.clear(); } QString TranscodingInfo::container() const { return m_container; } void TranscodingInfo::setContainer(QString newContainer) { m_container = newContainer; } bool TranscodingInfo::containerNull() const { return m_container.isNull(); } void TranscodingInfo::setContainerNull() { m_container.clear(); } bool TranscodingInfo::isVideoDirect() const { return m_isVideoDirect; } void TranscodingInfo::setIsVideoDirect(bool newIsVideoDirect) { m_isVideoDirect = newIsVideoDirect; } bool TranscodingInfo::isAudioDirect() const { return m_isAudioDirect; } void TranscodingInfo::setIsAudioDirect(bool newIsAudioDirect) { m_isAudioDirect = newIsAudioDirect; } std::optional TranscodingInfo::bitrate() const { return m_bitrate; } void TranscodingInfo::setBitrate(std::optional newBitrate) { m_bitrate = newBitrate; } bool TranscodingInfo::bitrateNull() const { return !m_bitrate.has_value(); } void TranscodingInfo::setBitrateNull() { m_bitrate = std::nullopt; } std::optional TranscodingInfo::framerate() const { return m_framerate; } void TranscodingInfo::setFramerate(std::optional newFramerate) { m_framerate = newFramerate; } bool TranscodingInfo::framerateNull() const { return !m_framerate.has_value(); } void TranscodingInfo::setFramerateNull() { m_framerate = std::nullopt; } std::optional TranscodingInfo::completionPercentage() const { return m_completionPercentage; } void TranscodingInfo::setCompletionPercentage(std::optional newCompletionPercentage) { m_completionPercentage = newCompletionPercentage; } bool TranscodingInfo::completionPercentageNull() const { return !m_completionPercentage.has_value(); } void TranscodingInfo::setCompletionPercentageNull() { m_completionPercentage = std::nullopt; } std::optional TranscodingInfo::width() const { return m_width; } void TranscodingInfo::setWidth(std::optional newWidth) { m_width = newWidth; } bool TranscodingInfo::widthNull() const { return !m_width.has_value(); } void TranscodingInfo::setWidthNull() { m_width = std::nullopt; } std::optional TranscodingInfo::height() const { return m_height; } void TranscodingInfo::setHeight(std::optional newHeight) { m_height = newHeight; } bool TranscodingInfo::heightNull() const { return !m_height.has_value(); } void TranscodingInfo::setHeightNull() { m_height = std::nullopt; } std::optional TranscodingInfo::audioChannels() const { return m_audioChannels; } void TranscodingInfo::setAudioChannels(std::optional newAudioChannels) { m_audioChannels = newAudioChannels; } bool TranscodingInfo::audioChannelsNull() const { return !m_audioChannels.has_value(); } void TranscodingInfo::setAudioChannelsNull() { m_audioChannels = std::nullopt; } QList TranscodingInfo::transcodeReasons() const { return m_transcodeReasons; } void TranscodingInfo::setTranscodeReasons(QList newTranscodeReasons) { m_transcodeReasons = newTranscodeReasons; } bool TranscodingInfo::transcodeReasonsNull() const { return m_transcodeReasons.size() == 0; } void TranscodingInfo::setTranscodeReasonsNull() { m_transcodeReasons.clear(); } } // NS DTO namespace Support { using TranscodingInfo = Jellyfin::DTO::TranscodingInfo; template <> TranscodingInfo fromJsonValue(const QJsonValue &source, convertType) { if (!source.isObject()) throw ParseException("Expected JSON Object"); return TranscodingInfo::fromJson(source.toObject()); } template<> QJsonValue toJsonValue(const TranscodingInfo &source, convertType) { return source.toJson(); } } // NS DTO } // NS Jellyfin